Use our own version of gdk_color_to_string if GTK < 2.12
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 24 Aug 2009 18:45:01 +0000 (18:45 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 24 Aug 2009 18:45:01 +0000 (18:45 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29541 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/color_utils.c
gtk/color_utils.h

index abe531d4d68f5662e3370e743b8bce11ad68f12c..f5042668e95f414aad90811c8279b4b10d647986 100644 (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) */
+
index 84456113aac4ddd7d894cca407e0bcdcdeeb8917..e6f4f82749ea39ed4ff91230cad849d3cdfa424d 100644 (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__ */