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