LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File xmms-skins.patch of Package xmms (Project home:donharter:home:FreeCAD)

--- xmms/main.c
+++ xmms/main.c
@@ -350,6 +350,8 @@
 	cfg.mainwin_use_xfont = FALSE;
 	cfg.use_pl_metadata = TRUE;
 
+	cfg.skin = (gchar *)(-1);
+
 	cfg.playlist_x = 295;
 	cfg.playlist_y = 20;
 	cfg.playlist_width = 300;
@@ -451,6 +453,22 @@
 		xmms_cfg_read_string(cfgfile, "xmms", "eqpreset_default_file", &cfg.eqpreset_default_file);
 		xmms_cfg_read_string(cfgfile, "xmms", "eqpreset_extension", &cfg.eqpreset_extension);
 		xmms_cfg_read_string(cfgfile, "xmms", "skin", &cfg.skin);
+
+		if (cfg.skin != (gchar *)(-1)) {
+			if (cfg.skin && !strcmp(cfg.skin, "(none)"))
+			{
+				if (cfg.skin)
+					g_free(cfg.skin);
+				cfg.skin = NULL;
+			}
+			else
+				if (!cfg.skin || !strcmp(cfg.skin, "(system default)"))
+				{
+					if (cfg.skin)
+						g_free(cfg.skin);
+					cfg.skin = (gchar *)(-1);
+				}
+		}
 		xmms_cfg_read_string(cfgfile, "xmms", "output_plugin", &cfg.outputplugin);
 		xmms_cfg_read_string(cfgfile, "xmms", "enabled_gplugins", &cfg.enabled_gplugins);
 		xmms_cfg_read_string(cfgfile, "xmms", "enabled_vplugins", &cfg.enabled_vplugins);
@@ -625,10 +643,13 @@
 		xmms_cfg_write_float(cfgfile, "xmms", str, cfg.equalizer_bands[i]);
 		g_free(str);
 	}
-	if (skin->path)
-		xmms_cfg_write_string(cfgfile, "xmms", "skin", skin->path);
+	if (system_skin_used)
+		xmms_cfg_write_string(cfgfile, "xmms", "skin", "(system default)");
 	else
-		xmms_cfg_remove_key(cfgfile, "xmms", "skin");
+		if (skin->path)
+			xmms_cfg_write_string(cfgfile, "xmms", "skin", skin->path);
+		else
+			xmms_cfg_write_string(cfgfile, "xmms", "skin", "(none)");
 	if (get_current_output_plugin())
 		xmms_cfg_write_string(cfgfile, "xmms", "output_plugin", get_current_output_plugin()->filename);
 	else
@@ -3828,6 +3849,8 @@
 	playlistwin_create();
 	equalizerwin_create();
 	init_skins();
+	if (cfg.skin == (gchar *)(-1))
+		scan_skins();
 	load_skin(cfg.skin);
 	create_popups();
 	create_prefs_window();
--- xmms/skin.c
+++ xmms/skin.c
@@ -39,6 +39,8 @@
 #endif
 
 Skin *skin;
+char *system_skin_path = NULL;
+int system_skin_used = 1;
 static int skin_current_num;
 
 static const gint skin_default_viscolor[24][3] =
@@ -634,7 +636,7 @@
 }
 	
 
-static void _load_skin(const gchar * path, gboolean force)
+static void __load_skin(const gchar * path, gboolean force)
 {
 	char *ending;
 
@@ -685,8 +687,22 @@
 	playlistwin_update_list();
 }
 
+static void _load_skin(const gchar * path, gboolean force)
+{
+        if (path == (gchar *)(-1))
+	{
+		if (system_skin_path)
+			__load_skin(system_skin_path, force);
+		else
+			__load_skin(NULL, force);
+	}
+	else
+		__load_skin(path, force);
+}
+
 void load_skin(const gchar * path)
 {
+        system_skin_used = (path == (gchar *)(-1));
 	_load_skin(path, FALSE);
 }
 
--- xmms/skin.h
+++ xmms/skin.h
@@ -83,6 +83,8 @@
 Skin;
 
 extern Skin *skin;
+extern char *system_skin_path;
+extern int system_skin_used;
 
 void init_skins(void);
 void load_skin(const gchar * path);
--- xmms/skinwin.c
+++ xmms/skinwin.c
@@ -17,6 +17,7 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 #include "xmms.h"
+#include "skin.h"
 
 GtkWidget *skinwin, *skinwin_list, *skinwin_close;
 GList *skinlist = NULL;
@@ -32,7 +33,11 @@
 	if (row == 0)
 		load_skin(NULL);
 	else
-		load_skin(((struct SkinNode *) g_list_nth(skinlist, row - 1)->data)->path);
+	    if (row == 1)
+		load_skin((gchar *)(-1));
+	    else
+		load_skin(((struct SkinNode *) g_list_nth(skinlist, row - 2)->data)->path);
+
 
 }
 
@@ -124,6 +129,11 @@
 				*tmp = '\0';
 		}
 	}
+	tmp = getenv("STYLE");
+	if (tmp && !strcasecmp(tmp, node->name))
+	{
+	    system_skin_path = node->path;
+	}
 	skinlist = g_list_prepend(skinlist, node);
 }
 
@@ -189,10 +199,11 @@
 {
 	int i;
 	GList *entry;
-	char *none, *str, *skinsdir;
+	char *none, *system, *str, *skinsdir;
 	gchar **list;
 
 	none = _("(none)");
+	system = _("(system default)");
 	if (skinlist)
 	{
 		g_list_foreach(skinlist, skin_free_func, NULL);
@@ -218,16 +229,20 @@
 	gtk_clist_freeze(GTK_CLIST(skinwin_list));
 	gtk_clist_clear(GTK_CLIST(skinwin_list));
 	gtk_clist_append(GTK_CLIST(skinwin_list), &none);
-	if (!skin->path)
-		gtk_clist_select_row(GTK_CLIST(skinwin_list), 0, 0);
+	gtk_clist_append(GTK_CLIST(skinwin_list), &system);
+	if (system_skin_used)
+		gtk_clist_select_row(GTK_CLIST(skinwin_list), 1, 0);
+	else
+		if (!skin->path)
+			gtk_clist_select_row(GTK_CLIST(skinwin_list), 0, 0);
 
 	for (i = 0; i < g_list_length(skinlist); i++)
 	{
 		entry = g_list_nth(skinlist, i);
 		gtk_clist_append(GTK_CLIST(skinwin_list), (gchar **) & ((struct SkinNode *) entry->data)->name);
 		if (skin->path)
-			if (!strcmp(((struct SkinNode *) entry->data)->path, skin->path))
-				gtk_clist_select_row(GTK_CLIST(skinwin_list), i + 1, 0);
+			if (!system_skin_used && !strcmp(((struct SkinNode *) entry->data)->path, skin->path))
+				gtk_clist_select_row(GTK_CLIST(skinwin_list), i + 2, 0);
 	}
 	gtk_clist_thaw(GTK_CLIST(skinwin_list));
 }