Mercurial > audlegacy
diff src/audacious/skin.c @ 3769:acb362a67c01
all of this shit to allow for skins to provide gtk skinning too...
what bullshit...
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Mon, 15 Oct 2007 20:34:07 -0500 |
parents | cad078740bef |
children | 1c8746b4b8ab |
line wrap: on
line diff
--- a/src/audacious/skin.c Mon Oct 15 00:01:57 2007 -0500 +++ b/src/audacious/skin.c Mon Oct 15 20:34:07 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);