annotate src/info.c @ 375:612b39ee9a7e

Rename l_conf to layout_order and make it more local.
author zas_
date Tue, 15 Apr 2008 20:55:21 +0000
parents 6a7298988a7a
children 4b2d7f9af171
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: 138
diff changeset
2 * Geeqie
9
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
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 271
diff changeset
13 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "info.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 "bar_info.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "bar_exif.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "dnd.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "filelist.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "image-load.h"
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
22 #include "pixbuf-renderer.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "ui_misc.h"
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 #include <pwd.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #include <grp.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 #define IMAGE_SIZE_W 200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 #define IMAGE_SIZE_H 200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33
90
dc3c77d027e6 Tue Oct 31 18:06:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
34 #define DEF_PROPERTY_WIDTH 600
dc3c77d027e6 Tue Oct 31 18:06:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
35 #define DEF_PROPERTY_HEIGHT 400
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 typedef struct _TabData TabData;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 struct _TabData
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 void (*func_free)(gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 void (*func_sync)(InfoData *id, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 void (*func_image)(InfoData *id, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 gpointer data;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
44 TabData *(*func_new)(InfoData *id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
45 GtkWidget *child;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
48 typedef struct _InfoTabsPos InfoTabsPos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
49 struct _InfoTabsPos
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
50 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
51 TabData *(*func)(InfoData *id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
52 gint pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
53 };
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
54
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
55 static GList *info_tabs_pos_list = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56
271
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
57 static void notebook_set_tab_reorderable(GtkNotebook *notebook, GtkWidget *child, gboolean reorderable)
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
58 {
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
59 #if GTK_CHECK_VERSION(2,10,0)
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
60 gtk_notebook_set_tab_reorderable(notebook, child, reorderable);
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
61 #endif
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
62 }
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
63
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 * table utils
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 GtkWidget *table_add_line(GtkWidget *table, gint x, gint y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 const gchar *description, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 if (!text) text = "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 label = pref_table_label(table, x, y, description, 1.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 pref_label_bold(label, TRUE, FALSE);
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 = pref_table_label(table, x + 1, y, text, 0.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 return label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 }
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 * EXIF tab
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 */
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 static void info_tab_exif_image(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 GtkWidget *bar = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
93 FileData *fd;
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 if (id->image->unknown)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
97 fd = NULL;
9
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
101 fd = id->image->image_fd;
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
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
104 bar_exif_set(bar, fd);
9
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 static void info_tab_exif_sync(InfoData *id, gpointer data)
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 GtkWidget *bar = data;
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 bar_exif_set(bar, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 static TabData *info_tab_exif_new(InfoData *id)
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 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 GtkWidget *bar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 bar = bar_exif_new(FALSE, NULL, FALSE, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 gtk_container_set_border_width(GTK_CONTAINER(bar), PREF_PAD_BORDER);
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 label = gtk_label_new(_("Exif"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 gtk_notebook_append_page(GTK_NOTEBOOK(id->notebook), bar, label);
271
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
125 notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), bar, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 gtk_widget_show(bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 td->func_free = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 td->func_sync = info_tab_exif_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 td->func_image = info_tab_exif_image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 td->data = bar;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
134 td->func_new = info_tab_exif_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
135 td->child = bar;
9
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 return td;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 * file attributes tab
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 *-------------------------------------------------------------------
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 typedef struct _InfoTabMeta InfoTabMeta;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 struct _InfoTabMeta
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 GtkWidget *bar_info;
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 void info_tab_meta_free(gpointer data)
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 InfoTabMeta *tab = data;
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 g_free(tab);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 }
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 static void info_tab_meta_sync(InfoData *id, gpointer data)
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 InfoTabMeta *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
163 bar_info_set(tab->bar_info, id->fd);
9
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 GList *info_tab_meta_list_cb(gpointer data)
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 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 return path_list_copy(id->list);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 static TabData *info_tab_meta_new(InfoData *id)
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 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 InfoTabMeta *tab;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 GtkWidget *label;
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 tab = g_new0(InfoTabMeta, 1);
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 tab->bar_info = bar_info_new(NULL, TRUE, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 bar_info_set_selection_func(tab->bar_info, info_tab_meta_list_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 bar_info_selection(tab->bar_info, g_list_length(id->list) - 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 gtk_container_set_border_width(GTK_CONTAINER(tab->bar_info), PREF_PAD_BORDER);
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 label = gtk_label_new(_("Keywords"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 gtk_notebook_append_page(GTK_NOTEBOOK(id->notebook), tab->bar_info, label);
271
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
189 notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), tab->bar_info, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 gtk_widget_show(tab->bar_info);
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 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 td->func_free = info_tab_meta_free;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 td->func_sync = info_tab_meta_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 td->func_image = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 td->data = tab;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
198 td->func_new = info_tab_meta_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
199 td->child = tab->bar_info;
9
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 return td;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 /*
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 * general tab
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 */
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 typedef struct _InfoTabGeneral InfoTabGeneral;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 struct _InfoTabGeneral
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 GtkWidget *label_file_time;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 GtkWidget *label_file_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 GtkWidget *label_dimensions;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 GtkWidget *label_transparent;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 GtkWidget *label_image_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 GtkWidget *label_compression;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 GtkWidget *label_mime_type;
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 GtkWidget *label_user;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 GtkWidget *label_group;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 GtkWidget *label_perms;
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 gint compression_done;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 gint64 byte_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 };
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 static void info_tab_general_image(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 InfoTabGeneral *tab = data;
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 guint mem_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 gint has_alpha;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
235 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
236 gint width, height;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 if (id->image->unknown) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
240 pixbuf_renderer_get_image_size(PIXBUF_RENDERER(id->image->pr), &width, &height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
241
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
242 buf = g_strdup_printf("%d x %d", width, height);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 gtk_label_set_text(GTK_LABEL(tab->label_dimensions), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
246 pixbuf = image_get_pixbuf(id->image);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
247 if (pixbuf)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
249 has_alpha = gdk_pixbuf_get_has_alpha(pixbuf);
9
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 else
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 has_alpha = FALSE;
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 gtk_label_set_text(GTK_LABEL(tab->label_transparent), has_alpha ? _("yes") : _("no"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
257 mem_size = width * height * ((has_alpha) ? 4 : 3);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 buf = text_from_size_abrev(mem_size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 gtk_label_set_text(GTK_LABEL(tab->label_image_size), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 if (!tab->compression_done && mem_size > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 {
15
3263965d5f9e ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
264 buf = g_strdup_printf("%.1f%%", (double)tab->byte_size / mem_size * 100.0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 gtk_label_set_text(GTK_LABEL(tab->label_compression), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 tab->compression_done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 }
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 buf = image_loader_get_format(id->image->il);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 if (buf)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 gtk_label_set_text(GTK_LABEL(tab->label_mime_type), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 static gchar *mode_number(mode_t m)
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 int mb, mu, mg, mo;
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 mb = mu = mg = mo = 0;
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 if (m & S_ISUID) mb |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 if (m & S_ISGID) mb |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 if (m & S_ISVTX) mb |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 if (m & S_IRUSR) mu |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 if (m & S_IWUSR) mu |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 if (m & S_IXUSR) mu |= 1;
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 if (m & S_IRGRP) mg |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 if (m & S_IWGRP) mg |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 if (m & S_IXGRP) mg |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 if (m & S_IROTH) mo |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 if (m & S_IWOTH) mo |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 if (m & S_IXOTH) mo |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 return g_strdup_printf("%d%d%d%d", mb, mu, mg, mo);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 static void info_tab_general_sync_perm(InfoTabGeneral *tab, InfoData *id)
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 struct stat st;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
306 if (!stat_utf8(id->fd->path, &st))
9
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 gtk_label_set_text(GTK_LABEL(tab->label_user), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 gtk_label_set_text(GTK_LABEL(tab->label_group), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 gtk_label_set_text(GTK_LABEL(tab->label_perms), "");
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 else
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 struct passwd *user;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 struct group *grp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 gchar pbuf[12];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 gchar *pmod;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 gchar *buf;
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 user = getpwuid(st.st_uid);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 gtk_label_set_text(GTK_LABEL(tab->label_user), (user) ? user->pw_name : "");
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 grp = getgrgid(st.st_gid);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 gtk_label_set_text(GTK_LABEL(tab->label_group), (grp) ? grp->gr_name : "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 pbuf[0] = (st.st_mode & S_IRUSR) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 pbuf[1] = (st.st_mode & S_IWUSR) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 pbuf[2] = (st.st_mode & S_IXUSR) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 pbuf[3] = (st.st_mode & S_IRGRP) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 pbuf[4] = (st.st_mode & S_IWGRP) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 pbuf[5] = (st.st_mode & S_IXGRP) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 pbuf[6] = (st.st_mode & S_IROTH) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 pbuf[7] = (st.st_mode & S_IWOTH) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 pbuf[8] = (st.st_mode & S_IXOTH) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 pbuf[9] = '\0';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 pmod = mode_number(st.st_mode);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 buf = g_strdup_printf("%s (%s)", pbuf, pmod);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 gtk_label_set_text(GTK_LABEL(tab->label_perms), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 g_free(pmod);
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 static void info_tab_general_sync(InfoData *id, gpointer data)
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 InfoTabGeneral *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
350 gtk_label_set_text(GTK_LABEL(tab->label_file_time), text_from_time(id->fd->date));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
351
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
352 tab->byte_size = id->fd->size;
9
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 buf = text_from_size(tab->byte_size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 gtk_label_set_text(GTK_LABEL(tab->label_file_size), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 g_free(buf);
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 gtk_label_set_text(GTK_LABEL(tab->label_dimensions), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 gtk_label_set_text(GTK_LABEL(tab->label_transparent), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 gtk_label_set_text(GTK_LABEL(tab->label_image_size), "");
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_label_set_text(GTK_LABEL(tab->label_compression), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 gtk_label_set_text(GTK_LABEL(tab->label_mime_type), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 info_tab_general_sync_perm(tab, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 tab->compression_done = FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 static void info_tab_general_free(gpointer data)
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 InfoTabGeneral *tab = data;
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 g_free(tab);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 static TabData *info_tab_general_new(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 InfoTabGeneral *tab;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381 GtkWidget *table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 GtkWidget *label;
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 tab = g_new0(InfoTabGeneral, 1);
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 table = pref_table_new(NULL, 2, 11, FALSE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 gtk_container_set_border_width(GTK_CONTAINER(table), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 tab->label_file_time = table_add_line(table, 0, 0, _("File date:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 tab->label_file_size = table_add_line(table, 0, 1, _("File size:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 tab->label_dimensions = table_add_line(table, 0, 2, _("Dimensions:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 tab->label_transparent = table_add_line(table, 0, 3, _("Transparent:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 tab->label_image_size = table_add_line(table, 0, 4, _("Image size:"), NULL);
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 tab->label_compression = table_add_line(table, 0, 5, _("Compress ratio:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 tab->label_mime_type = table_add_line(table, 0, 6, _("File type:"), NULL);
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 tab->label_user = table_add_line(table, 0, 7, _("Owner:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 tab->label_group = table_add_line(table, 0, 8, _("Group:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 tab->label_perms = table_add_line(table, 0, 9, "", NULL);
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 label = gtk_label_new(_("General"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 gtk_notebook_append_page(GTK_NOTEBOOK(id->notebook), table, label);
271
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
405 notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), table, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 gtk_widget_show(table);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 td->func_free = info_tab_general_free;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 td->func_sync = info_tab_general_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 td->func_image = info_tab_general_image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 td->data = tab;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
414 td->func_new = info_tab_general_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
415 td->child = table;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 return td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 }
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422 * tabs
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 static void info_tabs_sync(InfoData *id, gint image)
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 GList *work;
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 work = id->tab_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431 while (work)
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 TabData *td = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 if (image)
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 if (td->func_image) td->func_image(id, td->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 if (td->func_sync) td->func_sync(id, td->data);
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 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 static void info_tabs_free(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 work = id->tab_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 while (work)
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 TabData *td = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 work = work->next;
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 if (td->func_free) td->func_free(td->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 g_free(td);
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 g_list_free(id->tab_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 id->tab_list = NULL;
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
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
464 static InfoTabsPos *info_tabs_pos_new(gpointer func, gint pos)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
465 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
466 InfoTabsPos *t = g_new0(InfoTabsPos, 1);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
467 t->func = func;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
468 t->pos = pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
469
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
470 return t;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
471 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
472
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
473 static void info_tabs_pos_list_append(gpointer func)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
474 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
475 static gint pos = 0;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
476
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
477 info_tabs_pos_list = g_list_append(info_tabs_pos_list, info_tabs_pos_new(func, pos++));
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
478 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
479
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
480 static gint compare_info_tabs_pos(gconstpointer a, gconstpointer b)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
481 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
482 InfoTabsPos *ta = (InfoTabsPos *) a;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
483 InfoTabsPos *tb = (InfoTabsPos *) b;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
484
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
485 if (ta->pos > tb->pos) return 1;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
486 return -1;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
487 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
488
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489 static void info_tabs_init(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 {
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
491 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
492
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
493 if (!info_tabs_pos_list)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
494 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
495 /* First run, default tabs order is defined here. */
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
496 info_tabs_pos_list_append(info_tab_general_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
497 info_tabs_pos_list_append(info_tab_meta_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
498 info_tabs_pos_list_append(info_tab_exif_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
499 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
500 else
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
501 info_tabs_pos_list = g_list_sort(info_tabs_pos_list, compare_info_tabs_pos);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
502
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
503 work = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
504 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
505 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
506 InfoTabsPos *t = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
507 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
508
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
509 id->tab_list = g_list_append(id->tab_list, t->func(id));
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
510 }
9
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
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 * sync
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
519 static void info_window_sync(InfoData *id, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
522 if (!fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
524 gtk_entry_set_text(GTK_ENTRY(id->name_entry), fd->name);
9
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 if (id->label_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 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 buf = g_strdup_printf(_("Image %d of %d"),
219
92d2444893b8 Fix display of image number in properties dialog when more than one image is selected.
zas_
parents: 196
diff changeset
530 g_list_index(id->list, (gpointer)fd) + 1,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531 g_list_length(id->list));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 gtk_label_set_text(GTK_LABEL(id->label_count), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 g_free(buf);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536 info_tabs_sync(id, FALSE);
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 id->updated = FALSE;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
539 image_change_fd(id->image, fd, 0.0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
542 static void info_notebook_reordered_cb(GtkNotebook *notebook, GtkWidget *child, guint page_num, gpointer data)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
543 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
544 InfoData *id = data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
545 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
546
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
547 info_tabs_sync(id, 0);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
548
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
549 /* Save current tabs position to be able to restore them later. */
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
550 work = id->tab_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
551 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
552 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
553 GList *tabpos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
554 TabData *td = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
555 gint pos = gtk_notebook_page_num(GTK_NOTEBOOK(id->notebook), GTK_WIDGET(td->child));
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
556 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
557
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
558 tabpos = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
559 while (tabpos)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
560 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
561 InfoTabsPos *t = tabpos->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
562 tabpos = tabpos->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
563
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
564 if (t->func == td->func_new)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
565 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
566 t->pos = pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
567 break;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
568 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
569 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
570 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
571 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
572
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 /*
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 * drag n drop (dropping not supported!)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 */
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 static void info_window_dnd_data_set(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 InfoData *id = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
584 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
586 fd = image_get_fd(id->image);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
587 if (fd)
9
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 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 gint len;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 gint plain_text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 switch (info)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 case TARGET_URI_LIST:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 plain_text = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 case TARGET_TEXT_PLAIN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 plain_text = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 }
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
604 list = g_list_append(NULL, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
605 text = uri_text_from_filelist(list, &len, plain_text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 g_list_free(list);
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 gtk_selection_data_set(selection_data, selection_data->target,
64
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
609 8, (guchar *)text, len);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 static void info_window_dnd_init(InfoData *id)
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 ImageWindow *imd;
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 imd = id->image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
620 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
623 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 G_CALLBACK(info_window_dnd_data_set), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 #if 0
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
627 gtk_drag_dest_set(imd->pr,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 dnd_file_drop_types, dnd_file_drop_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
631 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 G_CALLBACK(info_window_dnd_data_get), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 * base window
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 *-------------------------------------------------------------------
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 static gint info_window_last_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 static gint info_window_last_height = DEF_PROPERTY_HEIGHT;
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 static void info_window_image_update_cb(ImageWindow *imd, gpointer data)
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 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 /* only do this once after when loading a new image,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 * for tabs that depend on image data (exif)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 * Subsequent updates are ignored, as the image
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 * should not really changed if id->updated is TRUE.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 */
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 if (id->updated) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 if (imd->unknown) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 info_tabs_sync(id, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 id->updated = TRUE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 static void info_window_back_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
667 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 if (!work || !work->prev) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 work = work->prev;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
671 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
673 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 gtk_widget_set_sensitive(id->button_back, (work->prev != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 gtk_widget_set_sensitive(id->button_next, TRUE);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679 static void info_window_next_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
684 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 if (!work || !work->next) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 work = work->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
688 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
690 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
691
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692 gtk_widget_set_sensitive(id->button_next, (work->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 gtk_widget_set_sensitive(id->button_back, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 static void info_window_image_button_cb(ImageWindow *imd, gint button, guint32 time,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 gdouble x, gdouble y, guint state, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 if (button == 1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 else if (button == 2 || button == 3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 info_window_back_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
708
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 static void info_window_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 gdouble x, gdouble y, guint state, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 if (direction == GDK_SCROLL_UP)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 info_window_back_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
716 else if (direction == GDK_SCROLL_DOWN)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
717 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722 static void info_window_close(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 gdk_drawable_get_size(id->window->window, &info_window_last_width, &info_window_last_height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 info_window_last_width = MAX(info_window_last_width, DEF_PROPERTY_WIDTH);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 info_window_last_height = MAX(info_window_last_height, DEF_PROPERTY_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 gtk_widget_destroy(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731 static void info_window_close_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738 static gint info_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
741
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
745
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
746 static void info_window_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750 info_tabs_free(id);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
751 filelist_free(id->list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 g_free(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
755 void info_window_new(FileData *fd, GList *list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 InfoData *id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 GtkWidget *main_vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 GtkWidget *paned;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 GdkGeometry geometry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
765 if (!fd && !list) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767 if (!list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
769 list = g_list_append(NULL, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 id = g_new0(InfoData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774 id->list = list;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
775 id->fd = (FileData *)id->list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776 id->updated = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777
289
6a7298988a7a Simplify and unify gtk_window creation with the help of
zas_
parents: 288
diff changeset
778 id->window = window_new(GTK_WINDOW_TOPLEVEL, "properties", NULL, NULL, _("Image properties"));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779 gtk_window_set_type_hint(GTK_WINDOW(id->window), GDK_WINDOW_TYPE_HINT_DIALOG);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
780
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
781 gtk_window_set_resizable(GTK_WINDOW(id->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
783 geometry.min_width = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
784 geometry.min_height = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 geometry.base_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786 geometry.base_height = DEF_PROPERTY_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787 gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791 gtk_window_set_default_size(GTK_WINDOW(id->window), info_window_last_width, info_window_last_height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 g_signal_connect(G_OBJECT(id->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 G_CALLBACK(info_window_delete_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 g_signal_connect(G_OBJECT(id->window), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797 G_CALLBACK(info_window_destroy_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 paned = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800 gtk_container_add(GTK_CONTAINER(id->window), paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
801 gtk_widget_show(paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 id->image = image_new(FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804 image_set_update_func(id->image, info_window_image_update_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 image_set_button_func(id->image, info_window_image_button_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 image_set_scroll_func(id->image, info_window_image_scroll_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 gtk_widget_set_size_request(id->image->widget, IMAGE_SIZE_W, IMAGE_SIZE_H);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810 gtk_paned_pack1(GTK_PANED(paned), id->image->widget, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 gtk_widget_show(id->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 main_vbox = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 gtk_paned_pack2(GTK_PANED(paned), main_vbox, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815 gtk_widget_show(main_vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 hbox = pref_box_new(main_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818 label = pref_label_new(hbox, _("Filename:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 id->name_entry = gtk_entry_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 gtk_editable_set_editable(GTK_EDITABLE(id->name_entry), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 gtk_box_pack_start(GTK_BOX(hbox), id->name_entry, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824 gtk_widget_show(id->name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 id->notebook = gtk_notebook_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(id->notebook), GTK_POS_TOP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 gtk_box_pack_start(GTK_BOX(main_vbox), id->notebook, TRUE, TRUE, 5);
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
829 g_signal_connect(G_OBJECT(id->notebook), "page-reordered",
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
830 G_CALLBACK(info_notebook_reordered_cb), id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
831
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832 gtk_widget_show(id->notebook);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834 pref_spacer(main_vbox, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 hbox = pref_box_new(main_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
838 id->button_back = pref_button_new(hbox, GTK_STOCK_GO_BACK, NULL, TRUE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 G_CALLBACK(info_window_back_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 gtk_widget_set_sensitive(id->button_back, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842 id->button_next = pref_button_new(hbox, GTK_STOCK_GO_FORWARD, NULL, TRUE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 G_CALLBACK(info_window_next_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 gtk_widget_set_sensitive(id->button_next, (id->list->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846 if (id->list->next)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848 id->label_count = pref_label_new(hbox, "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851 button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 G_CALLBACK(info_window_close_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856 /* set up tabs */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
857
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
858 info_tabs_init(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 /* fill it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
862 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
864 /* finish */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 info_window_dnd_init(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868 gtk_widget_show(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870