sadrul.gtkblist-theme: 8dc4b6bf: Allow unsetting the color for a PidginTh...
sadrul at pidgin.im
sadrul at pidgin.im
Sat Apr 18 14:15:54 EDT 2009
-----------------------------------------------------------------
Revision: 8dc4b6bfc20c035a80439f0b8930e0703b0ab470
Ancestor: 2956c7075765e54fab21d8f6b22e76fa9733c0d0
Author: sadrul at pidgin.im
Date: 2009-04-18T18:11:28
Branch: im.pidgin.sadrul.gtkblist-theme
URL: http://d.pidgin.im/viewmtn/revision/info/8dc4b6bfc20c035a80439f0b8930e0703b0ab470
Modified files:
pidgin/gtkblist-theme.c pidgin/gtkblist-theme.h
ChangeLog:
Allow unsetting the color for a PidginThemeFont.
-------------- next part --------------
============================================================
--- pidgin/gtkblist-theme.c da5b86d8c23cb6d3876fa35fa8b6b83851a84542
+++ pidgin/gtkblist-theme.c 780c41dc395f985aa83c249b59ac4d9101671ed8
@@ -105,7 +105,8 @@ pidgin_theme_font_new(const gchar *face,
{
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 @@ pidgin_theme_font_set_color(PidginThemeF
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 @@ pidgin_theme_font_get_color_describe(Pid
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;
}
/******************************************************************************
============================================================
--- pidgin/gtkblist-theme.h 5a69850b9f860257233bb7bef3eee03649a98b22
+++ pidgin/gtkblist-theme.h 5b15c7ccec68d20a253777abaeee57e540e36aaf
@@ -122,7 +122,7 @@ void pidgin_theme_font_set_color(PidginT
*
* @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
*
* @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_c
*
* @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);
More information about the Commits
mailing list