Mercurial > geeqie
annotate src/bar_exif.c @ 1309:55ea4962887a
config file format changed to XML
save and restore all layout windows
save and restore sidebar configuration
author | nadvornik |
---|---|
date | Sun, 22 Feb 2009 15:35:37 +0000 |
parents | 48e064b37ba6 |
children | 8cca18bce950 |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
9 | 3 * (C) 2004 John Ellis |
1284 | 4 * Copyright (C) 2008 - 2009 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" | |
1288 | 18 #include "metadata.h" |
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
902
diff
changeset
|
19 #include "filedata.h" |
902 | 20 #include "history_list.h" |
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
902
diff
changeset
|
21 #include "misc.h" |
9 | 22 #include "ui_misc.h" |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
23 #include "bar.h" |
1309 | 24 #include "rcfile.h" |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
25 |
9 | 26 |
27 #include <math.h> | |
28 | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
29 ExifUI ExifUIList[]={ |
1189 | 30 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("Camera")}, |
31 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("DateTime")}, | |
32 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("ShutterSpeed")}, | |
33 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("Aperture")}, | |
34 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("ExposureBias")}, | |
35 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("ISOSpeedRating")}, | |
36 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("FocalLength")}, | |
37 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("FocalLength35mmFilm")}, | |
38 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("Flash")}, | |
325 | 39 { 0, 0, EXIF_UI_IFSET, "Exif.Photo.ExposureProgram"}, |
40 { 0, 0, EXIF_UI_IFSET, "Exif.Photo.MeteringMode"}, | |
41 { 0, 0, EXIF_UI_IFSET, "Exif.Photo.LightSource"}, | |
1189 | 42 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("ColorProfile")}, |
43 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("SubjectDistance")}, | |
44 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("Resolution")}, | |
325 | 45 { 0, 0, EXIF_UI_IFSET, "Exif.Image.Orientation"}, |
1189 | 46 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("GPSPosition")}, |
47 { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("GPSAltitude")}, | |
325 | 48 { 0, 0, EXIF_UI_IFSET, "Exif.Image.ImageDescription"}, |
49 { 0, 0, EXIF_UI_IFSET, "Exif.Image.Copyright"}, | |
50 { 0, 0, EXIF_UI_OFF, NULL} | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
51 }; |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
52 |
9 | 53 |
54 /* | |
55 *------------------------------------------------------------------- | |
56 * table util | |
57 *------------------------------------------------------------------- | |
58 */ | |
59 | |
60 static void table_add_line_custom(GtkWidget *table, gint x, gint y, | |
442 | 61 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
|
62 GtkWidget **label1, GtkWidget **label2, |
1065 | 63 GtkWidget **remove) |
9 | 64 { |
65 GtkWidget *label; | |
66 gchar *buf; | |
67 | |
68 buf = g_strconcat((text1) ? text1 : "fixme", ":", NULL); | |
69 if (!text2) text2 = ""; | |
70 | |
71 label = gtk_label_new(buf); | |
72 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.0); | |
73 pref_label_bold(label, TRUE, FALSE); | |
74 gtk_table_attach(GTK_TABLE(table), label, | |
1065 | 75 x + 1, x + 2, y, y + 1, |
9 | 76 GTK_FILL, GTK_FILL, |
77 2, 2); | |
78 *label1 = label; | |
79 | |
80 label = gtk_label_new(text2); | |
81 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); | |
82 gtk_table_attach(GTK_TABLE(table), label, | |
1065 | 83 x + 2, x + 3, y, y + 1, |
9 | 84 GTK_FILL, GTK_FILL, |
85 2, 2); | |
86 *label2 = label; | |
87 | |
1065 | 88 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
|
89 { |
1065 | 90 *remove = gtk_check_button_new(); |
91 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(*remove), TRUE); | |
92 | |
93 gtk_table_attach(GTK_TABLE(table), *remove, | |
94 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
|
95 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
|
96 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
|
97 } |
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 |
9 | 99 g_free(buf); |
100 } | |
101 | |
102 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
|
103 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
|
104 GtkWidget **keyret) |
9 | 105 { |
106 GtkWidget *key; | |
107 GtkWidget *label; | |
108 | |
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
|
109 table_add_line_custom(table, x, y, description, text, &key, &label, NULL); |
9 | 110 gtk_widget_show(key); |
111 gtk_widget_show(label); | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
112 if (keyret) *keyret = key; |
9 | 113 |
114 return label; | |
115 } | |
116 | |
117 | |
118 /* | |
119 *------------------------------------------------------------------- | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
120 * EXIF widget |
9 | 121 *------------------------------------------------------------------- |
122 */ | |
123 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
124 typedef struct _PaneExifData PaneExifData; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
125 struct _PaneExifData |
9 | 126 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
127 PaneData pane; |
9 | 128 GtkWidget *vbox; |
129 GtkWidget *scrolled; | |
130 GtkWidget *table; | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
131 GtkWidget **keys; |
9 | 132 GtkWidget **labels; |
133 | |
134 GtkWidget *custom_sep; | |
135 GtkWidget *custom_name[EXIF_BAR_CUSTOM_COUNT]; | |
136 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
|
137 GtkWidget *custom_remove[EXIF_BAR_CUSTOM_COUNT]; |
9 | 138 |
138 | 139 FileData *fd; |
9 | 140 |
141 gint allow_search; | |
142 }; | |
143 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
144 static void bar_pane_exif_sensitive(PaneExifData *ped, gint enable) |
9 | 145 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
146 gtk_widget_set_sensitive(ped->table, enable); |
9 | 147 } |
148 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
149 static void bar_pane_exif_update(PaneExifData *ped) |
9 | 150 { |
151 ExifData *exif; | |
233 | 152 gint i; |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
153 GList *list; |
9 | 154 |
1288 | 155 /* do we have any exif at all ? */ |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
156 exif = exif_read_fd(ped->fd); |
9 | 157 |
1288 | 158 if (!exif) |
9 | 159 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
160 bar_pane_exif_sensitive(ped, FALSE); |
9 | 161 return; |
162 } | |
1069 | 163 else |
164 { | |
1288 | 165 /* we will use high level functions so we can release it for now. |
166 it will stay in the cache */ | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
167 exif_free_fd(ped->fd, exif); |
1288 | 168 exif = NULL; |
1069 | 169 } |
1288 | 170 |
9 | 171 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
172 bar_pane_exif_sensitive(ped, TRUE); |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
173 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
174 for (i = 0; ExifUIList[i].key; i++) |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
175 { |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
176 gchar *text; |
9 | 177 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
178 if (ExifUIList[i].current == EXIF_UI_OFF) |
9 | 179 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
180 gtk_widget_hide(ped->labels[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
181 gtk_widget_hide(ped->keys[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
182 continue; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
183 } |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
184 text = metadata_read_string(ped->fd, ExifUIList[i].key, METADATA_FORMATTED); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
185 if (ExifUIList[i].current == EXIF_UI_IFSET |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
186 && (!text || !*text)) |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
187 { |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
188 gtk_widget_hide(ped->labels[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
189 gtk_widget_hide(ped->keys[i]); |
1288 | 190 g_free(text); |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
191 continue; |
9 | 192 } |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
193 gtk_widget_show(ped->labels[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
194 gtk_widget_show(ped->keys[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
195 gtk_label_set_text(GTK_LABEL(ped->labels[i]), text); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
196 g_free(text); |
9 | 197 } |
198 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
199 list = g_list_last(history_list_get_by_key("exif_extras")); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
200 if (list) |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
201 { |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
202 gtk_widget_show(ped->custom_sep); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
203 } |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
204 else |
9 | 205 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
206 gtk_widget_hide(ped->custom_sep); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
207 } |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
208 i = 0; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
209 while (list && i < EXIF_BAR_CUSTOM_COUNT) |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
210 { |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
211 gchar *text; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
212 gchar *name; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
213 gchar *buf; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
214 gchar *description; |
1288 | 215 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
216 name = list->data; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
217 list = list->prev; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
218 |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
219 text = metadata_read_string(ped->fd, name, METADATA_FORMATTED); |
9 | 220 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
221 description = exif_get_tag_description_by_key(name); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
222 if (!description || *description == '\0') |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
223 { |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
224 g_free(description); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
225 description = g_strdup(name); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
226 } |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
227 buf = g_strconcat(description, ":", NULL); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
228 g_free(description); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
229 |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
230 gtk_label_set_text(GTK_LABEL(ped->custom_name[i]), buf); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
231 g_free(buf); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
232 gtk_label_set_text(GTK_LABEL(ped->custom_value[i]), text); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
233 g_free(text); |
767
e73d30e0c896
Make utf8_validate_or_convert() to always allocate a new string.
zas_
parents:
680
diff
changeset
|
234 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
235 gtk_widget_show(ped->custom_name[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
236 gtk_widget_show(ped->custom_value[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
237 g_object_set_data(G_OBJECT(ped->custom_remove[i]), "key", name); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
238 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ped->custom_remove[i]), TRUE); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
239 gtk_widget_show(ped->custom_remove[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
240 |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
241 i++; |
9 | 242 } |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
243 while (i < EXIF_BAR_CUSTOM_COUNT) |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
244 { |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
245 g_object_set_data(G_OBJECT(ped->custom_remove[i]), "key", NULL); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
246 gtk_widget_hide(ped->custom_name[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
247 gtk_widget_hide(ped->custom_value[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
248 gtk_widget_hide(ped->custom_remove[i]); |
9 | 249 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
250 i++; |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
251 } |
9 | 252 } |
253 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
254 static void bar_pane_exif_clear(PaneExifData *ped) |
9 | 255 { |
256 gint i; | |
257 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
258 if (!GTK_WIDGET_SENSITIVE(ped->labels[0])) return; |
9 | 259 |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
260 for (i = 0; ExifUIList[i].key; i++) |
9 | 261 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
262 gtk_label_set_text(GTK_LABEL(ped->labels[i]), ""); |
9 | 263 } |
264 for (i = 0; i < EXIF_BAR_CUSTOM_COUNT; i++) | |
265 { | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
266 gtk_label_set_text(GTK_LABEL(ped->custom_value[i]), ""); |
9 | 267 } |
268 } | |
269 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
270 void bar_pane_exif_set_fd(GtkWidget *widget, FileData *fd) |
9 | 271 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
272 PaneExifData *ped; |
9 | 273 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
274 ped = g_object_get_data(G_OBJECT(widget), "pane_data"); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
275 if (!ped) return; |
9 | 276 |
277 /* store this, advanced view toggle needs to reload data */ | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
278 file_data_unref(ped->fd); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
279 ped->fd = file_data_ref(fd); |
9 | 280 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
281 bar_pane_exif_clear(ped); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
282 bar_pane_exif_update(ped); |
9 | 283 } |
284 | |
1309 | 285 static void bar_pane_exif_write_config(GtkWidget *pane, GString *outstr, gint indent) |
286 { | |
287 PaneExifData *ped; | |
288 | |
289 ped = g_object_get_data(G_OBJECT(pane), "pane_data"); | |
290 if (!ped) return; | |
291 | |
292 write_indent(outstr, indent); | |
293 g_string_append_printf(outstr, "<pane_exif\n"); | |
294 indent++; | |
295 WRITE_CHAR(*ped, pane.title); | |
296 WRITE_BOOL(*ped, pane.expanded); | |
297 indent--; | |
298 write_indent(outstr, indent); | |
299 g_string_append_printf(outstr, "/>\n"); | |
300 } | |
301 | |
302 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
303 static void bar_pane_exif_remove_advanced_cb(GtkWidget *widget, gpointer data) |
9 | 304 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
305 PaneExifData *ped = data; |
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
|
306 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
|
307 |
1065 | 308 /* continue only if the toggle was deactivated */ |
309 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) return; | |
310 | |
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
|
311 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
|
312 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
|
313 |
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
|
314 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
|
315 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
316 bar_pane_exif_update(ped); |
9 | 317 } |
318 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
319 void bar_pane_exif_close(GtkWidget *widget) |
9 | 320 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
321 PaneExifData *ped; |
48
6948407f52a5
Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
322 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
323 ped = g_object_get_data(G_OBJECT(widget), "pane_data"); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
324 if (!ped) return; |
9 | 325 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
326 gtk_widget_destroy(ped->vbox); |
9 | 327 } |
328 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
329 static void bar_pane_exif_destroy(GtkWidget *widget, gpointer data) |
9 | 330 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
331 PaneExifData *ped = data; |
9 | 332 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
333 g_free(ped->keys); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
334 g_free(ped->labels); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
335 file_data_unref(ped->fd); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
336 g_free(ped); |
9 | 337 } |
338 | |
1309 | 339 GtkWidget *bar_pane_exif_new(const gchar *title, gboolean expanded) |
9 | 340 { |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
341 PaneExifData *ped; |
9 | 342 GtkWidget *table; |
343 GtkWidget *viewport; | |
344 GtkWidget *hbox; | |
345 gint i; | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
346 gint exif_len; |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
347 |
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
348 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
|
349 ; |
9 | 350 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
351 ped = g_new0(PaneExifData, 1); |
9 | 352 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
353 ped->pane.pane_set_fd = bar_pane_exif_set_fd; |
1309 | 354 ped->pane.pane_write_config = bar_pane_exif_write_config; |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
355 ped->pane.title = g_strdup(title); |
1309 | 356 ped->pane.expanded = expanded; |
9 | 357 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
358 ped->keys = g_new0(GtkWidget *, exif_len); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
359 ped->labels = g_new0(GtkWidget *, exif_len); |
9 | 360 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
361 ped->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
362 g_object_set_data(G_OBJECT(ped->vbox), "pane_data", ped); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
363 g_signal_connect_after(G_OBJECT(ped->vbox), "destroy", |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
364 G_CALLBACK(bar_pane_exif_destroy), ped); |
9 | 365 |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
366 |
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
|
367 table = gtk_table_new(3, exif_len + 1 + EXIF_BAR_CUSTOM_COUNT, FALSE); |
9 | 368 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
369 ped->table = table; |
9 | 370 |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
371 for (i = 0; ExifUIList[i].key; i++) |
9 | 372 { |
1053
77ca9a5d42be
fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents:
1052
diff
changeset
|
373 gchar *text; |
9 | 374 |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
375 text = exif_get_description_by_key(ExifUIList[i].key); |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
376 ped->labels[i] = table_add_line(table, 0, i, text, NULL, |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
377 &ped->keys[i]); |
1053
77ca9a5d42be
fixed charset of exiv2 strings in non-utf8 locales
nadvornik
parents:
1052
diff
changeset
|
378 g_free(text); |
9 | 379 } |
380 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
381 ped->custom_sep = gtk_hseparator_new(); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
382 gtk_table_attach(GTK_TABLE(table), ped->custom_sep, 0, 3, |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
383 exif_len, exif_len + 1, |
9 | 384 GTK_FILL, GTK_FILL, 2, 2); |
385 | |
386 for (i = 0; i < EXIF_BAR_CUSTOM_COUNT; i++) | |
387 { | |
222
77f1bcc6c161
various exif improvements based on patch by Uwe Ohse
nadvornik
parents:
204
diff
changeset
|
388 table_add_line_custom(table, 0, exif_len + 1 + i, |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
389 "", "", &ped->custom_name[i], &ped->custom_value[i], |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
390 &ped->custom_remove[i]); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
391 g_signal_connect(G_OBJECT(ped->custom_remove[i]), "clicked", |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
392 G_CALLBACK(bar_pane_exif_remove_advanced_cb), ped); |
9 | 393 } |
394 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
395 ped->scrolled = gtk_scrolled_window_new(NULL, NULL); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
396 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ped->scrolled), |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
397 GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); |
9 | 398 |
399 viewport = gtk_viewport_new(NULL, NULL); | |
400 gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE); | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
401 gtk_container_add(GTK_CONTAINER(ped->scrolled), viewport); |
9 | 402 gtk_widget_show(viewport); |
403 | |
404 gtk_container_add(GTK_CONTAINER(viewport), table); | |
405 gtk_widget_show(table); | |
406 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
407 gtk_box_pack_start(GTK_BOX(ped->vbox), ped->scrolled, TRUE, TRUE, 0); |
9 | 408 |
409 hbox = gtk_hbox_new(FALSE, PREF_PAD_SPACE); | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
410 gtk_box_pack_end(GTK_BOX(ped->vbox), hbox, FALSE, FALSE, 0); |
9 | 411 gtk_widget_show(hbox); |
412 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
413 gtk_widget_show(ped->scrolled); |
9 | 414 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
415 gtk_widget_show(ped->vbox); |
9 | 416 |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1288
diff
changeset
|
417 return ped->vbox; |
9 | 418 } |
1309 | 419 |
420 GtkWidget *bar_pane_exif_new_from_config(const gchar **attribute_names, const gchar **attribute_values) | |
421 { | |
422 gchar *title = g_strdup(_("NoName")); | |
423 gboolean expanded = TRUE; | |
424 | |
425 while (*attribute_names) | |
426 { | |
427 const gchar *option = *attribute_names++; | |
428 const gchar *value = *attribute_values++; | |
429 | |
430 READ_CHAR_FULL("pane.title", title); | |
431 READ_BOOL_FULL("pane.expanded", expanded); | |
432 | |
433 | |
434 DEBUG_1("unknown attribute %s = %s", option, value); | |
435 } | |
436 | |
437 return bar_pane_exif_new(title, expanded); | |
438 } | |
439 | |
440 | |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
1053
diff
changeset
|
441 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |