[gtk+] gtkgrid: Use g_object_class_install_properties() and g_object_notify_by_pspec()



commit 65ce9a523a13c9e6656cf4c3b015240c92fbceef
Author: Javier Jardón <jjardon gnome org>
Date:   Sun Nov 14 03:49:26 2010 +0100

    gtkgrid: Use g_object_class_install_properties() and g_object_notify_by_pspec()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=634793

 gtk/gtkgrid.c |   33 ++++++++++++++++++++-------------
 1 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index 23cbc53..1d14d02 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -151,9 +151,12 @@ enum
   PROP_COLUMN_SPACING,
   PROP_ROW_HOMOGENEOUS,
   PROP_COLUMN_HOMOGENEOUS,
-  PROP_BASELINE_ROW
+  PROP_BASELINE_ROW,
+  N_PROPERTIES
 };
 
+static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
+
 enum
 {
   CHILD_PROP_0,
@@ -1727,33 +1730,37 @@ gtk_grid_class_init (GtkGridClass *class)
 
   g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation");
 
-  g_object_class_install_property (object_class, PROP_ROW_SPACING,
+  obj_properties [PROP_ROW_SPACING] =
     g_param_spec_int ("row-spacing",
                       P_("Row spacing"),
                       P_("The amount of space between two consecutive rows"),
                       0, G_MAXINT16, 0,
-                      GTK_PARAM_READWRITE));
+                      GTK_PARAM_READWRITE);
 
-  g_object_class_install_property (object_class, PROP_COLUMN_SPACING,
+  obj_properties [PROP_COLUMN_SPACING] =
     g_param_spec_int ("column-spacing",
                       P_("Column spacing"),
                       P_("The amount of space between two consecutive columns"),
                       0, G_MAXINT16, 0,
-                      GTK_PARAM_READWRITE));
+                      GTK_PARAM_READWRITE);
 
-  g_object_class_install_property (object_class, PROP_ROW_HOMOGENEOUS,
+  obj_properties [PROP_ROW_HOMOGENEOUS] =
     g_param_spec_boolean ("row-homogeneous",
                           P_("Row Homogeneous"),
                           P_("If TRUE, the rows are all the same height"),
                           FALSE,
-                          GTK_PARAM_READWRITE));
+                          GTK_PARAM_READWRITE);
 
-  g_object_class_install_property (object_class, PROP_COLUMN_HOMOGENEOUS,
+  obj_properties [PROP_COLUMN_HOMOGENEOUS] =
     g_param_spec_boolean ("column-homogeneous",
                           P_("Column Homogeneous"),
                           P_("If TRUE, the columns are all the same width"),
                           FALSE,
-                          GTK_PARAM_READWRITE));
+                          GTK_PARAM_READWRITE);
+
+  g_object_class_install_properties (object_class,
+                                     N_PROPERTIES,
+                                     obj_properties);
 
   g_object_class_install_property (object_class, PROP_BASELINE_ROW,
     g_param_spec_int ("baseline-row",
@@ -2244,7 +2251,7 @@ gtk_grid_set_row_homogeneous (GtkGrid  *grid,
       if (gtk_widget_get_visible (GTK_WIDGET (grid)))
         gtk_widget_queue_resize (GTK_WIDGET (grid));
 
-      g_object_notify (G_OBJECT (grid), "row-homogeneous");
+      g_object_notify_by_pspec (G_OBJECT (grid), obj_properties [PROP_ROW_HOMOGENEOUS]);
     }
 }
 
@@ -2291,7 +2298,7 @@ gtk_grid_set_column_homogeneous (GtkGrid  *grid,
       if (gtk_widget_get_visible (GTK_WIDGET (grid)))
         gtk_widget_queue_resize (GTK_WIDGET (grid));
 
-      g_object_notify (G_OBJECT (grid), "column-homogeneous");
+      g_object_notify_by_pspec (G_OBJECT (grid), obj_properties [PROP_COLUMN_HOMOGENEOUS]);
     }
 }
 
@@ -2338,7 +2345,7 @@ gtk_grid_set_row_spacing (GtkGrid *grid,
       if (gtk_widget_get_visible (GTK_WIDGET (grid)))
         gtk_widget_queue_resize (GTK_WIDGET (grid));
 
-      g_object_notify (G_OBJECT (grid), "row-spacing");
+      g_object_notify_by_pspec (G_OBJECT (grid), obj_properties [PROP_ROW_SPACING]);
     }
 }
 
@@ -2385,7 +2392,7 @@ gtk_grid_set_column_spacing (GtkGrid *grid,
       if (gtk_widget_get_visible (GTK_WIDGET (grid)))
         gtk_widget_queue_resize (GTK_WIDGET (grid));
 
-      g_object_notify (G_OBJECT (grid), "column-spacing");
+      g_object_notify_by_pspec (G_OBJECT (grid), obj_properties [PROP_COLUMN_SPACING]);
     }
 }
 


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