changeset 56:c722cbf9ad25

Fri Jun 10 02:19:26 2005 John Ellis <johne@verizon.net> * pan-view.c: Add exif date sorting option to right click menu, and change 'reading dimensions...' message to be more generic as it may now also be reading embedded exif dates, or both date and dimensions.
author gqview
date Fri, 10 Jun 2005 06:23:22 +0000
parents 1e21f094e0be
children a8c9992320f4
files ChangeLog src/pan-view.c
diffstat 2 files changed, 53 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 10 03:24:35 2005 +0000
+++ b/ChangeLog	Fri Jun 10 06:23:22 2005 +0000
@@ -1,3 +1,9 @@
+Fri Jun 10 02:19:26 2005  John Ellis  <johne@verizon.net>
+
+	* pan-view.c: Add exif date sorting option to right click menu, and
+	change 'reading dimensions...' message to be more generic as it may now
+	also be reading embedded exif dates, or both date and dimensions.
+
 Thu Jun  9 23:22:01 2005  John Ellis  <johne@verizon.net>
 
 	* exif.c (exif_parse_JPEG): Use memcmp as strncmp is inadequate when
--- a/src/pan-view.c	Fri Jun 10 03:24:35 2005 +0000
+++ b/src/pan-view.c	Fri Jun 10 06:23:22 2005 +0000
@@ -125,8 +125,7 @@
 
 #define PAN_PREF_GROUP "pan_view_options"
 #define PAN_PREF_HIDE_WARNING "hide_performance_warning"
