forked from AuroraMiddleware/gtk
singleselection: 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.
This commit is contained in:
parent
68d6671413
commit
ccb9dcc86b
@ -409,7 +409,6 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
columnview, NULL);
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selection));
|
||||
g_object_unref (selection);
|
||||
g_object_unref (treemodel);
|
||||
|
||||
name_column = GTK_COLUMN_VIEW_COLUMN (gtk_builder_get_object (builder, "name_column"));
|
||||
sorter = gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name"));
|
||||
|
@ -896,7 +896,7 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
listview = gtk_list_view_new ();
|
||||
gtk_widget_set_size_request (listview, 140, -1);
|
||||
|
||||
model = G_LIST_MODEL (gtk_single_selection_new (G_LIST_MODEL (dialog->custom_paper_list)));
|
||||
model = G_LIST_MODEL (gtk_single_selection_new (g_object_ref (G_LIST_MODEL (dialog->custom_paper_list))));
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (listview), model);
|
||||
g_signal_connect (model, "notify::selected", G_CALLBACK (selected_custom_paper_changed), dialog);
|
||||
g_object_unref (model);
|
||||
|
@ -668,7 +668,6 @@ gtk_drop_down_set_model (GtkDropDown *self,
|
||||
|
||||
filter_model = G_LIST_MODEL (gtk_filter_list_model_new (g_object_ref (model), NULL));
|
||||
g_set_object (&self->filter_model, filter_model);
|
||||
g_object_unref (filter_model);
|
||||
|
||||
update_filter (self);
|
||||
|
||||
@ -677,7 +676,7 @@ gtk_drop_down_set_model (GtkDropDown *self,
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (self->popup_list), selection);
|
||||
g_object_unref (selection);
|
||||
|
||||
selection = G_LIST_MODEL (gtk_single_selection_new (model));
|
||||
selection = G_LIST_MODEL (gtk_single_selection_new (g_object_ref (model)));
|
||||
g_set_object (&self->selection, selection);
|
||||
g_object_unref (selection);
|
||||
|
||||
|
@ -2130,7 +2130,7 @@ gtk_list_base_set_model (GtkListBase *self,
|
||||
if (GTK_IS_SELECTION_MODEL (model))
|
||||
selection_model = GTK_SELECTION_MODEL (g_object_ref (model));
|
||||
else
|
||||
selection_model = GTK_SELECTION_MODEL (gtk_single_selection_new (model));
|
||||
selection_model = GTK_SELECTION_MODEL (gtk_single_selection_new (g_object_ref (model)));
|
||||
|
||||
gtk_list_item_manager_set_model (priv->item_manager, selection_model);
|
||||
gtk_list_base_set_anchor (self, 0, 0.0, GTK_PACK_START, 0.0, GTK_PACK_START);
|
||||
|
@ -837,7 +837,6 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
|
||||
g_signal_connect (selection, "items-changed", G_CALLBACK (printer_added_cb), dialog);
|
||||
g_signal_connect_swapped (selection, "notify::selected", G_CALLBACK (selected_printer_changed), dialog);
|
||||
g_object_unref (selection);
|
||||
g_object_unref (filtered);
|
||||
|
||||
gtk_print_load_custom_papers (dialog->custom_paper_list);
|
||||
|
||||
|
@ -453,7 +453,7 @@ gtk_single_selection_init (GtkSingleSelection *self)
|
||||
|
||||
/**
|
||||
* gtk_single_selection_new:
|
||||
* @model: (transfer none): the #GListModel to manage
|
||||
* @model: (allow-none) (transfer full): the #GListModel to manage, or %NULL
|
||||
*
|
||||
* Creates a new selection to handle @model.
|
||||
*
|
||||
@ -462,11 +462,18 @@ gtk_single_selection_init (GtkSingleSelection *self)
|
||||
GtkSingleSelection *
|
||||
gtk_single_selection_new (GListModel *model)
|
||||
{
|
||||
GtkSingleSelection *self;
|
||||
|
||||
g_return_val_if_fail (G_IS_LIST_MODEL (model), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_SINGLE_SELECTION,
|
||||
self = g_object_new (GTK_TYPE_SINGLE_SELECTION,
|
||||
"model", model,
|
||||
NULL);
|
||||
|
||||
/* consume the reference */
|
||||
g_clear_object (&model);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1304,7 +1304,7 @@ gtk_inspector_object_tree_set_display (GtkInspectorObjectTree *wt,
|
||||
create_model_for_object,
|
||||
NULL,
|
||||
NULL);
|
||||
wt->priv->selection = gtk_single_selection_new (G_LIST_MODEL (wt->priv->tree_model));
|
||||
wt->priv->selection = gtk_single_selection_new (g_object_ref (G_LIST_MODEL (wt->priv->tree_model)));
|
||||
gtk_column_view_set_model (GTK_COLUMN_VIEW (wt->priv->list),
|
||||
G_LIST_MODEL (wt->priv->selection));
|
||||
}
|
||||
|
@ -1239,7 +1239,7 @@ gtk_inspector_recorder_init (GtkInspectorRecorder *recorder)
|
||||
TRUE,
|
||||
create_list_model_for_render_node_paintable,
|
||||
NULL, NULL);
|
||||
recorder->render_node_selection = gtk_single_selection_new (G_LIST_MODEL (recorder->render_node_model));
|
||||
recorder->render_node_selection = gtk_single_selection_new (g_object_ref (G_LIST_MODEL (recorder->render_node_model)));
|
||||
g_signal_connect (recorder->render_node_selection, "notify::selected-item", G_CALLBACK (render_node_list_selection_changed), recorder);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
|
@ -712,7 +712,6 @@ constructed (GObject *object)
|
||||
sorter = gtk_tree_list_row_sorter_new (g_object_ref (column_sorter));
|
||||
sort_model = G_LIST_MODEL (gtk_sort_list_model_new (g_object_ref (G_LIST_MODEL (rl->tree_model)), sorter));
|
||||
rl->selection = gtk_single_selection_new (sort_model);
|
||||
g_object_unref (sort_model);
|
||||
|
||||
gtk_column_view_set_model (GTK_COLUMN_VIEW (rl->list), G_LIST_MODEL (rl->selection));
|
||||
|
||||
|
@ -249,7 +249,7 @@ new_model (GListStore *store, gboolean autoselect, gboolean can_unselect)
|
||||
GtkSelectionModel *result;
|
||||
GString *changes;
|
||||
|
||||
result = GTK_SELECTION_MODEL (gtk_single_selection_new (G_LIST_MODEL (store)));
|
||||
result = GTK_SELECTION_MODEL (gtk_single_selection_new (g_object_ref (G_LIST_MODEL (store))));
|
||||
|
||||
/* We want to return an empty selection unless autoselect is true,
|
||||
* so undo the initial selection due to autoselect defaulting to TRUE.
|
||||
|
Loading…
Reference in New Issue
Block a user