From ed4a3b09c9ca83477e443994fd75edb8ef7f807b Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 14 Nov 2012 20:06:28 -0500 Subject: [PATCH] clean up get_config_cairo_color implementation --- termite.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/termite.cc b/termite.cc index e80e9ab..518db76 100644 --- a/termite.cc +++ b/termite.cc @@ -912,20 +912,13 @@ static bool get_config_color(GKeyFile *config, const char *section, const char * static maybe get_config_cairo_color(GKeyFile *config, const char *group, const char *key) { - maybe ret; - - if (auto s = get_config_string(config, group, key)) { - GdkColor color; - if (gdk_color_parse(*s, &color)) { - ret = cairo_pattern_create_rgb(color.red / 65535.0, - color.green / 65535.0, - color.blue / 65535.0); - } else { - g_printerr("invalid color string: %s\n", *s); - } - g_free(*s); + GdkColor color; + if (get_config_color(config, group, key, &color)) { + return cairo_pattern_create_rgb(color.red / 65535.0, + color.green / 65535.0, + color.blue / 65535.0); } - return ret; + return {}; } static void load_theme(VteTerminal *vte, GKeyFile *config) {