Compare commits

..

2 Commits

Author SHA1 Message Date
Matthias Clasen
58b34f1990 Add an example using GtkApplicationList 2020-07-26 08:38:32 -04:00
Matthias Clasen
3dce8cda54 Add GtkApplicationList 2020-07-25 19:10:38 -04:00
23 changed files with 353 additions and 49 deletions

View File

@@ -174,29 +174,28 @@ constraint_view_init (ConstraintView *self)
manager = gtk_constraint_layout_new ();
gtk_widget_set_layout_manager (GTK_WIDGET (self), manager);
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
g_object_unref (filter);
g_object_unref (all_constraints);
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
children = (GListModel *)gtk_filter_list_model_new (all_children, filter);
g_object_unref (filter);
g_object_unref (all_children);
list = g_list_store_new (G_TYPE_LIST_MODEL);
g_list_store_append (list, children);
g_list_store_append (list, guides);
g_list_store_append (list, constraints);
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
g_object_unref (children);
g_object_unref (guides);
g_object_unref (constraints);
g_object_unref (all_children);
g_object_unref (all_constraints);
g_object_unref (list);
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
controller = (GtkEventController *)gtk_gesture_drag_new ();
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);

View File

@@ -76,6 +76,7 @@
<xi:include href="xml/gtkmultiselection.xml" />
</section>
<xi:include href="xml/gtkselectionfiltermodel.xml" />
<xi:include href="xml/gtkapplicationlist.xml" />
<xi:include href="xml/gtkbookmarklist.xml" />
<xi:include href="xml/gtkdirectorylist.xml" />
<xi:include href="xml/gtkstringlist.xml" />

View File

@@ -7639,3 +7639,10 @@ gtk_selection_filter_model_new_for_type
gtk_selection_filter_model_set_model
gtk_selection_filter_model_get_model
</SECTION>
<SECTION>
<FILE>gtkapplicationlist</FILE>
<TITLE>GtkApplicationList</TITLE>
GtkApplicationList
gtk_application_list_new
</SECTION>

View File

@@ -13,6 +13,7 @@ gtk_app_chooser_button_get_type
gtk_app_chooser_dialog_get_type
gtk_app_chooser_widget_get_type
gtk_application_get_type
gtk_application_list_get_type
gtk_application_window_get_type
gtk_aspect_frame_get_type
gtk_assistant_get_type

View File

@@ -43,6 +43,7 @@
#include <gtk/gtkappchooserwidget.h>
#include <gtk/gtkappchooserbutton.h>
#include <gtk/gtkapplication.h>
#include <gtk/gtkapplicationlist.h>
#include <gtk/gtkapplicationwindow.h>
#include <gtk/gtkaspectframe.h>
#include <gtk/gtkassistant.h>

163
gtk/gtkapplicationlist.c Normal file
View File

