annotate src/info.c @ 526:92b5a033a279

fixed dragging multiple files from file list http://sourceforge.net/tracker/index.php?func=detail&aid=1950740&group_id=222125&atid=1054680
author nadvornik
date Fri, 25 Apr 2008 20:08:47 +0000
parents 5212d4fed37f
children 1149a7b0a3d7
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"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "filelist.h"
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"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #include <pwd.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 #include <grp.h>
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 #define IMAGE_SIZE_W 200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 #define IMAGE_SIZE_H 200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34
90
dc3c77d027e6 Tue Oct 31 18:06:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
35 #define DEF_PROPERTY_WIDTH 600
dc3c77d027e6 Tue Oct 31 18:06:42 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
36 #define DEF_PROPERTY_HEIGHT 400
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 typedef struct _TabData TabData;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 struct _TabData
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 void (*func_free)(gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 void (*func_sync)(InfoData *id, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 void (*func_image)(InfoData *id, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 gpointer data;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
45 TabData *(*func_new)(InfoData *id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
46 GtkWidget *child;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
49 typedef struct _InfoTabsPos InfoTabsPos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
50 struct _InfoTabsPos
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
51 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
52 TabData *(*func)(InfoData *id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
53 gint pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
54 };
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
55
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
56 static GList *info_tabs_pos_list = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57
271
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
58 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
59 {
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
60 #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
61 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
62 #endif
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
63 }
35f9083c6b95 gtk_notebook_set_tab_reorderable() is only available sinc gtk+ 2.10.
zas_
parents: 254
diff changeset
64
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 * table utils
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 GtkWidget *table_add_line(GtkWidget *table, gint x, gint y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 const gchar *description, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 if (!text) text = "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 label = pref_table_label(table, x, y, description, 1.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 label = pref_table_label(table, x + 1, y, text, 0.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 return label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 * EXIF tab
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 static void info_tab_exif_image(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 GtkWidget *bar = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
94 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 if (id->image->unknown)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
98 fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
102 fd = id->image->image_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
105 bar_exif_set(bar, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 static void info_tab_exif_sync(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 GtkWidget *bar = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 bar_exif_set(bar, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 static TabData *info_tab_exif_new(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 GtkWidget *bar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 bar = bar_exif_new(FALSE, NULL, FALSE, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 gtk_container_set_border_width(GTK_CONTAINER(bar), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 label = gtk_label_new(_("Exif"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 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
126 notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), bar, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 gtk_widget_show(bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 td->func_free = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 td->func_sync = info_tab_exif_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 td->func_image = info_tab_exif_image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 td->data = bar;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
135 td->func_new = info_tab_exif_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
136 td->child = bar;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 return td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 * file attributes tab
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 typedef struct _InfoTabMeta InfoTabMeta;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 struct _InfoTabMeta
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 GtkWidget *bar_info;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 static void info_tab_meta_free(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 InfoTabMeta *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 g_free(tab);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 static void info_tab_meta_sync(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 InfoTabMeta *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
164 bar_info_set(tab->bar_info, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 static GList *info_tab_meta_list_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 return path_list_copy(id->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 static TabData *info_tab_meta_new(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 InfoTabMeta *tab;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 tab = g_new0(InfoTabMeta, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 tab->bar_info = bar_info_new(NULL, TRUE, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 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
184 bar_info_selection(tab->bar_info, g_list_length(id->list) - 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 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
187
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 label = gtk_label_new(_("Keywords"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 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
190 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
191 gtk_widget_show(tab->bar_info);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 td->func_free = info_tab_meta_free;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 td->func_sync = info_tab_meta_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 td->func_image = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 td->data = tab;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
199 td->func_new = info_tab_meta_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
200 td->child = tab->bar_info;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 return td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 * general tab
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 typedef struct _InfoTabGeneral InfoTabGeneral;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 struct _InfoTabGeneral
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 GtkWidget *label_file_time;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 GtkWidget *label_file_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 GtkWidget *label_dimensions;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 GtkWidget *label_transparent;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 GtkWidget *label_image_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 GtkWidget *label_compression;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 GtkWidget *label_mime_type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 GtkWidget *label_user;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 GtkWidget *label_group;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 GtkWidget *label_perms;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 gint compression_done;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 gint64 byte_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 static void info_tab_general_image(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 InfoTabGeneral *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 guint mem_size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 gint has_alpha;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
236 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
237 gint width, height;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 if (id->image->unknown) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
241 pixbuf_renderer_get_image_size(PIXBUF_RENDERER(id->image->pr), &width, &height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
242
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
243 buf = g_strdup_printf("%d x %d", width, height);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 gtk_label_set_text(GTK_LABEL(tab->label_dimensions), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
247 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
248 if (pixbuf)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
250 has_alpha = gdk_pixbuf_get_has_alpha(pixbuf);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 has_alpha = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 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
257
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
258 mem_size = width * height * ((has_alpha) ? 4 : 3);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 buf = text_from_size_abrev(mem_size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 gtk_label_set_text(GTK_LABEL(tab->label_image_size), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 if (!tab->compression_done && mem_size > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 {
15
3263965d5f9e ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
265 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
266 gtk_label_set_text(GTK_LABEL(tab->label_compression), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 tab->compression_done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 buf = image_loader_get_format(id->image->il);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 if (buf)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 gtk_label_set_text(GTK_LABEL(tab->label_mime_type), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 static gchar *mode_number(mode_t m)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 int mb, mu, mg, mo;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 mb = mu = mg = mo = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 if (m & S_ISUID) mb |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 if (m & S_ISGID) mb |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 if (m & S_ISVTX) mb |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 if (m & S_IRUSR) mu |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 if (m & S_IWUSR) mu |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 if (m & S_IXUSR) mu |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 if (m & S_IRGRP) mg |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 if (m & S_IWGRP) mg |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 if (m & S_IXGRP) mg |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 if (m & S_IROTH) mo |= 4;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 if (m & S_IWOTH) mo |= 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 if (m & S_IXOTH) mo |= 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 return g_strdup_printf("%d%d%d%d", mb, mu, mg, mo);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 static void info_tab_general_sync_perm(InfoTabGeneral *tab, InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 struct stat st;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
307 if (!stat_utf8(id->fd->path, &st))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 gtk_label_set_text(GTK_LABEL(tab->label_user), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 gtk_label_set_text(GTK_LABEL(tab->label_group), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 gtk_label_set_text(GTK_LABEL(tab->label_perms), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 struct passwd *user;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 struct group *grp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 gchar pbuf[12];
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 gchar *pmod;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 user = getpwuid(st.st_uid);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 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
323
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 grp = getgrgid(st.st_gid);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 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
326
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 pbuf[0] = (st.st_mode & S_IRUSR) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 pbuf[1] = (st.st_mode & S_IWUSR) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 pbuf[2] = (st.st_mode & S_IXUSR) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 pbuf[3] = (st.st_mode & S_IRGRP) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 pbuf[4] = (st.st_mode & S_IWGRP) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 pbuf[5] = (st.st_mode & S_IXGRP) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 pbuf[6] = (st.st_mode & S_IROTH) ? 'r' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 pbuf[7] = (st.st_mode & S_IWOTH) ? 'w' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 pbuf[8] = (st.st_mode & S_IXOTH) ? 'x' : '-';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 pbuf[9] = '\0';
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 pmod = mode_number(st.st_mode);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 buf = g_strdup_printf("%s (%s)", pbuf, pmod);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 gtk_label_set_text(GTK_LABEL(tab->label_perms), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 g_free(pmod);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346 static void info_tab_general_sync(InfoData *id, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 InfoTabGeneral *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
351 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
352
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
353 tab->byte_size = id->fd->size;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 buf = text_from_size(tab->byte_size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 gtk_label_set_text(GTK_LABEL(tab->label_file_size), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 gtk_label_set_text(GTK_LABEL(tab->label_dimensions), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 gtk_label_set_text(GTK_LABEL(tab->label_transparent), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 gtk_label_set_text(GTK_LABEL(tab->label_image_size), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 gtk_label_set_text(GTK_LABEL(tab->label_compression), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364 gtk_label_set_text(GTK_LABEL(tab->label_mime_type), "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 info_tab_general_sync_perm(tab, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 tab->compression_done = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 static void info_tab_general_free(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 InfoTabGeneral *tab = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 g_free(tab);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 static TabData *info_tab_general_new(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 TabData *td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381 InfoTabGeneral *tab;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 GtkWidget *table;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385 tab = g_new0(InfoTabGeneral, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 table = pref_table_new(NULL, 2, 11, FALSE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388 gtk_container_set_border_width(GTK_CONTAINER(table), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 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
391 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
392
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 tab->label_dimensions = table_add_line(table, 0, 2, _("Dimensions:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 tab->label_transparent = table_add_line(table, 0, 3, _("Transparent:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 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
396
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 tab->label_compression = table_add_line(table, 0, 5, _("Compress ratio:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 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
399
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 tab->label_user = table_add_line(table, 0, 7, _("Owner:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 tab->label_group = table_add_line(table, 0, 8, _("Group:"), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 tab->label_perms = table_add_line(table, 0, 9, "", NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 label = gtk_label_new(_("General"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 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
406 notebook_set_tab_reorderable(GTK_NOTEBOOK(id->notebook), table, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 gtk_widget_show(table);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409 /* register */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 td = g_new0(TabData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 td->func_free = info_tab_general_free;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 td->func_sync = info_tab_general_sync;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 td->func_image = info_tab_general_image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 td->data = tab;
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
415 td->func_new = info_tab_general_new;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
416 td->child = table;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 return td;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423 * tabs
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 static void info_tabs_sync(InfoData *id, gint image)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431 work = id->tab_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 TabData *td = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 if (image)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 if (td->func_image) td->func_image(id, td->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 if (td->func_sync) td->func_sync(id, td->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 static void info_tabs_free(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 work = id->tab_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 TabData *td = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 if (td->func_free) td->func_free(td->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 g_free(td);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 g_list_free(id->tab_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 id->tab_list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
465 static InfoTabsPos *info_tabs_pos_new(gpointer func, gint pos)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
466 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
467 InfoTabsPos *t = g_new0(InfoTabsPos, 1);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
468 t->func = func;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
469 t->pos = pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
470
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
471 return t;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
472 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
473
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
474 static void info_tabs_pos_list_append(gpointer func)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
475 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
476 static gint pos = 0;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
477
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
478 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
479 }
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 static gint compare_info_tabs_pos(gconstpointer a, gconstpointer b)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
482 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
483 InfoTabsPos *ta = (InfoTabsPos *) a;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
484 InfoTabsPos *tb = (InfoTabsPos *) b;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
485
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
486 if (ta->pos > tb->pos) return 1;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
487 return -1;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
488 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
489
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 static void info_tabs_init(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 {
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
492 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
493
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
494 if (!info_tabs_pos_list)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
495 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
496 /* First run, default tabs order is defined here. */
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
497 info_tabs_pos_list_append(info_tab_general_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
498 info_tabs_pos_list_append(info_tab_meta_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
499 info_tabs_pos_list_append(info_tab_exif_new);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
500 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
501 else
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
502 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
503
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
504 work = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
505 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
506 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
507 InfoTabsPos *t = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
508 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
509
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
510 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
511 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 * sync
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
520 static void info_window_sync(InfoData *id, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
523 if (!fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
525 gtk_entry_set_text(GTK_ENTRY(id->name_entry), fd->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527 if (id->label_count)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 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
531 g_list_index(id->list, (gpointer)fd) + 1,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 g_list_length(id->list));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 gtk_label_set_text(GTK_LABEL(id->label_count), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537 info_tabs_sync(id, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 id->updated = FALSE;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
540 image_change_fd(id->image, fd, 0.0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542
221
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
543 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
544 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
545 InfoData *id = data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
546 GList *work;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
547
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
548 info_tabs_sync(id, 0);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
549
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
550 /* 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
551 work = id->tab_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
552 while (work)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
553 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
554 GList *tabpos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
555 TabData *td = work->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
556 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
557 work = work->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
558
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
559 tabpos = info_tabs_pos_list;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
560 while (tabpos)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
561 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
562 InfoTabsPos *t = tabpos->data;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
563 tabpos = tabpos->next;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
564
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
565 if (t->func == td->func_new)
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
566 {
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
567 t->pos = pos;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
568 break;
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
569 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 289
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 }
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
573
9
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 * drag n drop (dropping not supported!)
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 static void info_window_dnd_data_set(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582 guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 InfoData *id = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
585 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
587 fd = image_get_fd(id->image);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
588 if (fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 gint len;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 gint plain_text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 switch (info)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 case TARGET_URI_LIST:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 plain_text = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 case TARGET_TEXT_PLAIN:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 default:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 plain_text = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 }
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
605 list = g_list_append(NULL, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
606 text = uri_text_from_filelist(list, &len, plain_text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 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
610 8, (guchar *)text, len);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 g_free(text);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 static void info_window_dnd_init(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 ImageWindow *imd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 imd = id->image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
621 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 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
624 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 G_CALLBACK(info_window_dnd_data_set), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 #if 0
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 15
diff changeset
628 gtk_drag_dest_set(imd->pr,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 dnd_file_drop_types, dnd_file_drop_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631 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
632 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 G_CALLBACK(info_window_dnd_data_get), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 #endif
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 * base window
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 static gint info_window_last_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644 static gint info_window_last_height = DEF_PROPERTY_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646 static void info_window_image_update_cb(ImageWindow *imd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 /* only do this once after when loading a new image,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 * for tabs that depend on image data (exif)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 * Subsequent updates are ignored, as the image
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 * should not really changed if id->updated is TRUE.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 if (id->updated) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 if (imd->unknown) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 info_tabs_sync(id, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 id->updated = TRUE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 static void info_window_back_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
668 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 if (!work || !work->prev) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671 work = work->prev;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
672 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
674 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 gtk_widget_set_sensitive(id->button_back, (work->prev != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 gtk_widget_set_sensitive(id->button_next, TRUE);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 static void info_window_next_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
685 work = g_list_find(id->list, (gpointer)id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686 if (!work || !work->next) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 work = work->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
689 id->fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
691 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 gtk_widget_set_sensitive(id->button_next, (work->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 gtk_widget_set_sensitive(id->button_back, TRUE);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 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
698 gdouble x, gdouble y, guint state, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 {
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
700 if (button == MOUSE_BUTTON_LEFT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 }
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
704 else if (button == MOUSE_BUTTON_MIDDLE || button == MOUSE_BUTTON_RIGHT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 info_window_back_cb(NULL, data);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 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
711 gdouble x, gdouble y, guint state, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 if (direction == GDK_SCROLL_UP)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715 info_window_back_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
716 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
717 else if (direction == GDK_SCROLL_DOWN)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 info_window_next_cb(NULL, data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 static void info_window_close(InfoData *id)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 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
726 info_window_last_width = MAX(info_window_last_width, DEF_PROPERTY_WIDTH);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 info_window_last_height = MAX(info_window_last_height, DEF_PROPERTY_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729 gtk_widget_destroy(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732 static void info_window_close_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 static gint info_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
741 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743 info_window_close(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744 return TRUE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 static void info_window_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749 InfoData *id = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751 info_tabs_free(id);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
752 filelist_free(id->list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 g_free(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755
479
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
756 void info_window_new(FileData *fd, GList *list, GtkWidget *parent)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 InfoData *id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 GtkWidget *main_vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760 GtkWidget *paned;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764 GdkGeometry geometry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
766 if (!fd && !list) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 if (!list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
770 list = g_list_append(NULL, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773 id = g_new0(InfoData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 id->list = list;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
776 id->fd = (FileData *)id->list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777 id->updated = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
778
289
6a7298988a7a Simplify and unify gtk_window creation with the help of
zas_
parents: 288
diff changeset
779 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
780 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
781 id->parent = parent;
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
782 if (GTK_IS_WINDOW(id->parent)) {
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
783 gtk_window_set_keep_above(GTK_WINDOW(id->window), TRUE);
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
784 #if 0
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
785 /* work, but behavior is not that great */
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
786 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
787 #endif
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
788 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 gtk_window_set_resizable(GTK_WINDOW(id->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791 geometry.min_width = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 geometry.min_height = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 geometry.base_width = DEF_PROPERTY_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 geometry.base_height = DEF_PROPERTY_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 gtk_window_set_geometry_hints(GTK_WINDOW(id->window), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 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
800 gtk_container_set_border_width(GTK_CONTAINER(id->window), PREF_PAD_BORDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
801
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802 g_signal_connect(G_OBJECT(id->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803 G_CALLBACK(info_window_delete_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804 g_signal_connect(G_OBJECT(id->window), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805 G_CALLBACK(info_window_destroy_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 paned = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808 gtk_container_add(GTK_CONTAINER(id->window), paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 gtk_widget_show(paned);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 id->image = image_new(FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812 image_set_update_func(id->image, info_window_image_update_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 image_set_button_func(id->image, info_window_image_button_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815 image_set_scroll_func(id->image, info_window_image_scroll_cb, id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 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
818 gtk_paned_pack1(GTK_PANED(paned), id->image->widget, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 gtk_widget_show(id->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 main_vbox = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 gtk_paned_pack2(GTK_PANED(paned), main_vbox, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 gtk_widget_show(main_vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825 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
826 label = pref_label_new(hbox, _("Filename:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 id->name_entry = gtk_entry_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 gtk_editable_set_editable(GTK_EDITABLE(id->name_entry), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 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
832 gtk_widget_show(id->name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834 id->notebook = gtk_notebook_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(id->notebook), GTK_POS_TOP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 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
837 g_signal_connect(G_OBJECT(id->notebook), "page-reordered",
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
838 G_CALLBACK(info_notebook_reordered_cb), id);
79ef86f3b325 Make properties tabs reorderable through drag'n drop.
zas_
parents: 219
diff changeset
839
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 gtk_widget_show(id->notebook);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842 pref_spacer(main_vbox, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 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
845
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846 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
847 G_CALLBACK(info_window_back_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848 gtk_widget_set_sensitive(id->button_back, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 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
851 G_CALLBACK(info_window_next_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 gtk_widget_set_sensitive(id->button_next, (id->list->next != NULL));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854 if (id->list->next)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856 id->label_count = pref_label_new(hbox, "");
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859 button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 G_CALLBACK(info_window_close_cb), id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
862 gtk_widget_show(button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
864 /* set up tabs */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866 info_tabs_init(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868 /* fill it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 90
diff changeset
870 info_window_sync(id, id->fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872 /* finish */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
874 info_window_dnd_init(id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876 gtk_widget_show(id->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877 }