From d89f7fd0463b8af41785f2e0df6c8c142fb52a5a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 19 Sep 2020 16:58:42 -0400 Subject: [PATCH] Drop gtk_widget_new An abstract type should not have a constructor. If you want to be generic, just use g_object_new. --- docs/reference/gtk/gtk4-sections.txt | 1 - gtk/gtkwidget.c | 33 ---------------------------- gtk/gtkwidget.h | 4 ---- testsuite/gtk/object.c | 2 +- 4 files changed, 1 insertion(+), 39 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 62d617d582..a5246c6dae 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4368,7 +4368,6 @@ GtkWidget GtkWidgetClass GtkRequisition GtkAllocation -gtk_widget_new gtk_widget_in_destruction gtk_widget_unparent gtk_widget_show diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index df99bc01d2..ffd4ef4133 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -2294,39 +2294,6 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class) } } -/** - * gtk_widget_new: - * @type: type ID of the widget to create - * @first_property_name: name of first property to set - * @...: value of first property, followed by more properties, - * %NULL-terminated - * - * This is a convenience function for creating a widget and setting - * its properties in one go. For example you might write: - * `gtk_widget_new (GTK_TYPE_LABEL, "label", "Hello World", "xalign", - * 0.0, NULL)` to create a left-aligned label. Equivalent to - * g_object_new(), but returns a widget so you don’t have to - * cast the object yourself. - * - * Returns: a new #GtkWidget of type @widget_type - **/ -GtkWidget* -gtk_widget_new (GType type, - const char *first_property_name, - ...) -{ - GtkWidget *widget; - va_list var_args; - - g_return_val_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET), NULL); - - va_start (var_args, first_property_name); - widget = (GtkWidget *)g_object_new_valist (type, first_property_name, var_args); - va_end (var_args); - - return widget; -} - void gtk_widget_root (GtkWidget *widget) { diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 85fafa3149..61379b558e 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -275,10 +275,6 @@ struct _GtkWidgetClass GDK_AVAILABLE_IN_ALL GType gtk_widget_get_type (void) G_GNUC_CONST; GDK_AVAILABLE_IN_ALL -GtkWidget* gtk_widget_new (GType type, - const char *first_property_name, - ...); -GDK_AVAILABLE_IN_ALL void gtk_widget_unparent (GtkWidget *widget); GDK_AVAILABLE_IN_ALL void gtk_widget_show (GtkWidget *widget); diff --git a/testsuite/gtk/object.c b/testsuite/gtk/object.c index cd14013614..d4c13339c8 100644 --- a/testsuite/gtk/object.c +++ b/testsuite/gtk/object.c @@ -280,7 +280,7 @@ widget_property_tests (gconstpointer test_data) { GType wtype = (GType) test_data; /* create widget */ - GtkWidget *widget = gtk_widget_new (wtype, NULL); + GtkWidget *widget = g_object_new (wtype, NULL); g_object_ref_sink (widget); widget_fixups (widget); /* test property values */