Mercurial > geeqie.yaz
annotate src/bar_exif.c @ 1062:2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
author | zas_ |
---|---|
date | Sun, 12 Oct 2008 08:43:14 +0000 |
parents | 1646720364cf |
children | 6a8402e0eaea |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
9 | 3 * (C) 2004 John Ellis |
475 | 4 * Copyright (C) 2008 The Geeqie Team |
9 | 5 * |
6 * Author: John Ellis | |
7 * | |
8 * This software is released under the GNU General Public License (GNU GPL). | |
9 * Please read the included file COPYING for more information. | |
10 * This software comes with no warranty of any kind, use at your own risk! | |
11 */ | |
12 | |
13 | |
281 | 14 #include "main.h" |
9 | 15 #include "bar_exif.h" |
16 | |
17 #include "exif.h" | |
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
902
diff
changeset
|
18 #include "filedata.h" |
902 | 19 #include "history_list.h" |
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
902
diff
changeset
|
20 #include "misc.h" |
9 | 21 #include "ui_misc.h" |
22 | |
23 #include <math.h> | |
24 | |
25 #define EXIF_BAR_SIZE_INCREMENT 48 | |
26 #define EXIF_BAR_ARROW_SIZE 7 | |
27 | |
28 #define EXIF_BAR_CUSTOM_COUNT 20 | |
29 | |
48
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
30 #define BAR_EXIF_DATA_COLUMN_WIDTH 250 |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
31 |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
32 ExifUI ExifUIList[]={ |
566
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
33 { 0, 0, EXIF_UI_IFSET, "formatted.Camera"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
34 { 0, 0, EXIF_UI_IFSET, "formatted.DateTime"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
35 { 0, 0, EXIF_UI_IFSET, "formatted.ShutterSpeed"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
36 { 0, 0, EXIF_UI_IFSET, "formatted.Aperture"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
37 { 0, 0, EXIF_UI_IFSET, "formatted.ExposureBias"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
38 { 0, 0, EXIF_UI_IFSET, "formatted.ISOSpeedRating"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
39 { 0, 0, EXIF_UI_IFSET, "formatted.FocalLength"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
40 { 0, 0, EXIF_UI_IFSET, "formatted.FocalLength35mmFilm"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
41 { 0, 0, EXIF_UI_IFSET, "formatted.Flash"}, |
325 | 42 { 0, 0, EXIF_UI_IFSET, "Exif.Photo.ExposureProgram"}, |
43 { 0, 0, EXIF_UI_IFSET, "Exif.Photo.MeteringMode"}, | |
44 { 0, 0, EXIF_UI_IFSET, "Exif.Photo.LightSource"}, | |
566
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
45 { 0, 0, EXIF_UI_IFSET, "formatted.ColorProfile"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
46 { 0, 0, EXIF_UI_IFSET, "formatted.SubjectDistance"}, |
db08ccd54169
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
zas_
parents:
550
diff
changeset
|
47 { 0, 0, EXIF_UI_IFSET, "formatted.Resolution"}, |
325 | 48 { 0, 0, EXIF_UI_IFSET, "Exif.Image.Orientation"}, |
1052 | 49 { 0, 0, EXIF_UI_IFSET, "formatted.GPSPosition"}, |
50 { 0, 0, EXIF_UI_IFSET, "formatted.GPSAltitude"}, | |
325 | 51 { 0, 0, EXIF_UI_IFSET, "Exif.Image.ImageDescription"}, |
52 { 0, 0, EXIF_UI_IFSET, "Exif.Image.Copyright"}, | |
53 { 0, 0, EXIF_UI_OFF, NULL} | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
54 }; |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
55 |
9 | 56 |
57 /* | |
58 *------------------------------------------------------------------- | |
59 * table util | |
60 *------------------------------------------------------------------- | |
61 */ | |
62 | |
63 static void table_add_line_custom(GtkWidget *table, gint x, gint y, | |
442 | 64 const gchar *text1, const gchar *text2, |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
65 GtkWidget **label1, GtkWidget **label2, |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
66 GtkWidget **button) |
9 | 67 { |
68 GtkWidget *label; | |
69 gchar *buf; | |
70 | |
71 buf = g_strconcat((text1) ? text1 : "fixme", ":", NULL); | |
72 if (!text2) text2 = ""; | |
73 | |
74 label = gtk_label_new(buf); | |
75 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.0); | |
76 pref_label_bold(label, TRUE, FALSE); | |
77 gtk_table_attach(GTK_TABLE(table), label, | |
78 x, x + 1, y, y + 1, | |
79 GTK_FILL, GTK_FILL, | |
80 2, 2); | |
81 *label1 = label; | |
82 | |
83 label = gtk_label_new(text2); | |
84 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); | |
85 gtk_table_attach(GTK_TABLE(table), label, | |
86 x + 1, x + 2, y, y + 1, | |
87 GTK_FILL, GTK_FILL, | |
88 2, 2); | |
89 *label2 = label; | |
90 | |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
91 if (button) |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
92 { |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
93 *button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
94 gtk_table_attach(GTK_TABLE(table), *button, |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
95 x + 2, x + 3, y, y + 1, |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
96 GTK_FILL, GTK_FILL, |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
97 2, 2); |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
98 } |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
99 |
9 | 100 g_free(buf); |
101 } | |
102 | |
103 static GtkWidget *table_add_line(GtkWidget *table, gint x, gint y, | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
104 const gchar *description, const gchar *text, |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
105 GtkWidget **keyret) |
9 | 106 { |
107 GtkWidget *key; | |
108 GtkWidget *label; | |
109 | |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
110 table_add_line_custom(table, x, y, description, text, &key, &label, NULL); |
9 | 111 gtk_widget_show(key); |
112 gtk_widget_show(label); | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
113 if (keyret) *keyret = key; |
9 | 114 |
115 return label; | |
116 } | |
117 | |
118 | |
119 /* | |
120 *------------------------------------------------------------------- | |
121 * EXIF bar | |
122 *------------------------------------------------------------------- | |
123 */ | |
124 | |
125 typedef struct _ExifBar ExifBar; | |
126 struct _ExifBar | |
127 { | |
128 GtkWidget *vbox; | |
129 GtkWidget *scrolled; | |
130 GtkWidget *table; | |
131 GtkWidget *advanced_scrolled; | |
132 GtkWidget *listview; | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
133 GtkWidget **keys; |
9 | 134 GtkWidget **labels; |
135 | |
136 GtkWidget *custom_sep; | |
137 GtkWidget *custom_name[EXIF_BAR_CUSTOM_COUNT]; | |
138 GtkWidget *custom_value[EXIF_BAR_CUSTOM_COUNT]; | |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
139 GtkWidget *custom_remove[EXIF_BAR_CUSTOM_COUNT]; |
9 | 140 |
138 | 141 FileData *fd; |
9 | 142 |
143 gint allow_search; | |
144 }; | |
145 | |
146 enum { | |
147 EXIF_ADVCOL_ENABLED = 0, | |
148 EXIF_ADVCOL_TAG, | |
149 EXIF_ADVCOL_NAME, | |
150 EXIF_ADVCOL_VALUE, | |
151 EXIF_ADVCOL_FORMAT, | |
152 EXIF_ADVCOL_ELEMENTS, | |
153 EXIF_ADVCOL_DESCRIPTION, | |
154 EXIF_ADVCOL_COUNT | |
155 }; | |
156 | |
157 static void bar_exif_sensitive(ExifBar *eb, gint enable) | |
158 { | |
159 gtk_widget_set_sensitive(eb->table, enable); | |
160 if (eb->advanced_scrolled) gtk_widget_set_sensitive(eb->advanced_scrolled, enable); | |
161 } | |
162 | |
163 static gint bar_exif_row_enabled(const gchar *name) | |
164 { | |
165 GList *list; | |
166 | |
895 | 167 if (!name) return FALSE; |
168 | |
9 | 169 list = history_list_get_by_key("exif_extras"); |
170 while (list) | |
171 { | |
895 | 172 if (strcmp(name, (gchar *)(list->data)) == 0) return TRUE; |
9 | 173 list = list->next; |
174 } | |
175 | |
176 return FALSE; | |
177 } | |
178 | |
179 static void bar_exif_update(ExifBar *eb) | |
180 { | |
181 ExifData *exif; | |
233 | 182 gint i; |
9 | 183 |
449 | 184 exif = exif_read_fd(eb->fd); |
9 | 185 |
186 if (!exif) | |
187 { | |
188 bar_exif_sensitive(eb, FALSE); | |
189 return; | |
190 } | |
191 | |
192 bar_exif_sensitive(eb, TRUE); | |
193 | |
194 if (GTK_WIDGET_VISIBLE(eb->scrolled)) | |
195 { | |
196 GList *list; | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
197 for (i = 0; ExifUIList[i].key; i++) |
9 | 198 { |
199 gchar *text; | |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
200 gchar *utf8_text; |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
201 |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
202 if (ExifUIList[i].current == EXIF_UI_OFF) |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
203 { |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
204 gtk_widget_hide(eb->labels[i]); |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
205 gtk_widget_hide(eb->keys[i]); |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
206 continue; |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
207 } |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
208 text = exif_get_data_as_text(exif, ExifUIList[i].key); |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
209 utf8_text = utf8_validate_or_convert(text); |
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
210 g_free(text); |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
211 if (ExifUIList[i].current == EXIF_UI_IFSET |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
212 && (!utf8_text || !*utf8_text)) |
442 | 213 { |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
214 gtk_widget_hide(eb->labels[i]); |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
215 gtk_widget_hide(eb->keys[i]); |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
216 g_free(utf8_text); |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
217 continue; |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
218 } |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
219 gtk_widget_show(eb->labels[i]); |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
220 gtk_widget_show(eb->keys[i]); |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
221 gtk_label_set_text(GTK_LABEL(eb->labels[i]), utf8_text); |
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
222 g_free(utf8_text); |
9 | 223 } |
224 | |
225 list = g_list_last(history_list_get_by_key("exif_extras")); | |
226 if (list) | |
227 { | |
228 gtk_widget_show(eb->custom_sep); | |
229 } | |
230 else | |
231 { | |
232 gtk_widget_hide(eb->custom_sep); | |
233 } | |
234 i = 0; | |
235 while (list && i < EXIF_BAR_CUSTOM_COUNT) | |
236 { | |
237 gchar *text; | |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
238 gchar *utf8_text; |
9 | 239 gchar *name; |
240 gchar *buf; | |
241 | |
242 name = list->data; | |
243 list = list->prev; | |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
244 |
9 | 245 text = exif_get_data_as_text(exif, name); |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
246 utf8_text = utf8_validate_or_convert(text); |
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
247 g_free(text); |
9 | 248 |
249 buf = g_strconcat(name, ":", NULL); | |
250 gtk_label_set_text(GTK_LABEL(eb->custom_name[i]), buf); | |
251 g_free(buf); | |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
252 gtk_label_set_text(GTK_LABEL(eb->custom_value[i]), utf8_text); |
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
253 g_free(utf8_text); |
9 | 254 |
255 gtk_widget_show(eb->custom_name[i]); | |
256 gtk_widget_show(eb->custom_value[i]); | |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
257 gtk_widget_show(eb->custom_remove[i]); |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
258 g_object_set_data(G_OBJECT(eb->custom_remove[i]), "key", name); |
9 | 259 |
260 i++; | |
261 } | |
262 while (i < EXIF_BAR_CUSTOM_COUNT) | |
263 { | |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
264 g_object_set_data(G_OBJECT(eb->custom_remove[i]), "key", NULL); |
9 | 265 gtk_widget_hide(eb->custom_name[i]); |
266 gtk_widget_hide(eb->custom_value[i]); | |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
267 gtk_widget_hide(eb->custom_remove[i]); |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
268 |
9 | 269 i++; |
270 } | |
271 } | |
272 | |
273 if (eb->advanced_scrolled && GTK_WIDGET_VISIBLE(eb->advanced_scrolled)) | |
274 { | |
275 GtkListStore *store; | |
276 GtkTreeIter iter; | |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
277 ExifItem *item; |
442 | 278 |
9 | 279 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(eb->listview))); |
280 gtk_list_store_clear(store); | |
281 | |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
282 item = exif_get_first_item(exif); |
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
283 while (item) |
9 | 284 { |
285 gchar *tag; | |
185 | 286 gchar *tag_name; |
9 | 287 gchar *text; |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
288 gchar *utf8_text; |
9 | 289 const gchar *format; |
290 gchar *elements; | |
185 | 291 gchar *description; |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
292 gchar *utf8_description; |
9 | 293 |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
294 tag = g_strdup_printf("0x%04x", exif_item_get_tag_id(item)); |
9 | 295 tag_name = exif_item_get_tag_name(item); |
296 format = exif_item_get_format_name(item, TRUE); | |
297 text = exif_item_get_data_as_text(item); | |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
298 utf8_text = utf8_validate_or_convert(text); |
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
299 g_free(text); |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
300 elements = g_strdup_printf("%d", exif_item_get_elements(item)); |
9 | 301 description = exif_item_get_description(item); |
182 | 302 if (!description) description = g_strdup(""); |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
303 utf8_description = utf8_validate_or_convert(description); |
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
304 g_free(description); |
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
305 |
9 | 306 gtk_list_store_append(store, &iter); |
307 gtk_list_store_set(store, &iter, | |
308 EXIF_ADVCOL_ENABLED, bar_exif_row_enabled(tag_name), | |
309 EXIF_ADVCOL_TAG, tag, | |
310 EXIF_ADVCOL_NAME, tag_name, | |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
311 EXIF_ADVCOL_VALUE, utf8_text, |
9 | 312 EXIF_ADVCOL_FORMAT, format, |
313 EXIF_ADVCOL_ELEMENTS, elements, | |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
314 EXIF_ADVCOL_DESCRIPTION, utf8_description, -1); |
9 | 315 g_free(tag); |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
316 g_free(utf8_text); |
9 | 317 g_free(elements); |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
318 g_free(utf8_description); |
185 | 319 g_free(tag_name); |
176
695e1ad3b169
simplified exif.h, moved implementation-specific stuff to exif-int.h
nadvornik
parents:
138
diff
changeset
|
320 item = exif_get_next_item(exif); |
9 | 321 } |
322 } | |
323 | |
844 | 324 exif_free_fd(eb->fd, exif); |
9 | 325 } |
326 | |
327 static void bar_exif_clear(ExifBar *eb) | |
328 { | |
329 gint i; | |
330 | |
331 if (!GTK_WIDGET_SENSITIVE(eb->labels[0])) return; | |
332 | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
333 for (i = 0; ExifUIList[i].key; i++) |
9 | 334 { |
335 gtk_label_set_text(GTK_LABEL(eb->labels[i]), ""); | |
336 } | |
337 for (i = 0; i < EXIF_BAR_CUSTOM_COUNT; i++) | |
338 { | |
339 gtk_label_set_text(GTK_LABEL(eb->custom_value[i]), ""); | |
340 } | |
341 | |
342 if (eb->listview) | |
343 { | |
344 GtkListStore *store; | |
345 | |
346 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(eb->listview))); | |
347 gtk_list_store_clear(store); | |
348 } | |
349 } | |
350 | |
138 | 351 void bar_exif_set(GtkWidget *bar, FileData *fd) |
9 | 352 { |
353 ExifBar *eb; | |
354 | |
355 eb = g_object_get_data(G_OBJECT(bar), "bar_exif_data"); | |
356 if (!eb) return; | |
357 | |
358 /* store this, advanced view toggle needs to reload data */ | |
138 | 359 file_data_unref(eb->fd); |
360 eb->fd = file_data_ref(fd); | |
9 | 361 |
362 bar_exif_clear(eb); | |
363 bar_exif_update(eb); | |
364 } | |
365 | |
366 static void bar_exif_row_toggled_cb(GtkCellRendererToggle *toggle, const gchar *path, gpointer data) | |
367 { | |
368 GtkWidget *listview = data; | |
369 GtkTreeModel *store; | |
370 GtkTreeIter iter; | |
371 GtkTreePath *tpath; | |
372 gchar *name = NULL; | |
373 gboolean active; | |
374 | |
375 store = gtk_tree_view_get_model(GTK_TREE_VIEW(listview)); | |
376 | |
377 tpath = gtk_tree_path_new_from_string(path); | |
378 gtk_tree_model_get_iter(store, &iter, tpath); | |
379 gtk_tree_path_free(tpath); | |
380 | |
381 gtk_tree_model_get(store, &iter, EXIF_ADVCOL_ENABLED, &active, | |
382 EXIF_ADVCOL_NAME, &name, -1); | |
383 active = (!active); | |
384 | |
385 if (active && | |
386 g_list_length(history_list_get_by_key("exif_extras")) >= EXIF_BAR_CUSTOM_COUNT) | |
387 { | |
388 active = FALSE; | |
389 } | |
390 | |
391 gtk_list_store_set(GTK_LIST_STORE(store), &iter, EXIF_ADVCOL_ENABLED, active, -1); | |
392 | |
393 if (active) | |
394 { | |
395 history_list_add_to_key("exif_extras", name, EXIF_BAR_CUSTOM_COUNT); | |
396 } | |
397 else | |
398 { | |
399 history_list_item_change("exif_extras", name, NULL); | |
400 } | |
401 | |
402 g_free(name); | |
403 } | |
404 | |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
405 static void bar_exif_remove_advanced_cb(GtkWidget *widget, gpointer data) |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
406 { |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
407 ExifBar *eb = data; |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
408 const gchar *key; |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
409 |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
410 key = g_object_get_data(G_OBJECT(widget), "key"); |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
411 if (!key) return; |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
412 |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
413 history_list_item_change("exif_extras", key, NULL); |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
414 |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
415 bar_exif_update(eb); |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
416 } |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
417 |
9 | 418 static void bar_exif_add_column_check(GtkWidget *listview, const gchar *title, gint n) |
419 { | |
420 GtkTreeViewColumn *column; | |
421 GtkCellRenderer *renderer; | |
422 | |
423 column = gtk_tree_view_column_new(); | |
424 gtk_tree_view_column_set_title(column, title); | |
425 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
426 | |
427 renderer = gtk_cell_renderer_toggle_new(); | |
428 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
429 gtk_tree_view_column_add_attribute(column, renderer, "active", n); | |
430 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); | |
431 | |
432 g_signal_connect(G_OBJECT(renderer), "toggled", | |
433 G_CALLBACK(bar_exif_row_toggled_cb), listview); | |
434 } | |
435 | |
48
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
436 static void bar_exif_add_column(GtkWidget *listview, const gchar *title, gint n, gint sizable) |
9 | 437 { |
438 GtkTreeViewColumn *column; | |
439 GtkCellRenderer *renderer; | |
440 | |
441 column = gtk_tree_view_column_new(); | |
442 gtk_tree_view_column_set_title(column, title); | |
48
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
443 |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
444 if (sizable) |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
445 { |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
446 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
447 gtk_tree_view_column_set_fixed_width(column, BAR_EXIF_DATA_COLUMN_WIDTH); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
448 gtk_tree_view_column_set_resizable(column, TRUE); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
449 } |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
450 else |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
451 { |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
452 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
453 } |
9 | 454 |
455 renderer = gtk_cell_renderer_text_new(); | |
456 gtk_tree_view_column_pack_start(column, renderer, TRUE); | |
457 gtk_tree_view_column_add_attribute(column, renderer, "text", n); | |
458 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); | |
459 } | |
460 | |
461 static void bar_exif_advanced_build_view(ExifBar *eb) | |
462 { | |
463 GtkListStore *store; | |
464 | |
465 if (eb->listview) return; | |
466 | |
467 store = gtk_list_store_new(7, G_TYPE_BOOLEAN, | |
468 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, | |
469 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); | |
470 eb->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); | |
471 g_object_unref(store); | |
472 | |
473 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(eb->listview), TRUE); | |
474 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(eb->listview), TRUE); | |
475 | |
476 if (eb->allow_search) | |
477 { | |
478 gtk_tree_view_set_search_column(GTK_TREE_VIEW(eb->listview), EXIF_ADVCOL_NAME); | |
479 } | |
480 else | |
481 { | |
482 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(eb->listview), FALSE); | |
483 } | |
484 | |
485 bar_exif_add_column_check(eb->listview, "", EXIF_ADVCOL_ENABLED); | |
486 | |
48
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
487 bar_exif_add_column(eb->listview, _("Tag"), EXIF_ADVCOL_TAG, FALSE); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
488 bar_exif_add_column(eb->listview, _("Name"), EXIF_ADVCOL_NAME, FALSE); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
489 bar_exif_add_column(eb->listview, _("Value"), EXIF_ADVCOL_VALUE, TRUE); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
490 bar_exif_add_column(eb->listview, _("Format"), EXIF_ADVCOL_FORMAT, FALSE); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
491 bar_exif_add_column(eb->listview, _("Elements"), EXIF_ADVCOL_ELEMENTS, FALSE); |
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
492 bar_exif_add_column(eb->listview, _("Description"), EXIF_ADVCOL_DESCRIPTION, FALSE); |
9 | 493 |
494 eb->advanced_scrolled = gtk_scrolled_window_new(NULL, NULL); | |
495 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(eb->advanced_scrolled), GTK_SHADOW_IN); | |
496 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(eb->advanced_scrolled), | |
497 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
498 gtk_box_pack_start(GTK_BOX(eb->vbox), eb->advanced_scrolled, TRUE, TRUE, 0); | |
499 gtk_container_add(GTK_CONTAINER(eb->advanced_scrolled), eb->listview); | |
500 gtk_widget_show(eb->listview); | |
501 } | |
502 | |
503 static void bar_exif_advanced_cb(GtkWidget *widget, gpointer data) | |
504 { | |
505 ExifBar *eb = data; | |
506 gint advanced; | |
507 | |
508 advanced = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
509 | |
510 if (advanced) | |
511 { | |
512 gtk_widget_hide(eb->scrolled); | |
513 bar_exif_advanced_build_view(eb); | |
514 gtk_widget_show(eb->advanced_scrolled); | |
515 } | |
516 else | |
517 { | |
518 gtk_widget_hide(eb->advanced_scrolled); | |
519 gtk_widget_show(eb->scrolled); | |
520 } | |
521 | |
522 bar_exif_update(eb); | |
523 } | |
524 | |
525 gint bar_exif_is_advanced(GtkWidget *bar) | |
526 { | |
527 ExifBar *eb; | |
528 | |
529 eb = g_object_get_data(G_OBJECT(bar), "bar_exif_data"); | |
530 if (!eb) return FALSE; | |
531 | |
532 return (eb->advanced_scrolled && GTK_WIDGET_VISIBLE(eb->advanced_scrolled)); | |
533 } | |
534 | |
535 void bar_exif_close(GtkWidget *bar) | |
536 { | |
537 ExifBar *eb; | |
538 | |
539 eb = g_object_get_data(G_OBJECT(bar), "bar_exif_data"); | |
540 if (!eb) return; | |
541 | |
542 gtk_widget_destroy(eb->vbox); | |
543 } | |
544 | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
475
diff
changeset
|
545 static void bar_exif_width(ExifBar *eb, gint val) |
9 | 546 { |
547 gint size; | |
548 | |
549 size = eb->vbox->allocation.width; | |
550 size = CLAMP(size + val, EXIF_BAR_SIZE_INCREMENT * 2, EXIF_BAR_SIZE_INCREMENT * 16); | |
551 | |
552 gtk_widget_set_size_request(eb->vbox, size, -1); | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
475
diff
changeset
|
553 options->panels.exif.width = eb->vbox->allocation.width; |
9 | 554 } |
555 | |
556 static void bar_exif_larger(GtkWidget *widget, gpointer data) | |
557 { | |
558 ExifBar *eb = data; | |
559 | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
475
diff
changeset
|
560 bar_exif_width(eb, EXIF_BAR_SIZE_INCREMENT); |
9 | 561 } |
562 | |
563 static void bar_exif_smaller(GtkWidget *widget, gpointer data) | |
564 { | |
565 ExifBar *eb = data; | |
566 | |
489
3809ffa3567b
Save state and width of exif, info and sort panels to rc file.
zas_
parents:
475
diff
changeset
|
567 bar_exif_width(eb, -EXIF_BAR_SIZE_INCREMENT); |
9 | 568 } |
569 | |
570 static void bar_exif_destroy(GtkWidget *widget, gpointer data) | |
571 { | |
572 ExifBar *eb = data; | |
573 | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
574 g_free(eb->keys); |
9 | 575 g_free(eb->labels); |
138 | 576 file_data_unref(eb->fd); |
9 | 577 g_free(eb); |
578 } | |
579 | |
138 | 580 GtkWidget *bar_exif_new(gint show_title, FileData *fd, gint advanced, GtkWidget *bounding_widget) |
9 | 581 { |
582 ExifBar *eb; | |
583 GtkWidget *table; | |
584 GtkWidget *viewport; | |
585 GtkWidget *hbox; | |
586 GtkWidget *button; | |
587 gint i; | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
588 gint exif_len; |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
589 |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
590 for (exif_len = 0; ExifUIList[exif_len].key; exif_len++) |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
591 ; |
9 | 592 |
593 eb = g_new0(ExifBar, 1); | |
594 | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
595 eb->keys = g_new0(GtkWidget *, exif_len); |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
596 eb->labels = g_new0(GtkWidget *, exif_len); |
9 | 597 |
598 eb->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP); | |
599 g_object_set_data(G_OBJECT(eb->vbox), "bar_exif_data", eb); | |
600 g_signal_connect_after(G_OBJECT(eb->vbox), "destroy", | |
601 G_CALLBACK(bar_exif_destroy), eb); | |
602 | |
603 eb->allow_search = !show_title; | |
604 | |
605 if (show_title) | |
606 { | |
607 GtkWidget *box; | |
608 GtkWidget *label; | |
609 GtkWidget *button; | |
610 GtkWidget *arrow; | |
611 | |
612 box = gtk_hbox_new(FALSE, 0); | |
613 | |
614 label = sizer_new(eb->vbox, bounding_widget, SIZER_POS_LEFT); | |
615 sizer_set_limits(label, EXIF_BAR_SIZE_INCREMENT * 2, -1, -1 , -1); | |
616 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); | |
617 gtk_widget_show(label); | |
618 | |
619 label = gtk_label_new(_("Exif")); | |
620 pref_label_bold(label, TRUE, FALSE); | |
621 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0); | |
622 gtk_widget_show(label); | |
623 | |
624 button = gtk_button_new(); | |
625 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
626 g_signal_connect(G_OBJECT(button), "clicked", | |
627 G_CALLBACK(bar_exif_smaller), eb); | |
628 gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0); | |
629 arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE); | |
630 gtk_widget_set_size_request(arrow, EXIF_BAR_ARROW_SIZE, EXIF_BAR_ARROW_SIZE); | |
631 gtk_container_add(GTK_CONTAINER(button), arrow); | |
632 gtk_widget_show(arrow); | |
633 gtk_widget_show(button); | |
634 | |
635 button = gtk_button_new(); | |
636 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
637 g_signal_connect(G_OBJECT(button), "clicked", | |
638 G_CALLBACK(bar_exif_larger), eb); | |
639 gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0); | |
640 arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE); | |
641 gtk_widget_set_size_request(arrow, EXIF_BAR_ARROW_SIZE, EXIF_BAR_ARROW_SIZE); | |
642 gtk_container_add(GTK_CONTAINER(button), arrow); | |
643 gtk_widget_show(arrow); | |
644 gtk_widget_show(button); | |
645 | |
646 gtk_box_pack_start(GTK_BOX(eb->vbox), box, FALSE, FALSE, 0); | |
647 gtk_widget_show(box); | |
648 } | |
649 | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
650 |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
651 table = gtk_table_new(3, exif_len + 1 + EXIF_BAR_CUSTOM_COUNT, FALSE); |
9 | 652 |
653 eb->table = table; | |
654 | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
655 for (i = 0; ExifUIList[i].key; i++) |
9 | 656 { |
1053
77ca9a5d42be
fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents:
1052
diff
changeset
|
657 gchar *text; |
9 | 658 |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
659 text = exif_get_description_by_key(ExifUIList[i].key); |
442 | 660 eb->labels[i] = table_add_line(table, 0, i, text, NULL, |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
661 &eb->keys[i]); |
1053
77ca9a5d42be
fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents:
1052
diff
changeset
|
662 g_free(text); |
9 | 663 } |
664 | |
665 eb->custom_sep = gtk_hseparator_new(); | |
666 gtk_table_attach(GTK_TABLE(table), eb->custom_sep, 0, 1, | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
667 exif_len, exif_len + 1, |
9 | 668 GTK_FILL, GTK_FILL, 2, 2); |
669 | |
670 for (i = 0; i < EXIF_BAR_CUSTOM_COUNT; i++) | |
671 { | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
672 table_add_line_custom(table, 0, exif_len + 1 + i, |
1062
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
673 "", "", &eb->custom_name[i], &eb->custom_value[i], |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
674 &eb->custom_remove[i]); |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
675 g_signal_connect(G_OBJECT(eb->custom_remove[i]), "clicked", |
2e661b3e7ca0
Add a button for each advanced entry in Properties Exif Panel that allow to remove it from display. It fixes bug 1962611.
zas_
parents:
1055
diff
changeset
|
676 G_CALLBACK(bar_exif_remove_advanced_cb), eb); |
9 | 677 } |
678 | |
679 eb->scrolled = gtk_scrolled_window_new(NULL, NULL); | |
680 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(eb->scrolled), | |
681 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
682 | |
683 viewport = gtk_viewport_new(NULL, NULL); | |
684 gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE); | |
685 gtk_container_add(GTK_CONTAINER(eb->scrolled), viewport); | |
686 gtk_widget_show(viewport); | |
687 | |
688 gtk_container_add(GTK_CONTAINER(viewport), table); | |
689 gtk_widget_show(table); | |
690 | |
691 gtk_box_pack_start(GTK_BOX(eb->vbox), eb->scrolled, TRUE, TRUE, 0); | |
692 | |
693 hbox = gtk_hbox_new(FALSE, PREF_PAD_SPACE); | |
694 gtk_box_pack_end(GTK_BOX(eb->vbox), hbox, FALSE, FALSE, 0); | |
695 gtk_widget_show(hbox); | |
696 | |
697 button = gtk_check_button_new_with_label(_("Advanced view")); | |
698 if (advanced) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); | |
699 g_signal_connect(G_OBJECT(button), "toggled", | |
700 G_CALLBACK(bar_exif_advanced_cb), eb); | |
701 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
702 gtk_widget_show(button); | |
703 | |
704 eb->advanced_scrolled = NULL; | |
705 eb->listview = NULL; | |
706 | |
707 if (advanced) | |
708 { | |
709 bar_exif_advanced_build_view(eb); | |
710 gtk_widget_show(eb->advanced_scrolled); | |
711 } | |
712 else | |
713 { | |
714 gtk_widget_show(eb->scrolled); | |
715 } | |
716 | |
138 | 717 eb->fd = file_data_ref(fd); |
9 | 718 bar_exif_update(eb); |
719 | |
720 return eb->vbox; | |
721 } | |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
1053
diff
changeset
|
722 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |