annotate src/info.c @ 1029:1a4b18c58556

Use a constant for minimal window size. Set it to 32 for all dialogs.
author zas_
date Mon, 01 Sep 2008 17:29:07 +0000
parents 4fe8f9656107
children 1646720364cf
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
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 448
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 271
diff changeset
14 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 #include "info.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "bar_info.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "bar_exif.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "dnd.h"
586
905688aa2317 split filelist.c to filefilter.c and filedata.c
nadvornik
parents: 576
diff changeset
20 #include "filedata.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "image-load.h"
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
23 #include "pixbuf-renderer.h"
9
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"
904
1698baa37871 Move uri_*() functions to separate files: uri_utils.[ch]
zas_
parents: 868
diff changeset
26 #include "uri_utils.h"
648
e34c1002e553 Move some functions from main.[ch] to new window.[ch].
zas_
parents: 586
diff changeset
27 #include "window.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 #include <pwd.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 #include <grp.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 #define IMAGE_SIZE_W 200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 #define IMAGE_SIZE_H 200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35
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);
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
52 guint pos;
221
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
995
6ca2c5fd7b13 Whitespaces cleanup.
zas_
parents: 904
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
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 551
diff changeset
170 return filelist_copy(id->list);
9
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
531
1149a7b0a3d7 cleanup: use image_get_image_size
nadvornik
parents: 479
diff changeset
240 image_get_image_size(id->image, &width, &height);
23
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 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
264 buf = g_strdup_printf("%.1f%%", (gdouble)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 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 995
diff changeset
279 gint mb, mu, mg, mo;
9
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
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
489 static gpointer info_tab_new_funcs[] = {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
490 info_tab_general_new,
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
491 info_tab_meta_new,
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
492 info_tab_exif_new,
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
493 };
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
494
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
495 gchar *info_tab_default_order(void)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
496 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
497 guint i;
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
498 static gchar str[G_N_ELEMENTS(info_tab_new_funcs) + 1];
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
499
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
500 for (i = 0; i < G_N_ELEMENTS(info_tab_new_funcs); i++)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
501 str[i] = i + '1';
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
502 str[i] = '\0';
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
503
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
504 return str;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
505 }
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
506
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
507 static void info_tab_get_order_string(gchar **dest)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
508 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
509 GList *work;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
510 gchar str[G_N_ELEMENTS(info_tab_new_funcs) + 1];
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
511
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
512 g_assert(dest);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
513
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
514 if (!info_tabs_pos_list)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
515 return;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
516
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
517 memset(str, 0, G_N_ELEMENTS(info_tab_new_funcs) + 1);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
518
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
519 work = info_tabs_pos_list;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
520 while (work)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
521 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
522 guint i;
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
523 InfoTabsPos *t = work->data;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
524 work = work->next;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
525
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
526 for (i = 0; i < G_N_ELEMENTS(info_tab_new_funcs); i++)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
527 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
528 if (t->func == info_tab_new_funcs[i])
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
529 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
530 g_assert(t->pos >= 0 && t->pos < G_N_ELEMENTS(info_tab_new_funcs));
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
531 str[t->pos] = i + '1';
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
532 }
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
533 }
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
534 }
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
535
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
536 if (strlen(str) != G_N_ELEMENTS(info_tab_new_funcs)) return;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
537
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
538 g_free(*dest);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
539 *dest = g_strdup(str);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
540 }
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
541
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 static void info_tabs_init(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 {
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
544 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
545
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
546 if (!info_tabs_pos_list)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
547 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
548 guint count = 0;
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
549 guint i;
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
550 gchar *order = options->properties.tabs_order;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
551
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
552 for (i = 0; i < strlen(order); i++)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
553 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
554 guint n = order[i] - '1';
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
555
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
556 if (n >= G_N_ELEMENTS(info_tab_new_funcs)) break;
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
557 count++;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
558 }
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
559
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
560 if (count != G_N_ELEMENTS(info_tab_new_funcs))
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
561 order = info_tab_default_order();
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
562
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
563 for (i = 0; i < strlen(order); i++)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
564 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
565 guint n = order[i] - '1';
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
566
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 684
diff changeset
567 if (n >= G_N_ELEMENTS(info_tab_new_funcs)) continue;
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
568 if (g_list_find(info_tabs_pos_list, info_tab_new_funcs[n])) continue;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
569 info_tabs_pos_list_append(info_tab_new_funcs[n]);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
570 }
221
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 else
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
573 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
574
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
575 info_tab_get_order_string(&options->properties.tabs_order);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
576
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
577 work = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
578 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
579 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
580 InfoTabsPos *t = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
581 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
582
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
583 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
584 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 /*
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 * sync
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
593 static void info_window_sync(InfoData *id, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
596 if (!fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
598 gtk_entry_set_text(GTK_ENTRY(id->name_entry), fd->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 if (id->label_count)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 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
604 g_list_index(id->list, (gpointer)fd) + 1,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 g_list_length(id->list));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 gtk_label_set_text(GTK_LABEL(id->label_count), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 info_tabs_sync(id, FALSE);
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 id->updated = FALSE;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
613 image_change_fd(id->image, fd, 0.0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
616 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
617 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
618 InfoData *id = data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
619 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
620
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
621 /* 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
622 work = id->tab_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
623 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
624 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
625 GList *tabpos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
626 TabData *td = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
627 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
628 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
629
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
630 tabpos = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
631 while (tabpos)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
632 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
633 InfoTabsPos *t = tabpos->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
634 tabpos = tabpos->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
635
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
636 if (t->func == td->func_new)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
637 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
638 t->pos = pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
639 break;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
640 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 289
diff changeset
641 }
551
5b127951daa1 info_notebook_reordered_cb(): do not call info_tabs_sync(), it causes exif
zas_
parents: 531
diff changeset
642 }
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
643
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
644 info_tabs_pos_list = g_list_sort(info_tabs_pos_list, compare_info_tabs_pos);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
645 info_tab_get_order_string(&options->properties.tabs_order);
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
646 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
647
9
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 * drag n drop (dropping not supported!)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 */
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 static void info_window_dnd_data_set(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 guint time, gpointer data)
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 InfoData *id = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
659 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
661 fd = image_get_fd(id->image);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
662 if (fd)
9
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 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 gint len;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667 gint plain_text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 switch (info)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671 case TARGET_URI_LIST:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 plain_text = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 case TARGET_TEXT_PLAIN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 plain_text = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678 }
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
679 list = g_list_append(NULL, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
680 text = uri_text_from_filelist(list, &len, plain_text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 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
684 8, (guchar *)text, len);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 g_free(text);
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 static void info_window_dnd_init(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
691 ImageWindow *imd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 imd = id->image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
695 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 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
698 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 G_CALLBACK(info_window_dnd_data_set), id);
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 #if 0
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
702 gtk_drag_dest_set(imd->pr,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704 dnd_file_drop_types, dnd_file_drop_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 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
706 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 G_CALLBACK(info_window_dnd_data_get), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
708 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 * base window
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 *-------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
717 static void info_window_image_update_cb(ImageWindow *imd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 InfoData *id = data;
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 /* only do this once after when loading a new image,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722 * for tabs that depend on image data (exif)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 * Subsequent updates are ignored, as the image
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 * should not really changed if id->updated is TRUE.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 if (id->updated) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 if (imd->unknown) return;
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 info_tabs_sync(id, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731 id->updated = TRUE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734 static void info_window_back_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
739 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 if (!work || !work->prev) return;
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 work = work->prev;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
743 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
745 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
746
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 gtk_widget_set_sensitive(id->button_back, (work->prev != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748 gtk_widget_set_sensitive(id->button_next, TRUE);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751 static void info_window_next_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
756 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 if (!work || !work->next) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 work = work->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
760 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
762 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764 gtk_widget_set_sensitive(id->button_next, (work->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765 gtk_widget_set_sensitive(id->button_back, TRUE);
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
868
db6977f8b0f1 Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents: 765
diff changeset
768 static void info_window_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 {
868
db6977f8b0f1 Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents: 765
diff changeset
770 if (event->button == MOUSE_BUTTON_LEFT)
9
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 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773 }
868
db6977f8b0f1 Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents: 765
diff changeset
774 else if (event->button == MOUSE_BUTTON_MIDDLE || event->button == MOUSE_BUTTON_RIGHT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776 info_window_back_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
778 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779
868
db6977f8b0f1 Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents: 765
diff changeset
780 static void info_window_image_scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
781 {
868
db6977f8b0f1 Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents: 765
diff changeset
782 if (event->direction == GDK_SCROLL_UP)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
783 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
784 info_window_back_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 }
868
db6977f8b0f1 Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents: 765
diff changeset
786 else if (event->direction == GDK_SCROLL_DOWN)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 info_window_next_cb(NULL, data);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 static void info_window_close(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 {
764
ae618ebec3e9 Save properties window width and height to rc file and restore
zas_
parents: 736
diff changeset
794 gdk_drawable_get_size(id->window->window, &options->layout.properties_window.w, &options->layout.properties_window.h);
ae618ebec3e9 Save properties window width and height to rc file and restore
zas_
parents: 736
diff changeset
795 options->layout.properties_window.w = MAX(options->layout.properties_window.w, DEF_PROPERTY_WIDTH);
ae618ebec3e9 Save properties window width and height to rc file and restore
zas_
parents: 736
diff changeset
796 options->layout.properties_window.h = MAX(options->layout.properties_window.h, DEF_PROPERTY_HEIGHT);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 gtk_widget_destroy(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
801 static void info_window_close_cb(GtkWidget *widget, gpointer data)
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 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808 static gint info_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816 static void info_window_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 info_tabs_free(id);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
821 filelist_free(id->list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 g_free(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824
479
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
825 void info_window_new(FileData *fd, GList *list, GtkWidget *parent)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827 InfoData *id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 GtkWidget *main_vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 GtkWidget *paned;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 GdkGeometry geometry;
765
339db85846da Preserve properties window width and height during session even when
zas_
parents: 764
diff changeset
834 static gboolean run_once = FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
836 if (!fd && !list) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837
765
339db85846da Preserve properties window width and height during session even when
zas_
parents: 764
diff changeset
838 run_once = TRUE;
339db85846da Preserve properties window width and height during session even when
zas_
parents: 764
diff changeset
839
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 if (!list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
842 list = g_list_append(NULL, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 id = g_new0(InfoData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847 id->list = list;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
848 id->fd = (FileData *)id->list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849 id->updated = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850
289
6a7298988a7a Simplify and unify gtk_window creation with the help of
zas_
parents: 288
diff changeset
851 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
852 gtk_window_set_type_hint(GTK_WINDOW(id->window), GDK_WINDOW_TYPE_HINT_DIALOG);
479
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
853 id->parent = parent;
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
854 if (GTK_IS_WINDOW(id->parent)) {
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
855 gtk_window_set_keep_above(GTK_WINDOW(id->window), TRUE);
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
856 #if 0
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
857 /* work, but behavior is not that great */
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
858 gtk_window_set_transient_for(GTK_WINDOW(id->window), GTK_WINDOW(id->parent));
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
859 #endif
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
860 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 gtk_window_set_resizable(GTK_WINDOW(id->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
862
1029
1a4b18c58556 Use a constant for minimal window size. Set it to 32 for all dialogs.
zas_
parents: 1000
diff changeset
863 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
1a4b18c58556 Use a constant for minimal window size. Set it to 32 for all dialogs.
zas_
parents: 1000
diff changeset
864 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865 geometry.base_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 geometry.base_height = DEF_PROPERTY_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867 gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869
765
339db85846da Preserve properties window width and height during session even when
zas_
parents: 764
diff changeset
870 if (options->layout.save_window_positions || run_once)
764
ae618ebec3e9 Save properties window width and height to rc file and restore
zas_
parents: 736
diff changeset
871 gtk_window_set_default_size(GTK_WINDOW(id->window), options->layout.properties_window.w, options->layout.properties_window.h);
ae618ebec3e9 Save properties window width and height to rc file and restore
zas_
parents: 736
diff changeset
872 else
ae618ebec3e9 Save properties window width and height to rc file and restore
zas_
parents: 736
diff changeset
873 gtk_window_set_default_size(GTK_WINDOW(id->window), DEF_PROPERTY_WIDTH, DEF_PROPERTY_HEIGHT);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
874
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875 gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877 g_signal_connect(G_OBJECT(id->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 G_CALLBACK(info_window_delete_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879 g_signal_connect(G_OBJECT(id->window), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 G_CALLBACK(info_window_destroy_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
881
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
882 paned = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 gtk_container_add(GTK_CONTAINER(id->window), paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884 gtk_widget_show(paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886 id->image = image_new(FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 image_set_update_func(id->image, info_window_image_update_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
889 image_set_button_func(id->image, info_window_image_button_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 image_set_scroll_func(id->image, info_window_image_scroll_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892 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
893 gtk_paned_pack1(GTK_PANED(paned), id->image->widget, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
894 gtk_widget_show(id->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896 main_vbox = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 gtk_paned_pack2(GTK_PANED(paned), main_vbox, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 gtk_widget_show(main_vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
900 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
901 label = pref_label_new(hbox, _("Filename:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
902 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
904 id->name_entry = gtk_entry_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
905 gtk_editable_set_editable(GTK_EDITABLE(id->name_entry), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906 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
907 gtk_widget_show(id->name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
908
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
909 id->notebook = gtk_notebook_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
910 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(id->notebook), GTK_POS_TOP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
911 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
912 g_signal_connect(G_OBJECT(id->notebook), "page-reordered",
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
913 G_CALLBACK(info_notebook_reordered_cb), id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
914
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
915 gtk_widget_show(id->notebook);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
916
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917 pref_spacer(main_vbox, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919 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
920
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
921 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
922 G_CALLBACK(info_window_back_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
923 gtk_widget_set_sensitive(id->button_back, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
924
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925 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
926 G_CALLBACK(info_window_next_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
927 gtk_widget_set_sensitive(id->button_next, (id->list->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
928
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
929 if (id->list->next)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
930 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
931 id->label_count = pref_label_new(hbox, "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
932 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
933
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
934 button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
935 G_CALLBACK(info_window_close_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
936 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
937 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
938
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
939 /* set up tabs */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
940
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
941 info_tabs_init(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
942
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
943 /* fill it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
944
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
945 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
946
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
947 /* finish */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
948
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
949 info_window_dnd_init(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
950
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
951 gtk_widget_show(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
952 }