diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-26 15:38:15 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-26 15:38:15 -0400 |
commit | cd8a810d69f4f56c265b934db2dfc0fcb3881bfd (patch) | |
tree | 898ef7d6d21b802d91124911dd53424b56b2a24f | |
parent | 8f63a5ab63e29969876f9a0107a50b2564a69e84 (diff) | |
download | gtk+-slice-list-constructor.tar.gz |
slicelistmodel: Make constructor transfer fullslice-list-constructor
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.
Update all callers.
-rw-r--r-- | gtk/gtkslicelistmodel.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gtk/gtkslicelistmodel.c b/gtk/gtkslicelistmodel.c index 8d0273c037..523a3b1c6d 100644 --- a/gtk/gtkslicelistmodel.c +++ b/gtk/gtkslicelistmodel.c @@ -30,11 +30,12 @@ * @short_description: A list model that presents a slice out of a larger list * @see_also: #GListModel * - * #GtkSliceListModel is a list model that takes a list model and presents a slice of - * that model. + * #GtkSliceListModel is a list model that takes a list model and presents a + * slice of that model. * - * This is useful when implementing paging by setting the size to the number of elements - * per page and updating the offset whenever a different page is opened. + * This is useful when implementing paging by setting the size to the number + * of elements per page and updating the offset whenever a different page is + * opened. */ #define DEFAULT_SIZE 10 @@ -300,7 +301,7 @@ gtk_slice_list_model_init (GtkSliceListModel *self) /** * gtk_slice_list_model_new: - * @model: (transfer none) (allow-none): The model to use + * @model: (transfer full) (allow-none): The model to use, or %NULL * @offset: the offset of the slice * @size: maximum size of the slice * @@ -314,13 +315,20 @@ gtk_slice_list_model_new (GListModel *model, guint offset, guint size) { + GtkSliceListModel *self; + g_return_val_if_fail (model == NULL || G_IS_LIST_MODEL (model), NULL); - return g_object_new (GTK_TYPE_SLICE_LIST_MODEL, + self = g_object_new (GTK_TYPE_SLICE_LIST_MODEL, "model", model, "offset", offset, "size", size, NULL); + + /* consume the reference */ + g_clear_object (&model); + + return self; } /** |