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