changeset 267:a9adf9e1a746

Remove dependency on GTK 2.12, reported by John Vodden and Vladimir Nadvornik. gtk_set_tooltip_markup() calls were disabled for GTK+ versions < 2.12. gdk_color_to_string() was replaced by a equivalent function.
author zas_
date Tue, 08 Apr 2008 11:53:35 +0000
parents 65187a2309d3
children 98268a6b8182
files src/preferences.c src/rcfile.c
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/preferences.c	Mon Apr 07 19:47:22 2008 +0000
+++ b/src/preferences.c	Tue Apr 08 11:53:35 2008 +0000
@@ -1346,6 +1346,8 @@
 	gtk_widget_show(scrolled);
 
 	fullscreen_info_view = gtk_text_view_new();
+
+#if GTK_CHECK_VERSION(2,12,0)
 	gtk_widget_set_tooltip_markup(fullscreen_info_view,
 	_("<i>%name%</i> results in the filename of the picture.\n"
 	  "Also available: <i>%collection%</i>, <i>%number%</i>, <i>%total%</i>, <i>%date%</i>,\n"
@@ -1357,7 +1359,7 @@
 	  "if there's no ISO information in the Exif data.\n"
 	  "If a line is empty, it is removed. This allows to add lines that totally disappear when no data is available.\n"
 ));
-	
+#endif
 	gtk_container_add(GTK_CONTAINER(scrolled), fullscreen_info_view);
 	gtk_widget_show(fullscreen_info_view);
 
@@ -1393,8 +1395,9 @@
 	pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_GAP);
 	spin = pref_spin_new_int(hbox, _("Maximum size:"), _("MB"),
 			 	 0, 2048, 1, safe_delete_size, &safe_delete_size_c);
+#if GTK_CHECK_VERSION(2,12,0)
 	gtk_widget_set_tooltip_markup(spin, _("Set to 0 for unlimited size"));
-
+#endif
 	button = pref_button_new(NULL, NULL, _("View"), FALSE,
 				 G_CALLBACK(safe_delete_view_cb), NULL);
 	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
--- a/src/rcfile.c	Mon Apr 07 19:47:22 2008 +0000
+++ b/src/rcfile.c	Tue Apr 08 11:53:35 2008 +0000
@@ -121,11 +121,18 @@
 	return text;
 }
 
+/* Since gdk_color_to_string() is only available since gtk 2.12
+ * here is an equivalent stub function. */
+static gchar *color_to_string(GdkColor *color)
+{
+	return g_strdup_printf("#%04X%04X%04X", color->red, color->green, color->blue);
+}
+
 static void write_color_option(FILE *f, gchar *label, GdkColor *color)
 {
 	if (color)
 		{
-		gchar *colorstring = gdk_color_to_string (color);
+		gchar *colorstring = color_to_string(color);
 
 		write_char_option(f, label, colorstring);
 		g_free(colorstring);