[Xfce4-commits] [apps/xfdashboard] 04/04: Split loading theme into seperate signals. So rename signal "theme-changing" to "theme-loading" and add new signal "theme-loaded" to application which is emitted after loading theme is complete but not yet applied. It is the last chance for a plugin to load additional resources (CSS etc.), e.g. to override theme's CSS.

noreply at xfce.org noreply at xfce.org
Thu Jun 30 10:03:32 CEST 2016


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

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

commit 21ad77ee339589d14f540e694c600bdb775ef221
Author: Stephan Haller <nomad at froevel.de>
Date:   Thu Jun 30 10:02:08 2016 +0200

    Split loading theme into seperate signals. So rename signal "theme-changing" to "theme-loading" and add new signal "theme-loaded" to application which is emitted after loading theme is complete but not yet applied. It is the last chance for a plugin to load additional resources (CSS etc.), e.g. to override theme's CSS.
---
 libxfdashboard/application.c | 54 ++++++++++++++++++++++++++++++++------------
 libxfdashboard/application.h |  3 ++-
 2 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/libxfdashboard/application.c b/libxfdashboard/application.c
index a2bfc50..c87c24a 100644
--- a/libxfdashboard/application.c
+++ b/libxfdashboard/application.c
@@ -127,7 +127,8 @@ enum
 	SIGNAL_SUSPEND,
 	SIGNAL_RESUME,
 
-	SIGNAL_THEME_CHANGING,
+	SIGNAL_THEME_LOADING,
+	SIGNAL_THEME_LOADED,
 	SIGNAL_THEME_CHANGED,
 
 	SIGNAL_APPLICATION_LAUNCHED,
@@ -287,8 +288,8 @@ static void _xfdashboard_application_set_theme_name(XfdashboardApplication *self
 		/* Create new theme instance */
 		theme=xfdashboard_theme_new(inThemeName);
 
-		/* Emit signal that theme is going to be loaded and changed */
-		g_signal_emit(self, XfdashboardApplicationSignals[SIGNAL_THEME_CHANGING], 0, theme);
+		/* Emit signal that theme is going to be loaded */
+		g_signal_emit(self, XfdashboardApplicationSignals[SIGNAL_THEME_LOADING], 0, theme);
 
 		/* Load theme */
 		if(!xfdashboard_theme_load(theme, &error))
@@ -312,6 +313,9 @@ static void _xfdashboard_application_set_theme_name(XfdashboardApplication *self
 			return;
 		}
 
+		/* Emit signal that theme was loaded successfully and will soon be applied */
+		g_signal_emit(self, XfdashboardApplicationSignals[SIGNAL_THEME_LOADED], 0, theme);
+
 		/* Set value */
 		if(priv->themeName) g_free(priv->themeName);
 		priv->themeName=g_strdup(inThemeName);
@@ -1237,21 +1241,43 @@ static void xfdashboard_application_class_init(XfdashboardApplicationClass *klas
 						0);
 
 	/**
-	 * XfdashboardApplication::theme-changing:
+	 * XfdashboardApplication::theme-loading:
+	 * @self: The application whose theme is going to change
+	 * @inTheme: The new #XfdashboardTheme used
+	 *
+	 * The ::theme-loading signal is emitted when the theme of application is
+	 * going to be loaded. When this signal is received no file was loaded so far
+	 * but will be. For example, at this moment it is possible to load a CSS file
+	 * by a plugin before the CSS files of the new theme will be loaded to give
+	 * the theme a chance to override the default CSS of plugin.
+	 */
+	XfdashboardApplicationSignals[SIGNAL_THEME_LOADING]=
+		g_signal_new("theme-loading",
+						G_TYPE_FROM_CLASS(klass),
+						G_SIGNAL_RUN_LAST,
+						G_STRUCT_OFFSET(XfdashboardApplicationClass, theme_loading),
+						NULL,
+						NULL,
+						g_cclosure_marshal_VOID__OBJECT,
+						G_TYPE_NONE,
+						1,
+						XFDASHBOARD_TYPE_THEME);
+
+	/**
+	 * XfdashboardApplication::theme-loaded:
 	 * @self: The application whose theme is going to change
 	 * @inTheme: The new #XfdashboardTheme used
 	 *
-	 * The ::theme-changing signal is emitted when the theme of application
-	 * is going to be loaded and changed. When this signal is received no file
-	 * was loaded so far but will be. For example, at this moment it is possible
-	 * to load a CSS file by a plugin before the CSS files of the new theme will
-	 * be loaded to give the theme a chance to override the default CSS of plugin.
+	 * The ::theme-loaded signal is emitted when the new theme of application was
+	 * loaded and will soon be applied. When this signal is received it is the
+	 * last chance for other components and plugins to load additionally resources
+	 * like CSS, e.g. to override CSS of theme.
 	 */
-	XfdashboardApplicationSignals[SIGNAL_THEME_CHANGING]=
-		g_signal_new("theme-changing",
+	XfdashboardApplicationSignals[SIGNAL_THEME_LOADED]=
+		g_signal_new("theme-loaded",
 						G_TYPE_FROM_CLASS(klass),
 						G_SIGNAL_RUN_LAST,
-						G_STRUCT_OFFSET(XfdashboardApplicationClass, theme_changing),
+						G_STRUCT_OFFSET(XfdashboardApplicationClass, theme_loaded),
 						NULL,
 						NULL,
 						g_cclosure_marshal_VOID__OBJECT,
@@ -1264,8 +1290,8 @@ static void xfdashboard_application_class_init(XfdashboardApplicationClass *klas
 	 * @self: The application whose theme has changed
 	 * @inTheme: The new #XfdashboardTheme used
 	 *
-	 * The ::theme-changed signal is emitted when the theme of application
-	 * has been loaded successfully and changed.
+	 * The ::theme-changed signal is emitted when a new theme of application
+	 * has been loaded and applied.
 	 */
 	XfdashboardApplicationSignals[SIGNAL_THEME_CHANGED]=
 		g_signal_new("theme-changed",
diff --git a/libxfdashboard/application.h b/libxfdashboard/application.h
index 140d31a..3b1937d 100644
--- a/libxfdashboard/application.h
+++ b/libxfdashboard/application.h
@@ -114,7 +114,8 @@ struct _XfdashboardApplicationClass
 	void (*quit)(XfdashboardApplication *self);
 	void (*shutdown_final)(XfdashboardApplication *self);
 
-	void (*theme_changing)(XfdashboardApplication *self, XfdashboardTheme *inTheme);
+	void (*theme_loading)(XfdashboardApplication *self, XfdashboardTheme *inTheme);
+	void (*theme_loaded)(XfdashboardApplication *self, XfdashboardTheme *inTheme);
 	void (*theme_changed)(XfdashboardApplication *self, XfdashboardTheme *inTheme);
 
 	void (*application_launched)(XfdashboardApplication *self, GAppInfo *inAppInfo);

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


More information about the Xfce4-commits mailing list