@@ -0,0 +1,163 @@
/*
* Copyright © 2020 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#include "config.h"
#include "gtkapplicationlist.h"
#include "gtksettings.h"
#include "gtkintl.h"
#include "gtkprivate.h"
/**
* SECTION:gtkapplicationlist
* @title: GtkApplicationList
* @short_description: A list model for applications
* @see_also: #GListModel, #GAppInfo
*
* #GtkApplicationList is a list model that wraps #GAppInfo.
* It presents a #GListModel and fills it with the #GAppInfos for
* the available applications.
*
* The #GtkApplicationList is monitoring for changes and emits
* #GListModel::items-changed when the list of applications changes.
*/
struct _GtkApplicationList
{
GObject parent_instance;
GAppInfoMonitor *monitor;
GSequence *items;
};
struct _GtkApplicationListClass
{
GObjectClass parent_class;
};
static GType
gtk_application_list_get_item_type (GListModel *list)
{
return G_TYPE_APP_INFO;
}
static guint
gtk_application_list_get_n_items (GListModel *list)
{
GtkApplicationList *self = GTK_APPLICATION_LIST (list);
return g_sequence_get_length (self->items);
}
static gpointer
gtk_application_list_get_item (GListModel *list,
guint position)
{
GtkApplicationList *self = GTK_APPLICATION_LIST (list);
GSequenceIter *iter;
iter = g_sequence_get_iter_at_pos (self->items, position);
if (g_sequence_iter_is_end (iter))
return NULL;
else
return g_object_ref (g_sequence_get (iter));
}
static void
gtk_application_list_model_init (GListModelInterface *iface)
{
iface->get_item_type = gtk_application_list_get_item_type;
iface->get_n_items = gtk_application_list_get_n_items;
iface->get_item = gtk_application_list_get_item;
}
G_DEFINE_TYPE_WITH_CODE (GtkApplicationList, gtk_application_list, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_application_list_model_init))
static void
apps_changed (GAppInfoMonitor *monitor,
GtkApplicationList *self)
{
guint before;
guint after;
GList *apps, *l;
before = g_sequence_get_length (self->items);
if (before > 0)
g_sequence_remove_range (g_sequence_get_begin_iter (self->items),
g_sequence_get_end_iter (self->items));
apps = g_app_info_get_all ();
for (l = apps; l; l = l->next)
{
GAppInfo *info = l->data;
g_sequence_append (self->items, g_object_ref (info));
}
g_list_free_full (apps, g_object_unref);
after = g_sequence_get_length (self->items);
g_list_model_items_changed (G_LIST_MODEL (self), 0, before, after);
}
static void
gtk_application_list_dispose (GObject *object)
{
GtkApplicationList *self = GTK_APPLICATION_LIST (object);
g_clear_pointer (&self->items, g_sequence_free);
g_signal_handlers_disconnect_by_func (self->monitor, G_CALLBACK (apps_changed), self);
g_clear_object (&self->monitor);
G_OBJECT_CLASS (gtk_application_list_parent_class)->dispose (object);
}
static void
gtk_application_list_class_init (GtkApplicationListClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
gobject_class->dispose = gtk_application_list_dispose;
}
static void
gtk_application_list_init (GtkApplicationList *self)
{
self->items = g_sequence_new (g_object_unref);
self->monitor = g_app_info_monitor_get ();
g_signal_connect (self->monitor, "changed", G_CALLBACK (apps_changed), self);
apps_changed (self->monitor, self);
}
/**
* gtk_application_list_new:
*
* Creates a new #GtkApplicationList.
*
* Returns: a new #GtkApplicationList
**/
GtkApplicationList *
gtk_application_list_new (void)
{
return g_object_new (GTK_TYPE_APPLICATION_LIST, NULL);
}

45
gtk/gtkapplicationlist.h Normal file
View File

@@ -0,0 +1,45 @@
/*
* Copyright © 2020 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#ifndef __GTK_APPLICATION_LIST_H__
#define __GTK_APPLICATION_LIST_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gio/gio.h>
/* for GDK_AVAILABLE_IN_ALL */
#include <gdk/gdk.h>
G_BEGIN_DECLS
#define GTK_TYPE_APPLICATION_LIST (gtk_application_list_get_type ())
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkApplicationList, gtk_application_list, GTK, APPLICATION_LIST, GObject)
GDK_AVAILABLE_IN_ALL
GtkApplicationList * gtk_application_list_new (void);
G_END_DECLS
#endif /* __GTK_APPLICATION_LIST_H__ */

View File

@@ -322,6 +322,7 @@ gtk_custom_paper_unix_dialog_init (GtkCustomPaperUnixDialog *dialog)
g_object_unref (printer_list);
full_list = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (printer_list_list)));
g_object_unref (printer_list_list);
filter = gtk_custom_filter_new (match_func, NULL, NULL);
dialog->printer_list = G_LIST_MODEL (gtk_filter_list_model_new (full_list, filter));

View File

@@ -425,7 +425,7 @@ gtk_flatten_list_model_init (GtkFlattenListModel *self)
/**
* gtk_flatten_list_model_new:
* @model: (nullable) (transfer full): the model to be flattened
* @model: (nullable) (transfer none): the model to be flattened
*
* Creates a new #GtkFlattenListModel that flattens @list.
*
@@ -442,9 +442,6 @@ gtk_flatten_list_model_new (GListModel *model)
"model", model,
NULL);
/* we consume the reference */
g_clear_object (&model);
return result;
}

View File

@@ -784,7 +784,7 @@ update_fontlist (GtkFontChooserWidget *self)
if ((self->level & GTK_FONT_CHOOSER_LEVEL_STYLE) == 0)
model = g_object_ref (G_LIST_MODEL (fontmap));
else
model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (g_object_ref (fontmap))));
model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (fontmap)));
gtk_filter_list_model_set_model (self->filter_model, model);
g_object_unref (model);
}

View File

