Compare commits

...

3 Commits

Author SHA1 Message Date
Matthias Clasen
8f63a5ab63 listlistmodel: Drop item_type
We are using G_TYPE_OBJECT throughout, so there
is no need for GtkListListModel to do anything else.

Update all callers.
2020-07-26 14:37:55 -04:00
Matthias Clasen
eb3381723f maplistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 14:23:16 -04:00
Matthias Clasen
7e87ad1887 flattenlistmodel: Make the constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 14:21:28 -04:00
17 changed files with 49 additions and 105 deletions

View File

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

View File

@@ -322,7 +322,6 @@ gtk_custom_paper_unix_dialog_init (GtkCustomPaperUnixDialog *dialog)
g_object_unref (printer_list); g_object_unref (printer_list);
full_list = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (printer_list_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); filter = gtk_custom_filter_new (match_func, NULL, NULL);
dialog->printer_list = G_LIST_MODEL (gtk_filter_list_model_new (full_list, filter)); 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: * gtk_flatten_list_model_new:
* @model: (nullable) (transfer none): the model to be flattened * @model: (nullable) (transfer full): the model to be flattened
* *
* Creates a new #GtkFlattenListModel that flattens @list. * Creates a new #GtkFlattenListModel that flattens @list.
* *
@@ -442,6 +442,9 @@ gtk_flatten_list_model_new (GListModel *model)
"model", model, "model", model,
NULL); NULL);
/* we consume the reference */
g_clear_object (&model);
return result; return result;
} }

View File

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

View File

