annotate src/advanced_exif.c @ 1629:f8503019ac38

better implementation of tree_view_row_get_visibility, gtk_tree_view_set_cursor is not sufficient in some cases, call also tree_view_row_make_visible
author nadvornik
date Sat, 06 Jun 2009 16:14:07 +0000
parents d9e918eb917c
children ae0b1f854f22
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
1 /*
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
2 * Geeqie
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
3 * (C) 2004 John Ellis
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
4 * Copyright (C) 2008 - 2009 The Geeqie Team
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
5 *
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
6 * Author: John Ellis
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
7 *
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
9 * Please read the included file COPYING for more information.
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
11 */
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
12
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
13
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
14 #include "main.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
15 #include "advanced_exif.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
16
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
17 #include "exif.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
18 #include "metadata.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
19 #include "filedata.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
20 #include "history_list.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
21 #include "misc.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
22 #include "ui_misc.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
23 #include "window.h"
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
24 #include "dnd.h"
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
25
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
26 /* FIXME: not needed when bar_exif.c is improved */
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
27 #include "bar_exif.h"
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
28
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
29 #include <math.h>
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
30
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
31 #define ADVANCED_EXIF_DATA_COLUMN_WIDTH 200
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
32
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
33 /*
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
34 *-------------------------------------------------------------------
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
35 * EXIF window
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
36 *-------------------------------------------------------------------
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
37 */
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
38
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
39 typedef struct _ExifWin ExifWin;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
40 struct _ExifWin
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
41 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
42 GtkWidget *window;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
43 GtkWidget *vbox;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
44 GtkWidget *scrolled;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
45 GtkWidget *listview;
1427
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
46 GtkWidget *label_file_name;
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
47
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
48 FileData *fd;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
49 };
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
50
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
51 enum {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
52 EXIF_ADVCOL_ENABLED = 0,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
53 EXIF_ADVCOL_TAG,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
54 EXIF_ADVCOL_NAME,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
55 EXIF_ADVCOL_VALUE,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
56 EXIF_ADVCOL_FORMAT,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
57 EXIF_ADVCOL_ELEMENTS,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
58 EXIF_ADVCOL_DESCRIPTION,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
59 EXIF_ADVCOL_COUNT
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
60 };
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
61
1417
8036c5b779ca Tidy up.
zas_
parents: 1401
diff changeset
62 static gboolean advanced_exif_row_enabled(const gchar *name)
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
63 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
64 GList *list;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
65
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
66 if (!name) return FALSE;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
67
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
68 list = history_list_get_by_key("exif_extras");
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
69 while (list)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
70 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
71 if (strcmp(name, (gchar *)(list->data)) == 0) return TRUE;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
72 list = list->next;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
73 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
74
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
75 return FALSE;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
76 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
77
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
78 static void advanced_exif_update(ExifWin *ew)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
79 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
80 ExifData *exif;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
81
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
82 GtkListStore *store;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
83 GtkTreeIter iter;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
84 ExifData *exif_original;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
85 ExifItem *item;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
86
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
87 exif = exif_read_fd(ew->fd);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
88
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
89 gtk_widget_set_sensitive(ew->scrolled, !!exif);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
90
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
91 if (!exif) return;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
92
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
93 exif_original = exif_get_original(exif);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
94
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
95 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ew->listview)));
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
96 gtk_list_store_clear(store);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
97
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
98 item = exif_get_first_item(exif_original);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
99 while (item)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
100 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
101 gchar *tag;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
102 gchar *tag_name;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
103 gchar *text;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
104 gchar *utf8_text;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
105 const gchar *format;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
106 gchar *elements;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
107 gchar *description;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
108
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
109 tag = g_strdup_printf("0x%04x", exif_item_get_tag_id(item));
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
110 tag_name = exif_item_get_tag_name(item);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
111 format = exif_item_get_format_name(item, TRUE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
112 text = exif_item_get_data_as_text(item);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
113 utf8_text = utf8_validate_or_convert(text);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
114 g_free(text);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
115 elements = g_strdup_printf("%d", exif_item_get_elements(item));
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
116 description = exif_item_get_description(item);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
117 if (!description || *description == '\0')
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
118 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
119 g_free(description);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
120 description = g_strdup(tag_name);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
121 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
122
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
123 gtk_list_store_append(store, &iter);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
124 gtk_list_store_set(store, &iter,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
125 EXIF_ADVCOL_ENABLED, advanced_exif_row_enabled(tag_name),
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
126 EXIF_ADVCOL_TAG, tag,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
127 EXIF_ADVCOL_NAME, tag_name,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
128 EXIF_ADVCOL_VALUE, utf8_text,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
129 EXIF_ADVCOL_FORMAT, format,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
130 EXIF_ADVCOL_ELEMENTS, elements,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
131 EXIF_ADVCOL_DESCRIPTION, description, -1);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
132 g_free(tag);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
133 g_free(utf8_text);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
134 g_free(elements);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
135 g_free(description);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
136 g_free(tag_name);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
137 item = exif_get_next_item(exif_original);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
138 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
139 exif_free_fd(ew->fd, exif);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
140
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
141 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
142
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
143 static void advanced_exif_clear(ExifWin *ew)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
144 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
145 GtkListStore *store;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
146
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
147 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(ew->listview)));
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
148 gtk_list_store_clear(store);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
149 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
150
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
151 void advanced_exif_set_fd(GtkWidget *window, FileData *fd)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
152 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
153 ExifWin *ew;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
154
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
155 ew = g_object_get_data(G_OBJECT(window), "advanced_exif_data");
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
156 if (!ew) return;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
157
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
158 /* store this, advanced view toggle needs to reload data */
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
159 file_data_unref(ew->fd);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
160 ew->fd = file_data_ref(fd);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
161
1427
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
162 gtk_label_set_text(GTK_LABEL(ew->label_file_name), (ew->fd) ? ew->fd->path : "");
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
163
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
164 advanced_exif_clear(ew);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
165 advanced_exif_update(ew);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
166 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
167
1353
77c3d9dcd6bc dropped ExifUIList
nadvornik
parents: 1293
diff changeset
168 #if 0
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
169 static void advanced_exif_row_toggled_cb(GtkCellRendererToggle *toggle, const gchar *path, gpointer data)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
170 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
171 GtkWidget *listview = data;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
172 GtkTreeModel *store;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
173 GtkTreeIter iter;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
174 GtkTreePath *tpath;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
175 gchar *name = NULL;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
176 gboolean active;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
177
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
178 store = gtk_tree_view_get_model(GTK_TREE_VIEW(listview));
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
179
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
180 tpath = gtk_tree_path_new_from_string(path);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
181 gtk_tree_model_get_iter(store, &iter, tpath);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
182 gtk_tree_path_free(tpath);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
183
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
184 gtk_tree_model_get(store, &iter, EXIF_ADVCOL_ENABLED, &active,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
185 EXIF_ADVCOL_NAME, &name, -1);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
186 active = (!active);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
187
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
188 if (active &&
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
189 g_list_length(history_list_get_by_key("exif_extras")) >= EXIF_BAR_CUSTOM_COUNT)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
190 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
191 active = FALSE;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
192 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
193
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
194 gtk_list_store_set(GTK_LIST_STORE(store), &iter, EXIF_ADVCOL_ENABLED, active, -1);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
195
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
196 if (active)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
197 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
198 history_list_add_to_key("exif_extras", name, EXIF_BAR_CUSTOM_COUNT);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
199 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
200 else
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
201 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
202 history_list_item_change("exif_extras", name, NULL);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
203 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
204
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
205 g_free(name);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
206 }
1353
77c3d9dcd6bc dropped ExifUIList
nadvornik
parents: 1293
diff changeset
207 #endif
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
208
1353
77c3d9dcd6bc dropped ExifUIList
nadvornik
parents: 1293
diff changeset
209 #if 0
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
210 static void advanced_exif_add_column_check(GtkWidget *listview, const gchar *title, gint n)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
211 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
212 GtkTreeViewColumn *column;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
213 GtkCellRenderer *renderer;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
214
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
215 column = gtk_tree_view_column_new();
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
216 gtk_tree_view_column_set_title(column, title);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
217 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
218
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
219 renderer = gtk_cell_renderer_toggle_new();
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
220 gtk_tree_view_column_pack_start(column, renderer, TRUE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
221 gtk_tree_view_column_add_attribute(column, renderer, "active", n);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
222 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
223
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
224 g_signal_connect(G_OBJECT(renderer), "toggled",
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
225 G_CALLBACK(advanced_exif_row_toggled_cb), listview);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
226 }
1353
77c3d9dcd6bc dropped ExifUIList
nadvornik
parents: 1293
diff changeset
227 #endif
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
228
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
229 static GtkTargetEntry advanced_exif_drag_types[] = {
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
230 { "text/plain", 0, TARGET_TEXT_PLAIN }
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
231 };
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
232 static gint n_exif_drag_types = 1;
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
233
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
234
1392
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
235 static void advanced_exif_dnd_get(GtkWidget *listview, GdkDragContext *context,
1417
8036c5b779ca Tidy up.
zas_
parents: 1401
diff changeset
236 GtkSelectionData *selection_data, guint info,
8036c5b779ca Tidy up.
zas_
parents: 1401
diff changeset
237 guint time, gpointer data)
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
238 {
1417
8036c5b779ca Tidy up.
zas_
parents: 1401
diff changeset
239 //ExifWin *ew = data;
1392
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
240 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(listview));
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
241 GtkTreeIter iter;
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
242
1392
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
243 if (gtk_tree_selection_get_selected(sel, NULL, &iter))
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
244 {
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
245 GtkTreeModel *store = gtk_tree_view_get_model(GTK_TREE_VIEW(listview));
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
246 gchar *key;
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
247
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
248 gtk_tree_model_get(store, &iter, EXIF_ADVCOL_NAME, &key, -1);
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
249 gtk_selection_data_set_text(selection_data, key, -1);
1417
8036c5b779ca Tidy up.
zas_
parents: 1401
diff changeset
250 //printf("%s\n",key);
1392
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
251 g_free(key);
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
252 }
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
253
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
254 }
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
255
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
256
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
257 static void advanced_exif_dnd_begin(GtkWidget *listview, GdkDragContext *context, gpointer data)
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
258 {
1417
8036c5b779ca Tidy up.
zas_
parents: 1401
diff changeset
259 //ExifWin *ew = data;
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
260 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(listview));
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
261 GtkTreeIter iter;
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
262
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
263 if (gtk_tree_selection_get_selected(sel, NULL, &iter))
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
264 {
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
265 GtkTreeModel *store = gtk_tree_view_get_model(GTK_TREE_VIEW(listview));
1392
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
266 gchar *key;
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
267
1392
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
268 gtk_tree_model_get(store, &iter, EXIF_ADVCOL_NAME, &key, -1);
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
269
1393
79b32088ecc4 show a label instead of the default drag icon
nadvornik
parents: 1392
diff changeset
270 dnd_set_drag_label(listview, context, key);
1392
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
271 g_free(key);
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
272 }
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
273 }
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
274
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
275
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
276
1417
8036c5b779ca Tidy up.
zas_
parents: 1401
diff changeset
277 static void advanced_exif_add_column(GtkWidget *listview, const gchar *title, gint n, gboolean sizable)
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
278 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
279 GtkTreeViewColumn *column;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
280 GtkCellRenderer *renderer;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
281
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
282 column = gtk_tree_view_column_new();
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
283 gtk_tree_view_column_set_title(column, title);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
284
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
285 if (sizable)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
286 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
287 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
288 gtk_tree_view_column_set_fixed_width(column, ADVANCED_EXIF_DATA_COLUMN_WIDTH);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
289 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
290 else
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
291 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
292 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
293 }
1401
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
294
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
295 gtk_tree_view_column_set_resizable(column, TRUE);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
296 gtk_tree_view_column_set_sort_column_id(column, n);
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
297
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
298 renderer = gtk_cell_renderer_text_new();
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
299 gtk_tree_view_column_pack_start(column, renderer, TRUE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
300 gtk_tree_view_column_add_attribute(column, renderer, "text", n);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
301 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
302 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
303
1537
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
304 void advanced_exif_close(ExifWin *ew)
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
305 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
306 if (!ew) return;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
307
1537
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
308 gtk_widget_destroy(ew->window);
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
309 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
310
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
311 static void advanced_exif_destroy(GtkWidget *widget, gpointer data)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
312 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
313 ExifWin *ew = data;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
314 file_data_unref(ew->fd);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
315 g_free(ew);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
316 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
317
1401
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
318 static gint advanced_exif_sort_cb(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data)
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
319 {
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
320 gint n = GPOINTER_TO_INT(data);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
321 gint ret = 0;
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
322
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
323 switch (n)
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
324 {
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
325 case EXIF_ADVCOL_DESCRIPTION:
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
326 case EXIF_ADVCOL_VALUE:
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
327 case EXIF_ADVCOL_NAME:
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
328 case EXIF_ADVCOL_TAG:
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
329 case EXIF_ADVCOL_FORMAT:
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
330 case EXIF_ADVCOL_ELEMENTS:
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
331 {
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
332 gchar *s1, *s2;
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
333
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
334 gtk_tree_model_get(model, a, n, &s1, -1);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
335 gtk_tree_model_get(model, b, n, &s2, -1);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
336
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
337 if (!s1 || !s2)
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
338 {
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
339 if (!s1 && !s2) break;
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
340 ret = s1 ? 1 : -1;
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
341 }
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
342 else
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
343 {
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
344 ret = g_utf8_collate(s1, s2);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
345 }
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
346
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
347 g_free(s1);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
348 g_free(s2);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
349 }
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
350 break;
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
351
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
352 default:
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
353 g_return_val_if_reached(0);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
354 }
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
355
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
356 return ret;
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
357 }
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
358
1537
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
359 static gboolean advanced_exif_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
360 {
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
361 ExifWin *ew = data;
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
362 gboolean stop_signal = FALSE;
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
363
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
364 if (event->state & GDK_CONTROL_MASK)
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
365 {
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
366 switch (event->keyval)
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
367 {
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
368 case 'W': case 'w':
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
369 advanced_exif_close(ew);
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
370 stop_signal = TRUE;
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
371 break;
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
372 }
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
373 } // if (event->state & GDK_CONTROL...
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
374
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
375 return stop_signal;
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
376 } // static gboolean advanced_exif_...
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
377
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
378 GtkWidget *advanced_exif_new(void)
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
379 {
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
380 ExifWin *ew;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
381 GtkListStore *store;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
382 GdkGeometry geometry;
1401
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
383 GtkTreeSortable *sortable;
1427
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
384 GtkWidget *box;
1401
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
385 gint n;
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
386
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
387 ew = g_new0(ExifWin, 1);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
388
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
389 ew->window = window_new(GTK_WINDOW_TOPLEVEL, "view", NULL, NULL, _("Metadata"));
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
390
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
391 geometry.min_width = 900;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
392 geometry.min_height = 600;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
393 gtk_window_set_geometry_hints(GTK_WINDOW(ew->window), NULL, &geometry, GDK_HINT_MIN_SIZE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
394
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
395 gtk_window_set_resizable(GTK_WINDOW(ew->window), TRUE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
396
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
397 g_object_set_data(G_OBJECT(ew->window), "advanced_exif_data", ew);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
398 g_signal_connect_after(G_OBJECT(ew->window), "destroy",
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
399 G_CALLBACK(advanced_exif_destroy), ew);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
400
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
401 ew->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
402 gtk_container_add(GTK_CONTAINER(ew->window), ew->vbox);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
403 gtk_widget_show(ew->vbox);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
404
1427
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
405 box = gtk_hbox_new(FALSE, 0);
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
406
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
407 ew->label_file_name = gtk_label_new("");
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
408 gtk_label_set_ellipsize(GTK_LABEL(ew->label_file_name), PANGO_ELLIPSIZE_START);
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
409 gtk_label_set_selectable(GTK_LABEL(ew->label_file_name), TRUE);
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
410 gtk_misc_set_alignment(GTK_MISC(ew->label_file_name), 0.5, 0.5);
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
411 gtk_box_pack_start(GTK_BOX(box), ew->label_file_name, TRUE, TRUE, 0);
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
412 gtk_widget_show(ew->label_file_name);
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
413
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
414 gtk_box_pack_start(GTK_BOX(ew->vbox), box, FALSE, FALSE, 0);
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
415 gtk_widget_show(box);
c449a9344c8e show file name in advanced_exif
nadvornik
parents: 1417
diff changeset
416
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
417
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
418 store = gtk_list_store_new(7, G_TYPE_BOOLEAN,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
419 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
420 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
1401
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
421
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
422 /* set up sorting */
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
423 sortable = GTK_TREE_SORTABLE(store);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
424 for (n = EXIF_ADVCOL_DESCRIPTION; n <= EXIF_ADVCOL_ELEMENTS; n++)
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
425 gtk_tree_sortable_set_sort_func(sortable, n, advanced_exif_sort_cb,
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
426 GINT_TO_POINTER(n), NULL);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
427
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
428 /* set initial sort order */
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
429 gtk_tree_sortable_set_sort_column_id(sortable, EXIF_ADVCOL_NAME, GTK_SORT_ASCENDING);
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
430
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
431 ew->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
432 g_object_unref(store);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
433
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
434 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(ew->listview), TRUE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
435 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(ew->listview), TRUE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
436
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
437 advanced_exif_add_column(ew->listview, _("Description"), EXIF_ADVCOL_DESCRIPTION, FALSE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
438 advanced_exif_add_column(ew->listview, _("Value"), EXIF_ADVCOL_VALUE, TRUE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
439 advanced_exif_add_column(ew->listview, _("Name"), EXIF_ADVCOL_NAME, FALSE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
440 advanced_exif_add_column(ew->listview, _("Tag"), EXIF_ADVCOL_TAG, FALSE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
441 advanced_exif_add_column(ew->listview, _("Format"), EXIF_ADVCOL_FORMAT, FALSE);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
442 advanced_exif_add_column(ew->listview, _("Elements"), EXIF_ADVCOL_ELEMENTS, FALSE);
1401
e18871df295f Advanced exif window: make all columns sortable and resizable.
zas_
parents: 1393
diff changeset
443
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
444
1392
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
445 gtk_drag_source_set(ew->listview,
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
446 GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
447 advanced_exif_drag_types, n_exif_drag_types,
d1b32a69b40a dnd in keywords tree
nadvornik
parents: 1376
diff changeset
448 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
1376
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
449
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
450 g_signal_connect(G_OBJECT(ew->listview), "drag_data_get",
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
451 G_CALLBACK(advanced_exif_dnd_get), ew);
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
452
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
453 g_signal_connect(G_OBJECT(ew->listview), "drag_begin",
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
454 G_CALLBACK(advanced_exif_dnd_begin), ew);
2ecdff667841 dnd from advanced exif window to exif pane
nadvornik
parents: 1353
diff changeset
455
1537
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
456 g_signal_connect(G_OBJECT(ew->window), "key_press_event",
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
457 G_CALLBACK(advanced_exif_keypress), ew);
d9e918eb917c Implementing CTRL-W to close advanced exif window
mow
parents: 1427
diff changeset
458
1293
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
459 ew->scrolled = gtk_scrolled_window_new(NULL, NULL);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
460 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ew->scrolled), GTK_SHADOW_IN);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
461 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ew->scrolled),
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
462 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
463 gtk_box_pack_start(GTK_BOX(ew->vbox), ew->scrolled, TRUE, TRUE, 0);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
464 gtk_container_add(GTK_CONTAINER(ew->scrolled), ew->listview);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
465 gtk_widget_show(ew->listview);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
466 gtk_widget_show(ew->scrolled);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
467
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
468 gtk_widget_show(ew->window);
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
469 return ew->window;
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
470 }
48e064b37ba6 separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
diff changeset
471 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */