[gtk+/gtk-3-10] stack: Use g_object_class_install_properties()



commit 8e7516ac8525530734c6586ff274ecb1fed9cca5
Author: David King <dking redhat com>
Date:   Tue Nov 5 10:11:35 2013 +0000

    stack: Use g_object_class_install_properties()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711611

 gtk/gtkstack.c |   71 ++++++++++++++++++++++++++------------------------------
 1 files changed, 33 insertions(+), 38 deletions(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index be4e0ff..d6789a1 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -73,7 +73,8 @@ enum  {
   PROP_VISIBLE_CHILD,
   PROP_VISIBLE_CHILD_NAME,
   PROP_TRANSITION_DURATION,
-  PROP_TRANSITION_TYPE
+  PROP_TRANSITION_TYPE,
+  LAST_PROP
 };
 
 enum
@@ -118,6 +119,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,
@@ -351,43 +354,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",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]