@@ -36,7 +36,6 @@ struct _GtkListListModel
{ {
GObject parent_instance; GObject parent_instance;
GType item_type;
guint n_items; guint n_items;
gpointer (* get_first) (gpointer); gpointer (* get_first) (gpointer);
gpointer (* get_next) (gpointer, gpointer); gpointer (* get_next) (gpointer, gpointer);
@@ -55,9 +54,7 @@ struct _GtkListListModelClass
static GType static GType
gtk_list_list_model_get_item_type (GListModel *list) gtk_list_list_model_get_item_type (GListModel *list)
{ {
GtkListListModel *self = GTK_LIST_LIST_MODEL (list); return G_TYPE_OBJECT;
return self->item_type;
} }
static guint static guint
@@ -143,8 +140,7 @@ gtk_list_list_model_init (GtkListListModel *self)
} }
GtkListListModel * GtkListListModel *
gtk_list_list_model_new (GType item_type, gtk_list_list_model_new (gpointer (* get_first) (gpointer),
gpointer (* get_first) (gpointer),
gpointer (* get_next) (gpointer, gpointer), gpointer (* get_next) (gpointer, gpointer),
gpointer (* get_previous) (gpointer, gpointer), gpointer (* get_previous) (gpointer, gpointer),
gpointer (* get_last) (gpointer), gpointer (* get_last) (gpointer),
@@ -161,8 +157,7 @@ gtk_list_list_model_new (GType item_type,
item = get_next (item, data)) item = get_next (item, data))
n_items++; n_items++;
return gtk_list_list_model_new_with_size (item_type, return gtk_list_list_model_new_with_size (n_items,
n_items,
get_first, get_first,
get_next, get_next,
get_previous, get_previous,
@@ -173,8 +168,7 @@ gtk_list_list_model_new (GType item_type,
} }
GtkListListModel * GtkListListModel *
gtk_list_list_model_new_with_size (GType item_type, gtk_list_list_model_new_with_size (guint n_items,
guint n_items,
gpointer (* get_first) (gpointer), gpointer (* get_first) (gpointer),
gpointer (* get_next) (gpointer, gpointer), gpointer (* get_next) (gpointer, gpointer),
gpointer (* get_previous) (gpointer, gpointer), gpointer (* get_previous) (gpointer, gpointer),
@@ -185,7 +179,6 @@ gtk_list_list_model_new_with_size (GType item_type,
{ {
GtkListListModel *result; GtkListListModel *result;
g_return_val_if_fail (g_type_is_a (item_type, G_TYPE_OBJECT), NULL);
g_return_val_if_fail (get_first != NULL, NULL); g_return_val_if_fail (get_first != NULL, NULL);
g_return_val_if_fail (get_next != NULL, NULL); g_return_val_if_fail (get_next != NULL, NULL);
g_return_val_if_fail (get_previous != NULL, NULL); g_return_val_if_fail (get_previous != NULL, NULL);
@@ -193,7 +186,6 @@ gtk_list_list_model_new_with_size (GType item_type,
result = g_object_new (GTK_TYPE_LIST_LIST_MODEL, NULL); result = g_object_new (GTK_TYPE_LIST_LIST_MODEL, NULL);
result->item_type = item_type;
result->n_items = n_items; result->n_items = n_items;
result->get_first = get_first; result->get_first = get_first;
result->get_next = get_next; result->get_next = get_next;

View File

@@ -37,8 +37,7 @@ typedef struct _GtkListListModelClass GtkListListModelClass;
GType gtk_list_list_model_get_type (void) G_GNUC_CONST; GType gtk_list_list_model_get_type (void) G_GNUC_CONST;
GtkListListModel * gtk_list_list_model_new (GType item_type, GtkListListModel * gtk_list_list_model_new (gpointer (* get_first) (gpointer),
gpointer (* get_first) (gpointer),
gpointer (* get_next) (gpointer, gpointer), gpointer (* get_next) (gpointer, gpointer),
gpointer (* get_previous) (gpointer, gpointer), gpointer (* get_previous) (gpointer, gpointer),
gpointer (* get_last) (gpointer), gpointer (* get_last) (gpointer),
@@ -46,8 +45,7 @@ GtkListListModel * gtk_list_list_model_new (GType
gpointer data, gpointer data,
GDestroyNotify notify); GDestroyNotify notify);
GtkListListModel * gtk_list_list_model_new_with_size (GType item_type, GtkListListModel * gtk_list_list_model_new_with_size (guint n_items,
guint n_items,
gpointer (* get_first) (gpointer), gpointer (* get_first) (gpointer),
gpointer (* get_next) (gpointer, gpointer), gpointer (* get_next) (gpointer, gpointer),
gpointer (* get_previous) (gpointer, gpointer), gpointer (* get_previous) (gpointer, gpointer),

View File

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

View File

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

View File

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

View File

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

View File

@@ -11535,8 +11535,7 @@ gtk_widget_observe_children (GtkWidget *widget)
if (priv->children_observer) if (priv->children_observer)
return g_object_ref (G_LIST_MODEL (priv->children_observer)); return g_object_ref (G_LIST_MODEL (priv->children_observer));
priv->children_observer = gtk_list_list_model_new (GTK_TYPE_WIDGET, priv->children_observer = gtk_list_list_model_new ((gpointer) gtk_widget_get_first_child,
(gpointer) gtk_widget_get_first_child,
(gpointer) gtk_widget_get_next_sibling, (gpointer) gtk_widget_get_next_sibling,
(gpointer) gtk_widget_get_prev_sibling, (gpointer) gtk_widget_get_prev_sibling,
(gpointer) gtk_widget_get_last_child, (gpointer) gtk_widget_get_last_child,
@@ -11622,14 +11621,13 @@ gtk_widget_observe_controllers (GtkWidget *widget)
if (priv->controller_observer) if (priv->controller_observer)
return g_object_ref (G_LIST_MODEL (priv->controller_observer)); return g_object_ref (G_LIST_MODEL (priv->controller_observer));
priv->controller_observer = gtk_list_list_model_new (GTK_TYPE_EVENT_CONTROLLER, priv->controller_observer = gtk_list_list_model_new (gtk_widget_controller_list_get_first,
gtk_widget_controller_list_get_first, gtk_widget_controller_list_get_next,
gtk_widget_controller_list_get_next, gtk_widget_controller_list_get_prev,
gtk_widget_controller_list_get_prev, NULL,
NULL, (gpointer) g_object_ref,
(gpointer) g_object_ref, widget,
widget, gtk_widget_controller_observer_destroyed);
gtk_widget_controller_observer_destroyed);
return G_LIST_MODEL (priv->controller_observer); return G_LIST_MODEL (priv->controller_observer);
} }

View File

@@ -244,7 +244,6 @@ gtk_inspector_controllers_set_object (GtkInspectorControllers *self,
gtk_property_lookup_list_model_set_object (self->model, object); 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); 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)); flatten_model = gtk_flatten_list_model_new (G_LIST_MODEL (map_model));
@@ -260,7 +259,6 @@ gtk_inspector_controllers_set_object (GtkInspectorControllers *self,
g_object_unref (sort_model); g_object_unref (sort_model);
g_object_unref (flatten_model); g_object_unref (flatten_model);
g_object_unref (map_model);
} }
static void static void

View File

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

View File

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

View File

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

View File

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

View File

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