annotate src/info.c @ 722:9a145206ec2c

tab_completion_do(): use g_build_filename(), G_DIR_SEPARATOR, G_DIR_SEPARATOR_S.
author zas_
date Wed, 21 May 2008 10:11:56 +0000
parents 9f00d0d874fa
children a7289f9e8d29
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_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "ui_misc.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
90
dc3c77d027e6 Tue Oct 31 18:06:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
36 #define DEF_PROPERTY_WIDTH 600
dc3c77d027e6 Tue Oct 31 18:06:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
37 #define DEF_PROPERTY_HEIGHT 400
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 typedef struct _TabData TabData;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 struct _TabData
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 void (*func_free)(gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 void (*func_sync)(InfoData *id, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 void (*func_image)(InfoData *id, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 gpointer data;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
46 TabData *(*func_new)(InfoData *id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
47 GtkWidget *child;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
50 typedef struct _InfoTabsPos InfoTabsPos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
51 struct _InfoTabsPos
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
52 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
53 TabData *(*func)(InfoData *id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
54 gint pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
55 };
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
56
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
57 static GList *info_tabs_pos_list = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58
271
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
59 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
60 {
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
61 #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
62 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
63 #endif
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
64 }
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
65
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 /*
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 * table utils
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 GtkWidget *table_add_line(GtkWidget *table, gint x, gint y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 const gchar *description, const gchar *text)
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 GtkWidget *label;
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 if (!text) text = "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 label = pref_table_label(table, x, y, description, 1.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 label = pref_table_label(table, x + 1, y, text, 0.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 return label;
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 /*
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 * EXIF tab
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 static void info_tab_exif_image(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 GtkWidget *bar = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
95 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 if (id->image->unknown)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
99 fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
103 fd = id->image->image_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
106 bar_exif_set(bar, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 static void info_tab_exif_sync(InfoData *id, gpointer 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 GtkWidget *bar = data;
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 bar_exif_set(bar, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 static TabData *info_tab_exif_new(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 GtkWidget *bar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 bar = bar_exif_new(FALSE, NULL, FALSE, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 gtk_container_set_border_width(GTK_CONTAINER(bar), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 label = gtk_label_new(_("Exif"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 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
127 notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), bar, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 gtk_widget_show(bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 td->func_free = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 td->func_sync = info_tab_exif_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 td->func_image = info_tab_exif_image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135 td->data = bar;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
136 td->func_new = info_tab_exif_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
137 td->child = bar;
9
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 return td;
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 /*
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 * file attributes tab
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 typedef struct _InfoTabMeta InfoTabMeta;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 struct _InfoTabMeta
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 GtkWidget *bar_info;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 };
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 static void info_tab_meta_free(gpointer 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 InfoTabMeta *tab = data;
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 g_free(tab);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 static void info_tab_meta_sync(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 InfoTabMeta *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
165 bar_info_set(tab->bar_info, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 }
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 static GList *info_tab_meta_list_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 551
diff changeset
172 return filelist_copy(id->list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 static TabData *info_tab_meta_new(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 InfoTabMeta *tab;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 GtkWidget *label;
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 = g_new0(InfoTabMeta, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 tab->bar_info = bar_info_new(NULL, TRUE, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 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
185 bar_info_selection(tab->bar_info, g_list_length(id->list) - 1);
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 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
188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 label = gtk_label_new(_("Keywords"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 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
191 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
192 gtk_widget_show(tab->bar_info);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 td->func_free = info_tab_meta_free;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 td->func_sync = info_tab_meta_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 td->func_image = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 td->data = tab;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
200 td->func_new = info_tab_meta_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
201 td->child = tab->bar_info;
9
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 return td;
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 /*
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 * general tab
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 typedef struct _InfoTabGeneral InfoTabGeneral;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 struct _InfoTabGeneral
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 GtkWidget *label_file_time;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 GtkWidget *label_file_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 GtkWidget *label_dimensions;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 GtkWidget *label_transparent;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 GtkWidget *label_image_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 GtkWidget *label_compression;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 GtkWidget *label_mime_type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 GtkWidget *label_user;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 GtkWidget *label_group;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 GtkWidget *label_perms;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 gint compression_done;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 gint64 byte_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 static void info_tab_general_image(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 InfoTabGeneral *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 guint mem_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 gint has_alpha;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
237 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
238 gint width, height;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240 if (id->image->unknown) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241
531
1149a7b0a3d7 cleanup: use image_get_image_size
nadvornik
parents: 479
diff changeset
242 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
243
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
244 buf = g_strdup_printf("%d x %d", width, height);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 gtk_label_set_text(GTK_LABEL(tab->label_dimensions), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
248 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
249 if (pixbuf)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
251 has_alpha = gdk_pixbuf_get_has_alpha(pixbuf);
9
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 else
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 has_alpha = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257 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
258
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
259 mem_size = width * height * ((has_alpha) ? 4 : 3);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 buf = text_from_size_abrev(mem_size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 gtk_label_set_text(GTK_LABEL(tab->label_image_size), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 if (!tab->compression_done && mem_size > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 {
15
3263965d5f9e ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
266 buf = g_strdup_printf("%.1f%%", (double)tab->byte_size / mem_size * 100.0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 gtk_label_set_text(GTK_LABEL(tab->label_compression), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 g_free(buf);
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 tab->compression_done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 buf = image_loader_get_format(id->image->il);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 if (buf)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 gtk_label_set_text(GTK_LABEL(tab->label_mime_type), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 static gchar *mode_number(mode_t m)
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 int mb, mu, mg, mo;
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 mb = mu = mg = mo = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 if (m & S_ISUID) mb |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 if (m & S_ISGID) mb |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 if (m & S_ISVTX) mb |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 if (m & S_IRUSR) mu |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 if (m & S_IWUSR) mu |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 if (m & S_IXUSR) mu |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 if (m & S_IRGRP) mg |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 if (m & S_IWGRP) mg |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 if (m & S_IXGRP) mg |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 if (m & S_IROTH) mo |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 if (m & S_IWOTH) mo |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 if (m & S_IXOTH) mo |= 1;
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 return g_strdup_printf("%d%d%d%d", mb, mu, mg, mo);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 static void info_tab_general_sync_perm(InfoTabGeneral *tab, InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 struct stat st;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
308 if (!stat_utf8(id->fd->path, &st))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 gtk_label_set_text(GTK_LABEL(tab->label_user), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 gtk_label_set_text(GTK_LABEL(tab->label_group), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 gtk_label_set_text(GTK_LABEL(tab->label_perms), "");
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 struct passwd *user;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 struct group *grp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 gchar pbuf[12];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 gchar *pmod;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 user = getpwuid(st.st_uid);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 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
324
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 grp = getgrgid(st.st_gid);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 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
327
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 pbuf[0] = (st.st_mode & S_IRUSR) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 pbuf[1] = (st.st_mode & S_IWUSR) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 pbuf[2] = (st.st_mode & S_IXUSR) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 pbuf[3] = (st.st_mode & S_IRGRP) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 pbuf[4] = (st.st_mode & S_IWGRP) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 pbuf[5] = (st.st_mode & S_IXGRP) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 pbuf[6] = (st.st_mode & S_IROTH) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 pbuf[7] = (st.st_mode & S_IWOTH) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 pbuf[8] = (st.st_mode & S_IXOTH) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 pbuf[9] = '\0';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 pmod = mode_number(st.st_mode);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 buf = g_strdup_printf("%s (%s)", pbuf, pmod);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 gtk_label_set_text(GTK_LABEL(tab->label_perms), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 g_free(pmod);
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 static void info_tab_general_sync(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 InfoTabGeneral *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350 gchar *buf;
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 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
353
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
354 tab->byte_size = id->fd->size;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 buf = text_from_size(tab->byte_size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 gtk_label_set_text(GTK_LABEL(tab->label_file_size), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 gtk_label_set_text(GTK_LABEL(tab->label_dimensions), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 gtk_label_set_text(GTK_LABEL(tab->label_transparent), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362 gtk_label_set_text(GTK_LABEL(tab->label_image_size), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364 gtk_label_set_text(GTK_LABEL(tab->label_compression), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 gtk_label_set_text(GTK_LABEL(tab->label_mime_type), "");
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 info_tab_general_sync_perm(tab, id);
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 tab->compression_done = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372 static void info_tab_general_free(gpointer 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 InfoTabGeneral *tab = data;
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 g_free(tab);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 static TabData *info_tab_general_new(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 InfoTabGeneral *tab;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 GtkWidget *table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 GtkWidget *label;
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 tab = g_new0(InfoTabGeneral, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388 table = pref_table_new(NULL, 2, 11, FALSE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 gtk_container_set_border_width(GTK_CONTAINER(table), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 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
392 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
393
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 tab->label_dimensions = table_add_line(table, 0, 2, _("Dimensions:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 tab->label_transparent = table_add_line(table, 0, 3, _("Transparent:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 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
397
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 tab->label_compression = table_add_line(table, 0, 5, _("Compress ratio:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 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
400
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 tab->label_user = table_add_line(table, 0, 7, _("Owner:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 tab->label_group = table_add_line(table, 0, 8, _("Group:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 tab->label_perms = table_add_line(table, 0, 9, "", NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 label = gtk_label_new(_("General"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 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
407 notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), table, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 gtk_widget_show(table);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 td->func_free = info_tab_general_free;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 td->func_sync = info_tab_general_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 td->func_image = info_tab_general_image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 td->data = tab;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
416 td->func_new = info_tab_general_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
417 td->child = table;
9
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 return td;
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 /*
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 * tabs
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 */
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 static void info_tabs_sync(InfoData *id, gint image)
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 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 work = id->tab_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 TabData *td = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 work = work->next;
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 (image)
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 if (td->func_image) td->func_image(id, td->data);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 if (td->func_sync) td->func_sync(id, td->data);
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 }
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 static void info_tabs_free(InfoData *id)
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 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 work = id->tab_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 TabData *td = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 if (td->func_free) td->func_free(td->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 g_free(td);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 g_list_free(id->tab_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 id->tab_list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
466 static InfoTabsPos *info_tabs_pos_new(gpointer func, gint pos)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
467 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
468 InfoTabsPos *t = g_new0(InfoTabsPos, 1);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
469 t->func = func;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
470 t->pos = pos;
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 return t;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
473 }
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 void info_tabs_pos_list_append(gpointer func)
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 static gint pos = 0;
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 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
480 }
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 static gint compare_info_tabs_pos(gconstpointer a, gconstpointer b)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
483 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
484 InfoTabsPos *ta = (InfoTabsPos *) a;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
485 InfoTabsPos *tb = (InfoTabsPos *) b;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
486
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
487 if (ta->pos > tb->pos) return 1;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
488 return -1;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
489 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
490
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
491 static gpointer info_tab_new_funcs[] = {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
492 info_tab_general_new,
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
493 info_tab_meta_new,
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
494 info_tab_exif_new,
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
495 };
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
496
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
497 gchar *info_tab_default_order(void)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
498 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
499 gint i;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
500 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
501
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
502 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
503 str[i] = i + '1';
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
504 str[i] = '\0';
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 return str;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
507 }
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 static void info_tab_get_order_string(gchar **dest)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
510 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
511 GList *work;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
512 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
513
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
514 g_assert(dest);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
515
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
516 if (!info_tabs_pos_list)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
517 return;
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 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
520
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
521 work = info_tabs_pos_list;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
522 while (work)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
523 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
524 gint i;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
525 InfoTabsPos *t = work->data;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
526 work = work->next;
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 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
529 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
530 if (t->func == info_tab_new_funcs[i])
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
531 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
532 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
533 str[t->pos] = i + '1';
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 }
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 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
539
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
540 g_free(*dest);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
541 *dest = g_strdup(str);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
542 }
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
543
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 static void info_tabs_init(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545 {
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
546 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
547
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
548 if (!info_tabs_pos_list)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
549 {
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
550 gint count = 0;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
551 gint i;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
552 gchar *order = options->properties.tabs_order;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
553
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
554 for (i = 0; i < strlen(order); i++)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
555 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
556 gint n = order[i] - '1';
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
557
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
558 if (n < 0 || n >= G_N_ELEMENTS(info_tab_new_funcs)) break;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
559 count++;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
560 }
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
561
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
562 if (count != G_N_ELEMENTS(info_tab_new_funcs))
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
563 order = info_tab_default_order();
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
564
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
565 for (i = 0; i < strlen(order); i++)
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
566 {
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
567 gint n = order[i] - '1';
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
568
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
569 if (n < 0 || n >= G_N_ELEMENTS(info_tab_new_funcs)) continue;
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
570 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
571 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
572 }
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
573 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
574 else
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
575 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
576
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
577 info_tab_get_order_string(&options->properties.tabs_order);
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
578
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
579 work = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
580 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
581 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
582 InfoTabsPos *t = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
583 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
584
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
585 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
586 }
9
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 /*
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 * sync
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
595 static void info_window_sync(InfoData *id, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 {
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 if (!fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
600 gtk_entry_set_text(GTK_ENTRY(id->name_entry), fd->name);
9
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 if (id->label_count)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 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
606 g_list_index(id->list, (gpointer)fd) + 1,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 g_list_length(id->list));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 gtk_label_set_text(GTK_LABEL(id->label_count), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 }
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 info_tabs_sync(id, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 id->updated = FALSE;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
615 image_change_fd(id->image, fd, 0.0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
618 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
619 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
620 InfoData *id = data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
621 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
622
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
623 /* 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
624 work = id->tab_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
625 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
626 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
627 GList *tabpos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
628 TabData *td = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
629 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
630 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
631
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
632 tabpos = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
633 while (tabpos)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
634 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
635 InfoTabsPos *t = tabpos->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
636 tabpos = tabpos->next;
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 if (t->func == td->func_new)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
639 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
640 t->pos = pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
641 break;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
642 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 289
diff changeset
643 }
551
5b127951daa1 info_notebook_reordered_cb(): do not call info_tabs_sync(), it causes exif
zas_
parents: 531
diff changeset
644 }
684
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
645
9f00d0d874fa Save order of Properties dialog tabs to rc file.
zas_
parents: 648
diff changeset
646 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
647 info_tab_get_order_string(&options->properties.tabs_order);
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
648 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
649
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 /*
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 * drag n drop (dropping not supported!)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 static void info_window_dnd_data_set(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 InfoData *id = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
661 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
663 fd = image_get_fd(id->image);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
664 if (fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667 gint len;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 gint plain_text;
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 switch (info)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673 case TARGET_URI_LIST:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 plain_text = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 case TARGET_TEXT_PLAIN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678 plain_text = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 }
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
681 list = g_list_append(NULL, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
682 text = uri_text_from_filelist(list, &len, plain_text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 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
686 8, (guchar *)text, len);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 g_free(text);
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 }
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 static void info_window_dnd_init(InfoData *id)
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 ImageWindow *imd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695 imd = id->image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
697 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 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
700 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 G_CALLBACK(info_window_dnd_data_set), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 #if 0
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
704 gtk_drag_dest_set(imd->pr,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 dnd_file_drop_types, dnd_file_drop_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 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
708 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 G_CALLBACK(info_window_dnd_data_get), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 #endif
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 /*
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 * base window
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 */
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 static gint info_window_last_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 static gint info_window_last_height = DEF_PROPERTY_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722 static void info_window_image_update_cb(ImageWindow *imd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 InfoData *id = data;
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 /* only do this once after when loading a new image,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 * for tabs that depend on image data (exif)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 * Subsequent updates are ignored, as the image
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729 * should not really changed if id->updated is TRUE.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732 if (id->updated) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733 if (imd->unknown) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 info_tabs_sync(id, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 id->updated = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 static void info_window_back_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
741 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
744 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
745 if (!work || !work->prev) return;
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 work = work->prev;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
748 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
750 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 gtk_widget_set_sensitive(id->button_back, (work->prev != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 gtk_widget_set_sensitive(id->button_next, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 static void info_window_next_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
761 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762 if (!work || !work->next) return;
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 work = work->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
765 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
767 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 gtk_widget_set_sensitive(id->button_next, (work->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770 gtk_widget_set_sensitive(id->button_back, TRUE);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773 static void info_window_image_button_cb(ImageWindow *imd, gint button, guint32 time,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774 gdouble x, gdouble y, guint state, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 {
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
776 if (button == MOUSE_BUTTON_LEFT)
9
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 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779 }
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
780 else if (button == MOUSE_BUTTON_MIDDLE || button == MOUSE_BUTTON_RIGHT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
781 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782 info_window_back_cb(NULL, data);
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786 static void info_window_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787 gdouble x, gdouble y, guint state, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 if (direction == GDK_SCROLL_UP)
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 info_window_back_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 else if (direction == GDK_SCROLL_DOWN)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 static void info_window_close(InfoData *id)
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 gdk_drawable_get_size(id->window->window, &info_window_last_width, &info_window_last_height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802 info_window_last_width = MAX(info_window_last_width, DEF_PROPERTY_WIDTH);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 info_window_last_height = MAX(info_window_last_height, DEF_PROPERTY_HEIGHT);
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 gtk_widget_destroy(id->window);
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 void info_window_close_cb(GtkWidget *widget, 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 }
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 static gint info_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 static void info_window_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825 InfoData *id = data;
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 info_tabs_free(id);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
828 filelist_free(id->list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 g_free(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831
479
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
832 void info_window_new(FileData *fd, GList *list, GtkWidget *parent)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834 InfoData *id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 GtkWidget *main_vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 GtkWidget *paned;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
838 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 GdkGeometry geometry;
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 if (!fd && !list) return;
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 if (!list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
846 list = g_list_append(NULL, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849 id = g_new0(InfoData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851 id->list = list;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
852 id->fd = (FileData *)id->list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853 id->updated = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854
289
6a7298988a7a Simplify and unify gtk_window creation with the help of
zas_
parents: 288
diff changeset
855 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
856 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
857 id->parent = parent;
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
858 if (GTK_IS_WINDOW(id->parent)) {
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
859 gtk_window_set_keep_above(GTK_WINDOW(id->window), TRUE);
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
860 #if 0
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
861 /* work, but behavior is not that great */
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
862 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
863 #endif
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
864 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865 gtk_window_set_resizable(GTK_WINDOW(id->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867 geometry.min_width = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868 geometry.min_height = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869 geometry.base_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870 geometry.base_height = DEF_PROPERTY_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871 gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873
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_window_set_default_size(GTK_WINDOW(id->window), info_window_last_width, info_window_last_height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876 gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 g_signal_connect(G_OBJECT(id->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879 G_CALLBACK(info_window_delete_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 g_signal_connect(G_OBJECT(id->window), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
881 G_CALLBACK(info_window_destroy_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
882
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 paned = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884 gtk_container_add(GTK_CONTAINER(id->window), paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885 gtk_widget_show(paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 id->image = image_new(FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888 image_set_update_func(id->image, info_window_image_update_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
889
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 image_set_button_func(id->image, info_window_image_button_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891 image_set_scroll_func(id->image, info_window_image_scroll_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
893 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
894 gtk_paned_pack1(GTK_PANED(paned), id->image->widget, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895 gtk_widget_show(id->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 main_vbox = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 gtk_paned_pack2(GTK_PANED(paned), main_vbox, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899 gtk_widget_show(main_vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
900
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 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
902 label = pref_label_new(hbox, _("Filename:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
904
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
905 id->name_entry = gtk_entry_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906 gtk_editable_set_editable(GTK_EDITABLE(id->name_entry), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
907 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
908 gtk_widget_show(id->name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
909
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
910 id->notebook = gtk_notebook_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
911 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(id->notebook), GTK_POS_TOP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
912 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
913 g_signal_connect(G_OBJECT(id->notebook), "page-reordered",
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
914 G_CALLBACK(info_notebook_reordered_cb), id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
915
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
916 gtk_widget_show(id->notebook);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918 pref_spacer(main_vbox, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
920 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
921
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
922 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
923 G_CALLBACK(info_window_back_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
924 gtk_widget_set_sensitive(id->button_back, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
926 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
927 G_CALLBACK(info_window_next_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
928 gtk_widget_set_sensitive(id->button_next, (id->list->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
929
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
930 if (id->list->next)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
931 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
932 id->label_count = pref_label_new(hbox, "");
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
935 button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
936 G_CALLBACK(info_window_close_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
937 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
938 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
939
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
940 /* set up tabs */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
941
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
942 info_tabs_init(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
943
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
944 /* fill it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
945
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
946 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
947
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
948 /* finish */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
949
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
950 info_window_dnd_init(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
951
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
952 gtk_widget_show(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
953 }