[tepl] Tab: do not store properties GParamSpec's



commit daa8aec0f4460ca9e7e6f1a0760cf866862f38bb
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Jul 20 18:30:38 2017 +0200

    Tab: do not store properties GParamSpec's
    
    With g_object_class_override_property(), we don't have the GParamSpec,
    so we cannot call g_object_notify_by_pspec(). For code consistency, it's
    better to notify all the properties in the same way, because otherwise
    it's dangerous to have some properties that can be notified_by_pspec and
    others not (in the same enum).

 tepl/tepl-tab.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/tepl/tepl-tab.c b/tepl/tepl-tab.c
index 5208538..5e13f75 100644
--- a/tepl/tepl-tab.c
+++ b/tepl/tepl-tab.c
@@ -55,11 +55,8 @@ enum
 {
        PROP_0,
        PROP_VIEW,
-       N_PROPERTIES
 };
 
-static GParamSpec *properties[N_PROPERTIES];
-
 static void tepl_tab_group_interface_init (gpointer g_iface,
                                           gpointer iface_data);
 
@@ -164,7 +161,7 @@ set_view (TeplTab  *tab,
 
        TEPL_TAB_GET_CLASS (tab)->pack_view (tab, view);
 
-       g_object_notify_by_pspec (G_OBJECT (tab), properties[PROP_VIEW]);
+       g_object_notify (G_OBJECT (tab), "view");
 }
 
 static void
@@ -237,16 +234,15 @@ tepl_tab_class_init (TeplTabClass *klass)
         *
         * Since: 3.0
         */
-       properties[PROP_VIEW] =
-               g_param_spec_object ("view",
-                                    "View",
-                                    "",
-                                    TEPL_TYPE_VIEW,
-                                    G_PARAM_READWRITE |
-                                    G_PARAM_CONSTRUCT_ONLY |
-                                    G_PARAM_STATIC_STRINGS);
-
-       g_object_class_install_properties (object_class, N_PROPERTIES, properties);
+       g_object_class_install_property (object_class,
+                                        PROP_VIEW,
+                                        g_param_spec_object ("view",
+                                                             "View",
+                                                             "",
+                                                             TEPL_TYPE_VIEW,
+                                                             G_PARAM_READWRITE |
+                                                             G_PARAM_CONSTRUCT_ONLY |
+                                                             G_PARAM_STATIC_STRINGS));
 }
 
 static GList *


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