[Xfce4-commits] <terminal:master> Check the palette colors too.

Nick Schermer noreply at xfce.org
Sun Dec 6 20:04:01 CET 2009


Updating branch refs/heads/master
         to a636c09a2c02a638d6258150ac1054b735397773 (commit)
       from be94a9a00e786e9aff3475db7a517a8d407ca4a2 (commit)

commit a636c09a2c02a638d6258150ac1054b735397773
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Dec 6 20:00:23 2009 +0100

    Check the palette colors too.

 terminal/terminal-screen.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index b77169a..9600073 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -757,21 +757,32 @@ terminal_screen_update_colors (TerminalScreen *screen)
   gboolean has_bg;
   gboolean has_fg;
   gboolean has_cursor;
+  gboolean has_pallette;
 
   has_bg = terminal_preferences_get_color (screen->preferences, "color-background", &bg);
   has_fg = terminal_preferences_get_color (screen->preferences, "color-foreground", &fg);
   has_cursor = terminal_preferences_get_color (screen->preferences, "color-cursor", &cursor);
 
-  for (n = 0; n < 16; ++n)
+  for (n = 0, has_pallette = TRUE; has_pallette && n < 16; ++n)
     {
       g_snprintf (name, sizeof (name), "color-palette%u", n + 1);
-      terminal_preferences_get_color (screen->preferences, name, palette + n);
+      has_pallette = terminal_preferences_get_color (screen->preferences, name, palette + n);
+    }
+
+  if (G_LIKELY (has_pallette))
+    {
+      vte_terminal_set_colors (VTE_TERMINAL (screen->terminal),
+                               has_fg ? &fg : NULL,
+                               has_bg ? &bg : NULL,
+                               palette, 16);
+    }
+  else
+    {
+      vte_terminal_set_default_colors (VTE_TERMINAL (screen->terminal));
+      g_warning ("One of the terminal colors (color-palette%u) was not parsed "
+                 "successfully. The default palette has been applied.", n);
     }
 
-  vte_terminal_set_colors (VTE_TERMINAL (screen->terminal),
-                           has_fg ? &fg : NULL,
-                           has_bg ? &bg : NULL,
-                           palette, 16);
   vte_terminal_set_background_tint_color (VTE_TERMINAL (screen->terminal), has_bg ? &bg : NULL);
   vte_terminal_set_color_cursor (VTE_TERMINAL (screen->terminal), has_cursor ? &cursor : NULL);
 



More information about the Xfce4-commits mailing list