@@ -412,7 +412,7 @@ gtk_map_list_model_augment (GtkRbTree *map,
/**
* gtk_map_list_model_new:
* @model: (transfer full) (allow-none): The model to map or %NULL for none
* @model: (allow-none): The model to map or %NULL for none
* @map_func: (allow-none): map function or %NULL to not map items
* @user_data: (closure): user data passed to @map_func
* @user_destroy: destroy notifier for @user_data
@@ -435,9 +435,6 @@ gtk_map_list_model_new (GListModel *model,
"model", model,
NULL);
/* consume the reference */
g_clear_object (&model);
if (map_func)
gtk_map_list_model_set_map_func (result, map_func, user_data, user_destroy);

View File

@@ -31,20 +31,6 @@
#include <graphene-gobject.h>
/**
* SECTION:gtkoverlaylayout
* @Title: GtkOverlayLayout
* @Short_description: Layout manager that places widgets as overlays
*
* GtkOverlayLayout is the layout manager used by #GtkOverlay.
* It places widgets as overlays on top of the main child.
*
* This is not a reusable layout manager, since it expects its widget
* to be a #GtkOverlay. It only listed here so that its layout
* properties get documented.
*/
struct _GtkOverlayLayout
{
GtkLayoutManager parent_instance;

View File

@@ -308,6 +308,7 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
g_list_store_append (store, dialog->manage_papers_list);
paper_size_list = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (store)));
gtk_drop_down_set_model (GTK_DROP_DOWN (dialog->paper_size_combo), paper_size_list);
g_object_unref (store);
g_object_unref (paper_size_list);
/* Do this in code, we want the translatable strings without the markup */

View File

@@ -807,6 +807,7 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
g_list_store_append (store, dialog->manage_papers_list);
paper_size_list = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (store)));
gtk_drop_down_set_model (GTK_DROP_DOWN (dialog->paper_size_combo), paper_size_list);
g_object_unref (store);
g_object_unref (paper_size_list);
/* Load backends */
@@ -1036,6 +1037,7 @@ load_print_backends (GtkPrintUnixDialog *dialog)
{
GList *node;
GListStore *lists;
GListModel *model;
lists = g_list_store_new (G_TYPE_LIST_MODEL);
@@ -1051,7 +1053,11 @@ load_print_backends (GtkPrintUnixDialog *dialog)
g_list_store_append (lists, gtk_print_backend_get_printers (backend));
}
return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (lists)));
model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (lists)));
g_object_unref (lists);
return model;
}
static void

View File

