[Xfce4-commits] [apps/xfdashboard] 01/02: Also properties should only be defined once in interfaces

noreply at xfce.org noreply at xfce.org
Tue Jan 17 09:00:28 CET 2017


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit ebf92e86d9cbe10c70e186eaa0f20d58c4ae5774
Author: Stephan Haller <nomad at froevel.de>
Date:   Tue Jan 17 08:27:20 2017 +0100

    Also properties should only be defined once in interfaces
---
 libxfdashboard/stylable.c | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/libxfdashboard/stylable.c b/libxfdashboard/stylable.c
index 8ae2125..2c4673a 100644
--- a/libxfdashboard/stylable.c
+++ b/libxfdashboard/stylable.c
@@ -248,6 +248,7 @@ static void _xfdashboard_stylable_real_invalidate(XfdashboardStylable *self)
  */
 void xfdashboard_stylable_default_init(XfdashboardStylableInterface *iface)
 {
+	static gboolean		initialized=FALSE;
 	GParamSpec			*property;
 
 	/* All the following virtual functions must be overridden */
@@ -264,20 +265,27 @@ void xfdashboard_stylable_default_init(XfdashboardStylableInterface *iface)
 	iface->get_parent=_xfdashboard_stylable_real_get_parent;
 	iface->invalidate=_xfdashboard_stylable_real_invalidate;
 
-	/* Define properties */
-	property=g_param_spec_string("style-classes",
-									_("Style classes"),
-									_("String representing list of classes separated by '.'"),
-									NULL,
-									G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_interface_install_property(iface, property);
-
-	property=g_param_spec_string("style-pseudo-classes",
-									_("Style pseudo-classes"),
-									_("String representing list of pseudo-classes, e.g. current state, separated by ':'"),
-									NULL,
-									G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_interface_install_property(iface, property);
+	/* Define properties, signals and actions */
+	if(!initialized)
+	{
+		/* Define properties */
+		property=g_param_spec_string("style-classes",
+										_("Style classes"),
+										_("String representing list of classes separated by '.'"),
+										NULL,
+										G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+		g_object_interface_install_property(iface, property);
+
+		property=g_param_spec_string("style-pseudo-classes",
+										_("Style pseudo-classes"),
+										_("String representing list of pseudo-classes, e.g. current state, separated by ':'"),
+										NULL,
+										G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+		g_object_interface_install_property(iface, property);
+
+		/* Set flag that base initialization was done for this interface */
+		initialized=TRUE;
+	}
 }
 
 /* IMPLEMENTATION: Public API */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list