annotate src/info.c @ 671:8268cbe682f1

Include debug.h from main.h since debug macros may be used anywhere in the code.
author zas_
date Fri, 16 May 2008 10:02:56 +0000
parents e34c1002e553
children 9f00d0d874fa
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
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 static void info_tabs_init(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492 {
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
493 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
494
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
495 if (!info_tabs_pos_list)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
496 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
497 /* First run, default tabs order is defined here. */
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
498 info_tabs_pos_list_append(info_tab_general_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
499 info_tabs_pos_list_append(info_tab_meta_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
500 info_tabs_pos_list_append(info_tab_exif_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
501 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
502 else
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
503 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
504
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
505 work = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
506 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
507 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
508 InfoTabsPos *t = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
509 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
510
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
511 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
512 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 * sync
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
521 static void info_window_sync(InfoData *id, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
524 if (!fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
525
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
526 gtk_entry_set_text(GTK_ENTRY(id->name_entry), fd->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 if (id->label_count)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531 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
532 g_list_index(id->list, (gpointer)fd) + 1,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 g_list_length(id->list));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534 gtk_label_set_text(GTK_LABEL(id->label_count), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 info_tabs_sync(id, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540 id->updated = FALSE;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
541 image_change_fd(id->image, fd, 0.0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
544 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
545 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
546 InfoData *id = data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
547 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
548
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
549 /* Save current tabs position to be able to restore them later. */
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
550 work = id->tab_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
551 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
552 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
553 GList *tabpos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
554 TabData *td = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
555 gint pos = gtk_notebook_page_num(GTK_NOTEBOOK(id->notebook), GTK_WIDGET(td->child));
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
556 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
557
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
558 tabpos = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
559 while (tabpos)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
560 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
561 InfoTabsPos *t = tabpos->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
562 tabpos = tabpos->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
563
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
564 if (t->func == td->func_new)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
565 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
566 t->pos = pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
567 break;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
568 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 289
diff changeset
569 }
551
5b127951daa1 info_notebook_reordered_cb(): do not call info_tabs_sync(), it causes exif
zas_
parents: 531
diff changeset
570 }
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
571 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
572
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 * drag n drop (dropping not supported!)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579 static void info_window_dnd_data_set(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 InfoData *id = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
584 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
586 fd = image_get_fd(id->image);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
587 if (fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 gint len;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 gint plain_text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 switch (info)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 case TARGET_URI_LIST:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 plain_text = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 case TARGET_TEXT_PLAIN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 plain_text = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 }
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
604 list = g_list_append(NULL, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
605 text = uri_text_from_filelist(list, &len, plain_text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 gtk_selection_data_set(selection_data, selection_data->target,
64
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
609 8, (guchar *)text, len);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 static void info_window_dnd_init(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 ImageWindow *imd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 imd = id->image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
620 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
623 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 G_CALLBACK(info_window_dnd_data_set), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 #if 0
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
627 gtk_drag_dest_set(imd->pr,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 dnd_file_drop_types, dnd_file_drop_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
631 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 G_CALLBACK(info_window_dnd_data_get), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 * base window
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642 static gint info_window_last_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 static gint info_window_last_height = DEF_PROPERTY_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645 static void info_window_image_update_cb(ImageWindow *imd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 /* only do this once after when loading a new image,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 * for tabs that depend on image data (exif)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 * Subsequent updates are ignored, as the image
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 * should not really changed if id->updated is TRUE.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 if (id->updated) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 if (imd->unknown) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 info_tabs_sync(id, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 id->updated = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 static void info_window_back_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
667 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 if (!work || !work->prev) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 work = work->prev;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
671 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
673 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 gtk_widget_set_sensitive(id->button_back, (work->prev != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 gtk_widget_set_sensitive(id->button_next, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679 static void info_window_next_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
684 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 if (!work || !work->next) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 work = work->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
688 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
690 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
691
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692 gtk_widget_set_sensitive(id->button_next, (work->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 gtk_widget_set_sensitive(id->button_back, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 static void info_window_image_button_cb(ImageWindow *imd, gint button, guint32 time,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 gdouble x, gdouble y, guint state, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698 {
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
699 if (button == MOUSE_BUTTON_LEFT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702 }
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
703 else if (button == MOUSE_BUTTON_MIDDLE || button == MOUSE_BUTTON_RIGHT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 info_window_back_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
708
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 static void info_window_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 gdouble x, gdouble y, guint state, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 if (direction == GDK_SCROLL_UP)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 info_window_back_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
716 else if (direction == GDK_SCROLL_DOWN)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
717 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722 static void info_window_close(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 gdk_drawable_get_size(id->window->window, &info_window_last_width, &info_window_last_height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 info_window_last_width = MAX(info_window_last_width, DEF_PROPERTY_WIDTH);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 info_window_last_height = MAX(info_window_last_height, DEF_PROPERTY_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 gtk_widget_destroy(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731 static void info_window_close_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738 static gint info_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
741
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
745
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
746 static void info_window_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750 info_tabs_free(id);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
751 filelist_free(id->list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 g_free(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754
479
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
755 void info_window_new(FileData *fd, GList *list, GtkWidget *parent)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 InfoData *id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 GtkWidget *main_vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 GtkWidget *paned;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 GdkGeometry geometry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
765 if (!fd && !list) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767 if (!list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
769 list = g_list_append(NULL, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 id = g_new0(InfoData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774 id->list = list;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
775 id->fd = (FileData *)id->list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776 id->updated = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777
289
6a7298988a7a Simplify and unify gtk_window creation with the help of
zas_
parents: 288
diff changeset
778 id->window = window_new(GTK_WINDOW_TOPLEVEL, "properties", NULL, NULL, _("Image properties"));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779 gtk_window_set_type_hint(GTK_WINDOW(id->window), GDK_WINDOW_TYPE_HINT_DIALOG);
479
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
780 id->parent = parent;
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
781 if (GTK_IS_WINDOW(id->parent)) {
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
782 gtk_window_set_keep_above(GTK_WINDOW(id->window), TRUE);
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
783 #if 0
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
784 /* work, but behavior is not that great */
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
785 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
786 #endif
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
787 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 gtk_window_set_resizable(GTK_WINDOW(id->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790 geometry.min_width = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791 geometry.min_height = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 geometry.base_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 geometry.base_height = DEF_PROPERTY_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
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 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
799 gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER);
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 g_signal_connect(G_OBJECT(id->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802 G_CALLBACK(info_window_delete_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 g_signal_connect(G_OBJECT(id->window), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804 G_CALLBACK(info_window_destroy_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 paned = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 gtk_container_add(GTK_CONTAINER(id->window), paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808 gtk_widget_show(paned);
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 id->image = image_new(FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 image_set_update_func(id->image, info_window_image_update_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 image_set_button_func(id->image, info_window_image_button_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 image_set_scroll_func(id->image, info_window_image_scroll_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816 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
817 gtk_paned_pack1(GTK_PANED(paned), id->image->widget, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818 gtk_widget_show(id->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 main_vbox = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 gtk_paned_pack2(GTK_PANED(paned), main_vbox, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 gtk_widget_show(main_vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824 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
825 label = pref_label_new(hbox, _("Filename:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 id->name_entry = gtk_entry_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 gtk_editable_set_editable(GTK_EDITABLE(id->name_entry), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 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
831 gtk_widget_show(id->name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 id->notebook = gtk_notebook_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(id->notebook), GTK_POS_TOP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 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
836 g_signal_connect(G_OBJECT(id->notebook), "page-reordered",
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
837 G_CALLBACK(info_notebook_reordered_cb), id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
838
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 gtk_widget_show(id->notebook);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841 pref_spacer(main_vbox, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 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
844
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 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
846 G_CALLBACK(info_window_back_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847 gtk_widget_set_sensitive(id->button_back, FALSE);
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->button_next = pref_button_new(hbox, GTK_STOCK_GO_FORWARD, NULL, TRUE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 G_CALLBACK(info_window_next_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851 gtk_widget_set_sensitive(id->button_next, (id->list->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853 if (id->list->next)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855 id->label_count = pref_label_new(hbox, "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
857
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
858 button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859 G_CALLBACK(info_window_close_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
862
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863 /* set up tabs */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
864
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865 info_tabs_init(id);
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 /* fill it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
869 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871 /* finish */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 info_window_dnd_init(id);
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_widget_show(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876 }