annotate src/bar_exif.c @ 9:d907d608745f

Sync to GQview 1.5.9 release. ######## DO NOT BASE ENHANCEMENTS OR TRANSLATION UPDATES ON CODE IN THIS CVS! This CVS is never up to date with current development and is provided solely for reference purposes, please use the latest official release package when making any changes or translation updates. ########
author gqview
date Sat, 26 Feb 2005 00:13:35 +0000
parents
children 6948407f52a5
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 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2 * GQview
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * 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
10 */
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 #include "gqview.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "bar_exif.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "exif.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "ui_misc.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include <math.h>
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 #define EXIF_BAR_SIZE_INCREMENT 48
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #define EXIF_BAR_ARROW_SIZE 7
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #define EXIF_BAR_CUSTOM_COUNT 20
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 static const gchar *bar_exif_key_list[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 "fCamera",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 "fDateTime",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 "fShutterSpeed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 "fAperture",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 "ExposureProgram",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 "fExposureBias",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 "fISOSpeedRating",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 "fFocalLength",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 "fSubjectDistance",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 "MeteringMode",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 "fFlash",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 "LightSource",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 "fResolution",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 "Orientation",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 "ImageDescription",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 "Copyright"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 #define bar_exif_key_count (sizeof(bar_exif_key_list) / sizeof(gchar *))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 * table util
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 */
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 static void table_add_line_custom(GtkWidget *table, gint x, gint y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 const gchar *text1, const gchar *text2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 GtkWidget **label1, GtkWidget **label2)
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 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 buf = g_strconcat((text1) ? text1 : "fixme", ":", NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 if (!text2) text2 = "";
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 label = gtk_label_new(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 gtk_table_attach(GTK_TABLE(table), label,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 x, x + 1, y, y + 1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 GTK_FILL, GTK_FILL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 2, 2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 *label1 = label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 label = gtk_label_new(text2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 gtk_table_attach(GTK_TABLE(table), label,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 x + 1, x + 2, y, y + 1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 GTK_FILL, GTK_FILL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 2, 2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 *label2 = label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 static GtkWidget *table_add_line(GtkWidget *table, gint x, gint y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 const gchar *description, const gchar *text)
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 GtkWidget *key;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 GtkWidget *label;
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 table_add_line_custom(table, x, y, description, text, &key, &label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 gtk_widget_show(key);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 gtk_widget_show(label);
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 return label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 * EXIF bar
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 */
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 typedef struct _ExifBar ExifBar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106 struct _ExifBar
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 GtkWidget *vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 GtkWidget *scrolled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 GtkWidget *table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 GtkWidget *advanced_scrolled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 GtkWidget *listview;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 GtkWidget **labels;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 GtkWidget *custom_sep;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 GtkWidget *custom_name[EXIF_BAR_CUSTOM_COUNT];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 GtkWidget *custom_value[EXIF_BAR_CUSTOM_COUNT];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 gchar *path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 gint allow_search;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 };
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 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 EXIF_ADVCOL_ENABLED = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 EXIF_ADVCOL_TAG,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 EXIF_ADVCOL_NAME,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 EXIF_ADVCOL_VALUE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 EXIF_ADVCOL_FORMAT,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 EXIF_ADVCOL_ELEMENTS,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 EXIF_ADVCOL_DESCRIPTION,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 EXIF_ADVCOL_COUNT
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135 static gchar *bar_exif_validate_text(gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137 if (text && !g_utf8_validate(text, strlen(text), NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 gchar *tmp = text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 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
141 g_free(tmp);
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 return text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 }
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 static void bar_exif_sensitive(ExifBar *eb, gint enable)
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 gtk_widget_set_sensitive(eb->table, enable);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 if (eb->advanced_scrolled) gtk_widget_set_sensitive(eb->advanced_scrolled, enable);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 }
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 static gint bar_exif_row_enabled(const gchar *name)
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 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 list = history_list_get_by_key("exif_extras");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 if (name && strcmp(name, (gchar *)(list->data)) == 0) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 list = list->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 }
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 return FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 static void bar_exif_update(ExifBar *eb)
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 ExifData *exif;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 gint len, i;
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 exif = exif_read(eb->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 if (!exif)
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 bar_exif_sensitive(eb, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 bar_exif_sensitive(eb, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 if (GTK_WIDGET_VISIBLE(eb->scrolled))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 len = bar_exif_key_count;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 for (i = 0; i < len; i++)
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 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 text = exif_get_data_as_text(exif, bar_exif_key_list[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 text = bar_exif_validate_text(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 gtk_label_set_text(GTK_LABEL(eb->labels[i]), text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 list = g_list_last(history_list_get_by_key("exif_extras"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 if (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 gtk_widget_show(eb->custom_sep);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 gtk_widget_hide(eb->custom_sep);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 i = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 while (list && i < EXIF_BAR_CUSTOM_COUNT)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 gchar *name;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 name = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 list = list->prev;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 text = exif_get_data_as_text(exif, name);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 text = bar_exif_validate_text(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 buf = g_strconcat(name, ":", NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 gtk_label_set_text(GTK_LABEL(eb->custom_name[i]), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 gtk_label_set_text(GTK_LABEL(eb->custom_value[i]), text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 gtk_widget_show(eb->custom_name[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 gtk_widget_show(eb->custom_value[i]);
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 i++;
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 while (i < EXIF_BAR_CUSTOM_COUNT)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 gtk_widget_hide(eb->custom_name[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 gtk_widget_hide(eb->custom_value[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 i++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 if (eb->advanced_scrolled && GTK_WIDGET_VISIBLE(eb->advanced_scrolled))
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 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 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
242 gtk_list_store_clear(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 work = exif->items;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 ExifItem *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 gchar *tag;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 const gchar *tag_name;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 const gchar *format;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252 gchar *elements;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 const gchar *description;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 item = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 work = work->next;
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 tag = g_strdup_printf("0x%04x", item->tag);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 tag_name = exif_item_get_tag_name(item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 format = exif_item_get_format_name(item, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 text = exif_item_get_data_as_text(item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 text = bar_exif_validate_text(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 elements = g_strdup_printf("%d", item->elements);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 description = exif_item_get_description(item);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 if (!description) description = "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 gtk_list_store_append(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 gtk_list_store_set(store, &iter,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 EXIF_ADVCOL_ENABLED, bar_exif_row_enabled(tag_name),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 EXIF_ADVCOL_TAG, tag,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 EXIF_ADVCOL_NAME, tag_name,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 EXIF_ADVCOL_VALUE, text,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 EXIF_ADVCOL_FORMAT, format,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 EXIF_ADVCOL_ELEMENTS, elements,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 EXIF_ADVCOL_DESCRIPTION, description, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 g_free(tag);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 g_free(elements);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 exif_free(exif);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 static void bar_exif_clear(ExifBar *eb)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 gint len;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 if (!GTK_WIDGET_SENSITIVE(eb->labels[0])) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 len = bar_exif_key_count;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 for (i = 0; i < len; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 gtk_label_set_text(GTK_LABEL(eb->labels[i]), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 for (i = 0; i < EXIF_BAR_CUSTOM_COUNT; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 gtk_label_set_text(GTK_LABEL(eb->custom_value[i]), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 if (eb->listview)
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 GtkListStore *store;
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 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
306 gtk_list_store_clear(store);
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 }
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 void bar_exif_set(GtkWidget *bar, const gchar *path)
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 ExifBar *eb;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 eb = g_object_get_data(G_OBJECT(bar), "bar_exif_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 if (!eb) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 /* store this, advanced view toggle needs to reload data */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 g_free(eb->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 eb->path = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 bar_exif_clear(eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 bar_exif_update(eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 }
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 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
326 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 GtkWidget *listview = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 gchar *name = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 gboolean active;
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(listview));
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 tpath = gtk_tree_path_new_from_string(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 gtk_tree_model_get(store, &iter, EXIF_ADVCOL_ENABLED, &active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 EXIF_ADVCOL_NAME, &name, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 active = (!active);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 if (active &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 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
346 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 active = FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350 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
351
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352 if (active)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 history_list_add_to_key("exif_extras", name, EXIF_BAR_CUSTOM_COUNT);
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 else
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 history_list_item_change("exif_extras", name, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 g_free(name);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364 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
365 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 GtkCellRenderer *renderer;
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 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 gtk_tree_view_column_set_title(column, title);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 renderer = gtk_cell_renderer_toggle_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 gtk_tree_view_column_add_attribute(column, renderer, "active", n);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column);
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 g_signal_connect(G_OBJECT(renderer), "toggled",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 G_CALLBACK(bar_exif_row_toggled_cb), listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 }
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 static void bar_exif_add_column(GtkWidget *listview, const gchar *title, gint n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388 gtk_tree_view_column_set_title(column, title);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
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 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 gtk_tree_view_column_add_attribute(column, renderer, "text", n);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 static void bar_exif_advanced_build_view(ExifBar *eb)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 if (eb->listview) return;
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 store = gtk_list_store_new(7, G_TYPE_BOOLEAN,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 eb->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 g_object_unref(store);
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 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(eb->listview), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(eb->listview), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 if (eb->allow_search)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 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
415 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(eb->listview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421 bar_exif_add_column_check(eb->listview, "", EXIF_ADVCOL_ENABLED);
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 bar_exif_add_column(eb->listview, _("Tag"), EXIF_ADVCOL_TAG);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 bar_exif_add_column(eb->listview, _("Name"), EXIF_ADVCOL_NAME);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 bar_exif_add_column(eb->listview, _("Value"), EXIF_ADVCOL_VALUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 bar_exif_add_column(eb->listview, _("Format"), EXIF_ADVCOL_FORMAT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 bar_exif_add_column(eb->listview, _("Elements"), EXIF_ADVCOL_ELEMENTS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 bar_exif_add_column(eb->listview, _("Description"), EXIF_ADVCOL_DESCRIPTION);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430 eb->advanced_scrolled = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431 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
432 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(eb->advanced_scrolled),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 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
435 gtk_container_add(GTK_CONTAINER(eb->advanced_scrolled), eb->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 gtk_widget_show(eb->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 static void bar_exif_advanced_cb(GtkWidget *widget, gpointer data)
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 ExifBar *eb = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 gint advanced;
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 advanced = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
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 if (advanced)
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 gtk_widget_hide(eb->scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 bar_exif_advanced_build_view(eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 gtk_widget_show(eb->advanced_scrolled);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 gtk_widget_hide(eb->advanced_scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 gtk_widget_show(eb->scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 bar_exif_update(eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 gint bar_exif_is_advanced(GtkWidget *bar)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 ExifBar *eb;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465 eb = g_object_get_data(G_OBJECT(bar), "bar_exif_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
466 if (!eb) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468 return (eb->advanced_scrolled && GTK_WIDGET_VISIBLE(eb->advanced_scrolled));
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 void bar_exif_close(GtkWidget *bar)
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;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
474
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475 eb = g_object_get_data(G_OBJECT(bar), "bar_exif_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
476 if (!eb) return;
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 gtk_widget_destroy(eb->vbox);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 static void bar_exif_size(ExifBar *eb, gint val)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483 gint size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485 size = eb->vbox->allocation.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 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
487
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 gtk_widget_set_size_request(eb->vbox, size, -1);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 static void bar_exif_larger(GtkWidget *widget, gpointer data)
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 ExifBar *eb = data;
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 bar_exif_size(eb, EXIF_BAR_SIZE_INCREMENT);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 static void bar_exif_smaller(GtkWidget *widget, gpointer data)
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 ExifBar *eb = data;
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 bar_exif_size(eb, -EXIF_BAR_SIZE_INCREMENT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 }
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 static void bar_exif_destroy(GtkWidget *widget, gpointer data)
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 ExifBar *eb = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 g_free(eb->labels);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 g_free(eb->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 g_free(eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 GtkWidget *bar_exif_new(gint show_title, const gchar *path, gint advanced, GtkWidget *bounding_widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 ExifBar *eb;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 GtkWidget *table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 GtkWidget *viewport;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 gint len;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522 gint i;
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 eb = g_new0(ExifBar, 1);
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 eb->labels = g_new0(GtkWidget *, bar_exif_key_count);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 eb->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 g_object_set_data(G_OBJECT(eb->vbox), "bar_exif_data", eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 g_signal_connect_after(G_OBJECT(eb->vbox), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531 G_CALLBACK(bar_exif_destroy), eb);
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 eb->allow_search = !show_title;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 if (show_title)
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 GtkWidget *box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540 GtkWidget *arrow;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 box = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 label = sizer_new(eb->vbox, bounding_widget, SIZER_POS_LEFT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545 sizer_set_limits(label, EXIF_BAR_SIZE_INCREMENT * 2, -1, -1 , -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
546 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
547 gtk_widget_show(label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
548
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
549 label = gtk_label_new(_("Exif"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
550 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552 gtk_widget_show(label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 button = gtk_button_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
555 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
556 g_signal_connect(G_OBJECT(button), "clicked",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557 G_CALLBACK(bar_exif_smaller), eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
558 gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 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
561 gtk_container_add(GTK_CONTAINER(button), arrow);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 gtk_widget_show(arrow);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
564
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 button = gtk_button_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567 g_signal_connect(G_OBJECT(button), "clicked",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 G_CALLBACK(bar_exif_larger), eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 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
572 gtk_container_add(GTK_CONTAINER(button), arrow);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 gtk_widget_show(arrow);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 gtk_box_pack_start(GTK_BOX(eb->vbox), box, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 gtk_widget_show(box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 }
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 table = gtk_table_new(2, bar_exif_key_count + 1 + EXIF_BAR_CUSTOM_COUNT, FALSE);
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 eb->table = table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 len = bar_exif_key_count;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 for (i = 0; i < len; i++)
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 const gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 text = exif_get_description_by_key(bar_exif_key_list[i]);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 eb->labels[i] = table_add_line(table, 0, i, text, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 eb->custom_sep = gtk_hseparator_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 gtk_table_attach(GTK_TABLE(table), eb->custom_sep, 0, 1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 bar_exif_key_count, bar_exif_key_count + 1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 GTK_FILL, GTK_FILL, 2, 2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 for (i = 0; i < EXIF_BAR_CUSTOM_COUNT; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 table_add_line_custom(table, 0, bar_exif_key_count + 1 + i,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 "", "", &eb->custom_name[i], &eb->custom_value[i]);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 eb->scrolled = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(eb->scrolled),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 viewport = gtk_viewport_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 gtk_container_add(GTK_CONTAINER(eb->scrolled), viewport);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 gtk_widget_show(viewport);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 gtk_container_add(GTK_CONTAINER(viewport), table);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 gtk_widget_show(table);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 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
617
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 hbox = gtk_hbox_new(FALSE, PREF_PAD_SPACE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 gtk_box_pack_end(GTK_BOX(eb->vbox), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 button = gtk_check_button_new_with_label(_("Advanced view"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 if (advanced) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 g_signal_connect(G_OBJECT(button), "toggled",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 G_CALLBACK(bar_exif_advanced_cb), eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 eb->advanced_scrolled = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 eb->listview = NULL;
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 if (advanced)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 bar_exif_advanced_build_view(eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635 gtk_widget_show(eb->advanced_scrolled);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 gtk_widget_show(eb->scrolled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 }
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 eb->path = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 bar_exif_update(eb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645 return eb->vbox;
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