Skip to content

Commit

Permalink
Remove dependency on GTK 2.12, reported by John Vodden and Vladimir
Browse files Browse the repository at this point in the history
Nadvornik.
gtk_set_tooltip_markup() calls were disabled for GTK+ versions < 2.12.
gdk_color_to_string() was replaced by a equivalent function.
  • Loading branch information
Laurent Monin committed Apr 8, 2008
1 parent 255ee55 commit 5d4ea30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,8 @@ static void config_tab_advanced(GtkWidget *notebook)
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"
Expand All @@ -1357,7 +1359,7 @@ static void config_tab_advanced(GtkWidget *notebook)
"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);

Expand Down Expand Up @@ -1393,8 +1395,9 @@ static void config_tab_advanced(GtkWidget *notebook)
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);
Expand Down
9 changes: 8 additions & 1 deletion src/rcfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,18 @@ static gchar *read_char_option(FILE *f, gchar *option, gchar *label, gchar *valu
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);
Expand Down

0 comments on commit 5d4ea30

Please sign in to comment.