annotate src/bar_exif.c @ 550:00462776e9a2

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