changeset 2759:dc29a31b7c47

Pan view - implement exif data display The option to display exif data in pan view was NULLed out. This commit implements the display of exif data. The parameters displayed are the same as in the info sidebar.
author Colin Clark <colin.clark@cclark.uk>
date Thu, 24 May 2018 19:25:45 +0100
parents de18b5afdd1a
children 8c1423d43ec2
files src/bar_exif.c src/bar_exif.h src/pan-view/pan-view.c
diffstat 3 files changed, 56 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_exif.c	Thu May 24 10:04:39 2018 +0100
+++ b/src/bar_exif.c	Thu May 24 19:25:45 2018 +0100
@@ -33,6 +33,7 @@
 #include "rcfile.h"
 #include "dnd.h"
 #include "ui_utildlg.h"
+#include "layout.h"
 
 
 #include <math.h>
@@ -725,6 +726,38 @@
 	WRITE_NL(); WRITE_STRING("</pane_exif>");
 }
 
+GList * bar_pane_exif_list()
+{
+	PaneExifData *ped;
+	GList *list;
+	GList *work_windows;
+	GList *exif_list = NULL;
+	LayoutWindow *lw;
+	GtkWidget *bar;
+	GtkWidget *pane;
+	GtkWidget *entry;
+	ExifEntry *ee;
+
+	work_windows = layout_window_list;
+	lw = work_windows->data;
+	bar = lw->bar;
+	pane = bar_find_pane_by_id(bar, PANE_EXIF, "exif");
+	ped = g_object_get_data(G_OBJECT(pane), "pane_data");
+
+	list = gtk_container_get_children(GTK_CONTAINER(ped->vbox));
+	while (list)
+		{
+		entry = list->data;
+		list = list->next;
+		ee = g_object_get_data(G_OBJECT(entry), "entry_data");
+		exif_list = g_list_append(exif_list, g_strdup(ee->title));
+		exif_list = g_list_append(exif_list, g_strdup(ee->key));
+		}
+
+	g_list_free(list);
+
+	return exif_list;
+}
 
 void bar_pane_exif_close(GtkWidget *widget)
 {
--- a/src/bar_exif.h	Thu May 24 10:04:39 2018 +0100
+++ b/src/bar_exif.h	Thu May 24 19:25:45 2018 +0100
@@ -31,7 +31,7 @@
 
 const gchar **bar_exif_key_list;
 const gint bar_exif_key_count;
-
+GList *bar_pane_exif_list();
 
 #endif
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/pan-view/pan-view.c	Thu May 24 10:04:39 2018 +0100
+++ b/src/pan-view/pan-view.c	Thu May 24 19:25:45 2018 +0100
@@ -1322,10 +1322,31 @@
 
 static void pan_info_add_exif(PanTextAlignment *ta, FileData *fd)
 {
+	GList *exif_list;
+	gchar *text;
+	gchar *title;
+	gchar *key;
 
 	if (!fd) return;
 
-	pan_text_alignment_add(ta, NULL, NULL);
+	exif_list = bar_pane_exif_list();
+	while (exif_list)
+		{
+		title = exif_list->data;
+		exif_list = exif_list->next;
+		key = exif_list->data;
+		exif_list = exif_list->next;
+
+		text = metadata_read_string(fd, key, METADATA_FORMATTED);
+		if (text && text[0] != '\0')
+			{
+			pan_text_alignment_add(ta, title, text);
+			}
+
+		g_free(text);
+		}
+
+	string_list_free(exif_list);
 }