Mercurial > geeqie
annotate src/layout.c @ 1436:d7a6fb7a90dd
completely separated global and layout window options
layout window configuration is available under separate menu entry
author | nadvornik |
---|---|
date | Sat, 14 Mar 2009 23:26:42 +0000 |
parents | b4ad1d201279 |
children | a3d3208b0c50 |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
3 * (C) 2006 John Ellis |
1284 | 4 * Copyright (C) 2008 - 2009 The Geeqie Team |
9 | 5 * |
6 * Author: John Ellis | |
7 * | |
8 * This software is released under the GNU General Public License (GNU GPL). | |
9 * Please read the included file COPYING for more information. | |
10 * This software comes with no warranty of any kind, use at your own risk! | |
11 */ | |
12 | |
281 | 13 #include "main.h" |
9 | 14 #include "layout.h" |
15 | |
507 | 16 #include "color-man.h" |
586 | 17 #include "filedata.h" |
507 | 18 #include "histogram.h" |
9 | 19 #include "image.h" |
482 | 20 #include "image-overlay.h" |
9 | 21 #include "layout_config.h" |
22 #include "layout_image.h" | |
23 #include "layout_util.h" | |
24 #include "menu.h" | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
25 #include "pixbuf-renderer.h" |
9 | 26 #include "pixbuf_util.h" |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
27 #include "utilops.h" |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
28 #include "view_dir.h" |
556
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
29 #include "view_file.h" |
9 | 30 #include "ui_fileops.h" |
31 #include "ui_menu.h" | |
32 #include "ui_misc.h" | |
33 #include "ui_tabcomp.h" | |
648
e34c1002e553
Move some functions from main.[ch] to new window.[ch].
zas_
parents:
632
diff
changeset
|
34 #include "window.h" |
1214
31402ecb2aed
write metadata after timeout, image change or dir change
nadvornik
parents:
1177
diff
changeset
|
35 #include "metadata.h" |
1309 | 36 #include "rcfile.h" |
37 #include "bar.h" | |
1320 | 38 #include "bar_sort.h" |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
39 #include "preferences.h" |
648
e34c1002e553
Move some functions from main.[ch] to new window.[ch].
zas_
parents:
632
diff
changeset
|
40 |
528 | 41 #ifdef HAVE_LIRC |
42 #include "lirc.h" | |
43 #endif | |
9 | 44 |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
45 #define MAINWINDOW_DEF_WIDTH 700 |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
46 #define MAINWINDOW_DEF_HEIGHT 500 |
9 | 47 |
553
32cf2e7992fd
Change default positions of dividers since width of the main menu
zas_
parents:
531
diff
changeset
|
48 #define MAIN_WINDOW_DIV_HPOS (MAINWINDOW_DEF_WIDTH / 2) |
32cf2e7992fd
Change default positions of dividers since width of the main menu
zas_
parents:
531
diff
changeset
|
49 #define MAIN_WINDOW_DIV_VPOS (MAINWINDOW_DEF_HEIGHT / 2) |
9 | 50 |
51 #define TOOLWINDOW_DEF_WIDTH 260 | |
52 #define TOOLWINDOW_DEF_HEIGHT 450 | |
553
32cf2e7992fd
Change default positions of dividers since width of the main menu
zas_
parents:
531
diff
changeset
|
53 |
9 | 54 #define PROGRESS_WIDTH 150 |
1375
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
55 #define PIXEL_LABEL_WIDTH 130 |
9 | 56 #define ZOOM_LABEL_WIDTH 64 |
57 | |
58 #define PANE_DIVIDER_SIZE 10 | |
59 | |
60 | |
61 GList *layout_window_list = NULL; | |
62 | |
63 | |
64 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle); | |
65 | |
66 | |
67 /* | |
68 *----------------------------------------------------------------------------- | |
69 * misc | |
70 *----------------------------------------------------------------------------- | |
71 */ | |
72 | |
1416 | 73 gboolean layout_valid(LayoutWindow **lw) |
9 | 74 { |
75 if (*lw == NULL) | |
76 { | |
77 if (layout_window_list) *lw = layout_window_list->data; | |
78 return (*lw != NULL); | |
79 } | |
80 | |
81 return (g_list_find(layout_window_list, *lw) != NULL); | |
82 } | |
83 | |
84 LayoutWindow *layout_find_by_image(ImageWindow *imd) | |
85 { | |
86 GList *work; | |
87 | |
88 work = layout_window_list; | |
89 while (work) | |
90 { | |
91 LayoutWindow *lw = work->data; | |
92 work = work->next; | |
93 | |
94 if (lw->image == imd) return lw; | |
95 } | |
96 | |
97 return NULL; | |
98 } | |
99 | |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
100 LayoutWindow *layout_find_by_image_fd(ImageWindow *imd) |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
101 { |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
102 GList *work; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
103 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
104 work = layout_window_list; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
105 while (work) |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
106 { |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
107 LayoutWindow *lw = work->data; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
108 work = work->next; |
1372 | 109 |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
110 if (lw->image->image_fd == imd->image_fd) |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
111 return lw; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
112 } |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
113 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
114 return NULL; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
115 } |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
340
diff
changeset
|
116 |
9 | 117 /* |
118 *----------------------------------------------------------------------------- | |
119 * menu, toolbar, and dir view | |
120 *----------------------------------------------------------------------------- | |
121 */ | |
122 | |
123 static void layout_path_entry_changed_cb(GtkWidget *widget, gpointer data) | |
124 { | |
125 LayoutWindow *lw = data; | |
126 gchar *buf; | |
127 | |
128 if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return; | |
129 | |
130 buf = g_strdup(gtk_entry_get_text(GTK_ENTRY(lw->path_entry))); | |
1372 | 131 if (!lw->dir_fd || strcmp(buf, lw->dir_fd->path) != 0) |
9 | 132 { |
1372 | 133 layout_set_path(lw, buf); |
9 | 134 } |
135 | |
442 | 136 g_free(buf); |
9 | 137 } |
138 | |
139 static void layout_path_entry_tab_cb(const gchar *path, gpointer data) | |
140 { | |
141 LayoutWindow *lw = data; | |
142 gchar *buf; | |
143 | |
144 buf = g_strdup(path); | |
145 parse_out_relatives(buf); | |
1372 | 146 |
9 | 147 if (isdir(buf)) |
148 { | |
783 | 149 if ((!lw->dir_fd || strcmp(lw->dir_fd->path, buf) != 0) && layout_set_path(lw, buf)) |
9 | 150 { |
151 gint pos = -1; | |
726 | 152 /* put the G_DIR_SEPARATOR back, if we are in tab completion for a dir and result was path change */ |
725 | 153 gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), G_DIR_SEPARATOR_S, -1, &pos); |
9 | 154 gtk_editable_set_position(GTK_EDITABLE(lw->path_entry), |
155 strlen(gtk_entry_get_text(GTK_ENTRY(lw->path_entry)))); | |
156 } | |
157 } | |
1372 | 158 else if (lw->dir_fd) |
9 | 159 { |
1372 | 160 gchar *base = remove_level_from_path(buf); |
161 | |
162 if (strcmp(lw->dir_fd->path, base) == 0) | |
163 { | |
164 layout_list_scroll_to_subpart(lw, filename_from_path(buf)); | |
165 } | |
166 g_free(base); | |
9 | 167 } |
1372 | 168 |
9 | 169 g_free(buf); |
170 } | |
171 | |
172 static void layout_path_entry_cb(const gchar *path, gpointer data) | |
173 { | |
174 LayoutWindow *lw = data; | |
175 gchar *buf; | |
176 | |
177 buf = g_strdup(path); | |
178 parse_out_relatives(buf); | |
179 | |
180 layout_set_path(lw, buf); | |
181 | |
182 g_free(buf); | |
183 } | |
184 | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
185 static void layout_vd_select_cb(ViewDir *vd, const gchar *path, gpointer data) |
9 | 186 { |
187 LayoutWindow *lw = data; | |
188 | |
189 layout_set_path(lw, path); | |
190 } | |
191 | |
1167
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
192 static void layout_path_entry_tab_append_cb(const gchar *path, gpointer data, gint n) |
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
193 { |
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
194 LayoutWindow *lw = data; |
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
195 |
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
196 if (!lw || !lw->back_button) return; |
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
197 if (!layout_valid(&lw)) return; |
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
198 |
1372 | 199 /* Enable back button if it makes sense */ |
200 gtk_widget_set_sensitive(lw->back_button, (n > 1)); | |
1167
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
201 } |
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
202 |
9 | 203 static GtkWidget *layout_tool_setup(LayoutWindow *lw) |
204 { | |
205 GtkWidget *box; | |
206 GtkWidget *menu_bar; | |
207 GtkWidget *tabcomp; | |
208 | |
209 box = gtk_vbox_new(FALSE, 0); | |
210 | |
211 menu_bar = layout_actions_menu_bar(lw); | |
212 gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0); | |
213 gtk_widget_show(menu_bar); | |
214 | |
1335 | 215 lw->toolbar = layout_actions_toolbar(lw); |
9 | 216 gtk_box_pack_start(GTK_BOX(box), lw->toolbar, FALSE, FALSE, 0); |
1309 | 217 if (!lw->options.toolbar_hidden) gtk_widget_show(lw->toolbar); |
9 | 218 |
219 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1, | |
220 layout_path_entry_cb, lw); | |
221 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw); | |
1167
e812b1a7adda
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
zas_
parents:
1055
diff
changeset
|
222 tab_completion_add_append_func(lw->path_entry, layout_path_entry_tab_append_cb, lw); |
9 | 223 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0); |
224 gtk_widget_show(tabcomp); | |
225 | |
226 g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed", | |
227 G_CALLBACK(layout_path_entry_changed_cb), lw); | |
228 | |
1309 | 229 lw->vd = vd_new(lw->options.dir_view_type, lw->dir_fd); |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
230 vd_set_layout(lw->vd, lw); |
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
231 vd_set_select_func(lw->vd, layout_vd_select_cb, lw); |
9 | 232 |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
233 lw->dir_view = lw->vd->widget; |
9 | 234 |
235 gtk_box_pack_start(GTK_BOX(box), lw->dir_view, TRUE, TRUE, 0); | |
236 gtk_widget_show(lw->dir_view); | |
237 | |
238 gtk_widget_show(box); | |
239 | |
240 return box; | |
241 } | |
242 | |
243 /* | |
244 *----------------------------------------------------------------------------- | |
245 * sort button (and menu) | |
246 *----------------------------------------------------------------------------- | |
247 */ | |
248 | |
249 static void layout_sort_menu_cb(GtkWidget *widget, gpointer data) | |
250 { | |
251 LayoutWindow *lw; | |
252 SortType type; | |
253 | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
254 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
255 |
9 | 256 lw = submenu_item_get_data(widget); |
257 if (!lw) return; | |
258 | |
259 type = (SortType)GPOINTER_TO_INT(data); | |
260 | |
261 layout_sort_set(lw, type, lw->sort_ascend); | |
262 } | |
263 | |
264 static void layout_sort_menu_ascend_cb(GtkWidget *widget, gpointer data) | |
265 { | |
266 LayoutWindow *lw = data; | |
267 | |
268 layout_sort_set(lw, lw->sort_method, !lw->sort_ascend); | |
269 } | |
270 | |
271 static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data) | |
272 { | |
273 /* destroy the menu */ | |
1043 | 274 #if GTK_CHECK_VERSION(2,12,0) |
275 g_object_unref(widget); | |
276 #else | |
9 | 277 gtk_widget_unref(GTK_WIDGET(widget)); |
1043 | 278 #endif |
9 | 279 } |
280 | |
281 static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data) | |
282 { | |
283 LayoutWindow *lw = data; | |
284 GtkWidget *menu; | |
285 GdkEvent *event; | |
286 guint32 etime; | |
287 | |
288 menu = submenu_add_sort(NULL, G_CALLBACK(layout_sort_menu_cb), lw, FALSE, FALSE, TRUE, lw->sort_method); | |
289 | |
88
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
290 /* take ownership of menu */ |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
291 #ifdef GTK_OBJECT_FLOATING |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
292 /* GTK+ < 2.10 */ |
9 | 293 g_object_ref(G_OBJECT(menu)); |
294 gtk_object_sink(GTK_OBJECT(menu)); | |
88
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
295 #else |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
296 /* GTK+ >= 2.10 */ |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
297 g_object_ref_sink(G_OBJECT(menu)); |
2099ee3f9a8d
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
gqview
parents:
81
diff
changeset
|
298 #endif |
9 | 299 |
442 | 300 /* ascending option */ |
9 | 301 menu_item_add_divider(menu); |
302 menu_item_add_check(menu, _("Ascending"), lw->sort_ascend, G_CALLBACK(layout_sort_menu_ascend_cb), lw); | |
303 | |
304 g_signal_connect(G_OBJECT(menu), "selection_done", | |
305 G_CALLBACK(layout_sort_menu_hide_cb), NULL); | |
306 | |
307 event = gtk_get_current_event(); | |
308 if (event) | |
309 { | |
310 etime = gdk_event_get_time(event); | |
311 gdk_event_free(event); | |
312 } | |
313 else | |
314 { | |
315 etime = 0; | |
316 } | |
317 | |
318 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, etime); | |
319 } | |
320 | |
321 static GtkWidget *layout_sort_button(LayoutWindow *lw) | |
322 { | |
323 GtkWidget *button; | |
324 | |
325 button = gtk_button_new_with_label(sort_type_get_text(lw->sort_method)); | |
442 | 326 g_signal_connect(G_OBJECT(button), "clicked", |
9 | 327 G_CALLBACK(layout_sort_button_press_cb), lw); |
442 | 328 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
9 | 329 |
442 | 330 return button; |
9 | 331 } |
332 | |
333 /* | |
334 *----------------------------------------------------------------------------- | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
335 * color profile button (and menu) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
336 *----------------------------------------------------------------------------- |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
337 */ |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
338 |
1006
45ce6c1f331e
Silent warnings about unused functions when lcms is not used.
zas_
parents:
995
diff
changeset
|
339 #ifdef HAVE_LCMS |
45ce6c1f331e
Silent warnings about unused functions when lcms is not used.
zas_
parents:
995
diff
changeset
|
340 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
341 static void layout_color_menu_enable_cb(GtkWidget *widget, gpointer data) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
342 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
343 LayoutWindow *lw = data; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
344 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
345 layout_image_color_profile_set_use(lw, (!layout_image_color_profile_get_use(lw))); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
346 layout_image_refresh(lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
347 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
348 |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
349 static void layout_color_menu_use_image_cb(GtkWidget *widget, gpointer data) |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
350 { |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
351 LayoutWindow *lw = data; |
1431 | 352 gint input, screen; |
353 gboolean use_image; | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
354 |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
355 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
356 layout_image_color_profile_set(lw, input, screen, !use_image); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
357 layout_image_refresh(lw); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
358 } |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
359 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
360 #define COLOR_MENU_KEY "color_menu_key" |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
361 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
362 static void layout_color_menu_input_cb(GtkWidget *widget, gpointer data) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
363 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
364 LayoutWindow *lw = data; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
365 gint type; |
1431 | 366 gint input, screen; |
367 gboolean use_image; | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
368 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
369 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
370 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
371 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), COLOR_MENU_KEY)); |
432 | 372 if (type < 0 || type >= COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS) return; |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
373 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
374 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
375 if (type == input) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
376 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
377 layout_image_color_profile_set(lw, type, screen, use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
378 layout_image_refresh(lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
379 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
380 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
381 static void layout_color_menu_screen_cb(GtkWidget *widget, gpointer data) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
382 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
383 LayoutWindow *lw = data; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
384 gint type; |
1431 | 385 gint input, screen; |
386 gboolean use_image; | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
387 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
388 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
389 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
390 type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), COLOR_MENU_KEY)); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
391 if (type < 0 || type > 1) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
392 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
393 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
394 if (type == screen) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
395 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
396 layout_image_color_profile_set(lw, input, type, use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
397 layout_image_refresh(lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
398 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
399 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
400 static gchar *layout_color_name_parse(const gchar *name) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
401 { |
1333
bdc19836c33d
Really fix up color profiles options tests. Add an indicator of the embedded color profile when recognized (a * just after sRGB or AdobeRGB compatible).
zas_
parents:
1332
diff
changeset
|
402 if (!name || !*name) return g_strdup(_("Empty")); |
269
dca6c0b9f862
Simplify layout_color_name_parse() using g_strdelimit().
zas_
parents:
268
diff
changeset
|
403 return g_strdelimit(g_strdup(name), "_", '-'); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
404 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
405 |
1006
45ce6c1f331e
Silent warnings about unused functions when lcms is not used.
zas_
parents:
995
diff
changeset
|
406 #endif /* HAVE_LCMS */ |
45ce6c1f331e
Silent warnings about unused functions when lcms is not used.
zas_
parents:
995
diff
changeset
|
407 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
408 static void layout_color_button_press_cb(GtkWidget *widget, gpointer data) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
409 { |
288
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
410 #ifndef HAVE_LCMS |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
411 gchar *msg = g_strdup_printf(_("This installation of %s was not built with support for color profiles."), GQ_APPNAME); |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
412 file_util_warning_dialog(_("Color profiles not supported"), |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
413 msg, |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
414 GTK_STOCK_DIALOG_INFO, widget); |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
415 g_free(msg); |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
416 return; |
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
417 #else |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
418 LayoutWindow *lw = data; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
419 GtkWidget *menu; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
420 GtkWidget *item; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
421 gchar *buf; |
1416 | 422 gboolean active; |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
423 gint input = 0; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
424 gint screen = 0; |
1431 | 425 gboolean use_image = FALSE; |
426 gboolean from_image; | |
1333
bdc19836c33d
Really fix up color profiles options tests. Add an indicator of the embedded color profile when recognized (a * just after sRGB or AdobeRGB compatible).
zas_
parents:
1332
diff
changeset
|
427 gint image_profile; |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
428 gint i; |
878
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
429 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
430 if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
431 |
1333
bdc19836c33d
Really fix up color profiles options tests. Add an indicator of the embedded color profile when recognized (a * just after sRGB or AdobeRGB compatible).
zas_
parents:
1332
diff
changeset
|
432 image_profile = layout_image_color_profile_get_from_image(lw); |
bdc19836c33d
Really fix up color profiles options tests. Add an indicator of the embedded color profile when recognized (a * just after sRGB or AdobeRGB compatible).
zas_
parents:
1332
diff
changeset
|
433 from_image = use_image && (image_profile != COLOR_PROFILE_NONE); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
434 menu = popup_menu_short_lived(); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
435 |
270 | 436 active = layout_image_color_profile_get_use(lw); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
437 menu_item_add_check(menu, _("Use _color profiles"), active, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
438 G_CALLBACK(layout_color_menu_enable_cb), lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
439 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
440 menu_item_add_divider(menu); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
441 |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
442 item = menu_item_add_check(menu, _("Use profile from _image"), use_image, |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
443 G_CALLBACK(layout_color_menu_use_image_cb), lw); |
1363
d87deb05d59f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
zas_
parents:
1362
diff
changeset
|
444 gtk_widget_set_sensitive(item, image_profile == COLOR_PROFILE_MEM || (image_profile > COLOR_PROFILE_NONE && image_profile < COLOR_PROFILE_FILE)); |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
445 |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
446 for (i = COLOR_PROFILE_SRGB; i < COLOR_PROFILE_FILE; i++) |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
447 { |
878
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
448 const gchar *label; |
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
449 |
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
450 switch (i) |
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
451 { |
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
452 case COLOR_PROFILE_SRGB: label = _("sRGB"); break; |
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
453 case COLOR_PROFILE_ADOBERGB: label = _("AdobeRGB compatible"); break; |
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
454 default: label = "fixme"; break; |
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
455 } |
1333
bdc19836c33d
Really fix up color profiles options tests. Add an indicator of the embedded color profile when recognized (a * just after sRGB or AdobeRGB compatible).
zas_
parents:
1332
diff
changeset
|
456 buf = g_strdup_printf(_("Input _%d: %s%s"), i, label, (i == image_profile) ? " *" : ""); |
878
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
457 item = menu_item_add_radio(menu, (i == COLOR_PROFILE_SRGB) ? NULL : item, |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
458 buf, (input == i), |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
459 G_CALLBACK(layout_color_menu_input_cb), lw); |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
460 g_free(buf); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
461 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i)); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
462 gtk_widget_set_sensitive(item, active && !from_image); |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
463 } |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
464 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
465 for (i = 0; i < COLOR_PROFILE_INPUTS; i++) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
466 { |
1342
06ec1279e33e
Color profiles menu: test for file access before allowing to select it as input profile.
zas_
parents:
1336
diff
changeset
|
467 const gchar *name = options->color_profile.input_name[i]; |
06ec1279e33e
Color profiles menu: test for file access before allowing to select it as input profile.
zas_
parents:
1336
diff
changeset
|
468 const gchar *file = options->color_profile.input_file[i]; |
878
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
469 gchar *end; |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
470 |
1342
06ec1279e33e
Color profiles menu: test for file access before allowing to select it as input profile.
zas_
parents:
1336
diff
changeset
|
471 if (!name || !name[0]) name = filename_from_path(file); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
472 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
473 end = layout_color_name_parse(name); |
878
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
474 buf = g_strdup_printf(_("Input _%d: %s"), i + COLOR_PROFILE_FILE, end); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
475 g_free(end); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
476 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
477 item = menu_item_add_radio(menu, item, |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
478 buf, (i + COLOR_PROFILE_FILE == input), |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
479 G_CALLBACK(layout_color_menu_input_cb), lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
480 g_free(buf); |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
390
diff
changeset
|
481 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE)); |
1362 | 482 gtk_widget_set_sensitive(item, active && !from_image && is_readable_file(file)); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
483 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
484 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
485 menu_item_add_divider(menu); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
486 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
487 item = menu_item_add_radio(menu, NULL, |
878
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
488 _("Screen sRGB"), (screen == 0), |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
489 G_CALLBACK(layout_color_menu_screen_cb), lw); |
878
1b14c0e177ad
layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
zas_
parents:
837
diff
changeset
|
490 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
491 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(0)); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
492 gtk_widget_set_sensitive(item, active); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
493 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
494 item = menu_item_add_radio(menu, item, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
495 _("_Screen profile"), (screen == 1), |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
496 G_CALLBACK(layout_color_menu_screen_cb), lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
497 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1)); |
1362 | 498 gtk_widget_set_sensitive(item, active && is_readable_file(options->color_profile.screen_file)); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
499 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
500 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME); |
288
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
501 #endif /* HAVE_LCMS */ |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
502 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
503 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
504 static GtkWidget *layout_color_button(LayoutWindow *lw) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
505 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
506 GtkWidget *button; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
507 GtkWidget *image; |
1416 | 508 gboolean enable; |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
509 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
510 button = gtk_button_new(); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
511 image = gtk_image_new_from_stock(GTK_STOCK_SELECT_COLOR, GTK_ICON_SIZE_MENU); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
512 gtk_container_add(GTK_CONTAINER(button), image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
513 gtk_widget_show(image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
514 g_signal_connect(G_OBJECT(button), "clicked", |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
515 G_CALLBACK(layout_color_button_press_cb), lw); |
268 | 516 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
517 |
268 | 518 #ifdef HAVE_LCMS |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
519 enable = (lw->image) ? lw->image->color_profile_enable : FALSE; |
268 | 520 #else |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
521 enable = FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
522 #endif |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
523 gtk_widget_set_sensitive(image, enable); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
524 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
525 return button; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
526 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
527 |
1240
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
528 /* |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
529 *----------------------------------------------------------------------------- |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
530 * write button |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
531 *----------------------------------------------------------------------------- |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
532 */ |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
533 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
534 static void layout_write_button_press_cb(GtkWidget *widget, gpointer data) |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
535 { |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
536 metadata_write_queue_confirm(NULL, NULL); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
537 } |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
538 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
539 static GtkWidget *layout_write_button(LayoutWindow *lw) |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
540 { |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
541 GtkWidget *button; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
542 GtkWidget *image; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
543 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
544 button = gtk_button_new(); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
545 image = gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
546 gtk_container_add(GTK_CONTAINER(button), image); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
547 gtk_widget_show(image); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
548 g_signal_connect(G_OBJECT(button), "clicked", |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
549 G_CALLBACK(layout_write_button_press_cb), lw); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
550 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
551 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
552 gtk_widget_set_sensitive(button, metadata_queue_length() > 0); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
553 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
554 return button; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
555 } |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
556 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
557 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
558 /* |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
559 *----------------------------------------------------------------------------- |
9 | 560 * status bar |
561 *----------------------------------------------------------------------------- | |
562 */ | |
563 | |
1240
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
564 void layout_status_update_write(LayoutWindow *lw) |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
565 { |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
566 if (!layout_valid(&lw)) return; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
567 if (!lw->info_write) return; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
568 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
569 gtk_widget_set_sensitive(lw->info_write, metadata_queue_length() > 0); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
570 /* FIXME: maybe show also the number of files */ |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
571 } |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
572 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
573 void layout_status_update_write_all(void) |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
574 { |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
575 GList *work; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
576 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
577 work = layout_window_list; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
578 while (work) |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
579 { |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
580 LayoutWindow *lw = work->data; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
581 work = work->next; |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
582 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
583 layout_status_update_write(lw); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
584 } |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
585 } |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
586 |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
587 |
9 | 588 void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *text) |
589 { | |
590 if (!layout_valid(&lw)) return; | |
591 if (!lw->info_progress_bar) return; | |
592 | |
593 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(lw->info_progress_bar), val); | |
594 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(lw->info_progress_bar), (text) ? text : " "); | |
595 } | |
596 | |
597 void layout_status_update_info(LayoutWindow *lw, const gchar *text) | |
598 { | |
599 gchar *buf = NULL; | |
600 | |
601 if (!layout_valid(&lw)) return; | |
602 | |
603 if (!text) | |
604 { | |
736 | 605 guint n; |
9 | 606 gint64 n_bytes = 0; |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
607 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
608 n = layout_list_count(lw, &n_bytes); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
609 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
610 if (n) |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
611 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
612 guint s; |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
613 gint64 s_bytes = 0; |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
614 const gchar *ss; |
9 | 615 |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
616 if (layout_image_slideshow_active(lw)) |
9 | 617 { |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
618 if (!layout_image_slideshow_paused(lw)) |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
619 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
620 ss = _(" Slideshow"); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
621 } |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
622 else |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
623 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
624 ss = _(" Paused"); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
625 } |
9 | 626 } |
627 else | |
628 { | |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
629 ss = ""; |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
630 } |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
631 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
632 s = layout_selection_count(lw, &s_bytes); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
633 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
634 layout_bars_new_selection(lw, s); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
635 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
636 if (s > 0) |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
637 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
638 gchar *b = text_from_size_abrev(n_bytes); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
639 gchar *sb = text_from_size_abrev(s_bytes); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
640 buf = g_strdup_printf(_("%s, %d files (%s, %d)%s"), b, n, sb, s, ss); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
641 g_free(b); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
642 g_free(sb); |
9 | 643 } |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
644 else if (n > 0) |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
645 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
646 gchar *b = text_from_size_abrev(n_bytes); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
647 buf = g_strdup_printf(_("%s, %d files%s"), b, n, ss); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
648 g_free(b); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
649 } |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
650 else |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
651 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
652 buf = g_strdup_printf(_("%d files%s"), n, ss); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
653 } |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
654 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
655 text = buf; |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
656 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
657 image_osd_update(lw->image); |
9 | 658 } |
659 else | |
660 { | |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
661 text = ""; |
9 | 662 } |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
663 } |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
664 |
583
de3e2bc22336
Revert patch 675, and correctly fix gtk assertion failure.
zas_
parents:
574
diff
changeset
|
665 if (lw->info_status) gtk_label_set_text(GTK_LABEL(lw->info_status), text); |
9 | 666 g_free(buf); |
667 } | |
668 | |
669 void layout_status_update_image(LayoutWindow *lw) | |
670 { | |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
671 guint64 n; |
9 | 672 |
673 if (!layout_valid(&lw) || !lw->image) return; | |
674 | |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
675 n = layout_list_count(lw, NULL); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
676 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
677 if (!n) |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
678 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
679 gtk_label_set_text(GTK_LABEL(lw->info_zoom), ""); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
680 gtk_label_set_text(GTK_LABEL(lw->info_details), ""); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
681 } |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
682 else |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
683 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
684 gchar *text; |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
685 gchar *b; |
9 | 686 |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
687 text = image_zoom_get_as_text(lw->image); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
688 gtk_label_set_text(GTK_LABEL(lw->info_zoom), text); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
689 g_free(text); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
690 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
691 b = image_get_fd(lw->image) ? text_from_size(image_get_fd(lw->image)->size) : g_strdup("0"); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
692 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
693 if (lw->image->unknown) |
9 | 694 { |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
695 if (image_get_path(lw->image) && !access_file(image_get_path(lw->image), R_OK)) |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
696 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
697 text = g_strdup_printf(_("(no read permission) %s bytes"), b); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
698 } |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
699 else |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
700 { |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
701 text = g_strdup_printf(_("( ? x ? ) %s bytes"), b); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
702 } |
9 | 703 } |
704 else | |
705 { | |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
706 gint width, height; |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
707 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
708 image_get_image_size(lw->image, &width, &height); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
709 text = g_strdup_printf(_("( %d x %d ) %s bytes"), |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
710 width, height, b); |
9 | 711 } |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
712 |
1375
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
713 g_signal_emit_by_name (lw->image->pr, "update-pixel"); |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
714 |
984
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
715 g_free(b); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
716 |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
717 gtk_label_set_text(GTK_LABEL(lw->info_details), text); |
bc73dc055cd0
Only display status if there is at least one file in the file list.
zas_
parents:
960
diff
changeset
|
718 g_free(text); |
9 | 719 } |
720 } | |
721 | |
722 void layout_status_update_all(LayoutWindow *lw) | |
723 { | |
724 layout_status_update_progress(lw, 0.0, NULL); | |
725 layout_status_update_info(lw, NULL); | |
726 layout_status_update_image(lw); | |
1240
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
727 layout_status_update_write(lw); |
9 | 728 } |
729 | |
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1431
diff
changeset
|
730 static GtkWidget *layout_status_label(gchar *text, GtkWidget *box, gboolean start, gint size, gboolean expand) |
9 | 731 { |
732 GtkWidget *label; | |
733 GtkWidget *frame; | |
734 | |
735 frame = gtk_frame_new(NULL); | |
736 if (size) gtk_widget_set_size_request(frame, size, -1); | |
737 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
738 if (start) | |
739 { | |
740 gtk_box_pack_start(GTK_BOX(box), frame, expand, expand, 0); | |
741 } | |
742 else | |
743 { | |
744 gtk_box_pack_end(GTK_BOX(box), frame, expand, expand, 0); | |
745 } | |
746 gtk_widget_show(frame); | |
747 | |
748 label = gtk_label_new(text ? text : ""); | |
749 gtk_container_add(GTK_CONTAINER(frame), label); | |
750 gtk_widget_show(label); | |
751 | |
752 return label; | |
753 } | |
754 | |
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1431
diff
changeset
|
755 static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gboolean small_format) |
9 | 756 { |
757 GtkWidget *hbox; | |
758 | |
759 if (lw->info_box) return; | |
760 | |
761 if (small_format) | |
762 { | |
763 lw->info_box = gtk_vbox_new(FALSE, 0); | |
764 } | |
765 else | |
766 { | |
767 lw->info_box = gtk_hbox_new(FALSE, 0); | |
768 } | |
769 gtk_box_pack_end(GTK_BOX(box), lw->info_box, FALSE, FALSE, 0); | |
770 gtk_widget_show(lw->info_box); | |
771 | |
772 if (small_format) | |
773 { | |
774 hbox = gtk_hbox_new(FALSE, 0); | |
775 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0); | |
776 gtk_widget_show(hbox); | |
777 } | |
778 else | |
779 { | |
780 hbox = lw->info_box; | |
781 } | |
782 lw->info_progress_bar = gtk_progress_bar_new(); | |
783 gtk_widget_set_size_request(lw->info_progress_bar, PROGRESS_WIDTH, -1); | |
784 gtk_box_pack_start(GTK_BOX(hbox), lw->info_progress_bar, FALSE, FALSE, 0); | |
785 gtk_widget_show(lw->info_progress_bar); | |
786 | |
787 lw->info_sort = layout_sort_button(lw); | |
788 gtk_box_pack_start(GTK_BOX(hbox), lw->info_sort, FALSE, FALSE, 0); | |
789 gtk_widget_show(lw->info_sort); | |
790 | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
791 lw->info_color = layout_color_button(lw); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
792 gtk_widget_show(lw->info_color); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
793 |
1240
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
794 lw->info_write = layout_write_button(lw); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
795 gtk_widget_show(lw->info_write); |
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
796 |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
797 if (small_format) gtk_box_pack_end(GTK_BOX(hbox), lw->info_color, FALSE, FALSE, 0); |
1240
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
798 if (small_format) gtk_box_pack_end(GTK_BOX(hbox), lw->info_write, FALSE, FALSE, 0); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
799 |
9 | 800 lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, (!small_format)); |
801 | |
802 if (small_format) | |
803 { | |
804 hbox = gtk_hbox_new(FALSE, 0); | |
805 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0); | |
806 gtk_widget_show(hbox); | |
807 } | |
808 else | |
809 { | |
810 hbox = lw->info_box; | |
811 } | |
812 lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE); | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
813 if (!small_format) gtk_box_pack_start(GTK_BOX(hbox), lw->info_color, FALSE, FALSE, 0); |
1240
30e207ac22e4
added a status bar button for writting metadata immediately
nadvornik
parents:
1231
diff
changeset
|
814 if (!small_format) gtk_box_pack_start(GTK_BOX(hbox), lw->info_write, FALSE, FALSE, 0); |
1375
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
815 lw->info_pixel = layout_status_label(NULL, hbox, FALSE, PIXEL_LABEL_WIDTH, TRUE); |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
816 if (lw->options.info_pixel_hidden) gtk_widget_hide(gtk_widget_get_parent(lw->info_pixel)); |
9 | 817 lw->info_zoom = layout_status_label(NULL, hbox, FALSE, ZOOM_LABEL_WIDTH, FALSE); |
818 } | |
819 | |
820 /* | |
821 *----------------------------------------------------------------------------- | |
822 * views | |
823 *----------------------------------------------------------------------------- | |
824 */ | |
825 | |
826 static GtkWidget *layout_tools_new(LayoutWindow *lw) | |
827 { | |
828 lw->dir_view = layout_tool_setup(lw); | |
829 return lw->dir_view; | |
830 } | |
831 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
832 static void layout_list_status_cb(ViewFile *vf, gpointer data) |
9 | 833 { |
834 LayoutWindow *lw = data; | |
835 | |
836 layout_status_update_info(lw, NULL); | |
837 } | |
838 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
839 static void layout_list_thumb_cb(ViewFile *vf, gdouble val, const gchar *text, gpointer data) |
9 | 840 { |
841 LayoutWindow *lw = data; | |
842 | |
843 layout_status_update_progress(lw, val, text); | |
844 } | |
845 | |
846 static GtkWidget *layout_list_new(LayoutWindow *lw) | |
847 { | |
1412 | 848 lw->vf = vf_new(lw->options.file_view_type, NULL); |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
849 vf_set_layout(lw->vf, lw); |
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
850 |
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
851 vf_set_status_func(lw->vf, layout_list_status_cb, lw); |
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
852 vf_set_thumb_status_func(lw->vf, layout_list_thumb_cb, lw); |
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
853 |
1309 | 854 vf_marks_set(lw->vf, lw->options.show_marks); |
556
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
855 |
1412 | 856 switch (lw->options.file_view_type) |
556
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
857 { |
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
858 case FILEVIEW_ICON: |
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
859 break; |
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
860 case FILEVIEW_LIST: |
1309 | 861 vf_thumb_set(lw->vf, lw->options.show_thumbnails); |
556
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
862 break; |
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
863 } |
442 | 864 |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
865 return lw->vf->widget; |
9 | 866 } |
867 | |
868 static void layout_list_sync_thumb(LayoutWindow *lw) | |
869 { | |
1309 | 870 if (lw->vf) vf_thumb_set(lw->vf, lw->options.show_thumbnails); |
9 | 871 } |
872 | |
132 | 873 static void layout_list_sync_marks(LayoutWindow *lw) |
874 { | |
1309 | 875 if (lw->vf) vf_marks_set(lw->vf, lw->options.show_marks); |
132 | 876 } |
877 | |
9 | 878 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle) |
879 { | |
880 if (!lw) return; | |
881 #if 0 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
882 if (lw->vf) vf_scroll_to_subpart(lw->vf, needle); |
9 | 883 #endif |
884 } | |
885 | |
886 GList *layout_list(LayoutWindow *lw) | |
887 { | |
888 if (!layout_valid(&lw)) return NULL; | |
889 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
890 if (lw->vf) return vf_get_list(lw->vf); |
9 | 891 |
892 return NULL; | |
893 } | |
894 | |
736 | 895 guint layout_list_count(LayoutWindow *lw, gint64 *bytes) |
9 | 896 { |
897 if (!layout_valid(&lw)) return 0; | |
898 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
899 if (lw->vf) return vf_count(lw->vf, bytes); |
9 | 900 |
901 return 0; | |
902 } | |
903 | |
138 | 904 FileData *layout_list_get_fd(LayoutWindow *lw, gint index) |
905 { | |
906 if (!layout_valid(&lw)) return NULL; | |
907 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
908 if (lw->vf) return vf_index_get_data(lw->vf, index); |
138 | 909 |
910 return NULL; | |
911 } | |
912 | |
783 | 913 gint layout_list_get_index(LayoutWindow *lw, FileData *fd) |
9 | 914 { |
783 | 915 if (!layout_valid(&lw) || !fd) return -1; |
9 | 916 |
783 | 917 if (lw->vf) return vf_index_by_path(lw->vf, fd->path); |
9 | 918 |
919 return -1; | |
920 } | |
921 | |
138 | 922 void layout_list_sync_fd(LayoutWindow *lw, FileData *fd) |
9 | 923 { |
924 if (!layout_valid(&lw)) return; | |
925 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
926 if (lw->vf) vf_select_by_fd(lw->vf, fd); |
9 | 927 } |
928 | |
929 static void layout_list_sync_sort(LayoutWindow *lw) | |
930 { | |
931 if (!layout_valid(&lw)) return; | |
932 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
933 if (lw->vf) vf_sort_set(lw->vf, lw->sort_method, lw->sort_ascend); |
9 | 934 } |
935 | |
936 GList *layout_selection_list(LayoutWindow *lw) | |
937 { | |
938 if (!layout_valid(&lw)) return NULL; | |
939 | |
940 if (layout_image_get_collection(lw, NULL)) | |
941 { | |
138 | 942 FileData *fd; |
9 | 943 |
138 | 944 fd = layout_image_get_fd(lw); |
945 if (fd) return g_list_append(NULL, file_data_ref(fd)); | |
9 | 946 return NULL; |
947 } | |
948 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
949 if (lw->vf) return vf_selection_get_list(lw->vf); |
9 | 950 |
951 return NULL; | |
952 } | |
953 | |
954 GList *layout_selection_list_by_index(LayoutWindow *lw) | |
955 { | |
956 if (!layout_valid(&lw)) return NULL; | |
957 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
958 if (lw->vf) return vf_selection_get_list_by_index(lw->vf); |
9 | 959 |
960 return NULL; | |
961 } | |
962 | |
736 | 963 guint layout_selection_count(LayoutWindow *lw, gint64 *bytes) |
9 | 964 { |
965 if (!layout_valid(&lw)) return 0; | |
966 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
967 if (lw->vf) return vf_selection_count(lw->vf, bytes); |
9 | 968 |
969 return 0; | |
970 } | |
971 | |
972 void layout_select_all(LayoutWindow *lw) | |
973 { | |
974 if (!layout_valid(&lw)) return; | |
975 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
976 if (lw->vf) vf_select_all(lw->vf); |
9 | 977 } |
978 | |
979 void layout_select_none(LayoutWindow *lw) | |
980 { | |
981 if (!layout_valid(&lw)) return; | |
982 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
983 if (lw->vf) vf_select_none(lw->vf); |
9 | 984 } |
985 | |
601 | 986 void layout_select_invert(LayoutWindow *lw) |
987 { | |
988 if (!layout_valid(&lw)) return; | |
989 | |
990 if (lw->vf) vf_select_invert(lw->vf); | |
991 } | |
992 | |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
993 void layout_mark_to_selection(LayoutWindow *lw, gint mark, MarkToSelectionMode mode) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
994 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
995 if (!layout_valid(&lw)) return; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
996 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
997 if (lw->vf) vf_mark_to_selection(lw->vf, mark, mode); |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
998 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
999 |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
1000 void layout_selection_to_mark(LayoutWindow *lw, gint mark, SelectionToMarkMode mode) |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
1001 { |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
1002 if (!layout_valid(&lw)) return; |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
1003 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
1004 if (lw->vf) vf_selection_to_mark(lw->vf, mark, mode); |
442 | 1005 |
162
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
1006 layout_status_update_info(lw, NULL); /* osd in fullscreen mode */ |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
1007 } |
1a42a2451575
created menu "Select" with selection and marks operations
nadvornik
parents:
138
diff
changeset
|
1008 |
9 | 1009 /* |
1010 *----------------------------------------------------------------------------- | |
1011 * access | |
1012 *----------------------------------------------------------------------------- | |
1013 */ | |
1014 | |
1015 const gchar *layout_get_path(LayoutWindow *lw) | |
1016 { | |
1017 if (!layout_valid(&lw)) return NULL; | |
783 | 1018 return lw->dir_fd ? lw->dir_fd->path : NULL; |
9 | 1019 } |
1020 | |
1021 static void layout_sync_path(LayoutWindow *lw) | |
1022 { | |
783 | 1023 if (!lw->dir_fd) return; |
9 | 1024 |
783 | 1025 if (lw->path_entry) gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->dir_fd->path); |
1372 | 1026 |
783 | 1027 if (lw->vd) vd_set_fd(lw->vd, lw->dir_fd); |
1028 if (lw->vf) vf_set_fd(lw->vf, lw->dir_fd); | |
9 | 1029 } |
1030 | |
1416 | 1031 gboolean layout_set_path(LayoutWindow *lw, const gchar *path) |
9 | 1032 { |
959 | 1033 FileData *fd; |
1416 | 1034 gboolean ret; |
1372 | 1035 |
959 | 1036 if (!path) return FALSE; |
1372 | 1037 |
959 | 1038 fd = file_data_new_simple(path); |
1372 | 1039 ret = layout_set_fd(lw, fd); |
783 | 1040 file_data_unref(fd); |
1041 return ret; | |
1042 } | |
1043 | |
1044 | |
1416 | 1045 gboolean layout_set_fd(LayoutWindow *lw, FileData *fd) |
783 | 1046 { |
1416 | 1047 gboolean have_file = FALSE; |
9 | 1048 |
1049 if (!layout_valid(&lw)) return FALSE; | |
1050 | |
783 | 1051 if (!fd || !isname(fd->path)) return FALSE; |
1052 if (lw->dir_fd && fd == lw->dir_fd) | |
9 | 1053 { |
1054 return TRUE; | |
1055 } | |
1056 | |
783 | 1057 if (isdir(fd->path)) |
9 | 1058 { |
791 | 1059 if (lw->dir_fd) |
1060 { | |
1061 file_data_unregister_real_time_monitor(lw->dir_fd); | |
1062 file_data_unref(lw->dir_fd); | |
1063 } | |
783 | 1064 lw->dir_fd = file_data_ref(fd); |
791 | 1065 file_data_register_real_time_monitor(fd); |
9 | 1066 } |
1067 else | |
1068 { | |
1069 gchar *base; | |
1070 | |
783 | 1071 base = remove_level_from_path(fd->path); |
1072 if (lw->dir_fd && strcmp(lw->dir_fd->path, base) == 0) | |
9 | 1073 { |
1074 g_free(base); | |
1075 } | |
1076 else if (isdir(base)) | |
1077 { | |
791 | 1078 if (lw->dir_fd) |
1079 { | |
1080 file_data_unregister_real_time_monitor(lw->dir_fd); | |
1081 file_data_unref(lw->dir_fd); | |
1082 } | |
783 | 1083 lw->dir_fd = file_data_new_simple(base); |
791 | 1084 file_data_register_real_time_monitor(lw->dir_fd); |
783 | 1085 g_free(base); |
9 | 1086 } |
1087 else | |
1088 { | |
1089 g_free(base); | |
1090 return FALSE; | |
1091 } | |
783 | 1092 if (isfile(fd->path)) have_file = TRUE; |
9 | 1093 } |
1094 | |
783 | 1095 if (lw->path_entry) tab_completion_append_to_history(lw->path_entry, lw->dir_fd->path); |
9 | 1096 layout_sync_path(lw); |
1301
8c47a4f521ad
Fix bug 2599857: file list sort order was wrong in many cases.
zas_
parents:
1296
diff
changeset
|
1097 layout_list_sync_sort(lw); |
8c47a4f521ad
Fix bug 2599857: file list sort order was wrong in many cases.
zas_
parents:
1296
diff
changeset
|
1098 |
9 | 1099 if (have_file) |
1100 { | |
1101 gint row; | |
1102 | |
783 | 1103 row = layout_list_get_index(lw, fd); |
9 | 1104 if (row >= 0) |
1105 { | |
1106 layout_image_set_index(lw, row); | |
1107 } | |
1108 else | |
1109 { | |
783 | 1110 layout_image_set_fd(lw, fd); |
9 | 1111 } |
1112 } | |
320 | 1113 else if (!options->lazy_image_sync) |
9 | 1114 { |
1115 layout_image_set_index(lw, 0); | |
1116 } | |
1117 | |
1214
31402ecb2aed
write metadata after timeout, image change or dir change
nadvornik
parents:
1177
diff
changeset
|
1118 if (options->metadata.confirm_on_dir_change) |
1231 | 1119 metadata_write_queue_confirm(NULL, NULL); |
1214
31402ecb2aed
write metadata after timeout, image change or dir change
nadvornik
parents:
1177
diff
changeset
|
1120 |
9 | 1121 return TRUE; |
1122 } | |
1123 | |
1124 static void layout_refresh_lists(LayoutWindow *lw) | |
1125 { | |
390 | 1126 if (lw->vd) vd_refresh(lw->vd); |
9 | 1127 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
1128 if (lw->vf) vf_refresh(lw->vf); |
9 | 1129 } |
1130 | |
1131 void layout_refresh(LayoutWindow *lw) | |
1132 { | |
1133 if (!layout_valid(&lw)) return; | |
1134 | |
506
fc9c8a3e1a8b
Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents:
501
diff
changeset
|
1135 DEBUG_1("layout refresh"); |
9 | 1136 |
1137 layout_refresh_lists(lw); | |
1138 | |
1139 if (lw->image) layout_image_refresh(lw); | |
1140 } | |
1141 | |
1416 | 1142 void layout_thumb_set(LayoutWindow *lw, gboolean enable) |
9 | 1143 { |
1144 if (!layout_valid(&lw)) return; | |
1145 | |
1309 | 1146 if (lw->options.show_thumbnails == enable) return; |
1147 | |
1148 lw->options.show_thumbnails = enable; | |
9 | 1149 |
1150 layout_util_sync_thumb(lw); | |
1151 layout_list_sync_thumb(lw); | |
1152 } | |
1153 | |
1416 | 1154 void layout_marks_set(LayoutWindow *lw, gboolean enable) |
132 | 1155 { |
1156 if (!layout_valid(&lw)) return; | |
1157 | |
1309 | 1158 if (lw->options.show_marks == enable) return; |
1159 | |
1160 lw->options.show_marks = enable; | |
132 | 1161 |
268 | 1162 // layout_util_sync_marks(lw); |
1163 layout_list_sync_marks(lw); | |
132 | 1164 } |
1165 | |
1416 | 1166 gboolean layout_thumb_get(LayoutWindow *lw) |
9 | 1167 { |
1168 if (!layout_valid(&lw)) return FALSE; | |
1169 | |
1309 | 1170 return lw->options.show_thumbnails; |
9 | 1171 } |
1172 | |
1416 | 1173 gboolean layout_marks_get(LayoutWindow *lw) |
433
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1174 { |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1175 if (!layout_valid(&lw)) return FALSE; |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1176 |
1309 | 1177 return lw->options.show_marks; |
433
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1178 } |
5ddcf93278c7
Save Show Marks state to rc file and display current state in menu.
zas_
parents:
432
diff
changeset
|
1179 |
1416 | 1180 void layout_sort_set(LayoutWindow *lw, SortType type, gboolean ascend) |
9 | 1181 { |
1182 if (!layout_valid(&lw)) return; | |
1183 if (lw->sort_method == type && lw->sort_ascend == ascend) return; | |
1184 | |
1185 lw->sort_method = type; | |
1186 lw->sort_ascend = ascend; | |
1187 | |
1188 if (lw->info_sort) gtk_label_set_text(GTK_LABEL(GTK_BIN(lw->info_sort)->child), | |
1189 sort_type_get_text(type)); | |
1190 layout_list_sync_sort(lw); | |
1191 } | |
1192 | |
1416 | 1193 gboolean layout_sort_get(LayoutWindow *lw, SortType *type, gboolean *ascend) |
9 | 1194 { |
1195 if (!layout_valid(&lw)) return FALSE; | |
1196 | |
1197 if (type) *type = lw->sort_method; | |
1198 if (ascend) *ascend = lw->sort_ascend; | |
1199 | |
1200 return TRUE; | |
1201 } | |
1202 | |
1416 | 1203 gboolean layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h) |
9 | 1204 { |
1205 if (!layout_valid(&lw)) return FALSE; | |
1206 | |
1207 gdk_window_get_root_origin(lw->window->window, x, y); | |
1208 gdk_drawable_get_size(lw->window->window, w, h); | |
1209 | |
1210 return TRUE; | |
1211 } | |
1212 | |
1416 | 1213 gboolean layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v) |
9 | 1214 { |
1215 if (!layout_valid(&lw)) return FALSE; | |
1216 | |
1217 if (lw->h_pane && GTK_PANED(lw->h_pane)->child1->allocation.x >= 0) | |
1218 { | |
1219 *h = GTK_PANED(lw->h_pane)->child1->allocation.width; | |
1220 } | |
1309 | 1221 else if (h != &lw->options.main_window.hdivider_pos) |
9 | 1222 { |
1309 | 1223 *h = lw->options.main_window.hdivider_pos; |
9 | 1224 } |
1225 | |
1226 if (lw->v_pane && GTK_PANED(lw->v_pane)->child1->allocation.x >= 0) | |
1227 { | |
1228 *v = GTK_PANED(lw->v_pane)->child1->allocation.height; | |
1229 } | |
1309 | 1230 else if (v != &lw->options.main_window.vdivider_pos) |
9 | 1231 { |
1309 | 1232 *v = lw->options.main_window.vdivider_pos; |
9 | 1233 } |
1234 | |
1235 return TRUE; | |
1236 } | |
1237 | |
556
fe675761d091
Replace Layout icon_view field by more generic file_view_type.
zas_
parents:
555
diff
changeset
|
1238 void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type) |
9 | 1239 { |
1240 if (!layout_valid(&lw)) return; | |
1241 | |
1412 | 1242 if (lw->options.dir_view_type == dir_view_type && lw->options.file_view_type == file_view_type) return; |
1309 | 1243 |
1244 lw->options.dir_view_type = dir_view_type; | |
1412 | 1245 lw->options.file_view_type = file_view_type; |
9 | 1246 |
1247 layout_style_set(lw, -1, NULL); | |
1248 } | |
1249 | |
1416 | 1250 gboolean layout_views_get(LayoutWindow *lw, DirViewType *dir_view_type, FileViewType *file_view_type) |
9 | 1251 { |
1252 if (!layout_valid(&lw)) return FALSE; | |
1253 | |
1309 | 1254 *dir_view_type = lw->options.dir_view_type; |
1412 | 1255 *file_view_type = lw->options.file_view_type; |
9 | 1256 |
1257 return TRUE; | |
1258 } | |
1259 | |
1260 /* | |
1261 *----------------------------------------------------------------------------- | |
1262 * location utils | |
1263 *----------------------------------------------------------------------------- | |
1264 */ | |
1265 | |
1416 | 1266 static gboolean layout_location_single(LayoutLocation l) |
9 | 1267 { |
1268 return (l == LAYOUT_LEFT || | |
1269 l == LAYOUT_RIGHT || | |
1270 l == LAYOUT_TOP || | |
1271 l == LAYOUT_BOTTOM); | |
1272 } | |
1273 | |
1416 | 1274 static gboolean layout_location_vertical(LayoutLocation l) |
9 | 1275 { |
1276 return (l & LAYOUT_TOP || | |
1277 l & LAYOUT_BOTTOM); | |
1278 } | |
1279 | |
1416 | 1280 static gboolean layout_location_first(LayoutLocation l) |
9 | 1281 { |
1282 return (l & LAYOUT_TOP || | |
1283 l & LAYOUT_LEFT); | |
1284 } | |
1285 | |
1286 static LayoutLocation layout_grid_compass(LayoutWindow *lw) | |
1287 { | |
1288 if (layout_location_single(lw->dir_location)) return lw->dir_location; | |
1289 if (layout_location_single(lw->file_location)) return lw->file_location; | |
1290 return lw->image_location; | |
1291 } | |
1292 | |
1293 static void layout_location_compute(LayoutLocation l1, LayoutLocation l2, | |
1294 GtkWidget *s1, GtkWidget *s2, | |
1295 GtkWidget **d1, GtkWidget **d2) | |
1296 { | |
1297 LayoutLocation l; | |
1298 | |
1299 l = l1 & l2; /* get common compass direction */ | |
1300 l = l1 - l; /* remove it */ | |
1301 | |
1302 if (layout_location_first(l)) | |
1303 { | |
1304 *d1 = s1; | |
1305 *d2 = s2; | |
1306 } | |
1307 else | |
1308 { | |
1309 *d1 = s2; | |
1310 *d2 = s1; | |
1311 } | |
1312 } | |
1313 | |
1314 /* | |
1315 *----------------------------------------------------------------------------- | |
1316 * tools window (for floating/hidden) | |
1317 *----------------------------------------------------------------------------- | |
1318 */ | |
1319 | |
1416 | 1320 gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos) |
9 | 1321 { |
1322 if (!layout_valid(&lw)) return FALSE; | |
1323 | |
1324 if (!lw->tools || !GTK_WIDGET_VISIBLE(lw->tools)) | |
1325 { | |
1326 /* use the stored values (sort of breaks success return value) */ | |
1327 | |
1309 | 1328 *divider_pos = lw->options.float_window.vdivider_pos; |
9 | 1329 |
1330 return FALSE; | |
1331 } | |
1332 | |
1333 gdk_window_get_root_origin(lw->tools->window, x, y); | |
1334 gdk_drawable_get_size(lw->tools->window, w, h); | |
1335 | |
1336 if (GTK_IS_VPANED(lw->tools_pane)) | |
1337 { | |
1338 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.height; | |
1339 } | |
1340 else | |
1341 { | |
1342 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.width; | |
1343 } | |
1344 | |
1345 return TRUE; | |
1346 } | |
1347 | |
1348 static void layout_tools_geometry_sync(LayoutWindow *lw) | |
1349 { | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1350 layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.x, |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1351 &lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos); |
9 | 1352 } |
1353 | |
1416 | 1354 static void layout_tools_hide(LayoutWindow *lw, gboolean hide) |
9 | 1355 { |
1356 if (!lw->tools) return; | |
1357 | |
1358 if (hide) | |
1359 { | |
1360 if (GTK_WIDGET_VISIBLE(lw->tools)) | |
1361 { | |
1362 layout_tools_geometry_sync(lw); | |
1363 gtk_widget_hide(lw->tools); | |
1364 } | |
1365 } | |
1366 else | |
1367 { | |
1368 if (!GTK_WIDGET_VISIBLE(lw->tools)) | |
1369 { | |
1370 gtk_widget_show(lw->tools); | |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
1371 if (lw->vf) vf_refresh(lw->vf); |
9 | 1372 } |
1373 } | |
1374 | |
1309 | 1375 lw->options.tools_hidden = hide; |
9 | 1376 } |
1377 | |
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1431
diff
changeset
|
1378 static gboolean layout_tools_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) |
9 | 1379 { |
1380 LayoutWindow *lw = data; | |
1381 | |
1382 layout_tools_float_toggle(lw); | |
1383 | |
1384 return TRUE; | |
1385 } | |
1386 | |
1387 static void layout_tools_setup(LayoutWindow *lw, GtkWidget *tools, GtkWidget *files) | |
1388 { | |
1389 GtkWidget *vbox; | |
1390 GtkWidget *w1, *w2; | |
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1431
diff
changeset
|
1391 gboolean vertical; |
1416 | 1392 gboolean new_window = FALSE; |
9 | 1393 |
1394 vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) || | |
1395 (!layout_location_single(lw->image_location) && layout_location_vertical(layout_grid_compass(lw))); | |
1396 #if 0 | |
1397 layout_location_compute(lw->dir_location, lw->file_location, | |
1398 tools, files, &w1, &w2); | |
1399 #endif | |
1400 /* for now, tools/dir are always first in order */ | |
1401 w1 = tools; | |
1402 w2 = files; | |
1403 | |
1404 if (!lw->tools) | |
1405 { | |
1406 GdkGeometry geometry; | |
1407 GdkWindowHints hints; | |
1408 | |
289
6a7298988a7a
Simplify and unify gtk_window creation with the help of
zas_
parents:
288
diff
changeset
|
1409 lw->tools = window_new(GTK_WINDOW_TOPLEVEL, "tools", PIXBUF_INLINE_ICON_TOOLS, NULL, _("Tools")); |
9 | 1410 g_signal_connect(G_OBJECT(lw->tools), "delete_event", |
1411 G_CALLBACK(layout_tools_delete_cb), lw); | |
1412 layout_keyboard_init(lw, lw->tools); | |
1413 | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1414 if (options->save_window_positions) |
9 | 1415 { |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1416 hints = GDK_HINT_USER_POS; |
9 | 1417 } |
1418 else | |
1419 { | |
1420 hints = 0; | |
1421 } | |
1422 | |
1029
1a4b18c58556
Use a constant for minimal window size. Set it to 32 for all dialogs.
zas_
parents:
1006
diff
changeset
|
1423 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE; |
1a4b18c58556
Use a constant for minimal window size. Set it to 32 for all dialogs.
zas_
parents:
1006
diff
changeset
|
1424 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE; |
9 | 1425 geometry.base_width = TOOLWINDOW_DEF_WIDTH; |
1426 geometry.base_height = TOOLWINDOW_DEF_HEIGHT; | |
1427 gtk_window_set_geometry_hints(GTK_WINDOW(lw->tools), NULL, &geometry, | |
1428 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hints); | |
1429 | |
1430 | |
268 | 1431 gtk_window_set_resizable(GTK_WINDOW(lw->tools), TRUE); |
1432 gtk_container_set_border_width(GTK_CONTAINER(lw->tools), 0); | |
442 | 1433 |
9 | 1434 new_window = TRUE; |
1435 } | |
1436 else | |
1437 { | |
1438 layout_tools_geometry_sync(lw); | |
1439 /* dump the contents */ | |
1440 gtk_widget_destroy(GTK_BIN(lw->tools)->child); | |
1441 } | |
1442 | |
1443 layout_actions_add_window(lw, lw->tools); | |
1444 | |
1445 vbox = gtk_vbox_new(FALSE, 0); | |
1446 gtk_container_add(GTK_CONTAINER(lw->tools), vbox); | |
1447 gtk_widget_show(vbox); | |
1448 | |
1449 layout_status_setup(lw, vbox, TRUE); | |
1450 | |
1451 if (vertical) | |
1452 { | |
1453 lw->tools_pane = gtk_vpaned_new(); | |
1454 } | |
1455 else | |
1456 { | |
1457 lw->tools_pane = gtk_hpaned_new(); | |
1458 } | |
1459 gtk_box_pack_start(GTK_BOX(vbox), lw->tools_pane, TRUE, TRUE, 0); | |
1460 gtk_widget_show(lw->tools_pane); | |
1461 | |
1462 gtk_paned_pack1(GTK_PANED(lw->tools_pane), w1, FALSE, TRUE); | |
1463 gtk_paned_pack2(GTK_PANED(lw->tools_pane), w2, TRUE, TRUE); | |
1464 | |
1465 gtk_widget_show(tools); | |
1466 gtk_widget_show(files); | |
1467 | |
1468 if (new_window) | |
1469 { | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1470 if (options->save_window_positions) |
9 | 1471 { |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1472 gtk_window_set_default_size(GTK_WINDOW(lw->tools), lw->options.float_window.w, lw->options.float_window.h); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1473 gtk_window_move(GTK_WINDOW(lw->tools), lw->options.float_window.x, lw->options.float_window.y); |
268 | 1474 } |
9 | 1475 else |
1476 { | |
1477 if (vertical) | |
1478 { | |
1479 gtk_window_set_default_size(GTK_WINDOW(lw->tools), | |
1480 TOOLWINDOW_DEF_WIDTH, TOOLWINDOW_DEF_HEIGHT); | |
1481 } | |
1482 else | |
1483 { | |
1484 gtk_window_set_default_size(GTK_WINDOW(lw->tools), | |
1485 TOOLWINDOW_DEF_HEIGHT, TOOLWINDOW_DEF_WIDTH); | |
1486 } | |
1487 } | |
1488 } | |
1489 | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1490 if (!options->save_window_positions) |
9 | 1491 { |
1492 if (vertical) | |
1493 { | |
1309 | 1494 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS; |
9 | 1495 } |
1496 else | |
1497 { | |
1309 | 1498 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_HPOS; |
9 | 1499 } |
1500 } | |
1501 | |
1309 | 1502 gtk_paned_set_position(GTK_PANED(lw->tools_pane), lw->options.float_window.vdivider_pos); |
9 | 1503 } |
1504 | |
1505 /* | |
1506 *----------------------------------------------------------------------------- | |
1507 * glue (layout arrangement) | |
1508 *----------------------------------------------------------------------------- | |
1509 */ | |
1510 | |
1511 static void layout_grid_compute(LayoutWindow *lw, | |
1512 GtkWidget *image, GtkWidget *tools, GtkWidget *files, | |
1513 GtkWidget **w1, GtkWidget **w2, GtkWidget **w3) | |
1514 { | |
1515 /* heh, this was fun */ | |
1516 | |
1517 if (layout_location_single(lw->dir_location)) | |
1518 { | |
1519 if (layout_location_first(lw->dir_location)) | |
1520 { | |
1521 *w1 = tools; | |
1522 layout_location_compute(lw->file_location, lw->image_location, files, image, w2, w3); | |
1523 } | |
1524 else | |
1525 { | |
1526 *w3 = tools; | |
1527 layout_location_compute(lw->file_location, lw->image_location, files, image, w1, w2); | |
1528 } | |
1529 } | |
1530 else if (layout_location_single(lw->file_location)) | |
1531 { | |
1532 if (layout_location_first(lw->file_location)) | |
1533 { | |
1534 *w1 = files; | |
1535 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w2, w3); | |
1536 } | |
1537 else | |
1538 { | |
1539 *w3 = files; | |
1540 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w1, w2); | |
1541 } | |
1542 } | |
1543 else | |
1544 { | |
1545 /* image */ | |
1546 if (layout_location_first(lw->image_location)) | |
1547 { | |
1548 *w1 = image; | |
1549 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w2, w3); | |
1550 } | |
1551 else | |
1552 { | |
1553 *w3 = image; | |
1554 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w1, w2); | |
1555 } | |
1556 } | |
1557 } | |
1558 | |
127 | 1559 void layout_split_change(LayoutWindow *lw, ImageSplitMode mode) |
1560 { | |
1561 GtkWidget *image; | |
1562 gint i; | |
268 | 1563 |
1564 for (i = 0; i < MAX_SPLIT_IMAGES; i++) | |
127 | 1565 { |
1566 if (lw->split_images[i]) | |
1567 { | |
1568 gtk_widget_hide(lw->split_images[i]->widget); | |
1383 | 1569 if (lw->split_images[i]->widget->parent != lw->utility_paned) |
127 | 1570 gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget); |
1571 } | |
1572 } | |
1383 | 1573 gtk_container_remove(GTK_CONTAINER(lw->utility_paned), lw->split_image_widget); |
127 | 1574 |
1575 image = layout_image_setup_split(lw, mode); | |
1576 | |
1383 | 1577 // gtk_box_pack_start(GTK_BOX(lw->utility_box), image, TRUE, TRUE, 0); |
1578 // gtk_box_reorder_child(GTK_BOX(lw->utility_box), image, 0); | |
1579 gtk_paned_pack1(GTK_PANED(lw->utility_paned), image, TRUE, FALSE); | |
127 | 1580 gtk_widget_show(image); |
1581 } | |
1582 | |
9 | 1583 static void layout_grid_setup(LayoutWindow *lw) |
1584 { | |
1585 gint priority_location; | |
1586 GtkWidget *h; | |
1587 GtkWidget *v; | |
1588 GtkWidget *w1, *w2, *w3; | |
1589 | |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1590 GtkWidget *image_sb; /* image together with sidebars in utility box */ |
9 | 1591 GtkWidget *tools; |
1592 GtkWidget *files; | |
1593 | |
1594 layout_actions_setup(lw); | |
1595 layout_actions_add_window(lw, lw->window); | |
1596 | |
1597 lw->group_box = gtk_vbox_new(FALSE, 0); | |
1598 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0); | |
1599 gtk_widget_show(lw->group_box); | |
1600 | |
1601 priority_location = layout_grid_compass(lw); | |
1602 | |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1603 if (lw->utility_box) |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1604 { |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1605 image_sb = lw->utility_box; |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1606 } |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1607 else |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1608 { |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1609 GtkWidget *image; /* image or split images together */ |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1610 image = layout_image_setup_split(lw, lw->split_mode); |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1611 image_sb = layout_bars_prepare(lw, image); |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1612 } |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1613 |
9 | 1614 tools = layout_tools_new(lw); |
1615 files = layout_list_new(lw); | |
1616 | |
1617 | |
1309 | 1618 if (lw->options.tools_float || lw->options.tools_hidden) |
9 | 1619 { |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1620 gtk_box_pack_start(GTK_BOX(lw->group_box), image_sb, TRUE, TRUE, 0); |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1621 gtk_widget_show(image_sb); |
9 | 1622 |
1623 layout_tools_setup(lw, tools, files); | |
1624 | |
1625 gtk_widget_grab_focus(lw->image->widget); | |
1626 | |
1627 return; | |
1628 } | |
1629 else if (lw->tools) | |
1630 { | |
1631 layout_tools_geometry_sync(lw); | |
1632 gtk_widget_destroy(lw->tools); | |
1633 lw->tools = NULL; | |
1634 lw->tools_pane = NULL; | |
1635 } | |
1636 | |
1637 layout_status_setup(lw, lw->group_box, FALSE); | |
1638 | |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1639 layout_grid_compute(lw, image_sb, tools, files, &w1, &w2, &w3); |
9 | 1640 |
1641 v = lw->v_pane = gtk_vpaned_new(); | |
1642 | |
1643 h = lw->h_pane = gtk_hpaned_new(); | |
1644 | |
1645 if (!layout_location_vertical(priority_location)) | |
1646 { | |
1647 GtkWidget *tmp; | |
1648 | |
1649 tmp = v; | |
1650 v = h; | |
1651 h = tmp; | |
1652 } | |
1653 | |
1654 gtk_box_pack_start(GTK_BOX(lw->group_box), v, TRUE, TRUE, 0); | |
1655 | |
1656 if (!layout_location_first(priority_location)) | |
1657 { | |
1658 gtk_paned_pack1(GTK_PANED(v), h, FALSE, TRUE); | |
1659 gtk_paned_pack2(GTK_PANED(v), w3, TRUE, TRUE); | |
1660 | |
1661 gtk_paned_pack1(GTK_PANED(h), w1, FALSE, TRUE); | |
1662 gtk_paned_pack2(GTK_PANED(h), w2, TRUE, TRUE); | |
1663 } | |
1664 else | |
1665 { | |
1666 gtk_paned_pack1(GTK_PANED(v), w1, FALSE, TRUE); | |
1667 gtk_paned_pack2(GTK_PANED(v), h, TRUE, TRUE); | |
1668 | |
1669 gtk_paned_pack1(GTK_PANED(h), w2, FALSE, TRUE); | |
1670 gtk_paned_pack2(GTK_PANED(h), w3, TRUE, TRUE); | |
1671 } | |
1672 | |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1673 gtk_widget_show(image_sb); |
9 | 1674 gtk_widget_show(tools); |
1675 gtk_widget_show(files); | |
1676 | |
1677 gtk_widget_show(v); | |
1678 gtk_widget_show(h); | |
1679 | |
1680 /* fix to have image pane visible when it is left and priority widget */ | |
1309 | 1681 if (lw->options.main_window.hdivider_pos == -1 && |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1682 w1 == image_sb && |
9 | 1683 !layout_location_vertical(priority_location) && |
1684 layout_location_first(priority_location)) | |
1685 { | |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1686 gtk_widget_set_size_request(image_sb, 200, -1); |
9 | 1687 } |
1688 | |
1309 | 1689 gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->options.main_window.hdivider_pos); |
1690 gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->options.main_window.vdivider_pos); | |
9 | 1691 |
1692 gtk_widget_grab_focus(lw->image->widget); | |
1693 } | |
1694 | |
1695 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order) | |
1696 { | |
783 | 1697 FileData *dir_fd; |
9 | 1698 |
1699 if (!layout_valid(&lw)) return; | |
1700 | |
1701 if (style != -1) | |
1702 { | |
1703 LayoutLocation d, f, i; | |
1704 | |
1705 layout_config_parse(style, order, &d, &f, &i); | |
1706 | |
1707 if (lw->dir_location == d && | |
1708 lw->file_location == f && | |
1709 lw->image_location == i) return; | |
1710 | |
1711 lw->dir_location = d; | |
1712 lw->file_location = f; | |
1713 lw->image_location = i; | |
1714 } | |
1715 | |
1716 /* remember state */ | |
1717 | |
1718 layout_image_slideshow_stop(lw); | |
1719 layout_image_full_screen_stop(lw); | |
1720 | |
783 | 1721 dir_fd = lw->dir_fd; |
960
37fdfe8f2ab1
fixed crash with float file list and geeqie --blank
nadvornik
parents:
959
diff
changeset
|
1722 if (dir_fd) file_data_unregister_real_time_monitor(dir_fd); |
783 | 1723 lw->dir_fd = NULL; |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1724 |
1403 | 1725 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos); |
1726 | |
1322
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1727 /* lw->image is preserved together with lw->utility_box */ |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1728 if (lw->utility_box) |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1729 { |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1730 /* preserve utility_box (image + sidebars) to be reused later in layout_grid_setup */ |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1731 gtk_widget_hide(lw->utility_box); |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1732 g_object_ref(lw->utility_box); |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1733 gtk_container_remove(GTK_CONTAINER(lw->utility_box->parent), lw->utility_box); |
4370b90fa774
reuse original utility_box (image + sidebars) on layout change (switch
nadvornik
parents:
1320
diff
changeset
|
1734 } |
9 | 1735 |
1736 /* clear it all */ | |
1737 | |
1738 lw->h_pane = NULL; | |
1739 lw->v_pane = NULL; | |
1740 | |
1741 lw->toolbar = NULL; | |
1742 lw->path_entry = NULL; | |
1743 lw->dir_view = NULL; | |
380
5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
zas_
parents:
368
diff
changeset
|
1744 lw->vd = NULL; |
9 | 1745 |
1746 lw->file_view = NULL; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
559
diff
changeset
|
1747 lw->vf = NULL; |
9 | 1748 |
1749 lw->info_box = NULL; | |
1750 lw->info_progress_bar = NULL; | |
1751 lw->info_sort = NULL; | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
1752 lw->info_color = NULL; |
9 | 1753 lw->info_status = NULL; |
1754 lw->info_details = NULL; | |
1375
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1755 lw->info_pixel = NULL; |
9 | 1756 lw->info_zoom = NULL; |
1757 | |
1758 if (lw->ui_manager) g_object_unref(lw->ui_manager); | |
1759 lw->ui_manager = NULL; | |
1760 lw->action_group = NULL; | |
1279
6248faa9e829
do not translate already translated texts from desktop files
nadvornik
parents:
1249
diff
changeset
|
1761 lw->action_group_external = NULL; |
9 | 1762 |
1763 gtk_container_remove(GTK_CONTAINER(lw->main_box), lw->group_box); | |
1764 lw->group_box = NULL; | |
1765 | |
1766 /* re-fill */ | |
1767 | |
1768 layout_grid_setup(lw); | |
1309 | 1769 layout_tools_hide(lw, lw->options.tools_hidden); |
9 | 1770 |
1771 layout_util_sync(lw); | |
1772 layout_status_update_all(lw); | |
1773 | |
1774 /* sync */ | |
1775 | |
783 | 1776 if (image_get_fd(lw->image)) |
9 | 1777 { |
783 | 1778 layout_set_fd(lw, image_get_fd(lw->image)); |
9 | 1779 } |
1780 else | |
1781 { | |
783 | 1782 layout_set_fd(lw, dir_fd); |
9 | 1783 } |
1309 | 1784 image_top_window_set_sync(lw->image, (lw->options.tools_float || lw->options.tools_hidden)); |
9 | 1785 |
1786 /* clean up */ | |
1787 | |
783 | 1788 file_data_unref(dir_fd); |
9 | 1789 } |
1790 | |
1791 void layout_colors_update(void) | |
1792 { | |
1793 GList *work; | |
1794 | |
1795 work = layout_window_list; | |
1796 while (work) | |
1797 { | |
1798 LayoutWindow *lw = work->data; | |
1799 work = work->next; | |
442 | 1800 |
208
fa0e05f985c3
set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents:
196
diff
changeset
|
1801 if (!lw->image) continue; |
339
de1c2cd06fce
Rename user_specified_window_background and window_background_color
zas_
parents:
338
diff
changeset
|
1802 image_background_set_color(lw->image, options->image.use_custom_border_color ? &options->image.border_color : NULL); |
9 | 1803 } |
1804 } | |
1805 | |
1806 void layout_tools_float_toggle(LayoutWindow *lw) | |
1807 { | |
1416 | 1808 gboolean popped; |
9 | 1809 |
1810 if (!lw) return; | |
1811 | |
1309 | 1812 if (!lw->options.tools_hidden) |
9 | 1813 { |
1309 | 1814 popped = !lw->options.tools_float; |
9 | 1815 } |
1816 else | |
1817 { | |
1818 popped = TRUE; | |
1819 } | |
1820 | |
1309 | 1821 if (lw->options.tools_float == popped) |
9 | 1822 { |
1309 | 1823 if (popped && lw->options.tools_hidden) |
9 | 1824 { |
1825 layout_tools_float_set(lw, popped, FALSE); | |
1826 } | |
1827 } | |
1828 else | |
1829 { | |
1309 | 1830 if (lw->options.tools_float) |
9 | 1831 { |
1832 layout_tools_float_set(lw, FALSE, FALSE); | |
1833 } | |
1834 else | |
1835 { | |
1836 layout_tools_float_set(lw, TRUE, FALSE); | |
1837 } | |
1838 } | |
1839 } | |
1840 | |
1841 void layout_tools_hide_toggle(LayoutWindow *lw) | |
1842 { | |
1843 if (!lw) return; | |
1844 | |
1309 | 1845 layout_tools_float_set(lw, lw->options.tools_float, !lw->options.tools_hidden); |
9 | 1846 } |
1847 | |
1416 | 1848 void layout_tools_float_set(LayoutWindow *lw, gboolean popped, gboolean hidden) |
9 | 1849 { |
1850 if (!layout_valid(&lw)) return; | |
1851 | |
1309 | 1852 if (lw->options.tools_float == popped && lw->options.tools_hidden == hidden) return; |
1853 | |
1854 if (lw->options.tools_float == popped && lw->options.tools_float && lw->tools) | |
9 | 1855 { |
1856 layout_tools_hide(lw, hidden); | |
1857 return; | |
1858 } | |
1859 | |
1309 | 1860 lw->options.tools_float = popped; |
1861 lw->options.tools_hidden = hidden; | |
9 | 1862 |
1863 layout_style_set(lw, -1, NULL); | |
1864 } | |
1865 | |
1416 | 1866 gboolean layout_tools_float_get(LayoutWindow *lw, gboolean *popped, gboolean *hidden) |
9 | 1867 { |
1868 if (!layout_valid(&lw)) return FALSE; | |
1869 | |
1309 | 1870 *popped = lw->options.tools_float; |
1871 *hidden = lw->options.tools_hidden; | |
9 | 1872 |
1873 return TRUE; | |
1874 } | |
1875 | |
1876 void layout_toolbar_toggle(LayoutWindow *lw) | |
1877 { | |
1878 if (!layout_valid(&lw)) return; | |
1879 if (!lw->toolbar) return; | |
1880 | |
1309 | 1881 lw->options.toolbar_hidden = !lw->options.toolbar_hidden; |
1882 | |
1883 if (lw->options.toolbar_hidden) | |
9 | 1884 { |
1885 if (GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_hide(lw->toolbar); | |
1886 } | |
1887 else | |
1888 { | |
1889 if (!GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_show(lw->toolbar); | |
1890 } | |
1891 } | |
1892 | |
1375
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1893 void layout_info_pixel_toggle(LayoutWindow *lw) |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1894 { |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1895 GtkWidget *frame; |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1896 |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1897 if (!layout_valid(&lw)) return; |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1898 if (!lw->info_pixel) return; |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1899 |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1900 lw->options.info_pixel_hidden = !lw->options.info_pixel_hidden; |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1901 |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1902 frame = gtk_widget_get_parent(lw->info_pixel); |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1903 if (lw->options.info_pixel_hidden) |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1904 { |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1905 if (GTK_WIDGET_VISIBLE(frame)) gtk_widget_hide(frame); |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1906 } |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1907 else |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1908 { |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1909 if (!GTK_WIDGET_VISIBLE(frame)) gtk_widget_show(frame); |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1910 } |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1911 } |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
1912 |
9 | 1913 /* |
1914 *----------------------------------------------------------------------------- | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1915 * configuration |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1916 *----------------------------------------------------------------------------- |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1917 */ |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1918 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1919 #define CONFIG_WINDOW_DEF_WIDTH 600 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1920 #define CONFIG_WINDOW_DEF_HEIGHT 400 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1921 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1922 typedef struct _LayoutConfig LayoutConfig; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1923 struct _LayoutConfig |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1924 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1925 LayoutWindow *lw; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1926 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1927 GtkWidget *configwindow; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1928 GtkWidget *home_path_entry; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1929 GtkWidget *layout_widget; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1930 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1931 LayoutOptions options; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1932 }; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1933 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1934 static gint layout_config_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1935 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1936 static void layout_config_close_cb(GtkWidget *widget, gpointer data) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1937 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1938 LayoutConfig *lc = data; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1939 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1940 gtk_widget_destroy(lc->configwindow); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1941 free_layout_options_content(&lc->options); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1942 g_free(lc); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1943 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1944 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1945 static gint layout_config_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1946 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1947 layout_config_close_cb(w, data); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1948 return TRUE; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1949 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1950 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1951 static void layout_config_apply_cb(GtkWidget *widget, gpointer data) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1952 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1953 LayoutConfig *lc = data; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1954 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1955 g_free(lc->options.order); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1956 lc->options.order = layout_config_get(lc->layout_widget, &lc->options.style); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1957 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1958 config_entry_to_option(lc->home_path_entry, &lc->options.home_path, remove_trailing_slash); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1959 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1960 layout_apply_options(lc->lw, &lc->options); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1961 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1962 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1963 static void layout_config_ok_cb(GtkWidget *widget, gpointer data) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1964 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1965 LayoutConfig *lc = data; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1966 layout_config_apply_cb(widget, lc); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1967 layout_config_close_cb(widget, lc); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1968 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1969 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1970 static void home_path_set_current_cb(GtkWidget *widget, gpointer data) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1971 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1972 LayoutConfig *lc = data; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1973 gtk_entry_set_text(GTK_ENTRY(lc->home_path_entry), layout_get_path(lc->lw)); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1974 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1975 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1976 /* |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1977 static void layout_config_save_cb(GtkWidget *widget, gpointer data) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1978 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1979 layout_config_apply(); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1980 save_options(options); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1981 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1982 */ |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1983 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1984 void layout_show_config_window(LayoutWindow *lw) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1985 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1986 LayoutConfig *lc; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1987 GtkWidget *win_vbox; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1988 GtkWidget *hbox; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1989 GtkWidget *vbox; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1990 GtkWidget *button; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1991 GtkWidget *ct_button; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1992 GtkWidget *group; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1993 GtkWidget *frame; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1994 GtkWidget *tabcomp; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1995 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1996 lc = g_new0(LayoutConfig, 1); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1997 lc->lw = lw; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1998 layout_sync_options_with_current_state(lw); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
1999 copy_layout_options(&lc->options, &lw->options); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2000 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2001 lc->configwindow = window_new(GTK_WINDOW_TOPLEVEL, "Layout", PIXBUF_INLINE_ICON_CONFIG, NULL, _("Window options and layout")); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2002 gtk_window_set_type_hint(GTK_WINDOW(lc->configwindow), GDK_WINDOW_TYPE_HINT_DIALOG); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2003 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2004 g_signal_connect(G_OBJECT(lc->configwindow), "delete_event", |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2005 G_CALLBACK(layout_config_delete_cb), lc); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2006 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2007 gtk_window_set_default_size(GTK_WINDOW(lc->configwindow), CONFIG_WINDOW_DEF_WIDTH, CONFIG_WINDOW_DEF_HEIGHT); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2008 gtk_window_set_resizable(GTK_WINDOW(lc->configwindow), TRUE); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2009 gtk_container_set_border_width(GTK_CONTAINER(lc->configwindow), PREF_PAD_BORDER); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2010 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2011 win_vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2012 gtk_container_add(GTK_CONTAINER(lc->configwindow), win_vbox); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2013 gtk_widget_show(win_vbox); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2014 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2015 hbox = gtk_hbutton_box_new(); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2016 gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2017 gtk_box_set_spacing(GTK_BOX(hbox), PREF_PAD_BUTTON_GAP); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2018 gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2019 gtk_widget_show(hbox); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2020 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2021 button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE, |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2022 G_CALLBACK(layout_config_ok_cb), lc); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2023 gtk_container_add(GTK_CONTAINER(hbox), button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2024 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2025 gtk_widget_grab_default(button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2026 gtk_widget_show(button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2027 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2028 ct_button = button; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2029 /* |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2030 button = pref_button_new(NULL, GTK_STOCK_SAVE, NULL, FALSE, |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2031 G_CALLBACK(layout_config_save_cb), NULL); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2032 gtk_container_add(GTK_CONTAINER(hbox), button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2033 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2034 gtk_widget_show(button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2035 */ |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2036 button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE, |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2037 G_CALLBACK(layout_config_apply_cb), lc); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2038 gtk_container_add(GTK_CONTAINER(hbox), button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2039 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2040 gtk_widget_show(button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2041 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2042 button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE, |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2043 G_CALLBACK(layout_config_close_cb), lc); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2044 gtk_container_add(GTK_CONTAINER(hbox), button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2045 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2046 gtk_widget_show(button); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2047 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2048 if (!generic_dialog_get_alternative_button_order(lc->configwindow)) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2049 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2050 gtk_box_reorder_child(GTK_BOX(hbox), ct_button, -1); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2051 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2052 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2053 frame = pref_frame_new(win_vbox, TRUE, NULL, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2054 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2055 vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2056 gtk_container_add(GTK_CONTAINER(frame), vbox); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2057 gtk_widget_show(vbox); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2058 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2059 group = pref_group_new(vbox, FALSE, _("General options"), GTK_ORIENTATION_VERTICAL); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2060 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2061 pref_label_new(group, _("Home button path (empty to use your home directory)")); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2062 hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2063 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2064 tabcomp = tab_completion_new(&lc->home_path_entry, lc->options.home_path, NULL, NULL); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2065 tab_completion_add_select_button(lc->home_path_entry, NULL, TRUE); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2066 gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2067 gtk_widget_show(tabcomp); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2068 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2069 button = pref_button_new(hbox, NULL, _("Use current"), FALSE, |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2070 G_CALLBACK(home_path_set_current_cb), lc); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2071 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2072 group = pref_group_new(vbox, FALSE, _("Behavior"), GTK_ORIENTATION_VERTICAL); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2073 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2074 pref_checkbox_new_int(group, _("Show date in directories list view"), |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2075 lc->options.show_directory_date, &lc->options.show_directory_date); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2076 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2077 group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2078 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2079 lc->layout_widget = layout_config_new(); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2080 layout_config_set(lc->layout_widget, lw->options.style, lw->options.order); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2081 gtk_box_pack_start(GTK_BOX(group), lc->layout_widget, TRUE, TRUE, 0); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2082 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2083 gtk_widget_show(lc->layout_widget); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2084 gtk_widget_show(lc->configwindow); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2085 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2086 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2087 /* |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2088 *----------------------------------------------------------------------------- |
9 | 2089 * base |
2090 *----------------------------------------------------------------------------- | |
2091 */ | |
2092 | |
1309 | 2093 void layout_sync_options_with_current_state(LayoutWindow *lw) |
2094 { | |
1336 | 2095 Histogram *histogram; |
1309 | 2096 if (!layout_valid(&lw)) return; |
2097 | |
2098 lw->options.main_window.maximized = window_maximized(lw->window); | |
2099 if (!lw->options.main_window.maximized) | |
2100 { | |
2101 layout_geometry_get(lw, &lw->options.main_window.x, &lw->options.main_window.y, | |
2102 &lw->options.main_window.w, &lw->options.main_window.h); | |
2103 } | |
2104 | |
2105 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos); | |
2106 | |
2107 // layout_sort_get(NULL, &options->file_sort.method, &options->file_sort.ascending); | |
2108 | |
2109 layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.y, | |
2110 &lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos); | |
2111 | |
1336 | 2112 lw->options.image_overlay.state = image_osd_get(lw->image); |
2113 histogram = image_osd_get_histogram(lw->image); | |
2114 | |
2115 lw->options.image_overlay.histogram_channel = histogram->histogram_channel; | |
2116 lw->options.image_overlay.histogram_mode = histogram->histogram_mode; | |
2117 | |
1309 | 2118 // if (options->startup.restore_path && options->startup.use_last_path) |
2119 // { | |
2120 // g_free(options->startup.path); | |
2121 // options->startup.path = g_strdup(layout_get_path(NULL)); | |
2122 // } | |
2123 } | |
2124 | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2125 void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop) |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2126 { |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2127 gint refresh_style; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2128 gint refresh_lists; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2129 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2130 if (!layout_valid(&lw)) return; |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2131 /* FIXME: add other options too */ |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2132 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2133 refresh_style = (lop->style != lw->options.style || strcmp(lop->order, lw->options.order) != 0); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2134 refresh_lists = (lop->show_directory_date != lw->options.show_directory_date); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2135 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2136 copy_layout_options(&lw->options, lop); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2137 |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2138 if (refresh_style) layout_style_set(lw, lw->options.style, lw->options.order); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2139 if (refresh_lists) layout_refresh(lw); |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2140 } |
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2141 |
1309 | 2142 |
9 | 2143 void layout_close(LayoutWindow *lw) |
2144 { | |
2145 if (layout_window_list && layout_window_list->next) | |
2146 { | |
2147 layout_free(lw); | |
2148 } | |
2149 else | |
2150 { | |
278 | 2151 exit_program(); |
9 | 2152 } |
2153 } | |
2154 | |
2155 void layout_free(LayoutWindow *lw) | |
2156 { | |
2157 if (!lw) return; | |
2158 | |
2159 layout_window_list = g_list_remove(layout_window_list, lw); | |
2160 | |
1293
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1291
diff
changeset
|
2161 if (lw->exif_window) g_signal_handlers_disconnect_matched(G_OBJECT(lw->exif_window), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, lw); |
48e064b37ba6
separated "normal" and advanced exif, "Normal" exif is now in the
nadvornik
parents:
1291
diff
changeset
|
2162 |
9 | 2163 layout_bars_close(lw); |
2164 | |
2165 gtk_widget_destroy(lw->window); | |
837
f8c22438376c
use GtkSizeGroup to control initial size of split images
nadvornik
parents:
820
diff
changeset
|
2166 |
f8c22438376c
use GtkSizeGroup to control initial size of split images
nadvornik
parents:
820
diff
changeset
|
2167 if (lw->split_image_sizegroup) g_object_unref(lw->split_image_sizegroup); |
442 | 2168 |
796 | 2169 file_data_unregister_notify_func(layout_image_notify_cb, lw); |
2170 | |
995 | 2171 if (lw->dir_fd) |
791 | 2172 { |
2173 file_data_unregister_real_time_monitor(lw->dir_fd); | |
2174 file_data_unref(lw->dir_fd); | |
2175 } | |
9 | 2176 |
1335 | 2177 string_list_free(lw->toolbar_actions); |
1309 | 2178 free_layout_options_content(&lw->options); |
9 | 2179 g_free(lw); |
2180 } | |
2181 | |
1433
b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
zas_
parents:
1431
diff
changeset
|
2182 static gboolean layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) |
9 | 2183 { |
2184 LayoutWindow *lw = data; | |
2185 | |
2186 layout_close(lw); | |
2187 return TRUE; | |
2188 } | |
2189 | |
1309 | 2190 LayoutWindow *layout_new(FileData *dir_fd, LayoutOptions *lop) |
9 | 2191 { |
1309 | 2192 return layout_new_with_geometry(dir_fd, lop, NULL); |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2193 } |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2194 |
1309 | 2195 LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop, |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2196 const gchar *geometry) |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2197 { |
9 | 2198 LayoutWindow *lw; |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2199 GdkGeometry hint; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2200 GdkWindowHints hint_mask; |
1336 | 2201 Histogram *histogram; |
9 | 2202 |
2203 lw = g_new0(LayoutWindow, 1); | |
2204 | |
1309 | 2205 if (lop) |
2206 copy_layout_options(&lw->options, lop); | |
2207 else | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2208 init_layout_options(&lw->options); |
1309 | 2209 |
9 | 2210 lw->sort_method = SORT_NAME; |
2211 lw->sort_ascend = TRUE; | |
2212 | |
1309 | 2213 // lw->options.tools_float = popped; |
2214 // lw->options.tools_hidden = hidden; | |
2215 // lw->bar_sort_enabled = options->panels.sort.enabled; | |
2216 // lw->bar_enabled = options->panels.info.enabled; | |
9 | 2217 |
2218 /* default layout */ | |
2219 | |
1309 | 2220 layout_config_parse(lw->options.style, lw->options.order, |
9 | 2221 &lw->dir_location, &lw->file_location, &lw->image_location); |
1309 | 2222 if (lw->options.dir_view_type >= VIEW_DIR_TYPES_COUNT) lw->options.dir_view_type = 0; |
2223 if (lw->options.file_view_type >= VIEW_FILE_TYPES_COUNT) lw->options.file_view_type = 0; | |
9 | 2224 |
2225 /* divider positions */ | |
2226 | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2227 if (!options->save_window_positions) |
9 | 2228 { |
1309 | 2229 lw->options.main_window.hdivider_pos = MAIN_WINDOW_DIV_HPOS; |
2230 lw->options.main_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS; | |
2231 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS; | |
9 | 2232 } |
2233 | |
2234 /* window */ | |
2235 | |
1174
0bea79d87065
Drop useless wmclass stuff. Gtk will take care of it and as said in the documentation using gtk_window_set_wmclass() is sort of pointless.
zas_
parents:
1167
diff
changeset
|
2236 lw->window = window_new(GTK_WINDOW_TOPLEVEL, GQ_APPNAME_LC, NULL, NULL, NULL); |
9 | 2237 gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE); |
2238 gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0); | |
2239 | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2240 if (options->save_window_positions) |
9 | 2241 { |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2242 hint_mask = GDK_HINT_USER_POS; |
9 | 2243 } |
2244 else | |
2245 { | |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2246 hint_mask = 0; |
9 | 2247 } |
2248 | |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2249 hint.min_width = 32; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2250 hint.min_height = 32; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2251 hint.base_width = 0; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2252 hint.base_height = 0; |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2253 gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &hint, |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2254 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hint_mask); |
9 | 2255 |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2256 if (options->save_window_positions) |
9 | 2257 { |
1309 | 2258 gtk_window_set_default_size(GTK_WINDOW(lw->window), lw->options.main_window.w, lw->options.main_window.h); |
2259 // if (!layout_window_list) | |
2260 // { | |
2261 gtk_window_move(GTK_WINDOW(lw->window), lw->options.main_window.x, lw->options.main_window.y); | |
2262 if (lw->options.main_window.maximized) gtk_window_maximize(GTK_WINDOW(lw->window)); | |
2263 // } | |
9 | 2264 } |
2265 else | |
2266 { | |
2267 gtk_window_set_default_size(GTK_WINDOW(lw->window), MAINWINDOW_DEF_WIDTH, MAINWINDOW_DEF_HEIGHT); | |
2268 } | |
2269 | |
2270 g_signal_connect(G_OBJECT(lw->window), "delete_event", | |
2271 G_CALLBACK(layout_delete_cb), lw); | |
2272 | |
2273 layout_keyboard_init(lw, lw->window); | |
2274 | |
528 | 2275 #ifdef HAVE_LIRC |
2276 layout_image_lirc_init(lw); | |
2277 #endif | |
2278 | |
9 | 2279 lw->main_box = gtk_vbox_new(FALSE, 0); |
2280 gtk_container_add(GTK_CONTAINER(lw->window), lw->main_box); | |
2281 gtk_widget_show(lw->main_box); | |
2282 | |
2283 layout_grid_setup(lw); | |
1309 | 2284 image_top_window_set_sync(lw->image, (lw->options.tools_float || lw->options.tools_hidden)); |
9 | 2285 |
2286 layout_util_sync(lw); | |
2287 layout_status_update_all(lw); | |
2288 | |
783 | 2289 if (dir_fd) |
9 | 2290 { |
783 | 2291 layout_set_fd(lw, dir_fd); |
9 | 2292 } |
2293 else | |
2294 { | |
2295 GdkPixbuf *pixbuf; | |
2296 | |
2297 pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO); | |
1287
5fdf258f9c24
Start with "Fit to window" in "Leave Zoom at previous setting" mode
nadvornik
parents:
1284
diff
changeset
|
2298 |
5fdf258f9c24
Start with "Fit to window" in "Leave Zoom at previous setting" mode
nadvornik
parents:
1284
diff
changeset
|
2299 /* FIXME: the zoom value set here is the value, which is then copied again and again |
5fdf258f9c24
Start with "Fit to window" in "Leave Zoom at previous setting" mode
nadvornik
parents:
1284
diff
changeset
|
2300 in "Leave Zoom at previous setting" mode. This is not ideal. */ |
5fdf258f9c24
Start with "Fit to window" in "Leave Zoom at previous setting" mode
nadvornik
parents:
1284
diff
changeset
|
2301 image_change_pixbuf(lw->image, pixbuf, 0.0, FALSE); |
1043 | 2302 g_object_unref(pixbuf); |
9 | 2303 } |
2304 | |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2305 if (geometry) |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2306 { |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2307 if (!gtk_window_parse_geometry(GTK_WINDOW(lw->window), geometry)) |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2308 { |
694 | 2309 log_printf("%s", _("Invalid geometry\n")); |
81
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2310 } |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2311 } |
0ef72a64930b
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
2312 |
9 | 2313 gtk_widget_show(lw->window); |
1309 | 2314 layout_tools_hide(lw, lw->options.tools_hidden); |
9 | 2315 |
1336 | 2316 image_osd_set(lw->image, lw->options.image_overlay.state); |
2317 histogram = image_osd_get_histogram(lw->image); | |
2318 | |
2319 histogram->histogram_channel = lw->options.image_overlay.histogram_channel; | |
2320 histogram->histogram_mode = lw->options.image_overlay.histogram_mode; | |
1313 | 2321 |
9 | 2322 layout_window_list = g_list_append(layout_window_list, lw); |
2323 | |
796 | 2324 file_data_register_notify_func(layout_image_notify_cb, lw, NOTIFY_PRIORITY_LOW); |
2325 | |
9 | 2326 return lw; |
2327 } | |
2328 | |
1309 | 2329 void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent) |
2330 { | |
2331 WRITE_INT(*layout, style); | |
2332 WRITE_CHAR(*layout, order); | |
2333 WRITE_UINT(*layout, dir_view_type); | |
2334 WRITE_UINT(*layout, file_view_type); | |
2335 WRITE_BOOL(*layout, show_marks); | |
2336 WRITE_BOOL(*layout, show_thumbnails); | |
2337 WRITE_BOOL(*layout, show_directory_date); | |
2338 WRITE_CHAR(*layout, home_path); | |
2339 WRITE_SEPARATOR(); | |
2340 | |
2341 WRITE_INT(*layout, main_window.x); | |
2342 WRITE_INT(*layout, main_window.y); | |
2343 WRITE_INT(*layout, main_window.w); | |
2344 WRITE_INT(*layout, main_window.h); | |
2345 WRITE_BOOL(*layout, main_window.maximized); | |
2346 WRITE_INT(*layout, main_window.hdivider_pos); | |
2347 WRITE_INT(*layout, main_window.vdivider_pos); | |
2348 WRITE_SEPARATOR(); | |
2349 | |
2350 WRITE_INT(*layout, float_window.x); | |
2351 WRITE_INT(*layout, float_window.y); | |
2352 WRITE_INT(*layout, float_window.w); | |
2353 WRITE_INT(*layout, float_window.h); | |
2354 WRITE_INT(*layout, float_window.vdivider_pos); | |
2355 WRITE_SEPARATOR(); | |
2356 | |
2357 WRITE_INT(*layout, properties_window.w); | |
2358 WRITE_INT(*layout, properties_window.h); | |
2359 WRITE_SEPARATOR(); | |
2360 | |
2361 WRITE_BOOL(*layout, tools_float); | |
2362 WRITE_BOOL(*layout, tools_hidden); | |
2363 WRITE_SEPARATOR(); | |
2364 | |
2365 WRITE_BOOL(*layout, toolbar_hidden); | |
1375
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
2366 WRITE_BOOL(*layout, info_pixel_hidden); |
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
2367 |
1336 | 2368 WRITE_UINT(*layout, image_overlay.state); |
2369 WRITE_INT(*layout, image_overlay.histogram_channel); | |
2370 WRITE_INT(*layout, image_overlay.histogram_mode); | |
1309 | 2371 } |
2372 | |
2373 | |
2374 void layout_write_config(LayoutWindow *lw, GString *outstr, gint indent) | |
2375 { | |
2376 layout_sync_options_with_current_state(lw); | |
1314 | 2377 WRITE_STRING("<layout\n"); |
1309 | 2378 layout_write_attributes(&lw->options, outstr, indent + 1); |
1314 | 2379 WRITE_STRING(">\n"); |
1309 | 2380 |
1320 | 2381 bar_sort_write_config(lw->bar_sort, outstr, indent + 1); |
1309 | 2382 bar_write_config(lw->bar, outstr, indent + 1); |
2383 | |
1335 | 2384 layout_toolbar_write_config(lw, outstr, indent + 1); |
2385 | |
1314 | 2386 WRITE_STRING("</layout>\n"); |
1309 | 2387 } |
2388 | |
2389 void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values) | |
2390 { | |
2391 | |
2392 while (*attribute_names) | |
2393 { | |
2394 const gchar *option = *attribute_names++; | |
2395 const gchar *value = *attribute_values++; | |
2396 | |
2397 /* layout options */ | |
2398 | |
1315 | 2399 if (READ_INT(*layout, style)) continue; |
2400 if (READ_CHAR(*layout, order)) continue; | |
1309 | 2401 |
1315 | 2402 if (READ_UINT(*layout, dir_view_type)) continue; |
2403 if (READ_UINT(*layout, file_view_type)) continue; | |
2404 if (READ_BOOL(*layout, show_marks)) continue; | |
2405 if (READ_BOOL(*layout, show_thumbnails)) continue; | |
2406 if (READ_BOOL(*layout, show_directory_date)) continue; | |
2407 if (READ_CHAR(*layout, home_path)) continue; | |
1309 | 2408 |
2409 /* window positions */ | |
2410 | |
1315 | 2411 if (READ_INT(*layout, main_window.x)) continue; |
2412 if (READ_INT(*layout, main_window.y)) continue; | |
2413 if (READ_INT(*layout, main_window.w)) continue; | |
2414 if (READ_INT(*layout, main_window.h)) continue; | |
2415 if (READ_BOOL(*layout, main_window.maximized)) continue; | |
2416 if (READ_INT(*layout, main_window.hdivider_pos)) continue; | |
2417 if (READ_INT(*layout, main_window.vdivider_pos)) continue; | |
2418 | |
2419 if (READ_INT(*layout, float_window.x)) continue; | |
2420 if (READ_INT(*layout, float_window.y)) continue; | |
2421 if (READ_INT(*layout, float_window.w)) continue; | |
2422 if (READ_INT(*layout, float_window.h)) continue; | |
2423 if (READ_INT(*layout, float_window.vdivider_pos)) continue; | |
1309 | 2424 |
1315 | 2425 if (READ_INT(*layout, properties_window.w)) continue; |
2426 if (READ_INT(*layout, properties_window.h)) continue; | |
2427 | |
2428 if (READ_BOOL(*layout, tools_float)) continue; | |
2429 if (READ_BOOL(*layout, tools_hidden)) continue; | |
2430 if (READ_BOOL(*layout, toolbar_hidden)) continue; | |
1375
df58e511d90e
Display pixel coordinates and rgb - patch by Ruben Stein
nadvornik
parents:
1372
diff
changeset
|
2431 if (READ_BOOL(*layout, info_pixel_hidden)) continue; |
1309 | 2432 |
1336 | 2433 if (READ_UINT(*layout, image_overlay.state)) continue; |
2434 if (READ_INT(*layout, image_overlay.histogram_channel)) continue; | |
2435 if (READ_INT(*layout, image_overlay.histogram_mode)) continue; | |
2436 | |
1309 | 2437 DEBUG_1("unknown attribute %s = %s", option, value); |
2438 } | |
2439 | |
2440 } | |
2441 | |
1313 | 2442 static void layout_config_commandline(LayoutOptions *lop, gchar **path) |
2443 { | |
2444 if (command_line->startup_blank) | |
2445 { | |
2446 *path = NULL; | |
2447 } | |
2448 else if (command_line->file) | |
2449 { | |
2450 *path = g_strdup(command_line->file); | |
2451 } | |
2452 else if (command_line->path) | |
2453 { | |
2454 *path = g_strdup(command_line->path); | |
2455 } | |
2456 else if (options->startup.restore_path && options->startup.path && isdir(options->startup.path)) | |
2457 { | |
2458 *path = g_strdup(options->startup.path); | |
2459 } | |
2460 else | |
2461 { | |
2462 *path = get_current_dir(); | |
2463 } | |
2464 | |
2465 if (command_line->tools_show) | |
2466 { | |
2467 lop->tools_float = FALSE; | |
2468 lop->tools_hidden = FALSE; | |
2469 } | |
2470 else if (command_line->tools_hide) | |
2471 { | |
2472 lop->tools_hidden = TRUE; | |
2473 } | |
2474 } | |
2475 | |
2476 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline) | |
1309 | 2477 { |
2478 LayoutOptions lop; | |
2479 LayoutWindow *lw; | |
1313 | 2480 gchar *path = NULL; |
2481 | |
1436
d7a6fb7a90dd
completely separated global and layout window options
nadvornik
parents:
1433
diff
changeset
|
2482 init_layout_options(&lop); |
1309 | 2483 |
1313 | 2484 if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values); |
2485 | |
2486 if (use_commandline) | |
2487 { | |
2488 layout_config_commandline(&lop, &path); | |
2489 } | |
2490 else if (options->startup.restore_path && options->startup.path && isdir(options->startup.path)) | |
2491 { | |
2492 path = g_strdup(options->startup.path); | |
2493 } | |
2494 else | |
2495 { | |
2496 path = get_current_dir(); | |
2497 } | |
2498 | |
2499 lw = layout_new_with_geometry(NULL, &lop, use_commandline ? command_line->geometry : NULL); | |
1309 | 2500 layout_sort_set(lw, options->file_sort.method, options->file_sort.ascending); |
1313 | 2501 layout_set_path(lw, path); |
2502 | |
2503 if (use_commandline && command_line->startup_full_screen) layout_image_full_screen_start(lw); | |
2504 if (use_commandline && command_line->startup_in_slideshow) layout_image_slideshow_start(lw); | |
2505 | |
2506 | |
2507 g_free(path); | |
1309 | 2508 free_layout_options_content(&lop); |
2509 return lw; | |
2510 } | |
2511 | |
2512 | |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
1045
diff
changeset
|
2513 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |