changeset 4078:9be497d75ba3

fully disabled reloading of currently active skin: fixed bug with partial destroyed skin
author Eugene Zagidullin <e.asphyx@gmail.com>
date Sat, 08 Dec 2007 20:55:55 +0300
parents ea194fd79267
children acb28b9494b2
files src/audacious/skin.c
diffstat 1 files changed, 27 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/skin.c	Fri Dec 07 23:27:20 2007 +0900
+++ b/src/audacious/skin.c	Sat Dec 08 20:55:55 2007 +0300
@@ -158,18 +158,20 @@
 gboolean
 bmp_active_skin_reload(void) 
 {
+    AUDDBG("\n");
     return bmp_active_skin_load(bmp_active_skin->path); 
 }
 
 gboolean
 bmp_active_skin_load(const gchar * path)
 {
+    AUDDBG("%s\n", path);
     g_return_val_if_fail(bmp_active_skin != NULL, FALSE);
 
-    memset(&bmp_active_skin->properties, 0, sizeof(SkinProperties));
-
-    if (!skin_load(bmp_active_skin, path))
+    if (!skin_load(bmp_active_skin, path)) {
+        AUDDBG("loading failed\n");
         return FALSE;
+    }
 
     skin_setup_masks(bmp_active_skin);
 
@@ -382,6 +384,8 @@
         return FALSE;
     }
 
+    AUDDBG("loaded %s\n", filename);
+
     g_free(filename);
 
     gdk_drawable_get_size(GDK_DRAWABLE(gpm), &width, &height);
@@ -1423,6 +1427,8 @@
     gchar *filename;
     INIFile *inifile;
 
+    AUDDBG("\n");
+
     for (i = 0; i < SKIN_PIXMAP_COUNT; i++)
         skin_load_pixmap_id(skin, i, path);
 
@@ -1492,6 +1498,8 @@
     GtkSettings *settings;
     gchar *cpath, *gtkrcpath;
 
+    AUDDBG("\n");
+
     g_return_val_if_fail(skin != NULL, FALSE);
     g_return_val_if_fail(path != NULL, FALSE);
     REQUIRE_LOCK(skin->lock);
@@ -1499,8 +1507,12 @@
     if (!g_file_test(path, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_DIR))
         return FALSE;
    
-    if (!force && skin->path && !strcmp(skin->path, path))
-    return FALSE;
+    if (!force && skin->path && !strcmp(skin->path, path)) {
+        AUDDBG("skin %s already loaded\n", path);
+        return FALSE;
+    }
+    
+    memset(&(skin->properties), 0, sizeof(SkinProperties)); /* do it only if all tests above passed! --asphyx */
       
     skin_current_num++;
 
@@ -1538,6 +1550,8 @@
 
         return TRUE;
     }
+    
+    AUDDBG("Attempt to load archive\n");
 
     if (!(cpath = archive_decompress(path))) {
         g_message("Unable to extract skin archive (%s)", path);
@@ -1599,7 +1613,7 @@
 gboolean
 skin_load(Skin * skin, const gchar * path)
 {
-    gboolean error;
+    gboolean ret;
 
     g_return_val_if_fail(skin != NULL, FALSE);
 
@@ -1607,9 +1621,14 @@
         return FALSE;
 
     skin_lock(skin);
-    error = skin_load_nolock(skin, path, FALSE);
+    ret = skin_load_nolock(skin, path, FALSE);
     skin_unlock(skin);
 
+    if(!ret) {
+        AUDDBG("loading failed\n");
+        return FALSE; /* don't try to update anything if loading failed --asphyx */
+    }
+
     SkinPixmap *pixmap = NULL;
     pixmap = skin_get_pixmap(skin, SKIN_NUMBERS);
     if (pixmap) {
@@ -1632,7 +1651,7 @@
     if (pixmap->height >= 313)
         gtk_widget_show(equalizerwin_graph);
 
-    return error;
+    return TRUE;
 }
 
 gboolean