summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@pidgin.im>2009-04-18 18:11:28 +0000
committerSadrul Habib Chowdhury <sadrul@pidgin.im>2009-04-18 18:11:28 +0000
commitd3d064b4eee21803cbc7cf7aeb07efd72a963bef (patch)
tree1b9351f2edf1cbfcb6ab8bb709fbed81cd1469cb
parent2d802b532298d68c503d30f37ef4e452830b42fa (diff)
downloadpidgin-d3d064b4eee21803cbc7cf7aeb07efd72a963bef.tar.gz
Allow unsetting the color for a PidginThemeFont.
-rw-r--r--pidgin/gtkblist-theme.c16
-rw-r--r--pidgin/gtkblist-theme.h6
2 files changed, 13 insertions, 9 deletions
diff --git a/pidgin/gtkblist-theme.c b/pidgin/gtkblist-theme.c
index 755126484d..88f6b1d8cd 100644
--- a/pidgin/gtkblist-theme.c
+++ b/pidgin/gtkblist-theme.c
@@ -105,7 +105,8 @@ pidgin_theme_font_new(const gchar *face, GdkColor *color)
{
PidginThemeFont *font = g_new0(PidginThemeFont, 1);
font->font = g_strdup(face);
- pidgin_theme_font_set_color(font, color);
+ if (color)
+ pidgin_theme_font_set_color(font, color);
return font;
}
@@ -144,13 +145,16 @@ void
pidgin_theme_font_set_color(PidginThemeFont *font, const GdkColor *color)
{
g_return_if_fail(font);
- g_return_if_fail(color);
if (font->gdkcolor)
gdk_color_free(font->gdkcolor);
- font->gdkcolor = gdk_color_copy(color);
- g_snprintf(font->color, sizeof(font->color),
- "#%02x%02x%02x", color->red >> 8, color->green >> 8, color->blue >> 8);
+
+ font->gdkcolor = color ? gdk_color_copy(color) : NULL;
+ if (color)
+ g_snprintf(font->color, sizeof(font->color),
+ "#%02x%02x%02x", color->red >> 8, color->green >> 8, color->blue >> 8);
+ else
+ font->color[0] = '\0';
}
const gchar *
@@ -171,7 +175,7 @@ const gchar *
pidgin_theme_font_get_color_describe(PidginThemeFont *font)
{
g_return_val_if_fail(font, NULL);
- return font->color;
+ return font->color[0] ? font->color : NULL;
}
/******************************************************************************
diff --git a/pidgin/gtkblist-theme.h b/pidgin/gtkblist-theme.h
index e134ea56d0..9636dddb28 100644
--- a/pidgin/gtkblist-theme.h
+++ b/pidgin/gtkblist-theme.h
@@ -122,7 +122,7 @@ void pidgin_theme_font_set_color(PidginThemeFont *font, const GdkColor *color);
*
* @param font The PidginThemeFont
*
- * @return The font-face
+ * @return The font-face, or NULL if none is set.
*/
const gchar * pidgin_theme_font_get_font_face(PidginThemeFont *font);
@@ -131,7 +131,7 @@ const gchar * pidgin_theme_font_get_font_face(PidginThemeFont *font);
*
* @param font The PidginThemeFont
*
- * @return The color
+ * @return The color, or NULL if none is set.
*/
const GdkColor * pidgin_theme_font_get_color(PidginThemeFont *font);
@@ -140,7 +140,7 @@ const GdkColor * pidgin_theme_font_get_color(PidginThemeFont *font);
*
* @param font The PidginThemeFont
*
- * @return The color
+ * @return The color, or NULL if none is set.
*/
const gchar * pidgin_theme_font_get_color_describe(PidginThemeFont *font);