diff src/preferences.c @ 2566:034d8772d6d8

Fix #500: Geeqie doesn’t use shared thumbnail folder https://github.com/BestImageViewer/geeqie/issues/500
author Colin Clark <colin.clark@cclark.uk>
date Mon, 31 Jul 2017 14:36:29 +0100
parents ecd984e6ba99
children 78518b422e23
line wrap: on
line diff
--- a/src/preferences.c	Mon Jul 24 11:08:35 2017 +0100
+++ b/src/preferences.c	Mon Jul 31 14:36:29 2017 +0100
@@ -1412,12 +1412,54 @@
 	return vbox;
 }
 
+static void cache_standard_cb(GtkWidget *widget, gpointer data)
+{
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+		{
+		c_options->thumbnails.spec_standard =TRUE;
+		c_options->thumbnails.cache_into_dirs = FALSE;
+		}
+	else
+		{
+		c_options->thumbnails.spec_standard =FALSE;
+		}
+		DEBUG_0("standard %d",c_options->thumbnails.spec_standard);
+}
+
+static void cache_geeqie_cb(GtkWidget *widget, gpointer data)
+{
+	if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+		{
+		c_options->thumbnails.spec_standard =TRUE;
+		c_options->thumbnails.cache_into_dirs = FALSE;
+		}
+	else
+		{
+		c_options->thumbnails.spec_standard =FALSE;
+		}
+		DEBUG_0("geeqie %d",c_options->thumbnails.spec_standard);
+}
+
+static void cache_local_cb(GtkWidget *widget, gpointer data)
+{
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+		{
+		c_options->thumbnails.cache_into_dirs = TRUE;
+		c_options->thumbnails.spec_standard =FALSE;
+		}
+	else
+		{
+		c_options->thumbnails.cache_into_dirs = FALSE;
+		}
+}
+
 /* general options tab */
 static void config_tab_general(GtkWidget *notebook)
 {
 	GtkWidget *vbox;
 	GtkWidget *hbox;
 	GtkWidget *group;
+	GtkWidget *group_frame;
 	GtkWidget *subgroup;
 	GtkWidget *button;
 	GtkWidget *ct_button;
@@ -1438,14 +1480,25 @@
 	subgroup = pref_box_new(group, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
 	pref_checkbox_link_sensitivity(ct_button, subgroup);
 
-	button = pref_checkbox_new_int(subgroup, _("Use standard thumbnail cache, shared with other applications"),
-				       options->thumbnails.spec_standard, &c_options->thumbnails.spec_standard);
-
-	subgroup = pref_box_new(subgroup, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
-	pref_checkbox_link_sensitivity_swap(button, subgroup);
-
-	pref_checkbox_new_int(subgroup, _("Store thumbnails in '.thumbnails' folder, local to image folder (non-standard)"),
-			      options->thumbnails.cache_into_dirs, &c_options->thumbnails.cache_into_dirs);
+	group_frame = pref_frame_new(subgroup, TRUE, _("Use Geeqie thumbnail style and cache"),
+										GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
+	button = pref_radiobutton_new(group_frame, NULL,  get_thumbnails_cache_dir(),
+							!options->thumbnails.spec_standard,
+							G_CALLBACK(cache_geeqie_cb), NULL);
+
+	group_frame = pref_frame_new(subgroup, TRUE,
+							_("Store thumbnails local to image folder (non-standard)"),
+							GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
+	pref_radiobutton_new(group_frame, button, "*/.thumbnails",
+							options->thumbnails.cache_into_dirs,
+							G_CALLBACK(cache_local_cb), NULL);
+
+	group_frame = pref_frame_new(subgroup, TRUE,
+							_("Use standard thumbnail style and cache, shared with other applications"),
+							GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
+	pref_radiobutton_new(group_frame, button, get_thumbnails_standard_cache_dir(),
+							options->thumbnails.spec_standard,
+							G_CALLBACK(cache_standard_cb), NULL);
 
 	pref_checkbox_new_int(group, _("Use EXIF thumbnails when available (EXIF thumbnails may be outdated)"),
 			      options->thumbnails.use_exif, &c_options->thumbnails.use_exif);