[Xfce4-commits] [apps/xfce4-notifyd] 24/29: Load theme for user dir $HOME/.themes/

noreply at xfce.org noreply at xfce.org
Wed Jun 29 23:20:14 CEST 2016


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

ochosi pushed a commit to branch master
in repository apps/xfce4-notifyd.

commit 32432c3b89cc1103a8ec1b3d331f4d7ca3a2db11
Author: Ali Abdallah <aliovx at gmail.com>
Date:   Mon Nov 2 22:29:50 2015 +0100

    Load theme for user dir $HOME/.themes/
---
 xfce4-notifyd/xfce-notify-daemon.c | 44 +++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index 07b4de6..dd25c06 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -1313,39 +1313,43 @@ xfce_notify_daemon_set_theme(XfceNotifyDaemon *xndaemon,
 {
     GError *error = NULL;
     gchar  *file, **files;
+    gboolean css_parsed;
     
     DBG("New theme: %s", theme);
     
-    file = g_strconcat("themes/", theme, "/xfce-notify-4.0/gtk.css", NULL);
+    file = g_build_filename(xfce_get_homedir(), ".themes", theme,
+                            "xfce-notify-4.0", "gtk.css", NULL);
     
     xndaemon->is_default_theme = (g_strcmp0("Default", theme) == 0);
-
-    files = xfce_resource_lookup_all(XFCE_RESOURCE_DATA, file);
     
-    if (files && files[0])
-    {
-        gboolean css_parsed;
+    if (!g_file_test(file, G_FILE_TEST_EXISTS)) {
         
-        css_parsed = 
-            gtk_css_provider_load_from_path (xndaemon->css_provider, 
-                                             files[0],
-                                             &error);
-        if (!css_parsed)
+        g_free (file);
+        file = g_strconcat("themes/", theme, "/xfce-notify-4.0/gtk.css", NULL);
+        files = xfce_resource_lookup_all(XFCE_RESOURCE_DATA, file);
+        if (!files || !files[0])
         {
-            g_warning ("Faild to parse css file : %s\n", error->message);
-            g_error_free (error);
+            g_warning ("theme '%s' is not found anywhere is user themes directories", theme);
+            return;
         }
-        else
-            g_tree_foreach (xndaemon->active_notifications,
-                            (GTraverseFunc)notify_update_theme_foreach,
-                            xndaemon);
-            
+        file = g_strdup (files[0]);
         g_strfreev(files);
     }
-    else
+    
+    css_parsed = 
+        gtk_css_provider_load_from_path (xndaemon->css_provider, 
+                                         file,
+                                         &error);
+    if (!css_parsed)
     {
-        g_warning ("theme '%s' is not found anywhere is user themes directories", theme);
+        g_warning ("Faild to parse css file : %s\n", error->message);
+        g_error_free (error);
     }
+    else
+        g_tree_foreach (xndaemon->active_notifications,
+                        (GTraverseFunc)notify_update_theme_foreach,
+                        xndaemon);
+    
     g_free(file);
 }
 

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


More information about the Xfce4-commits mailing list