Use our own version of gdk_color_to_string if GTK < 2.12
svn path=/trunk/; revision=29541
This commit is contained in:
parent
04544e1213
commit
e5822b1874
2 changed files with 32 additions and 1 deletions
|
@ -128,3 +128,30 @@ gdkcolor_to_color_t(color_t *target, GdkColor *source)
|
||||||
target->green = source->green;
|
target->green = source->green;
|
||||||
target->blue = source->blue;
|
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>#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) */
|
||||||
|
|
||||||
|
|
|
@ -61,4 +61,8 @@ void color_t_to_gdkcolor(GdkColor *target, color_t *source);
|
||||||
*/
|
*/
|
||||||
void gdkcolor_to_color_t(color_t *target, GdkColor *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__ */
|
||||||
|
|
Loading…
Reference in a new issue