From 92a53187074aa64dde8982da78e98a5d69e1a9e0 Mon Sep 17 00:00:00 2001 From: rbuj Date: Tue, 9 Nov 2021 00:20:54 +0100 Subject: =?UTF-8?q?terminal-profile:=20fix=20initialization=20for=C2=A0def?= =?UTF-8?q?ault=20colors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/terminal-profile.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/terminal-profile.c b/src/terminal-profile.c index b991105..d40ff85 100644 --- a/src/terminal-profile.c +++ b/src/terminal-profile.c @@ -520,26 +520,38 @@ terminal_profile_reset_property_internal (TerminalProfile *profile, /* A few properties don't have defaults via the param spec; set them explicitly */ switch (pspec->param_id) { - case PROP_FOREGROUND_COLOR: - case PROP_BOLD_COLOR: - g_value_set_boxed (value, &DEFAULT_FOREGROUND_COLOR); - break; + case PROP_FOREGROUND_COLOR: + case PROP_BOLD_COLOR: + { + GdkRGBA color; - case PROP_BACKGROUND_COLOR: - g_value_set_boxed (value, &DEFAULT_BACKGROUND_COLOR); - break; + if (!gdk_rgba_parse (&color, DEFAULT_FOREGROUND_COLOR)) + return; + color.alpha = 1.0; + g_value_set_boxed (value, &color); + break; + } + case PROP_BACKGROUND_COLOR: + { + GdkRGBA color; - case PROP_FONT: - g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT)); - break; + if (!gdk_rgba_parse (&color, DEFAULT_BACKGROUND_COLOR)) + return; + color.alpha = 1.0; + g_value_set_boxed (value, &color); + break; + } + case PROP_FONT: + g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_FONT)); + break; - case PROP_PALETTE: - set_value_from_palette (value, DEFAULT_PALETTE, TERMINAL_PALETTE_SIZE); - break; + case PROP_PALETTE: + set_value_from_palette (value, DEFAULT_PALETTE, TERMINAL_PALETTE_SIZE); + break; - default: - g_param_value_set_default (pspec, value); - break; + default: + g_param_value_set_default (pspec, value); + break; } if (notify) -- cgit v1.2.1