[libgnomekbd] handle style = NULL scenario
- From: Sergey V. Udaltsov <svu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgnomekbd] handle style = NULL scenario
- Date: Sat, 15 May 2010 21:00:24 +0000 (UTC)
commit 1f1c8443a9f3e8527946d976776143a9b047f79a
Author: Sergey V. Udaltsov <svu gnome org>
Date: Sat May 15 21:59:35 2010 +0100
handle style = NULL scenario
https://bugzilla.gnome.org/show_bug.cgi?id=618727
libgnomekbd/gkbd-indicator-config.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/libgnomekbd/gkbd-indicator-config.c b/libgnomekbd/gkbd-indicator-config.c
index 1b5a1a2..5cabdcb 100644
--- a/libgnomekbd/gkbd-indicator-config.c
+++ b/libgnomekbd/gkbd-indicator-config.c
@@ -110,13 +110,14 @@ gkbd_indicator_config_load_font (GkbdIndicatorConfig * ind_config)
if (ind_config->font_family == NULL ||
ind_config->font_family[0] == '\0') {
- PangoFontDescription *fd;
+ PangoFontDescription *fd = NULL;
GtkStyle *style =
gtk_rc_get_style_by_paths (gtk_settings_get_default (),
GTK_STYLE_PATH,
GTK_STYLE_PATH,
GTK_TYPE_LABEL);
- fd = style->font_desc;
+ if (style != NULL)
+ fd = style->font_desc;
if (fd != NULL) {
ind_config->font_family =
g_strdup (pango_font_description_get_family
@@ -154,16 +155,22 @@ gkbd_indicator_config_load_colors (GkbdIndicatorConfig * ind_config)
GTK_STYLE_PATH,
GTK_STYLE_PATH,
GTK_TYPE_LABEL);
- ind_config->foreground_color =
- g_strdup_printf ("%g %g %g",
- ((double) style->
- fg[GTK_STATE_NORMAL].red) / 0x10000,
- ((double) style->
- fg[GTK_STATE_NORMAL].green) /
- 0x10000,
- ((double) style->
- fg[GTK_STATE_NORMAL].blue) /
- 0x10000);
+ if (style != NULL) {
+ ind_config->foreground_color =
+ g_strdup_printf ("%g %g %g", ((double)
+ style->
+ fg
+ [GTK_STATE_NORMAL].red)
+ / 0x10000, ((double)
+ style->
+ fg
+ [GTK_STATE_NORMAL].green)
+ / 0x10000, ((double)
+ style->
+ fg
+ [GTK_STATE_NORMAL].blue)
+ / 0x10000);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]