diff options
author | Sergey V. Udaltsov <svu@gnome.org> | 2010-03-06 23:55:46 +0000 |
---|---|---|
committer | Sergey V. Udaltsov <svu@gnome.org> | 2010-03-06 23:55:46 +0000 |
commit | 86e40a5206831dd5a39e093876783e7c197d1d29 (patch) | |
tree | 5be8777376857d17ce3d4cbb85831175190ac4cf | |
parent | 880b8ecf6625ae22350ccaed05328fc9665eff3f (diff) | |
download | libgnomekbd-86e40a5206831dd5a39e093876783e7c197d1d29.tar.gz |
Use the font foreground from the gtk style
Closing https://bugzilla.gnome.org/show_bug.cgi?id=611875
-rw-r--r-- | libgnomekbd/gkbd-indicator-config.c | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/libgnomekbd/gkbd-indicator-config.c b/libgnomekbd/gkbd-indicator-config.c index b15d872..a34456c 100644 --- a/libgnomekbd/gkbd-indicator-config.c +++ b/libgnomekbd/gkbd-indicator-config.c @@ -128,13 +128,55 @@ gkbd_indicator_config_load_font_from_gconf (GkbdIndicatorConfig * g_strdup (pango_font_description_get_family (fd)); ind_config->font_size = - pango_font_description_get_size (fd) / PANGO_SCALE; + pango_font_description_get_size (fd) / + PANGO_SCALE; pango_font_description_free (fd); } g_free (sysfontname); } xkl_debug (150, "font: [%s], size %d\n", ind_config->font_family, ind_config->font_size); + + ind_config->foreground_color = + gconf_client_get_string (ind_config->conf_client, + GKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR, + &gerror); + if (gerror != NULL) { + g_warning ("Error reading configuration:%s\n", + gerror->message); + g_error_free (gerror); + gerror = NULL; + } + + ind_config->background_color = + gconf_client_get_string (ind_config->conf_client, + GKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR, + &gerror); + if (gerror != NULL) { + g_warning ("Error reading configuration:%s\n", + gerror->message); + g_error_free (gerror); + gerror = NULL; + } + + if (ind_config->foreground_color == NULL || + ind_config->foreground_color[0] == '\0') { + GtkSettings *settings = gtk_settings_get_default (); + GtkStyle *style = gtk_rc_get_style_by_paths (settings, + "*.GtkLabel", + "*.GtkLabel", + GTK_TYPE_LABEL); + ind_config->foreground_color = + g_strdup_printf ("%lg %lg %lg", + ((double) style->fg[GTK_STATE_NORMAL]. + red) / 0x10000, + ((double) style->fg[GTK_STATE_NORMAL]. + green) / 0x10000, + ((double) style->fg[GTK_STATE_NORMAL]. + blue) / 0x10000); + + g_object_unref (style); + } } char * @@ -313,28 +355,6 @@ gkbd_indicator_config_load_from_gconf (GkbdIndicatorConfig * ind_config) gkbd_indicator_config_load_font_from_gconf (ind_config); - ind_config->foreground_color = - gconf_client_get_string (ind_config->conf_client, - GKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR, - &gerror); - if (gerror != NULL) { - g_warning ("Error reading configuration:%s\n", - gerror->message); - g_error_free (gerror); - gerror = NULL; - } - - ind_config->background_color = - gconf_client_get_string (ind_config->conf_client, - GKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR, - &gerror); - if (gerror != NULL) { - g_warning ("Error reading configuration:%s\n", - gerror->message); - g_error_free (gerror); - gerror = NULL; - } - gkbd_indicator_config_free_enabled_plugins (ind_config); ind_config->enabled_plugins = gconf_client_get_list (ind_config->conf_client, |