Use our own version of gdk_color_to_string if GTK < 2.12

svn path=/trunk/; revision=29541
This commit is contained in:
Anders Broman 2009-08-24 18:45:01 +00:00
parent 04544e1213
commit e5822b1874
2 changed files with 32 additions and 1 deletions

View File

@ -128,3 +128,30 @@ gdkcolor_to_color_t(color_t *target, GdkColor *source)
target->green = source->green;
target->blue = source->blue;
}
#if GTK_CHECK_VERSION(2,12,0)
#else
/** Copied from GTK sources
* gdk_color_to_string:
* @color: a #GdkColor
*
* Returns a textual specification of @color in the hexadecimal form
* <literal>&num;rrrrggggbbbb</literal>, where <literal>r</literal>,
* <literal>g</literal> and <literal>b</literal> are hex digits
* representing the red, green and blue components respectively.
*
* Return value: a newly-allocated text string
*
* Since: 2.12
**/
gchar *
gdk_color_to_string (const GdkColor *color)
{
g_return_val_if_fail (color != NULL, NULL);
return return g_strdup_printf ("#%04x%04x%04x", color->red, color->green, color->blue);
}
#endif /* GTK_CHECK_VERSION(2,12,0) */

View File

@ -61,4 +61,8 @@ void color_t_to_gdkcolor(GdkColor *target, color_t *source);
*/
void gdkcolor_to_color_t(color_t *target, GdkColor *source);
#endif
#if GTK_CHECK_VERSION(2,12,0)
#else
gchar * gdk_color_to_string (const GdkColor *color)
#endif /* GTK_CHECK_VERSION(2,12,0) */
#endif /* __COLORS_H__ */