changeset 3770:2953048bceee

Automated merge with ssh://hg.atheme.org//hg/audacious
author William Pitcock <nenolod@atheme.org>
date Mon, 15 Oct 2007 20:34:17 -0500
parents acb362a67c01 (diff) bf6b1c5091d5 (current diff)
children 1c8746b4b8ab
files
diffstat 1 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/skin.c	Mon Oct 15 12:56:59 2007 +0200
+++ b/src/audacious/skin.c	Mon Oct 15 20:34:17 2007 -0500
@@ -1464,7 +1464,7 @@
 static gboolean
 skin_load_nolock(Skin * skin, const gchar * path, gboolean force)
 {
-    gchar *cpath;
+    gchar *cpath, *gtkrcpath;
 
     g_return_val_if_fail(skin != NULL, FALSE);
     g_return_val_if_fail(path != NULL, FALSE);
@@ -1489,6 +1489,24 @@
 
         skin_load_cursor(skin, path);
 
+        gtkrcpath = find_file_recursively(skin->path, "gtkrc");
+
+        /* the way GTK does things can be very broken. --nenolod */
+        if (gtkrcpath != NULL) {
+            GtkSettings *settings = gtk_settings_get_default();
+            gchar *tmp = g_strdup_printf("%s/.themes/aud-%s", g_get_home_dir(), basename(skin->path));
+
+            gchar *troot = g_strdup_printf("%s/.themes");
+            g_mkdir_with_parents(troot, 0755);
+            g_free(troot);
+
+            symlink(skin->path, tmp);
+            gtk_settings_set_string_property (settings, "gtk-theme-name", basename(skin->path), "audacious");
+
+            unlink(tmp);
+            g_free(tmp);
+        }
+
         return TRUE;
     }
 
@@ -1497,6 +1515,8 @@
         return FALSE;
     }
 
+    gtkrcpath = find_file_recursively(skin->path, "gtkrc");
+
     /* Parse the hints for this skin. */
     skin_parse_hints(skin, cpath);
 
@@ -1509,6 +1529,22 @@
 
     skin_load_cursor(skin, cpath);
 
+    /* the way GTK does things can be very broken. --nenolod */
+    if (gtkrcpath != NULL) {
+        GtkSettings *settings = gtk_settings_get_default();
+        gchar *tmp = g_strdup_printf("%s/.themes/aud-%s", g_get_home_dir(), basename(skin->path));
+
+        gchar *troot = g_strdup_printf("%s/.themes");
+        g_mkdir_with_parents(troot, 0755);
+        g_free(troot);
+
+        symlink(skin->path, tmp);
+        gtk_settings_set_string_property (settings, "gtk-theme-name", basename(skin->path), "audacious");
+
+        unlink(tmp);
+        g_free(tmp);
+    }
+
     del_directory(cpath);
     g_free(cpath);