[Xfce4-commits] [apps/xfdashboard] 02/02: Instead of a static string to access data from an object created by XfdashboardThemeLayout use a GQuark. Also fix a bug registering focusable actors in reversed order.

noreply at xfce.org noreply at xfce.org
Fri Dec 18 16:12:19 CET 2015


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

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

commit b8cdc29081c94cb9aecfe4af4f465c4cd26a7070
Author: Stephan Haller <nomad at froevel.de>
Date:   Fri Dec 18 16:11:08 2015 +0100

    Instead of a static string to access data from an object created by XfdashboardThemeLayout use a GQuark. Also fix a bug registering focusable actors in reversed order.
---
 xfdashboard/stage.c        |    4 +---
 xfdashboard/theme-layout.c |   21 +++++++++++++++------
 xfdashboard/theme-layout.h |    4 ++++
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/xfdashboard/stage.c b/xfdashboard/stage.c
index 3a5320c..cafbd19 100644
--- a/xfdashboard/stage.c
+++ b/xfdashboard/stage.c
@@ -138,8 +138,6 @@ static guint XfdashboardStageSignals[SIGNAL_LAST]={ 0, };
 #define XFDASHBOARD_THEME_LAYOUT_PRIMARY				"primary"
 #define XFDASHBOARD_THEME_LAYOUT_SECONDARY				"secondary"
 
-#define XFDASHBOARD_THEME_LAYOUT_FOCUS_TABLE_DATA		"xfdashboard-theme-layout-interface-focus-table"
-
 /* Handle an event */
 static gboolean _xfdashboard_stage_event(ClutterActor *inActor, ClutterEvent *inEvent)
 {
@@ -944,7 +942,7 @@ static void _xfdashboard_stage_on_application_theme_changed(XfdashboardStage *se
 		if(!interface) continue;
 
 		/* Get focus table of interface */
-		interfaceFocusTable=g_object_get_data(G_OBJECT(interface), XFDASHBOARD_THEME_LAYOUT_FOCUS_TABLE_DATA);
+		interfaceFocusTable=g_object_get_qdata(G_OBJECT(interface), XFDASHBOARD_THEME_LAYOUT_FOCUS_TABLE_DATA);
 
 		/* Add interface to stage */
 		clutter_actor_add_child(CLUTTER_ACTOR(self), interface);
diff --git a/xfdashboard/theme-layout.c b/xfdashboard/theme-layout.c
index 4a784a6..61309e2 100644
--- a/xfdashboard/theme-layout.c
+++ b/xfdashboard/theme-layout.c
@@ -49,8 +49,6 @@ struct _XfdashboardThemeLayoutPrivate
 };
 
 /* IMPLEMENTATION: Private variables and methods */
-#define XFDASHBOARD_THEME_LAYOUT_FOCUS_TABLE_DATA		"xfdashboard-theme-layout-interface-focus-table"
-
 enum
 {
 	TAG_DOCUMENT,
@@ -599,11 +597,11 @@ static void _xfdashboard_theme_layout_create_object_resolve_unresolved(Xfdashboa
 				refObject=g_hash_table_lookup(inIDs, unresolvedID->property->tag.focus.refID);
 
 				/* Get current focus table from object */
-				focusTable=g_object_get_data(unresolvedID->targetObject, XFDASHBOARD_THEME_LAYOUT_FOCUS_TABLE_DATA);
+				focusTable=g_object_get_qdata(unresolvedID->targetObject, XFDASHBOARD_THEME_LAYOUT_FOCUS_TABLE_DATA);
 				if(!focusTable)
 				{
 					focusTable=g_ptr_array_new();
-					g_object_set_data_full(unresolvedID->targetObject,
+					g_object_set_qdata_full(unresolvedID->targetObject,
 											XFDASHBOARD_THEME_LAYOUT_FOCUS_TABLE_DATA,
 											focusTable,
 											(GDestroyNotify)g_ptr_array_unref);
@@ -873,8 +871,11 @@ static GObject* _xfdashboard_theme_layout_create_object(XfdashboardThemeLayout *
 			unresolved->targetObject=g_object_ref(object);
 			unresolved->property=_xfdashboard_theme_layout_tag_data_ref(focus);
 
-			/* Add to list of unresolved IDs */
-			*ioUnresolvedIDs=g_slist_prepend(*ioUnresolvedIDs, unresolved);
+			/* Add to list of unresolved IDs.
+			 * It is important to add it at the end of list to keep order
+			 * of focusable actors.
+			 */
+			*ioUnresolvedIDs=g_slist_append(*ioUnresolvedIDs, unresolved);
 		}
 	}
 
@@ -2051,3 +2052,11 @@ ClutterActor* xfdashboard_theme_layout_build_interface(XfdashboardThemeLayout *s
 	/* Return created actor */
 	return(actor);
 }
+
+/* Quark for accessing focus table data (a GPtrArray) at an actor
+ * with g_object_get_qdata() created by xfdashboard_theme_layout_build_interface().
+ */
+GQuark xfdashboard_theme_layout_focus_table_quark(void)
+{
+	return(g_quark_from_static_string("xfdashboard-theme-layout-focus-table-quark"));
+}
diff --git a/xfdashboard/theme-layout.h b/xfdashboard/theme-layout.h
index 0d9999f..98f8bbb 100644
--- a/xfdashboard/theme-layout.h
+++ b/xfdashboard/theme-layout.h
@@ -81,6 +81,10 @@ gboolean xfdashboard_theme_layout_add_file(XfdashboardThemeLayout *self,
 ClutterActor* xfdashboard_theme_layout_build_interface(XfdashboardThemeLayout *self,
 														const gchar *inID);
 
+
+#define XFDASHBOARD_THEME_LAYOUT_FOCUS_TABLE_DATA	(xfdashboard_theme_layout_focus_table_quark())
+GQuark xfdashboard_theme_layout_focus_table_quark(void);
+
 G_END_DECLS
 
 #endif	/* __XFDASHBOARD_THEME_LAYOUT__ */

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


More information about the Xfce4-commits mailing list