diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-09-01 12:24:06 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-09-01 12:24:06 -0400 |
commit | b628338db3e0bb4c906424294e4e988d45ed26f3 (patch) | |
tree | c1f5c407a2ff107c2fc43fe33d74b75d74a2bc2e /gtk/gtkgridview.c | |
parent | 7051fdee5da136c5c779bf8c1d9f1b3369eb30fb (diff) | |
download | gtk+-b628338db3e0bb4c906424294e4e988d45ed26f3.tar.gz |
list widgets: Simplify the constructors
Now that both arguments to the _new_with_factory() constructors
are nullable, there's no good reason to keep a separate _new()
around. Just make gtk_list_view_new() and gtk_grid_view_new()
take both a model and a factory.
Diffstat (limited to 'gtk/gtkgridview.c')
-rw-r--r-- | gtk/gtkgridview.c | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/gtk/gtkgridview.c b/gtk/gtkgridview.c index c80c60108b..5e3af58f5b 100644 --- a/gtk/gtkgridview.c +++ b/gtk/gtkgridview.c @@ -1179,51 +1179,23 @@ gtk_grid_view_init (GtkGridView *self) /** * gtk_grid_view_new: * @model: (allow-none) (transfer full): the model to use, or %NULL - * - * Creates a new #GtkGridView. - * - * You most likely want to call gtk_grid_view_set_factory() to - * set up a way to map its items to widgets next. - * - * Returns: a new #GtkGridView - **/ -GtkWidget * -gtk_grid_view_new (GtkSelectionModel *model) -{ - GtkWidget *result; - - g_return_val_if_fail (model == NULL || GTK_IS_SELECTION_MODEL (model), NULL); - - result = g_object_new (GTK_TYPE_GRID_VIEW, - "model", model, - NULL); - - /* consume the reference */ - g_clear_object (&model); - - return result; -} - -/** - * gtk_grid_view_new_with_factory: - * @model: (allow-none) (transfer full): the model to use, or %NULL * @factory: (allow-none) (transfer full): The factory to populate items with, or %NULL * * Creates a new #GtkGridView that uses the given @factory for * mapping items to widgets. * * The function takes ownership of the - * argument, so you can write code like + * arguments, so you can write code like * ``` - * grid_view = gtk_grid_view_new_with_factory (create_model (), + * grid_view = gtk_grid_view_new (create_model (), * gtk_builder_list_item_factory_new_from_resource ("/resource.ui")); * ``` * - * Returns: a new #GtkGridView using the given @factory + * Returns: a new #GtkGridView using the given @model and @factory **/ GtkWidget * -gtk_grid_view_new_with_factory (GtkSelectionModel *model, - GtkListItemFactory *factory) +gtk_grid_view_new (GtkSelectionModel *model, + GtkListItemFactory *factory) { GtkWidget *result; |