@@ -44,16 +44,21 @@ G_DEFINE_INTERFACE (GtkShortcutManager, gtk_shortcut_manager, G_TYPE_OBJECT)
void
gtk_shortcut_manager_create_controllers (GtkWidget *widget)
{
GListStore *store;
GtkFlattenListModel *model;
GtkEventController *controller;
model = gtk_flatten_list_model_new (G_LIST_MODEL (g_list_store_new (GTK_TYPE_SHORTCUT_CONTROLLER)));
store = g_list_store_new (GTK_TYPE_SHORTCUT_CONTROLLER);
model = gtk_flatten_list_model_new (G_LIST_MODEL (store));
g_object_unref (store);
g_object_set_data_full (G_OBJECT (widget), "gtk-shortcut-manager-bubble", model, g_object_unref);
controller = gtk_shortcut_controller_new_for_model (G_LIST_MODEL (model));
gtk_event_controller_set_name (controller, "gtk-shortcut-manager-bubble");
gtk_widget_add_controller (widget, controller);
model = gtk_flatten_list_model_new (G_LIST_MODEL (g_list_store_new (GTK_TYPE_SHORTCUT_CONTROLLER)));
store = g_list_store_new (GTK_TYPE_SHORTCUT_CONTROLLER);
model = gtk_flatten_list_model_new (G_LIST_MODEL (store));
g_object_unref (store);
g_object_set_data_full (G_OBJECT (widget), "gtk-shortcut-manager-capture", model, g_object_unref);
controller = gtk_shortcut_controller_new_for_model (G_LIST_MODEL (model));
gtk_event_controller_set_name (controller, "gtk-shortcut-manager-capture");

View File

@@ -244,6 +244,7 @@ gtk_inspector_controllers_set_object (GtkInspectorControllers *self,
gtk_property_lookup_list_model_set_object (self->model, object);
map_model = gtk_map_list_model_new (G_LIST_MODEL (self->model), map_to_controllers, NULL, NULL);
g_object_unref (self->model);
flatten_model = gtk_flatten_list_model_new (G_LIST_MODEL (map_model));
@@ -259,6 +260,7 @@ gtk_inspector_controllers_set_object (GtkInspectorControllers *self,
g_object_unref (sort_model);
g_object_unref (flatten_model);
g_object_unref (map_model);
}
static void

View File

@@ -116,6 +116,7 @@ static GListModel *
object_tree_widget_get_children (GObject *object)
{
GtkWidget *widget = GTK_WIDGET (object);
GtkFlattenListModel *flatten;
GListStore *list;
GListModel *sublist;
@@ -129,7 +130,10 @@ object_tree_widget_get_children (GObject *object)
g_list_store_append (list, sublist);
g_object_unref (sublist);
return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
flatten = gtk_flatten_list_model_new (G_LIST_MODEL (list));
g_object_unref (list);
return G_LIST_MODEL (flatten);
}
static GListModel *
@@ -207,6 +211,7 @@ list_model_for_properties (GObject *object,
const char **props)
{
GListStore *concat;
GListModel *result;
guint i;
if (props[1] == NULL)
@@ -220,7 +225,9 @@ list_model_for_properties (GObject *object,
g_object_unref (tmp);
}
return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (concat)));
result = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (concat)));
g_object_unref (concat);
return result;
}
static GListModel *
@@ -303,6 +310,7 @@ object_tree_tree_view_get_children (GObject *object)
GtkTreeView *treeview = GTK_TREE_VIEW (object);
GListStore *columns, *selection, *result_list;
GListModel *props;
GtkFlattenListModel *result;
guint i;
props = list_model_for_properties (object, (const char *[2]) { "model", NULL });
@@ -322,8 +330,10 @@ object_tree_tree_view_get_children (GObject *object)
g_object_unref (selection);
g_list_store_append (result_list, columns);
g_object_unref (columns);
result = gtk_flatten_list_model_new (G_LIST_MODEL (result_list));
g_object_unref (result_list);
return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (result_list)));
return G_LIST_MODEL (result);
}
static GListModel *
@@ -331,6 +341,7 @@ object_tree_column_view_get_children (GObject *object)
{
GtkColumnView *view = GTK_COLUMN_VIEW (object);
GListStore *result_list;
GtkFlattenListModel *result;
GListModel *columns, *sublist;
result_list = g_list_store_new (G_TYPE_LIST_MODEL);
@@ -342,7 +353,10 @@ object_tree_column_view_get_children (GObject *object)
g_list_store_append (result_list, sublist);
g_object_unref (sublist);
return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (result_list)));
result = gtk_flatten_list_model_new (G_LIST_MODEL (result_list));
g_object_unref (result_list);
return G_LIST_MODEL (result);
}
static GListModel *
@@ -588,11 +602,12 @@ static GListModel *
object_get_children (GObject *object)
{
GType object_type;
GListModel *children;
GListModel *result, *children;
GListStore *result_list;
guint i;
object_type = G_OBJECT_TYPE (object);
result = NULL;
result_list = NULL;
for (i = 0; i < G_N_ELEMENTS (object_tree_class_funcs); i++)
@@ -604,17 +619,32 @@ object_get_children (GObject *object)
if (children == NULL)
continue;
if (!result_list)
result_list = g_list_store_new (G_TYPE_LIST_MODEL);
g_list_store_append (result_list, children);
g_object_unref (children);
if (result_list)
{
g_list_store_append (result_list, children);
g_object_unref (children);
}
else if (result == NULL)
{
result = children;
}
else
{
result_list = g_list_store_new (G_TYPE_LIST_MODEL);
g_list_store_append (result_list, result);
g_object_unref (result);
g_list_store_append (result_list, children);
g_object_unref (children);
}
}
if (result_list)
return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (result_list)));
else
return NULL;
{
result = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (result_list)));
g_object_unref (result_list);
}
return result;
}
static const char *
@@ -1137,6 +1167,7 @@ create_root_model (GdkDisplay *display)
{
GtkFilter *custom_filter;
GtkFilterListModel *filter;
GtkFlattenListModel *flatten;
GListStore *list, *special;
gpointer item;
@@ -1158,7 +1189,9 @@ create_root_model (GdkDisplay *display)
g_list_store_append (list, filter);
g_object_unref (filter);
return G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
flatten = gtk_flatten_list_model_new (G_LIST_MODEL (list));
g_object_unref (list);
return G_LIST_MODEL (flatten);
}
static void

