mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
Drop gtk_widget_new
An abstract type should not have a constructor. If you want to be generic, just use g_object_new.
This commit is contained in:
parent
cdc5e83ef2
commit
d89f7fd046
@ -4368,7 +4368,6 @@ GtkWidget
|
||||
GtkWidgetClass
|
||||
GtkRequisition
|
||||
GtkAllocation
|
||||
gtk_widget_new
|
||||
gtk_widget_in_destruction
|
||||
gtk_widget_unparent
|
||||
gtk_widget_show
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user