diff audacious/skin.c @ 1040:f866da587845 trunk

[svn] mainwin.c: - always on top fix - playlistwin_time fix skin.c: - set default text colors in case of missing pledit.txt ui_playlist.c - playlistwin_info width fix
author nhjm449
date Sun, 14 May 2006 01:20:40 -0700
parents 247d1f58fbfe
children 3131795a78c4
line wrap: on
line diff
--- a/audacious/skin.c	Sat May 13 23:28:57 2006 -0700
+++ b/audacious/skin.c	Sun May 14 01:20:40 2006 -0700
@@ -548,14 +548,22 @@
 
 GdkColor *
 skin_load_color(const gchar * path, const gchar * file,
-                const gchar * section, const gchar * key)
+                const gchar * section, const gchar * key,
+                gchar * default_hex)
 {
     gchar *filename, *value;
     GdkColor *color = NULL;
 
     filename = find_file_recursively(path, file);
-    if (filename) {
-        value = read_ini_string(filename, section, key);
+    if (filename || default_hex) {
+        if (filename) {
+            value = read_ini_string(filename, section, key);
+            if (value == NULL) {
+                value = g_strdup(default_hex);
+            }
+        } else {
+            value = g_strdup(default_hex);
+        }
         if (value) {
             gchar *ptr = value;
             gint len;
@@ -566,7 +574,6 @@
             if (value[0] == '#')
                 ptr++;
             len = strlen(ptr);
-
             /*
              * The handling of incomplete values is done this way
              * to maximize winamp compatibility
@@ -582,12 +589,12 @@
             if (len >= 2)
                 color->blue = hex_chars_to_int(*ptr, *(ptr + 1));
 
-
             gdk_color_alloc(gdk_window_get_colormap(playlistwin->window),
                             color);
             g_free(value);
         }
-        g_free(filename);
+        if (filename)
+            g_free(filename);
     }
     return color;
 }
@@ -787,13 +794,13 @@
 #endif
 
     skin->colors[SKIN_PLEDIT_NORMAL] =
-        skin_load_color(path, "pledit.txt", "text", "normal");
+        skin_load_color(path, "pledit.txt", "text", "normal", "#2499ff");
     skin->colors[SKIN_PLEDIT_CURRENT] =
-        skin_load_color(path, "pledit.txt", "text", "current");
+        skin_load_color(path, "pledit.txt", "text", "current", "#ffeeff");
     skin->colors[SKIN_PLEDIT_NORMALBG] =
-        skin_load_color(path, "pledit.txt", "text", "normalbg");
+        skin_load_color(path, "pledit.txt", "text", "normalbg", "#0a120a");
     skin->colors[SKIN_PLEDIT_SELECTEDBG] =
-        skin_load_color(path, "pledit.txt", "text", "selectedbg");
+        skin_load_color(path, "pledit.txt", "text", "selectedbg", "#0a124a");
 
     skin_mask_create(skin, path, SKIN_MASK_MAIN, mainwin->window);
     skin_mask_create(skin, path, SKIN_MASK_MAIN_SHADE, mainwin->window);