View File

@@ -159,6 +159,7 @@ gtk_public_sources = files([
'gtkappchooserdialog.c',
'gtkappchooserwidget.c',
'gtkapplication.c',
'gtkapplicationlist.c',
'gtkapplicationwindow.c',
'gtkaspectframe.c',
'gtkassistant.c',
@@ -446,6 +447,7 @@ gtk_public_headers = files([
'gtkappchooserdialog.h',
'gtkappchooserwidget.h',
'gtkapplication.h',
'gtkapplicationlist.h',
'gtkapplicationwindow.h',
'gtkaspectframe.h',
'gtkassistant.h',

View File

@@ -431,6 +431,45 @@ selected_changed2 (GtkDropDown *dropdown,
g_object_unref (pair);
}
static void
setup_app_item (GtkSignalListItemFactory *factory,
GtkListItem *item)
{
GtkWidget *box;
GtkWidget *label;
GtkWidget *icon;
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
icon = gtk_image_new ();
gtk_box_append (GTK_BOX (box), icon);
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_box_append (GTK_BOX (box), label);
gtk_list_item_set_child (item, box);
}
static void
bind_app_item (GtkSignalListItemFactory *factory,
GtkListItem *item)
{
GAppInfo *info;
GtkWidget *box;
GtkWidget *label;
GtkWidget *icon;
info = gtk_list_item_get_item (item);
box = gtk_list_item_get_child (item);
icon = gtk_widget_get_first_child (box);
label = gtk_widget_get_next_sibling (icon);
gtk_image_set_from_gicon (GTK_IMAGE (icon), g_app_info_get_icon (info));
gtk_label_set_label (GTK_LABEL (label), g_app_info_get_display_name (info));
}
int
main (int argc, char *argv[])
{
@@ -454,6 +493,7 @@ main (int argc, char *argv[])
GtkListItemFactory *factory;
GtkWidget *entry;
GtkWidget *hbox;
GtkApplicationList *apps;
gtk_init ();
@@ -560,6 +600,20 @@ main (int argc, char *argv[])
g_object_unref (store);
button = gtk_drop_down_new ();
apps = gtk_application_list_new ();
gtk_drop_down_set_model (GTK_DROP_DOWN (button), G_LIST_MODEL (apps));
g_object_unref (apps);
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_app_item), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_app_item), NULL);
gtk_drop_down_set_factory (GTK_DROP_DOWN (button), factory);
g_object_unref (factory);
gtk_box_append (GTK_BOX (box), button);
gtk_window_present (GTK_WINDOW (window));
while (!quit)

View File

@@ -443,6 +443,8 @@ test_model_changes (gconstpointer model_id)
g_object_unref (model2);
g_object_unref (flatten2);
g_object_unref (flatten1);
g_object_unref (store2);
g_object_unref (store1);
g_object_unref (multi);
}

View File

@@ -210,7 +210,7 @@ new_model (GListStore *store)
GtkFlattenListModel *result;
GString *changes;
result = gtk_flatten_list_model_new (g_object_ref (G_LIST_MODEL (store)));
result = gtk_flatten_list_model_new (G_LIST_MODEL (store));
changes = g_string_new ("");
g_object_set_qdata_full (G_OBJECT(result), changes_quark, changes, free_changes);
g_signal_connect (result, "items-changed", G_CALLBACK (items_changed), changes);

View File

@@ -196,7 +196,7 @@ new_model (GListStore *store)
GtkMapListModel *result;
GString *changes;
result = gtk_map_list_model_new (g_object_ref (G_LIST_MODEL (store)), map_multiply, GUINT_TO_POINTER (2), NULL);
result = gtk_map_list_model_new (G_LIST_MODEL (store), map_multiply, GUINT_TO_POINTER (2), NULL);
changes = g_string_new ("");
g_object_set_qdata_full (G_OBJECT(result), changes_quark, changes, free_changes);
g_signal_connect (result, "items-changed", G_CALLBACK (items_changed), changes);

View File

@@ -433,6 +433,7 @@ test_stability (gconstpointer model_id)
g_object_unref (sort2);
g_object_unref (sort1);
g_object_unref (flatten);
g_object_unref (store);
}
static void