[Xfce4-commits] <terminal:master> Only migrate colors if a complete palette was set.

Nick Schermer noreply at xfce.org
Sun Dec 23 22:38:02 CET 2012


Updating branch refs/heads/master
         to b4957dde55683f0f596216ad38877c884a514fd7 (commit)
       from f667a6c918316171333cc82e79542918dbbe3265 (commit)

commit b4957dde55683f0f596216ad38877c884a514fd7
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Dec 23 14:52:52 2012 +0100

    Only migrate colors if a complete palette was set.

 terminal/terminal-preferences.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 491edc6..f8de9db 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -1008,14 +1008,18 @@ terminal_preferences_load (TerminalPreferences *preferences)
       for (n = 1; n <= 16; n++)
         {
           g_snprintf (color_name, sizeof (color_name), "ColorPalette%d", n);
-          string = xfce_rc_read_entry (rc, color_name, "#000000");
+          string = xfce_rc_read_entry (rc, color_name, NULL);
+          if (string == NULL)
+            break;
+
           g_string_append (array, string);
           if (n != 16)
             g_string_append_c (array, ';');
         }
 
-      /* set property */
-      g_object_set (G_OBJECT (preferences), "color-palette", array->str, NULL);
+      /* set property if 16 colors were found */
+      if (n >= 16)
+        g_object_set (G_OBJECT (preferences), "color-palette", array->str, NULL);
       g_string_free (array, TRUE);
     }
 


More information about the Xfce4-commits mailing list