Pan view - implement exif data display
authorColin Clark <colin.clark@cclark.uk>
Thu, 24 May 2018 18:25:45 +0000 (19:25 +0100)
committerColin Clark <colin.clark@cclark.uk>
Thu, 24 May 2018 18:25:45 +0000 (19:25 +0100)
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.

src/bar_exif.c
src/bar_exif.h
src/pan-view/pan-view.c

index fc83209..5b298f9 100644 (file)
@@ -33,6 +33,7 @@
 #include "rcfile.h"
 #include "dnd.h"
 #include "ui_utildlg.h"
+#include "layout.h"
 
 
 #include <math.h>
@@ -725,6 +726,38 @@ static void bar_pane_exif_write_config(GtkWidget *pane, GString *outstr, gint in
        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)
 {
index 4917847..63c30d4 100644 (file)
@@ -31,7 +31,7 @@ void bar_pane_exif_entry_add_from_config(GtkWidget *pane, const gchar **attribut
 
 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: */
index 031f0c4..8d2e10d 100644 (file)
@@ -1322,10 +1322,31 @@ static gboolean pan_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, g
 
 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);
 }