-
-#define SORT_BY_EXIF_DATE 1
+#define PAN_PREF_EXIF_DATE "use_exif_date"
 
 
 typedef enum {
@@ -226,6 +225,8 @@
 	GtkWidget *search_button;
 	GtkWidget *search_button_arrow;
 
+	GtkWidget *date_button;
+
 	GtkWidget *scrollbar_h;
 	GtkWidget *scrollbar_v;
 
@@ -237,6 +238,7 @@
 	gint thumb_size;
 	gint thumb_gap;
 	gint image_size;
+	gint exif_date_enable;
 
 	gint ignore_symlinks;
 
@@ -543,7 +545,7 @@
 
 	load_mask = CACHE_LOADER_NONE;
 	if (pw->size > LAYOUT_SIZE_THUMB_LARGE) load_mask |= CACHE_LOADER_DIMENSIONS;
-	if (SORT_BY_EXIF_DATE) load_mask |= CACHE_LOADER_DATE;
+	if (pw->exif_date_enable) load_mask |= CACHE_LOADER_DATE;
 	pw->cache_cl = cache_loader_new(((FileData *)pc)->path, load_mask,
 					pan_cache_step_done_cb, pw);
 	return (pw->cache_cl == NULL);
@@ -2015,7 +2017,7 @@
 
 	list = pan_window_layout_list(path, SORT_NONE, TRUE, pw->ignore_symlinks);
 
-	if (pw->cache_list && SORT_BY_EXIF_DATE)
+	if (pw->cache_list && pw->exif_date_enable)
 		{
 		pw->cache_list = filelist_sort(pw->cache_list, SORT_NAME, TRUE);
 		list = filelist_sort(list, SORT_NAME, TRUE);
@@ -2237,7 +2239,7 @@
 
 	list = pan_window_layout_list(path, SORT_NONE, TRUE, pw->ignore_symlinks);
 
-	if (pw->cache_list && SORT_BY_EXIF_DATE)
+	if (pw->cache_list && pw->exif_date_enable)
 		{
 		pw->cache_list = filelist_sort(pw->cache_list, SORT_NAME, TRUE);
 		list = filelist_sort(list, SORT_NAME, TRUE);
@@ -3216,14 +3218,14 @@
 	gint scroll_y;
 
 	if (pw->size > LAYOUT_SIZE_THUMB_LARGE ||
-	    (SORT_BY_EXIF_DATE && (pw->layout == LAYOUT_TIMELINE || pw->layout == LAYOUT_CALENDAR)))
+	    (pw->exif_date_enable && (pw->layout == LAYOUT_TIMELINE || pw->layout == LAYOUT_CALENDAR)))
 		{
 		if (!pw->cache_list && !pw->cache_todo)
 			{
 			pan_cache_fill(pw, pw->path);
 			if (pw->cache_todo)
 				{
-				pan_window_message(pw, _("Reading dimensions..."));
+				pan_window_message(pw, _("Reading image data..."));
 				return TRUE;
 				}
 			}
@@ -3233,13 +3235,13 @@
 			pw->cache_tick++;
 			if (pw->cache_count == pw->cache_total)
 				{
-				pan_window_message(pw, _("Sorting images..."));
+				pan_window_message(pw, _("Sorting..."));
 				}
 			else if (pw->cache_tick > 9)
 				{
 				gchar *buf;
 
-				buf = g_strdup_printf("%s %d", _("Reading dimensions..."),
+				buf = g_strdup_printf("%s %d", _("Reading image data..."),
 						      pw->cache_total - pw->cache_count);
 				pan_window_message(pw, buf);
 				g_free(buf);
@@ -4244,6 +4246,16 @@
 	pan_window_layout_update(pw);
 }
 
+#if 0
+static void pan_window_date_toggle_cb(GtkWidget *button, gpointer data)
+{
+	PanWindow *pw = data;
+
+	pw->exif_date_enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+	pan_window_layout_update(pw);
+}
+#endif
+
 static void pan_window_entry_activate_cb(const gchar *new_text, gpointer data)
 {
 	PanWindow *pw = data;
@@ -4284,6 +4296,8 @@
 {
 	pan_window_list = g_list_remove(pan_window_list, pw);
 
+	pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_EXIF_DATE, pw->exif_date_enable);
+
 	if (pw->idle_id != -1)
 		{
 		g_source_remove(pw->idle_id);
@@ -4327,6 +4341,11 @@
 	pw->thumb_size = PAN_THUMB_SIZE_NORMAL;
 	pw->thumb_gap = PAN_THUMB_GAP_NORMAL;
 
+	if (!pref_list_int_get(PAN_PREF_GROUP, PAN_PREF_EXIF_DATE, &pw->exif_date_enable))
+		{
+		pw->exif_date_enable = FALSE;
+		}
+
 	pw->ignore_symlinks = TRUE;
 
 	pw->list = NULL;
@@ -4358,7 +4377,7 @@
 
 	pref_spacer(box, 0);
 	pref_label_new(box, _("Location:"));
-	combo = tab_completion_new_with_history(&pw->path_entry, path, "pan_view", -1,
+	combo = tab_completion_new_with_history(&pw->path_entry, path, "pan_view_path", -1,
 						pan_window_entry_activate_cb, pw);
 	g_signal_connect(G_OBJECT(pw->path_entry->parent), "changed",
 			 G_CALLBACK(pan_window_entry_change_cb), pw);
@@ -4478,6 +4497,11 @@
 	gtk_container_add(GTK_CONTAINER(frame), pw->label_zoom);
 	gtk_widget_show(pw->label_zoom);
 
+#if 0
+	pw->date_button = pref_checkbox_new(box, _("Use Exif date"), pw->exif_date_enable,
+					    G_CALLBACK(pan_window_date_toggle_cb), pw);
+#endif
+
 	pw->search_button = gtk_toggle_button_new();
 	gtk_button_set_relief(GTK_BUTTON(pw->search_button), GTK_RELIEF_NONE);
 	gtk_button_set_focus_on_click(GTK_BUTTON(pw->search_button), FALSE);
@@ -4703,6 +4727,14 @@
 	if (path) file_util_delete(path, NULL, pw->imd->widget);
 }
 
+static void pan_exif_date_toggle_cb(GtkWidget *widget, gpointer data)
+{
+	PanWindow *pw = data;
+
+	pw->exif_date_enable = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+	pan_window_layout_update(pw);
+}
+
 static void pan_fullscreen_cb(GtkWidget *widget, gpointer data)
 {
 	PanWindow *pw = data;
@@ -4755,6 +4787,11 @@
 				      G_CALLBACK(pan_delete_cb), pw);
 
 	menu_item_add_divider(menu);
+	item = menu_item_add_check(menu, _("Sort by E_xif date"), pw->exif_date_enable,
+				   G_CALLBACK(pan_exif_date_toggle_cb), pw);
+	gtk_widget_set_sensitive(item, (pw->layout == LAYOUT_TIMELINE || pw->layout == LAYOUT_CALENDAR));
+
+	menu_item_add_divider(menu);
 
 	if (pw->fs)
 		{