forked from AuroraMiddleware/gtk
multiselection: Make constructor transfer full
This is for consistency with other wrapping list constructors. We want them all to be transfer full, allow-none. Also make the constructor return GtkMultiSelection *. Update all callers.
This commit is contained in:
parent
ccb9dcc86b
commit
cdc263f796
@ -884,7 +884,7 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
|
||||
sort_model = gtk_sort_list_model_new (gtk_color_list_new (0), NULL);
|
||||
gtk_sort_list_model_set_incremental (sort_model, TRUE);
|
||||
selection = GTK_MULTI_SELECTION (gtk_multi_selection_new (G_LIST_MODEL (sort_model)));
|
||||
selection = gtk_multi_selection_new (G_LIST_MODEL (sort_model));
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Colors");
|
||||
|
@ -370,20 +370,27 @@ gtk_multi_selection_init (GtkMultiSelection *self)
|
||||
|
||||
/**
|
||||
* gtk_multi_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.
|
||||
*
|
||||
* Returns: (transfer full) (type GtkMultiSelection): a new #GtkMultiSelection
|
||||
* Returns: (transfer full): a new #GtkMultiSelection
|
||||
**/
|
||||
GListModel *
|
||||
GtkMultiSelection *
|
||||
gtk_multi_selection_new (GListModel *model)
|
||||
{
|
||||
GtkMultiSelection *self;
|
||||
|
||||
g_return_val_if_fail (G_IS_LIST_MODEL (model), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_MULTI_SELECTION,
|
||||
self = g_object_new (GTK_TYPE_MULTI_SELECTION,
|
||||
"model", model,
|
||||
NULL);
|
||||
|
||||
/* consume the reference */
|
||||
g_clear_object (&model);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,13 +31,13 @@ GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (GtkMultiSelection, gtk_multi_selection, GTK, MULTI_SELECTION, GObject)
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GListModel * gtk_multi_selection_new (GListModel *model);
|
||||
GtkMultiSelection * gtk_multi_selection_new (GListModel *model);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GListModel * gtk_multi_selection_get_model (GtkMultiSelection *self);
|
||||
GListModel * gtk_multi_selection_get_model (GtkMultiSelection *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_multi_selection_set_model (GtkMultiSelection *self,
|
||||
GListModel *model);
|
||||
void gtk_multi_selection_set_model (GtkMultiSelection *self,
|
||||
GListModel *model);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -253,7 +253,7 @@ new_model (GListStore *store)
|
||||
GtkSelectionModel *result;
|
||||
GString *changes;
|
||||
|
||||
result = GTK_SELECTION_MODEL (gtk_multi_selection_new (G_LIST_MODEL (store)));
|
||||
result = GTK_SELECTION_MODEL (gtk_multi_selection_new (g_object_ref (G_LIST_MODEL (store))));
|
||||
|
||||
changes = g_string_new ("");
|
||||
g_object_set_qdata_full (G_OBJECT(result), changes_quark, changes, free_changes);
|
||||
|
Loading…
Reference in New Issue
Block a user