From 2454522b262736c9588e60982bd2f0fa3365a834 Mon Sep 17 00:00:00 2001 From: David King Date: Tue, 5 Nov 2013 10:11:35 +0000 Subject: [PATCH] stack: Use g_object_class_install_properties() https://bugzilla.gnome.org/show_bug.cgi?id=711611 --- gtk/gtkstack.c | 71 +++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index e7cc767cd0..4ff4d59b02 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -84,7 +84,8 @@ enum { PROP_VISIBLE_CHILD, PROP_VISIBLE_CHILD_NAME, PROP_TRANSITION_DURATION, - PROP_TRANSITION_TYPE + PROP_TRANSITION_TYPE, + LAST_PROP }; enum @@ -131,6 +132,8 @@ typedef struct { GtkStackTransitionType active_transition_type; } GtkStackPrivate; +static GParamSpec *stack_props[LAST_PROP] = { NULL, }; + static void gtk_stack_add (GtkContainer *widget, GtkWidget *child); static void gtk_stack_remove (GtkContainer *widget, @@ -364,43 +367,35 @@ gtk_stack_class_init (GtkStackClass *klass) /*container_class->get_path_for_child = gtk_stack_get_path_for_child; */ gtk_container_class_handle_border_width (container_class); - g_object_class_install_property (object_class, - PROP_HOMOGENEOUS, - g_param_spec_boolean ("homogeneous", - P_("Homogeneous"), - P_("Homogeneous sizing"), - TRUE, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT)); - g_object_class_install_property (object_class, - PROP_VISIBLE_CHILD, - g_param_spec_object ("visible-child", - P_("Visible child"), - P_("The widget currently visible in the stack"), - GTK_TYPE_WIDGET, - GTK_PARAM_READWRITE)); - g_object_class_install_property (object_class, - PROP_VISIBLE_CHILD_NAME, - g_param_spec_string ("visible-child-name", - P_("Name of visible child"), - P_("The name of the widget currently visible in the stack"), - NULL, - GTK_PARAM_READWRITE)); - g_object_class_install_property (object_class, - PROP_TRANSITION_DURATION, - g_param_spec_uint ("transition-duration", - P_("Transition duration"), - P_("The animation duration, in milliseconds"), - 0, G_MAXUINT, - 200, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT)); - g_object_class_install_property (object_class, - PROP_TRANSITION_TYPE, - g_param_spec_enum ("transition-type", - P_("Transition type"), - P_("The type of animation used to transition"), - GTK_TYPE_STACK_TRANSITION_TYPE, - GTK_STACK_TRANSITION_TYPE_NONE, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + stack_props[PROP_HOMOGENEOUS] = g_param_spec_boolean ("homogeneous", + P_("Homogeneous"), + P_("Homogeneous sizing"), + TRUE, + GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT); + stack_props[PROP_VISIBLE_CHILD] = g_param_spec_object ("visible-child", + P_("Visible child"), + P_("The widget currently visible in the stack"), + GTK_TYPE_WIDGET, + GTK_PARAM_READWRITE); + stack_props[PROP_VISIBLE_CHILD_NAME] = g_param_spec_string ("visible-child-name", + P_("Name of visible child"), + P_("The name of the widget currently visible in the stack"), + NULL, + GTK_PARAM_READWRITE); + stack_props[PROP_TRANSITION_DURATION] = g_param_spec_uint ("transition-duration", + P_("Transition duration"), + P_("The animation duration, in milliseconds"), + 0, G_MAXUINT, + 200, + GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT); + stack_props[PROP_TRANSITION_TYPE] = g_param_spec_enum ("transition-type", + P_("Transition type"), + P_("The type of animation used to transition"), + GTK_TYPE_STACK_TRANSITION_TYPE, + GTK_STACK_TRANSITION_TYPE_NONE, + GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT); + + g_object_class_install_properties (object_class, LAST_PROP, stack_props); gtk_container_class_install_child_property (container_class, CHILD_PROP_NAME, g_param_spec_string ("name",