Mercurial > hg > forks > geeqie
annotate src/layout.c @ 2808:1d43d9582f36
Tooltip for path entry
The current path entry can be partially obscured if the vertical divider
is pushed too far to the left.
This commit shows the current path as the tooltip.
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Thu, 02 Aug 2018 20:15:36 +0100 |
parents | bcd52f7517c7 |
children | e9e8e8b2afce |
rev | line source |
---|---|
9 | 1 /* |
2350
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
2 * Copyright (C) 2006 John Ellis |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
3 * Copyright (C) 2008 - 2016 The Geeqie Team |
9 | 4 * |
5 * Author: John Ellis | |
6 * | |
2350
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
7 * This program is free software; you can redistribute it and/or modify |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
8 * it under the terms of the GNU General Public License as published by |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
9 * the Free Software Foundation; either version 2 of the License, or |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
10 * (at your option) any later version. |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
11 * |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
15 * GNU General Public License for more details. |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
16 * |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
17 * You should have received a copy of the GNU General Public License along |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
18 * with this program; if not, write to the Free Software Foundation, Inc., |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2340
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
9 | 20 */ |
21 | |
281 | 22 #include "main.h" |
9 | 23 #include "layout.h" |
24 | |
507
7408e89b601d
Move debug macros from main.h to new debug.h.
Laurent Monin <geeqie@norz.org>
parents:
506
diff
changeset
|
25 #include "color-man.h" |
586
122fc2223b42
split filelist.c to filefilter.c and filedata.c
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
583
diff
changeset
|
26 #include "filedata.h" |
507
7408e89b601d
Move debug macros from main.h to new debug.h.
Laurent Monin <geeqie@norz.org>
parents:
506
diff
changeset
|
27 #include "histogram.h" |
2609
5beaa1da4f14
Fix #512: The "Back" button does not operate correctly
Colin Clark <colin.clark@cclark.uk>
parents:
2508
diff
changeset
|
28 #include "history_list.h" |
9 | 29 #include "image.h" |
482
b0194f65c239
Use image_osd_toggle() in layout_menu_overlay_cb().
Laurent Monin <geeqie@norz.org>
parents:
480
diff
changeset
|
30 #include "image-overlay.h" |
9 | 31 #include "layout_config.h" |
32 #include "layout_image.h" | |
33 #include "layout_util.h" | |
2508
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
34 #include "logwindow.h" |
9 | 35 #include "menu.h" |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
36 #include "pixbuf-renderer.h" |
9 | 37 #include "pixbuf_util.h" |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
91
diff
changeset
|
38 #include "utilops.h" |
380
41079d11eba7
Introduce a new struct ViewDir to handle directory views common
Laurent Monin <geeqie@norz.org>
parents:
368
diff
changeset
|
39 #include "view_dir.h" |
556
585f0de4f906
Replace Layout icon_view field by more generic file_view_type.
Laurent Monin <geeqie@norz.org>
parents:
555
diff
changeset
|
40 #include "view_file.h" |
9 | 41 #include "ui_fileops.h" |
42 #include "ui_menu.h" | |
43 #include "ui_misc.h" | |
44 #include "ui_tabcomp.h" | |
648
36e8da5a771d
Move some functions from main.[ch] to new window.[ch].
Laurent Monin <geeqie@norz.org>
parents:
632
diff
changeset
|
45 #include "window.h" |
1214
1e36edfd2a43
write metadata after timeout, image change or dir change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1177
diff
changeset
|
46 #include "metadata.h" |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
47 #include "rcfile.h" |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
48 #include "bar.h" |
1320
f1607e105298
improved bar_sort configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1317
diff
changeset
|
49 #include "bar_sort.h" |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
50 #include "preferences.h" |
2450
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
51 #include "shortcuts.h" |
528
c09da8b0fee9
Added LIRC patch written by Matteo Beniamino
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
523
diff
changeset
|
52 #ifdef HAVE_LIRC |
c09da8b0fee9
Added LIRC patch written by Matteo Beniamino
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
523
diff
changeset
|
53 #include "lirc.h" |
c09da8b0fee9
Added LIRC patch written by Matteo Beniamino
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
523
diff
changeset
|
54 #endif |
9 | 55 |
41
cac3a3efd1fd
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
23
diff
changeset
|
56 #define MAINWINDOW_DEF_WIDTH 700 |
cac3a3efd1fd
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
23
diff
changeset
|
57 #define MAINWINDOW_DEF_HEIGHT 500 |
9 | 58 |
553
20b3f221fcc5
Change default positions of dividers since width of the main menu
Laurent Monin <geeqie@norz.org>
parents:
531
diff
changeset
|
59 #define MAIN_WINDOW_DIV_HPOS (MAINWINDOW_DEF_WIDTH / 2) |
20b3f221fcc5
Change default positions of dividers since width of the main menu
Laurent Monin <geeqie@norz.org>
parents:
531
diff
changeset
|
60 #define MAIN_WINDOW_DIV_VPOS (MAINWINDOW_DEF_HEIGHT / 2) |
9 | 61 |
62 #define TOOLWINDOW_DEF_WIDTH 260 | |
63 #define TOOLWINDOW_DEF_HEIGHT 450 | |
553
20b3f221fcc5
Change default positions of dividers since width of the main menu
Laurent Monin <geeqie@norz.org>
parents:
531
diff
changeset
|
64 |
9 | 65 #define PROGRESS_WIDTH 150 |
66 #define ZOOM_LABEL_WIDTH 64 | |
67 | |
68 #define PANE_DIVIDER_SIZE 10 | |
69 | |
70 | |
71 GList *layout_window_list = NULL; | |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
72 LayoutWindow *current_lw = NULL; |
9 | 73 |
74 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle); | |
75 | |
76 | |
77 /* | |
78 *----------------------------------------------------------------------------- | |
79 * misc | |
80 *----------------------------------------------------------------------------- | |
81 */ | |
82 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
83 gboolean layout_valid(LayoutWindow **lw) |
9 | 84 { |
85 if (*lw == NULL) | |
86 { | |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
87 if (current_lw) *lw = current_lw; |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
88 else if (layout_window_list) *lw = layout_window_list->data; |
9 | 89 return (*lw != NULL); |
90 } | |
91 return (g_list_find(layout_window_list, *lw) != NULL); | |
92 } | |
93 | |
94 LayoutWindow *layout_find_by_image(ImageWindow *imd) | |
95 { | |
96 GList *work; | |
97 | |
98 work = layout_window_list; | |
99 while (work) | |
100 { | |
101 LayoutWindow *lw = work->data; | |
102 work = work->next; | |
103 | |
104 if (lw->image == imd) return lw; | |
105 } | |
106 | |
107 return NULL; | |
108 } | |
109 | |
368
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
110 LayoutWindow *layout_find_by_image_fd(ImageWindow *imd) |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
111 { |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
112 GList *work; |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
113 |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
114 work = layout_window_list; |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
115 while (work) |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
116 { |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
117 LayoutWindow *lw = work->data; |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
118 work = work->next; |
1372 | 119 |
368
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
120 if (lw->image->image_fd == imd->image_fd) |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
121 return lw; |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
122 } |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
123 |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
124 return NULL; |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
125 } |
515f8ef08cbe
New Go to directory view feature that permits to find and display the directory
Laurent Monin <geeqie@norz.org>
parents:
340
diff
changeset
|
126 |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
127 LayoutWindow *layout_find_by_layout_id(const gchar *id) |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
128 { |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
129 GList *work; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
130 |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
131 if (!id || !id[0]) return NULL; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
132 |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
133 if (strcmp(id, LAYOUT_ID_CURRENT) == 0) |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
134 { |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
135 if (current_lw) return current_lw; |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
136 if (layout_window_list) return layout_window_list->data; |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
137 return NULL; |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
138 } |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
139 |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
140 work = layout_window_list; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
141 while (work) |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
142 { |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
143 LayoutWindow *lw = work->data; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
144 work = work->next; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
145 |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
146 if (lw->options.id && strcmp(id, lw->options.id) == 0) |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
147 return lw; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
148 } |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
149 |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
150 return NULL; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
151 } |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
152 |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
153 static void layout_set_unique_id(LayoutWindow *lw) |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
154 { |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
155 char id[10]; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
156 gint i; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
157 if (lw->options.id && lw->options.id[0]) return; /* id is already set */ |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
158 |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
159 g_free(lw->options.id); |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
160 lw->options.id = NULL; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
161 |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
162 if (!layout_find_by_layout_id("main")) |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
163 { |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
164 lw->options.id = g_strdup("main"); |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
165 return; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
166 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
167 |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
168 i = 1; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
169 while (TRUE) |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
170 { |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
171 g_snprintf(id, sizeof(id), "lw%d", i); |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
172 if (!layout_find_by_layout_id(id)) |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
173 { |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
174 lw->options.id = g_strdup(id); |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
175 return; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
176 } |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
177 i++; |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
178 } |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
179 } |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
180 |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
181 static gboolean layout_set_current_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data) |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
182 { |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
183 LayoutWindow *lw = data; |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
184 current_lw = lw; |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
185 return FALSE; |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
186 } |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
187 |
2450
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
188 static void layout_box_folders_changed_cb(GtkWidget *widget, gpointer data) |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
189 { |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
190 LayoutWindow *lw; |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
191 GList *work; |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
192 |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
193 /* FIXME: this is probably not the correct way to implement this */ |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
194 work = layout_window_list; |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
195 while (work) |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
196 { |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
197 lw = work->data; |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
198 lw->options.folder_window.vdivider_pos = gtk_paned_get_position(GTK_PANED(widget)); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
199 work = work->next; |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
200 } |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
201 } |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
202 |
9 | 203 /* |
204 *----------------------------------------------------------------------------- | |
205 * menu, toolbar, and dir view | |
206 *----------------------------------------------------------------------------- | |
207 */ | |
208 | |
209 static void layout_path_entry_changed_cb(GtkWidget *widget, gpointer data) | |
210 { | |
211 LayoutWindow *lw = data; | |
212 gchar *buf; | |
213 | |
214 if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return; | |
215 | |
216 buf = g_strdup(gtk_entry_get_text(GTK_ENTRY(lw->path_entry))); | |
1372 | 217 if (!lw->dir_fd || strcmp(buf, lw->dir_fd->path) != 0) |
9 | 218 { |
1372 | 219 layout_set_path(lw, buf); |
9 | 220 } |
221 | |
442 | 222 g_free(buf); |
9 | 223 } |
224 | |
225 static void layout_path_entry_tab_cb(const gchar *path, gpointer data) | |
226 { | |
227 LayoutWindow *lw = data; | |
228 gchar *buf; | |
229 | |
230 buf = g_strdup(path); | |
231 parse_out_relatives(buf); | |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
232 |
9 | 233 if (isdir(buf)) |
234 { | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
235 if ((!lw->dir_fd || strcmp(lw->dir_fd->path, buf) != 0) && layout_set_path(lw, buf)) |
9 | 236 { |
2732
cff064279094
Fix #592: Directory widget loses focus on tab completion
Colin Clark <colin.clark@cclark.uk>
parents:
2723
diff
changeset
|
237 gtk_widget_grab_focus(GTK_WIDGET(lw->path_entry)); |
9 | 238 gint pos = -1; |
726
5166ed61c537
Use G_DIR_SEPARATOR where applicable.
Laurent Monin <geeqie@norz.org>
parents:
725
diff
changeset
|
239 /* put the G_DIR_SEPARATOR back, if we are in tab completion for a dir and result was path change */ |
725
ee5f1f4fd7e7
Use G_DIR_SEPARATOR_S where applicable.
Laurent Monin <geeqie@norz.org>
parents:
694
diff
changeset
|
240 gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), G_DIR_SEPARATOR_S, -1, &pos); |
9 | 241 gtk_editable_set_position(GTK_EDITABLE(lw->path_entry), |
242 strlen(gtk_entry_get_text(GTK_ENTRY(lw->path_entry)))); | |
243 } | |
244 } | |
1372 | 245 else if (lw->dir_fd) |
9 | 246 { |
1372 | 247 gchar *base = remove_level_from_path(buf); |
248 | |
249 if (strcmp(lw->dir_fd->path, base) == 0) | |
250 { | |
251 layout_list_scroll_to_subpart(lw, filename_from_path(buf)); | |
252 } | |
253 g_free(base); | |
9 | 254 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
255 |
9 | 256 g_free(buf); |
257 } | |
258 | |
259 static void layout_path_entry_cb(const gchar *path, gpointer data) | |
260 { | |
261 LayoutWindow *lw = data; | |
262 gchar *buf; | |
263 | |
264 buf = g_strdup(path); | |
265 parse_out_relatives(buf); | |
266 | |
267 layout_set_path(lw, buf); | |
268 | |
269 g_free(buf); | |
270 } | |
271 | |
1628
ac33c60e405e
simplified the code around vd_select_row
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1627
diff
changeset
|
272 static void layout_vd_select_cb(ViewDir *vd, FileData *fd, gpointer data) |
9 | 273 { |
274 LayoutWindow *lw = data; | |
275 | |
1628
ac33c60e405e
simplified the code around vd_select_row
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1627
diff
changeset
|
276 layout_set_fd(lw, fd); |
9 | 277 } |
278 | |
1167
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
279 static void layout_path_entry_tab_append_cb(const gchar *path, gpointer data, gint n) |
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
280 { |
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
281 LayoutWindow *lw = data; |
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
282 |
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
283 if (!lw || !lw->back_button) return; |
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
284 if (!layout_valid(&lw)) return; |
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
285 |
1372 | 286 /* Enable back button if it makes sense */ |
287 gtk_widget_set_sensitive(lw->back_button, (n > 1)); | |
1167
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
288 } |
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
289 |
2808
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
290 static gboolean path_entry_tooltip_cb(GtkWidget *widget, gpointer data) |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
291 { |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
292 LayoutWindow *lw = data; |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
293 GList *box_child_list; |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
294 GtkComboBox *path_entry; |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
295 gchar *current_path; |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
296 |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
297 box_child_list = gtk_container_get_children(GTK_CONTAINER(widget)); |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
298 path_entry = box_child_list->data; |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
299 current_path = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(path_entry)); |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
300 gtk_widget_set_tooltip_text(GTK_WIDGET(widget), current_path); |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
301 |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
302 g_free(current_path); |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
303 g_list_free(box_child_list); |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
304 |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
305 return FALSE; |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
306 } |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
307 |
9 | 308 static GtkWidget *layout_tool_setup(LayoutWindow *lw) |
309 { | |
310 GtkWidget *box; | |
2450
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
311 GtkWidget *box_folders; |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
312 GtkWidget *scd; |
9 | 313 GtkWidget *menu_bar; |
314 GtkWidget *tabcomp; | |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
315 GtkWidget *toolbar; |
9 | 316 |
317 box = gtk_vbox_new(FALSE, 0); | |
318 | |
319 menu_bar = layout_actions_menu_bar(lw); | |
320 gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0); | |
321 | |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
322 toolbar = layout_actions_toolbar(lw, TOOLBAR_MAIN); |
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
323 gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 0); |
2259 | 324 if (lw->options.toolbar_hidden) gtk_widget_hide(toolbar); |
9 | 325 |
326 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1, | |
327 layout_path_entry_cb, lw); | |
328 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw); | |
1167
95a52f5d7100
Add a back button in the toolbar: it allows to go back and forth between two directories. Experimental, please test and comment on ml.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
329 tab_completion_add_append_func(lw->path_entry, layout_path_entry_tab_append_cb, lw); |
9 | 330 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0); |
331 gtk_widget_show(tabcomp); | |
2808
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
332 gtk_widget_set_has_tooltip(GTK_WIDGET(tabcomp), TRUE); |
1d43d9582f36
Tooltip for path entry
Colin Clark <colin.clark@cclark.uk>
parents:
2806
diff
changeset
|
333 g_signal_connect(G_OBJECT(tabcomp), "query_tooltip", G_CALLBACK(path_entry_tooltip_cb), lw); |
9 | 334 |
2427
95afc4dda19f
Temporary fix #459: GTK 3.20 drop-down
Colin Clark <cclark@mcb.net>
parents:
2419
diff
changeset
|
335 #if GTK_CHECK_VERSION(3,20,0) |
95afc4dda19f
Temporary fix #459: GTK 3.20 drop-down
Colin Clark <cclark@mcb.net>
parents:
2419
diff
changeset
|
336 g_signal_connect(G_OBJECT(gtk_widget_get_parent(gtk_widget_get_parent(lw->path_entry))), "changed", |
95afc4dda19f
Temporary fix #459: GTK 3.20 drop-down
Colin Clark <cclark@mcb.net>
parents:
2419
diff
changeset
|
337 G_CALLBACK(layout_path_entry_changed_cb), lw); |
95afc4dda19f
Temporary fix #459: GTK 3.20 drop-down
Colin Clark <cclark@mcb.net>
parents:
2419
diff
changeset
|
338 #else |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
339 g_signal_connect(G_OBJECT(gtk_widget_get_parent(lw->path_entry)), "changed", |
9 | 340 G_CALLBACK(layout_path_entry_changed_cb), lw); |
2427
95afc4dda19f
Temporary fix #459: GTK 3.20 drop-down
Colin Clark <cclark@mcb.net>
parents:
2419
diff
changeset
|
341 #endif |
9 | 342 |
2450
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
343 box_folders = GTK_WIDGET(gtk_hpaned_new()); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
344 gtk_box_pack_start(GTK_BOX(box), box_folders, TRUE, TRUE, 0); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
345 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
346 lw->vd = vd_new(lw->options.dir_view_type, lw->dir_fd); |
380
41079d11eba7
Introduce a new struct ViewDir to handle directory views common
Laurent Monin <geeqie@norz.org>
parents:
368
diff
changeset
|
347 vd_set_layout(lw->vd, lw); |
41079d11eba7
Introduce a new struct ViewDir to handle directory views common
Laurent Monin <geeqie@norz.org>
parents:
368
diff
changeset
|
348 vd_set_select_func(lw->vd, layout_vd_select_cb, lw); |
9 | 349 |
380
41079d11eba7
Introduce a new struct ViewDir to handle directory views common
Laurent Monin <geeqie@norz.org>
parents:
368
diff
changeset
|
350 lw->dir_view = lw->vd->widget; |
2450
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
351 gtk_paned_add2(GTK_PANED(box_folders), lw->dir_view); |
9 | 352 gtk_widget_show(lw->dir_view); |
353 | |
2450
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
354 scd = shortcuts_new_default(lw); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
355 gtk_paned_add1(GTK_PANED(box_folders), scd); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
356 gtk_paned_set_position(GTK_PANED(box_folders), lw->options.folder_window.vdivider_pos); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
357 |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
358 gtk_widget_show(box_folders); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
359 |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
360 g_signal_connect(G_OBJECT(box_folders), "notify::position", |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
361 G_CALLBACK(layout_box_folders_changed_cb), lw); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
362 |
9 | 363 gtk_widget_show(box); |
364 | |
365 return box; | |
366 } | |
367 | |
368 /* | |
369 *----------------------------------------------------------------------------- | |
370 * sort button (and menu) | |
371 *----------------------------------------------------------------------------- | |
372 */ | |
373 | |
374 static void layout_sort_menu_cb(GtkWidget *widget, gpointer data) | |
375 { | |
376 LayoutWindow *lw; | |
377 SortType type; | |
378 | |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
91
diff
changeset
|
379 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
91
diff
changeset
|
380 |
9 | 381 lw = submenu_item_get_data(widget); |
382 if (!lw) return; | |
383 | |
384 type = (SortType)GPOINTER_TO_INT(data); | |
385 | |
2770
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
386 if (type == SORT_EXIFTIME || type == SORT_EXIFTIMEDIGITIZED || type == SORT_RATING) |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
387 { |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
388 vf_read_metadata_in_idle(lw->vf); |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
389 } |
9 | 390 layout_sort_set(lw, type, lw->sort_ascend); |
391 } | |
392 | |
393 static void layout_sort_menu_ascend_cb(GtkWidget *widget, gpointer data) | |
394 { | |
395 LayoutWindow *lw = data; | |
396 | |
397 layout_sort_set(lw, lw->sort_method, !lw->sort_ascend); | |
398 } | |
399 | |
400 static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data) | |
401 { | |
402 /* destroy the menu */ | |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1029
diff
changeset
|
403 g_object_unref(widget); |
9 | 404 } |
405 | |
406 static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data) | |
407 { | |
408 LayoutWindow *lw = data; | |
409 GtkWidget *menu; | |
410 GdkEvent *event; | |
411 guint32 etime; | |
412 | |
413 menu = submenu_add_sort(NULL, G_CALLBACK(layout_sort_menu_cb), lw, FALSE, FALSE, TRUE, lw->sort_method); | |
414 | |
88
a0bfbfe60a73
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
81
diff
changeset
|
415 /* take ownership of menu */ |
a0bfbfe60a73
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
81
diff
changeset
|
416 #ifdef GTK_OBJECT_FLOATING |
a0bfbfe60a73
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
81
diff
changeset
|
417 /* GTK+ < 2.10 */ |
9 | 418 g_object_ref(G_OBJECT(menu)); |
419 gtk_object_sink(GTK_OBJECT(menu)); | |
88
a0bfbfe60a73
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
81
diff
changeset
|
420 #else |
a0bfbfe60a73
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
81
diff
changeset
|
421 /* GTK+ >= 2.10 */ |
a0bfbfe60a73
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
81
diff
changeset
|
422 g_object_ref_sink(G_OBJECT(menu)); |
a0bfbfe60a73
Fri Oct 27 19:45:32 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
81
diff
changeset
|
423 #endif |
9 | 424 |
442 | 425 /* ascending option */ |
9 | 426 menu_item_add_divider(menu); |
427 menu_item_add_check(menu, _("Ascending"), lw->sort_ascend, G_CALLBACK(layout_sort_menu_ascend_cb), lw); | |
428 | |
429 g_signal_connect(G_OBJECT(menu), "selection_done", | |
430 G_CALLBACK(layout_sort_menu_hide_cb), NULL); | |
431 | |
432 event = gtk_get_current_event(); | |
433 if (event) | |
434 { | |
435 etime = gdk_event_get_time(event); | |
436 gdk_event_free(event); | |
437 } | |
438 else | |
439 { | |
440 etime = 0; | |
441 } | |
442 | |
443 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, etime); | |
444 } | |
445 | |
446 static GtkWidget *layout_sort_button(LayoutWindow *lw) | |
447 { | |
448 GtkWidget *button; | |
449 | |
450 button = gtk_button_new_with_label(sort_type_get_text(lw->sort_method)); | |
442 | 451 g_signal_connect(G_OBJECT(button), "clicked", |
9 | 452 G_CALLBACK(layout_sort_button_press_cb), lw); |
442 | 453 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
9 | 454 |
442 | 455 return button; |
9 | 456 } |
457 | |
2462
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
458 static void layout_zoom_menu_cb(GtkWidget *widget, gpointer data) |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
459 { |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
460 ZoomMode mode; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
461 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
462 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
463 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
464 mode = (ZoomMode)GPOINTER_TO_INT(data); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
465 options->image.zoom_mode = mode; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
466 } |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
467 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
468 static void layout_scroll_menu_cb(GtkWidget *widget, gpointer data) |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
469 { |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
470 guint scroll_type; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
471 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
472 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
473 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
474 scroll_type = GPOINTER_TO_UINT(data); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
475 options->image.scroll_reset_method = scroll_type; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
476 image_options_sync(); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
477 } |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
478 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
479 static void layout_zoom_menu_hide_cb(GtkWidget *widget, gpointer data) |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
480 { |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
481 /* destroy the menu */ |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
482 g_object_unref(widget); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
483 } |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
484 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
485 static void layout_zoom_button_press_cb(GtkWidget *widget, gpointer data) |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
486 { |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
487 LayoutWindow *lw = data; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
488 GtkWidget *menu; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
489 GdkEvent *event; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
490 guint32 etime; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
491 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
492 menu = submenu_add_zoom(NULL, G_CALLBACK(layout_zoom_menu_cb), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
493 lw, FALSE, FALSE, TRUE, options->image.zoom_mode); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
494 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
495 /* take ownership of menu */ |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
496 #ifdef GTK_OBJECT_FLOATING |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
497 /* GTK+ < 2.10 */ |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
498 g_object_ref(G_OBJECT(menu)); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
499 gtk_object_sink(GTK_OBJECT(menu)); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
500 #else |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
501 /* GTK+ >= 2.10 */ |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
502 g_object_ref_sink(G_OBJECT(menu)); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
503 #endif |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
504 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
505 menu_item_add_divider(menu); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
506 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
507 menu_item_add_radio(menu, _("Scroll to top left corner"), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
508 GUINT_TO_POINTER(SCROLL_RESET_TOPLEFT), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
509 options->image.scroll_reset_method == SCROLL_RESET_TOPLEFT, |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
510 G_CALLBACK(layout_scroll_menu_cb), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
511 GUINT_TO_POINTER(SCROLL_RESET_TOPLEFT)); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
512 menu_item_add_radio(menu, _("Scroll to image center"), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
513 GUINT_TO_POINTER(SCROLL_RESET_CENTER), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
514 options->image.scroll_reset_method == SCROLL_RESET_CENTER, |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
515 G_CALLBACK(layout_scroll_menu_cb), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
516 GUINT_TO_POINTER(SCROLL_RESET_CENTER)); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
517 menu_item_add_radio(menu, _("Keep the region from previous image"), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
518 GUINT_TO_POINTER(SCROLL_RESET_NOCHANGE), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
519 options->image.scroll_reset_method == SCROLL_RESET_NOCHANGE, |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
520 G_CALLBACK(layout_scroll_menu_cb), |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
521 GUINT_TO_POINTER(SCROLL_RESET_NOCHANGE)); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
522 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
523 g_signal_connect(G_OBJECT(menu), "selection_done", |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
524 G_CALLBACK(layout_zoom_menu_hide_cb), NULL); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
525 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
526 event = gtk_get_current_event(); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
527 if (event) |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
528 { |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
529 etime = gdk_event_get_time(event); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
530 gdk_event_free(event); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
531 } |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
532 else |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
533 { |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
534 etime = 0; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
535 } |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
536 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
537 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, etime); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
538 } |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
539 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
540 static GtkWidget *layout_zoom_button(LayoutWindow *lw, GtkWidget *box, gint size, gboolean expand) |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
541 { |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
542 GtkWidget *button; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
543 GtkWidget *frame; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
544 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
545 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
546 frame = gtk_frame_new(NULL); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
547 if (size) gtk_widget_set_size_request(frame, size, -1); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
548 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
549 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
550 gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 0); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
551 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
552 gtk_widget_show(frame); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
553 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
554 button = gtk_button_new_with_label("1:1"); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
555 g_signal_connect(G_OBJECT(button), "clicked", |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
556 G_CALLBACK(layout_zoom_button_press_cb), lw); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
557 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
558 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
559 gtk_container_add(GTK_CONTAINER(frame), button); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
560 gtk_widget_show(button); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
561 |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
562 return button; |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
563 } |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
564 |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
91
diff
changeset
|
565 /* |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
91
diff
changeset
|
566 *----------------------------------------------------------------------------- |
9 | 567 * status bar |
568 *----------------------------------------------------------------------------- | |
569 */ | |
570 | |
1240
6a1f19764c63
added a status bar button for writting metadata immediately
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1231
diff
changeset
|
571 |
9 | 572 void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *text) |
573 { | |
2770
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
574 static gdouble thumb = 0; |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
575 static gdouble meta = 0; |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
576 |
9 | 577 if (!layout_valid(&lw)) return; |
578 if (!lw->info_progress_bar) return; | |
579 | |
2770
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
580 /* Give priority to the loading meta data message |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
581 */ |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
582 if(!g_strcmp0(text, "Loading thumbs...")) |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
583 { |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
584 thumb = val; |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
585 if (meta) |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
586 { |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
587 return; |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
588 } |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
589 } |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
590 else |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
591 { |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
592 meta = val; |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
593 } |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
594 |
9 | 595 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(lw->info_progress_bar), val); |
2770
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
596 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(lw->info_progress_bar), |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
597 val ? ((text) ? text : " ") : " "); |
9 | 598 } |
599 | |
600 void layout_status_update_info(LayoutWindow *lw, const gchar *text) | |
601 { | |
602 gchar *buf = NULL; | |
603 | |
604 if (!layout_valid(&lw)) return; | |
605 | |
606 if (!text) | |
607 { | |
736
31d858f3272d
Fix signed vs unsigned warnings.
Laurent Monin <geeqie@norz.org>
parents:
726
diff
changeset
|
608 guint n; |
9 | 609 gint64 n_bytes = 0; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
610 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
611 n = layout_list_count(lw, &n_bytes); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
612 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
613 if (n) |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
614 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
615 guint s; |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
616 gint64 s_bytes = 0; |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
617 const gchar *ss; |
9 | 618 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
619 if (layout_image_slideshow_active(lw)) |
9 | 620 { |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
621 if (!layout_image_slideshow_paused(lw)) |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
622 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
623 ss = _(" Slideshow"); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
624 } |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
625 else |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
626 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
627 ss = _(" Paused"); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
628 } |
9 | 629 } |
630 else | |
631 { | |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
632 ss = ""; |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
633 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
634 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
635 s = layout_selection_count(lw, &s_bytes); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
636 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
637 layout_bars_new_selection(lw, s); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
638 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
639 if (s > 0) |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
640 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
641 gchar *b = text_from_size_abrev(n_bytes); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
642 gchar *sb = text_from_size_abrev(s_bytes); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
643 buf = g_strdup_printf(_("%s, %d files (%s, %d)%s"), b, n, sb, s, ss); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
644 g_free(b); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
645 g_free(sb); |
9 | 646 } |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
647 else if (n > 0) |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
648 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
649 gchar *b = text_from_size_abrev(n_bytes); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
650 buf = g_strdup_printf(_("%s, %d files%s"), b, n, ss); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
651 g_free(b); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
652 } |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
653 else |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
654 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
655 buf = g_strdup_printf(_("%d files%s"), n, ss); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
656 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
657 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
658 text = buf; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
659 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
660 image_osd_update(lw->image); |
9 | 661 } |
662 else | |
663 { | |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
664 text = ""; |
9 | 665 } |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
666 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
667 |
583
4d89efff3fb0
Revert patch 675, and correctly fix gtk assertion failure.
Laurent Monin <geeqie@norz.org>
parents:
574
diff
changeset
|
668 if (lw->info_status) gtk_label_set_text(GTK_LABEL(lw->info_status), text); |
9 | 669 g_free(buf); |
670 } | |
671 | |
672 void layout_status_update_image(LayoutWindow *lw) | |
673 { | |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
674 guint64 n; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
675 |
9 | 676 if (!layout_valid(&lw) || !lw->image) return; |
2017 | 677 if (!lw->info_zoom || !lw->info_details) return; /*called from layout_style_set */ |
9 | 678 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
679 n = layout_list_count(lw, NULL); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
680 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
681 if (!n) |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
682 { |
2468
faf8f7e202f5
Additional Fix #245: Eliminate run-time error
Colin Clark <cclark@mcb.net>
parents:
2462
diff
changeset
|
683 gtk_button_set_label(GTK_BUTTON(lw->info_zoom), ""); |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
684 gtk_label_set_text(GTK_LABEL(lw->info_details), ""); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
685 } |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
686 else |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
687 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
688 gchar *text; |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
689 gchar *b; |
9 | 690 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
691 text = image_zoom_get_as_text(lw->image); |
2462
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
692 gtk_button_set_label(GTK_BUTTON(lw->info_zoom), text); |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
693 g_free(text); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
694 |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
695 b = image_get_fd(lw->image) ? text_from_size(image_get_fd(lw->image)->size) : g_strdup("0"); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
696 |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
697 if (lw->image->unknown) |
9 | 698 { |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
699 if (image_get_path(lw->image) && !access_file(image_get_path(lw->image), R_OK)) |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
700 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
701 text = g_strdup_printf(_("(no read permission) %s bytes"), b); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
702 } |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
703 else |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
704 { |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
705 text = g_strdup_printf(_("( ? x ? ) %s bytes"), b); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
706 } |
9 | 707 } |
708 else | |
709 { | |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
710 gint width, height; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
711 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
712 image_get_image_size(lw->image, &width, &height); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
713 text = g_strdup_printf(_("( %d x %d ) %s bytes"), |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
714 width, height, b); |
9 | 715 } |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
716 |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
717 g_signal_emit_by_name (lw->image->pr, "update-pixel"); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
718 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
719 g_free(b); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
720 |
984
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
721 gtk_label_set_text(GTK_LABEL(lw->info_details), text); |
3d834c6040ab
Only display status if there is at least one file in the file list.
Laurent Monin <geeqie@norz.org>
parents:
960
diff
changeset
|
722 g_free(text); |
9 | 723 } |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
724 layout_util_sync_color(lw); /* update color button */ |
9 | 725 } |
726 | |
727 void layout_status_update_all(LayoutWindow *lw) | |
728 { | |
729 layout_status_update_progress(lw, 0.0, NULL); | |
730 layout_status_update_info(lw, NULL); | |
731 layout_status_update_image(lw); | |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
732 layout_util_status_update_write(lw); |
9 | 733 } |
734 | |
1433
12600de4b59a
Use gboolean where applicable, minor cleanup and indentations fixes.
Laurent Monin <geeqie@norz.org>
parents:
1431
diff
changeset
|
735 static GtkWidget *layout_status_label(gchar *text, GtkWidget *box, gboolean start, gint size, gboolean expand) |
9 | 736 { |
737 GtkWidget *label; | |
738 GtkWidget *frame; | |
739 | |
740 frame = gtk_frame_new(NULL); | |
741 if (size) gtk_widget_set_size_request(frame, size, -1); | |
742 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); | |
743 if (start) | |
744 { | |
745 gtk_box_pack_start(GTK_BOX(box), frame, expand, expand, 0); | |
746 } | |
747 else | |
748 { | |
749 gtk_box_pack_end(GTK_BOX(box), frame, expand, expand, 0); | |
750 } | |
751 gtk_widget_show(frame); | |
752 | |
753 label = gtk_label_new(text ? text : ""); | |
754 gtk_container_add(GTK_CONTAINER(frame), label); | |
755 gtk_widget_show(label); | |
756 | |
757 return label; | |
758 } | |
759 | |
1433
12600de4b59a
Use gboolean where applicable, minor cleanup and indentations fixes.
Laurent Monin <geeqie@norz.org>
parents:
1431
diff
changeset
|
760 static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gboolean small_format) |
9 | 761 { |
762 GtkWidget *hbox; | |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
763 GtkWidget *toolbar; |
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
764 GtkWidget *toolbar_frame; |
9 | 765 |
766 if (lw->info_box) return; | |
767 | |
768 if (small_format) | |
769 { | |
770 lw->info_box = gtk_vbox_new(FALSE, 0); | |
771 } | |
772 else | |
773 { | |
774 lw->info_box = gtk_hbox_new(FALSE, 0); | |
775 } | |
776 gtk_box_pack_end(GTK_BOX(box), lw->info_box, FALSE, FALSE, 0); | |
777 gtk_widget_show(lw->info_box); | |
778 | |
779 if (small_format) | |
780 { | |
781 hbox = gtk_hbox_new(FALSE, 0); | |
782 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0); | |
783 gtk_widget_show(hbox); | |
784 } | |
785 else | |
786 { | |
787 hbox = lw->info_box; | |
788 } | |
789 lw->info_progress_bar = gtk_progress_bar_new(); | |
790 gtk_widget_set_size_request(lw->info_progress_bar, PROGRESS_WIDTH, -1); | |
2439 | 791 #if GTK_CHECK_VERSION(3,0,0) |
792 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(lw->info_progress_bar), ""); | |
793 gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(lw->info_progress_bar), TRUE); | |
794 #endif | |
9 | 795 gtk_box_pack_start(GTK_BOX(hbox), lw->info_progress_bar, FALSE, FALSE, 0); |
796 gtk_widget_show(lw->info_progress_bar); | |
797 | |
798 lw->info_sort = layout_sort_button(lw); | |
2419 | 799 gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_sort), _("Select sort order")); |
9 | 800 gtk_box_pack_start(GTK_BOX(hbox), lw->info_sort, FALSE, FALSE, 0); |
801 gtk_widget_show(lw->info_sort); | |
802 | |
803 lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, (!small_format)); | |
2419 | 804 gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_status), _("Folder contents (files selected)")); |
9 | 805 |
806 if (small_format) | |
807 { | |
808 hbox = gtk_hbox_new(FALSE, 0); | |
809 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0); | |
810 gtk_widget_show(hbox); | |
811 } | |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
812 lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE); |
2419 | 813 gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_details), _("(Image dimensions) Image size")); |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
814 toolbar = layout_actions_toolbar(lw, TOOLBAR_STATUS); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
815 |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
816 toolbar_frame = gtk_frame_new(NULL); |
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
817 gtk_frame_set_shadow_type(GTK_FRAME(toolbar_frame), GTK_SHADOW_IN); |
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
818 gtk_container_add(GTK_CONTAINER(toolbar_frame), toolbar); |
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
819 gtk_widget_show(toolbar_frame); |
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
820 gtk_widget_show(toolbar); |
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
821 gtk_box_pack_end(GTK_BOX(hbox), toolbar_frame, FALSE, FALSE, 0); |
2462
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
822 lw->info_zoom = layout_zoom_button(lw, hbox, ZOOM_LABEL_WIDTH, TRUE); |
2775
0c5bcd8248fb
Fix #616: Image Position settings missing in 1.4
Colin Clark <colin.clark@cclark.uk>
parents:
2770
diff
changeset
|
823 gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_zoom), _("Select zoom and scroll mode")); |
2462
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
824 gtk_widget_show(lw->info_zoom); |
e4c44411a090
Fix #245: Zoom settings on status bar
Colin Clark <cclark@mcb.net>
parents:
2451
diff
changeset
|
825 |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
826 if (small_format) |
9 | 827 { |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
828 hbox = gtk_hbox_new(FALSE, 0); |
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
829 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0); |
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
830 gtk_widget_show(hbox); |
9 | 831 } |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
832 lw->info_pixel = layout_status_label(NULL, hbox, FALSE, 0, small_format); /* expand only in small format */ |
2419 | 833 gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_pixel), _("[Pixel x,y coord]: (Pixel R,G,B value)")); |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
834 if (!lw->options.show_info_pixel) gtk_widget_hide(gtk_widget_get_parent(lw->info_pixel)); |
9 | 835 } |
836 | |
837 /* | |
838 *----------------------------------------------------------------------------- | |
839 * views | |
840 *----------------------------------------------------------------------------- | |
841 */ | |
842 | |
843 static GtkWidget *layout_tools_new(LayoutWindow *lw) | |
844 { | |
845 lw->dir_view = layout_tool_setup(lw); | |
846 return lw->dir_view; | |
847 } | |
848 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
849 static void layout_list_status_cb(ViewFile *vf, gpointer data) |
9 | 850 { |
851 LayoutWindow *lw = data; | |
852 | |
853 layout_status_update_info(lw, NULL); | |
854 } | |
855 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
856 static void layout_list_thumb_cb(ViewFile *vf, gdouble val, const gchar *text, gpointer data) |
9 | 857 { |
858 LayoutWindow *lw = data; | |
859 | |
860 layout_status_update_progress(lw, val, text); | |
861 } | |
862 | |
1506
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
863 static void layout_list_sync_thumb(LayoutWindow *lw) |
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
864 { |
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
865 if (lw->vf) vf_thumb_set(lw->vf, lw->options.show_thumbnails); |
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
866 } |
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
867 |
9 | 868 static GtkWidget *layout_list_new(LayoutWindow *lw) |
869 { | |
1412
4e84054a1d7a
fixed saving of file_view_type
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1403
diff
changeset
|
870 lw->vf = vf_new(lw->options.file_view_type, NULL); |
574
b2b9c2ae04f8
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
Laurent Monin <geeqie@norz.org>
parents:
573
diff
changeset
|
871 vf_set_layout(lw->vf, lw); |
b2b9c2ae04f8
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
Laurent Monin <geeqie@norz.org>
parents:
573
diff
changeset
|
872 |
b2b9c2ae04f8
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
Laurent Monin <geeqie@norz.org>
parents:
573
diff
changeset
|
873 vf_set_status_func(lw->vf, layout_list_status_cb, lw); |
b2b9c2ae04f8
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
Laurent Monin <geeqie@norz.org>
parents:
573
diff
changeset
|
874 vf_set_thumb_status_func(lw->vf, layout_list_thumb_cb, lw); |
b2b9c2ae04f8
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
Laurent Monin <geeqie@norz.org>
parents:
573
diff
changeset
|
875 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
876 vf_marks_set(lw->vf, lw->options.show_marks); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
877 |
1506
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
878 layout_list_sync_thumb(lw); |
442 | 879 |
574
b2b9c2ae04f8
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
Laurent Monin <geeqie@norz.org>
parents:
573
diff
changeset
|
880 return lw->vf->widget; |
9 | 881 } |
882 | |
132
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
883 static void layout_list_sync_marks(LayoutWindow *lw) |
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
884 { |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
885 if (lw->vf) vf_marks_set(lw->vf, lw->options.show_marks); |
132
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
886 } |
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
887 |
9 | 888 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle) |
889 { | |
890 if (!lw) return; | |
891 } | |
892 | |
893 GList *layout_list(LayoutWindow *lw) | |
894 { | |
895 if (!layout_valid(&lw)) return NULL; | |
896 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
897 if (lw->vf) return vf_get_list(lw->vf); |
9 | 898 |
899 return NULL; | |
900 } | |
901 | |
736
31d858f3272d
Fix signed vs unsigned warnings.
Laurent Monin <geeqie@norz.org>
parents:
726
diff
changeset
|
902 guint layout_list_count(LayoutWindow *lw, gint64 *bytes) |
9 | 903 { |
904 if (!layout_valid(&lw)) return 0; | |
905 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
906 if (lw->vf) return vf_count(lw->vf, bytes); |
9 | 907 |
908 return 0; | |
909 } | |
910 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
911 FileData *layout_list_get_fd(LayoutWindow *lw, gint index) |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
912 { |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
913 if (!layout_valid(&lw)) return NULL; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
914 |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
915 if (lw->vf) return vf_index_get_data(lw->vf, index); |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
916 |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
917 return NULL; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
918 } |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
919 |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
920 gint layout_list_get_index(LayoutWindow *lw, FileData *fd) |
9 | 921 { |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
922 if (!layout_valid(&lw) || !fd) return -1; |
9 | 923 |
1503
edbe0e0d8046
improved next/prev operation on sidecar files
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1482
diff
changeset
|
924 if (lw->vf) return vf_index_by_fd(lw->vf, fd); |
9 | 925 |
926 return -1; | |
927 } | |
928 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
929 void layout_list_sync_fd(LayoutWindow *lw, FileData *fd) |
9 | 930 { |
931 if (!layout_valid(&lw)) return; | |
932 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
933 if (lw->vf) vf_select_by_fd(lw->vf, fd); |
9 | 934 } |
935 | |
936 static void layout_list_sync_sort(LayoutWindow *lw) | |
937 { | |
938 if (!layout_valid(&lw)) return; | |
939 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
940 if (lw->vf) vf_sort_set(lw->vf, lw->sort_method, lw->sort_ascend); |
9 | 941 } |
942 | |
943 GList *layout_selection_list(LayoutWindow *lw) | |
944 { | |
945 if (!layout_valid(&lw)) return NULL; | |
946 | |
947 if (layout_image_get_collection(lw, NULL)) | |
948 { | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
949 FileData *fd; |
9 | 950 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
951 fd = layout_image_get_fd(lw); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
132
diff
changeset
|
952 if (fd) return g_list_append(NULL, file_data_ref(fd)); |
9 | 953 return NULL; |
954 } | |
955 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
956 if (lw->vf) return vf_selection_get_list(lw->vf); |
9 | 957 |
958 return NULL; | |
959 } | |
960 | |
961 GList *layout_selection_list_by_index(LayoutWindow *lw) | |
962 { | |
963 if (!layout_valid(&lw)) return NULL; | |
964 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
965 if (lw->vf) return vf_selection_get_list_by_index(lw->vf); |
9 | 966 |
967 return NULL; | |
968 } | |
969 | |
736
31d858f3272d
Fix signed vs unsigned warnings.
Laurent Monin <geeqie@norz.org>
parents:
726
diff
changeset
|
970 guint layout_selection_count(LayoutWindow *lw, gint64 *bytes) |
9 | 971 { |
972 if (!layout_valid(&lw)) return 0; | |
973 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
974 if (lw->vf) return vf_selection_count(lw->vf, bytes); |
9 | 975 |
976 return 0; | |
977 } | |
978 | |
979 void layout_select_all(LayoutWindow *lw) | |
980 { | |
981 if (!layout_valid(&lw)) return; | |
982 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
983 if (lw->vf) vf_select_all(lw->vf); |
9 | 984 } |
985 | |
986 void layout_select_none(LayoutWindow *lw) | |
987 { | |
988 if (!layout_valid(&lw)) return; | |
989 | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
990 if (lw->vf) vf_select_none(lw->vf); |
9 | 991 } |
992 | |
601
c15474962d16
Add a way to invert the current selection.
Laurent Monin <geeqie@norz.org>
parents:
586
diff
changeset
|
993 void layout_select_invert(LayoutWindow *lw) |
c15474962d16
Add a way to invert the current selection.
Laurent Monin <geeqie@norz.org>
parents:
586
diff
changeset
|
994 { |
c15474962d16
Add a way to invert the current selection.
Laurent Monin <geeqie@norz.org>
parents:
586
diff
changeset
|
995 if (!layout_valid(&lw)) return; |
c15474962d16
Add a way to invert the current selection.
Laurent Monin <geeqie@norz.org>
parents:
586
diff
changeset
|
996 |
c15474962d16
Add a way to invert the current selection.
Laurent Monin <geeqie@norz.org>
parents:
586
diff
changeset
|
997 if (lw->vf) vf_select_invert(lw->vf); |
c15474962d16
Add a way to invert the current selection.
Laurent Monin <geeqie@norz.org>
parents:
586
diff
changeset
|
998 } |
c15474962d16
Add a way to invert the current selection.
Laurent Monin <geeqie@norz.org>
parents:
586
diff
changeset
|
999 |
162
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1000 void layout_mark_to_selection(LayoutWindow *lw, gint mark, MarkToSelectionMode mode) |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1001 { |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1002 if (!layout_valid(&lw)) return; |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1003 |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
1004 if (lw->vf) vf_mark_to_selection(lw->vf, mark, mode); |
162
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1005 } |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1006 |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1007 void layout_selection_to_mark(LayoutWindow *lw, gint mark, SelectionToMarkMode mode) |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1008 { |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1009 if (!layout_valid(&lw)) return; |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1010 |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
1011 if (lw->vf) vf_selection_to_mark(lw->vf, mark, mode); |
442 | 1012 |
162
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1013 layout_status_update_info(lw, NULL); /* osd in fullscreen mode */ |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1014 } |
6a5cc5a2bbe9
created menu "Select" with selection and marks operations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1015 |
1635
60012a2cc53b
added mark filter to menu - now it is possible to assign hotkeys
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1628
diff
changeset
|
1016 void layout_mark_filter_toggle(LayoutWindow *lw, gint mark) |
60012a2cc53b
added mark filter to menu - now it is possible to assign hotkeys
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1628
diff
changeset
|
1017 { |
60012a2cc53b
added mark filter to menu - now it is possible to assign hotkeys
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1628
diff
changeset
|
1018 if (!layout_valid(&lw)) return; |
60012a2cc53b
added mark filter to menu - now it is possible to assign hotkeys
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1628
diff
changeset
|
1019 |
60012a2cc53b
added mark filter to menu - now it is possible to assign hotkeys
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1628
diff
changeset
|
1020 if (lw->vf) vf_mark_filter_toggle(lw->vf, mark); |
60012a2cc53b
added mark filter to menu - now it is possible to assign hotkeys
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1628
diff
changeset
|
1021 } |
60012a2cc53b
added mark filter to menu - now it is possible to assign hotkeys
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1628
diff
changeset
|
1022 |
60012a2cc53b
added mark filter to menu - now it is possible to assign hotkeys
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1628
diff
changeset
|
1023 |
9 | 1024 /* |
1025 *----------------------------------------------------------------------------- | |
1026 * access | |
1027 *----------------------------------------------------------------------------- | |
1028 */ | |
1029 | |
1030 const gchar *layout_get_path(LayoutWindow *lw) | |
1031 { | |
1032 if (!layout_valid(&lw)) return NULL; | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1033 return lw->dir_fd ? lw->dir_fd->path : NULL; |
9 | 1034 } |
1035 | |
1036 static void layout_sync_path(LayoutWindow *lw) | |
1037 { | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1038 if (!lw->dir_fd) return; |
9 | 1039 |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1040 if (lw->path_entry) gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->dir_fd->path); |
1372 | 1041 |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1042 if (lw->vd) vd_set_fd(lw->vd, lw->dir_fd); |
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1043 if (lw->vf) vf_set_fd(lw->vf, lw->dir_fd); |
9 | 1044 } |
1045 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1046 gboolean layout_set_path(LayoutWindow *lw, const gchar *path) |
9 | 1047 { |
959
3ec42efa6958
fixed crash in geeqie --blank
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
902
diff
changeset
|
1048 FileData *fd; |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1049 gboolean ret; |
1372 | 1050 |
959
3ec42efa6958
fixed crash in geeqie --blank
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
902
diff
changeset
|
1051 if (!path) return FALSE; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1052 |
1936
ed6aa14b66c9
rename file_data_new_simple to file_data_new_group, filedata.c cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1927
diff
changeset
|
1053 fd = file_data_new_group(path); |
1372 | 1054 ret = layout_set_fd(lw, fd); |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1055 file_data_unref(fd); |
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1056 return ret; |
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1057 } |
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1058 |
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1059 |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1060 gboolean layout_set_fd(LayoutWindow *lw, FileData *fd) |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1061 { |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1062 gboolean have_file = FALSE; |
1558
0588c281322f
fixed metadata.confirm_on_dir_change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
1063 gboolean dir_changed = TRUE; |
9 | 1064 |
1065 if (!layout_valid(&lw)) return FALSE; | |
1066 | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1067 if (!fd || !isname(fd->path)) return FALSE; |
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1068 if (lw->dir_fd && fd == lw->dir_fd) |
9 | 1069 { |
1070 return TRUE; | |
1071 } | |
1072 | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1073 if (isdir(fd->path)) |
9 | 1074 { |
791
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1075 if (lw->dir_fd) |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1076 { |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1077 file_data_unregister_real_time_monitor(lw->dir_fd); |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1078 file_data_unref(lw->dir_fd); |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1079 } |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1080 lw->dir_fd = file_data_ref(fd); |
791
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1081 file_data_register_real_time_monitor(fd); |
9 | 1082 } |
1083 else | |
1084 { | |
1085 gchar *base; | |
1086 | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1087 base = remove_level_from_path(fd->path); |
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1088 if (lw->dir_fd && strcmp(lw->dir_fd->path, base) == 0) |
9 | 1089 { |
1090 g_free(base); | |
1558
0588c281322f
fixed metadata.confirm_on_dir_change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
1091 dir_changed = FALSE; |
9 | 1092 } |
1093 else if (isdir(base)) | |
1094 { | |
791
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1095 if (lw->dir_fd) |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1096 { |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1097 file_data_unregister_real_time_monitor(lw->dir_fd); |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1098 file_data_unref(lw->dir_fd); |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1099 } |
1927
d1a5b8633919
always check for sidecars by readdir
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1810
diff
changeset
|
1100 lw->dir_fd = file_data_new_dir(base); |
791
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
1101 file_data_register_real_time_monitor(lw->dir_fd); |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1102 g_free(base); |
9 | 1103 } |
1104 else | |
1105 { | |
1106 g_free(base); | |
1107 return FALSE; | |
1108 } | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1109 if (isfile(fd->path)) have_file = TRUE; |
9 | 1110 } |
1111 | |
2609
5beaa1da4f14
Fix #512: The "Back" button does not operate correctly
Colin Clark <colin.clark@cclark.uk>
parents:
2508
diff
changeset
|
1112 if (lw->path_entry) |
5beaa1da4f14
Fix #512: The "Back" button does not operate correctly
Colin Clark <colin.clark@cclark.uk>
parents:
2508
diff
changeset
|
1113 { |
5beaa1da4f14
Fix #512: The "Back" button does not operate correctly
Colin Clark <colin.clark@cclark.uk>
parents:
2508
diff
changeset
|
1114 history_chain_append_end(lw->dir_fd->path); |
5beaa1da4f14
Fix #512: The "Back" button does not operate correctly
Colin Clark <colin.clark@cclark.uk>
parents:
2508
diff
changeset
|
1115 tab_completion_append_to_history(lw->path_entry, lw->dir_fd->path); |
5beaa1da4f14
Fix #512: The "Back" button does not operate correctly
Colin Clark <colin.clark@cclark.uk>
parents:
2508
diff
changeset
|
1116 } |
9 | 1117 layout_sync_path(lw); |
1301
d27744bf03ec
Fix bug 2599857: file list sort order was wrong in many cases.
Laurent Monin <geeqie@norz.org>
parents:
1296
diff
changeset
|
1118 layout_list_sync_sort(lw); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1119 |
9 | 1120 if (have_file) |
1121 { | |
1122 gint row; | |
1123 | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1124 row = layout_list_get_index(lw, fd); |
9 | 1125 if (row >= 0) |
1126 { | |
1127 layout_image_set_index(lw, row); | |
1128 } | |
1129 else | |
1130 { | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1131 layout_image_set_fd(lw, fd); |
9 | 1132 } |
1133 } | |
320
bd97f1e60100
Move more options to ConfOptions.
Laurent Monin <geeqie@norz.org>
parents:
318
diff
changeset
|
1134 else if (!options->lazy_image_sync) |
9 | 1135 { |
1136 layout_image_set_index(lw, 0); | |
1137 } | |
1138 | |
1558
0588c281322f
fixed metadata.confirm_on_dir_change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
1139 if (options->metadata.confirm_on_dir_change && dir_changed) |
1586
b8515ea34e58
force the metadata dialog if it was triggered by the menu or the button
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1584
diff
changeset
|
1140 metadata_write_queue_confirm(FALSE, NULL, NULL); |
1214
1e36edfd2a43
write metadata after timeout, image change or dir change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1177
diff
changeset
|
1141 |
2770
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
1142 if (lw->vf && (options->read_metadata_in_idle || (lw->sort_method == SORT_EXIFTIME || lw->sort_method == SORT_EXIFTIMEDIGITIZED || lw->sort_method == SORT_RATING))) |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
1143 { |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
1144 vf_read_metadata_in_idle(lw->vf); |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
1145 } |
2e819f4a7a41
Read metadata in the idle loop
Colin Clark <colin.clark@cclark.uk>
parents:
2732
diff
changeset
|
1146 |
9 | 1147 return TRUE; |
1148 } | |
1149 | |
1150 static void layout_refresh_lists(LayoutWindow *lw) | |
1151 { | |
390
09d8a9b71520
Fix two errors made in revision 473.
Laurent Monin <geeqie@norz.org>
parents:
380
diff
changeset
|
1152 if (lw->vd) vd_refresh(lw->vd); |
9 | 1153 |
1506
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
1154 if (lw->vf) |
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
1155 { |
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
1156 vf_refresh(lw->vf); |
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
1157 vf_thumb_update(lw->vf); |
6e235e3ba076
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
Laurent Monin <geeqie@norz.org>
parents:
1503
diff
changeset
|
1158 } |
9 | 1159 } |
1160 | |
1161 void layout_refresh(LayoutWindow *lw) | |
1162 { | |
1163 if (!layout_valid(&lw)) return; | |
1164 | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
501
diff
changeset
|
1165 DEBUG_1("layout refresh"); |
9 | 1166 |
1167 layout_refresh_lists(lw); | |
1168 | |
1169 if (lw->image) layout_image_refresh(lw); | |
1170 } | |
1171 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1172 void layout_thumb_set(LayoutWindow *lw, gboolean enable) |
9 | 1173 { |
1174 if (!layout_valid(&lw)) return; | |
1175 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1176 if (lw->options.show_thumbnails == enable) return; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1177 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1178 lw->options.show_thumbnails = enable; |
9 | 1179 |
1180 layout_util_sync_thumb(lw); | |
1181 layout_list_sync_thumb(lw); | |
1182 } | |
1183 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1184 void layout_marks_set(LayoutWindow *lw, gboolean enable) |
132
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
1185 { |
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
1186 if (!layout_valid(&lw)) return; |
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
1187 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1188 if (lw->options.show_marks == enable) return; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1189 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1190 lw->options.show_marks = enable; |
132
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
1191 |
2611 | 1192 layout_util_sync_marks(lw); |
268
c439ad915ade
Tidy up, whitespaces and indentation fix.
Laurent Monin <geeqie@norz.org>
parents:
254
diff
changeset
|
1193 layout_list_sync_marks(lw); |
132
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
1194 } |
b025afc3c92a
First implementation of marks for all photos.
Petr Ostadal <postadal@suse.cz>
parents:
127
diff
changeset
|
1195 |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1196 gboolean layout_thumb_get(LayoutWindow *lw) |
9 | 1197 { |
1198 if (!layout_valid(&lw)) return FALSE; | |
1199 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1200 return lw->options.show_thumbnails; |
9 | 1201 } |
1202 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1203 gboolean layout_marks_get(LayoutWindow *lw) |
433
a20940d54915
Save Show Marks state to rc file and display current state in menu.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
1204 { |
a20940d54915
Save Show Marks state to rc file and display current state in menu.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
1205 if (!layout_valid(&lw)) return FALSE; |
a20940d54915
Save Show Marks state to rc file and display current state in menu.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
1206 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1207 return lw->options.show_marks; |
433
a20940d54915
Save Show Marks state to rc file and display current state in menu.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
1208 } |
a20940d54915
Save Show Marks state to rc file and display current state in menu.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
1209 |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1210 void layout_sort_set(LayoutWindow *lw, SortType type, gboolean ascend) |
9 | 1211 { |
1212 if (!layout_valid(&lw)) return; | |
1213 if (lw->sort_method == type && lw->sort_ascend == ascend) return; | |
1214 | |
1215 lw->sort_method = type; | |
1216 lw->sort_ascend = ascend; | |
1217 | |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1218 if (lw->info_sort) gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(lw->info_sort))), |
9 | 1219 sort_type_get_text(type)); |
1220 layout_list_sync_sort(lw); | |
1221 } | |
1222 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1223 gboolean layout_sort_get(LayoutWindow *lw, SortType *type, gboolean *ascend) |
9 | 1224 { |
1225 if (!layout_valid(&lw)) return FALSE; | |
1226 | |
1227 if (type) *type = lw->sort_method; | |
1228 if (ascend) *ascend = lw->sort_ascend; | |
1229 | |
1230 return TRUE; | |
1231 } | |
1232 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1233 gboolean layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h) |
9 | 1234 { |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1235 GdkWindow *window; |
9 | 1236 if (!layout_valid(&lw)) return FALSE; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1237 |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1238 window = gtk_widget_get_window(lw->window); |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1239 gdk_window_get_root_origin(window, x, y); |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1240 *w = gdk_window_get_width(window); |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1241 *h = gdk_window_get_height(window); |
9 | 1242 |
1243 return TRUE; | |
1244 } | |
1245 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1246 gboolean layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v) |
9 | 1247 { |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1248 GtkAllocation h_allocation; |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1249 GtkAllocation v_allocation; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1250 |
9 | 1251 if (!layout_valid(&lw)) return FALSE; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1252 |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1253 if (lw->h_pane) |
9 | 1254 { |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1255 GtkWidget *child = gtk_paned_get_child1(GTK_PANED(lw->h_pane)); |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1256 gtk_widget_get_allocation(child, &h_allocation); |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1257 } |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1258 |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1259 if (lw->v_pane) |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1260 { |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1261 GtkWidget *child = gtk_paned_get_child1(GTK_PANED(lw->v_pane)); |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1262 gtk_widget_get_allocation(child, &v_allocation); |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1263 } |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1264 |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1265 if (lw->h_pane && h_allocation.x >= 0) |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1266 { |
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1267 *h = h_allocation.width; |
9 | 1268 } |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1269 else if (h != &lw->options.main_window.hdivider_pos) |
9 | 1270 { |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1271 *h = lw->options.main_window.hdivider_pos; |
9 | 1272 } |
1273 | |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1274 if (lw->v_pane && v_allocation.x >= 0) |
9 | 1275 { |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1276 *v = v_allocation.height; |
9 | 1277 } |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1278 else if (v != &lw->options.main_window.vdivider_pos) |
9 | 1279 { |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1280 *v = lw->options.main_window.vdivider_pos; |
9 | 1281 } |
1282 | |
1283 return TRUE; | |
1284 } | |
1285 | |
556
585f0de4f906
Replace Layout icon_view field by more generic file_view_type.
Laurent Monin <geeqie@norz.org>
parents:
555
diff
changeset
|
1286 void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type) |
9 | 1287 { |
1288 if (!layout_valid(&lw)) return; | |
1289 | |
1412
4e84054a1d7a
fixed saving of file_view_type
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1403
diff
changeset
|
1290 if (lw->options.dir_view_type == dir_view_type && lw->options.file_view_type == file_view_type) return; |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1291 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1292 lw->options.dir_view_type = dir_view_type; |
1412
4e84054a1d7a
fixed saving of file_view_type
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1403
diff
changeset
|
1293 lw->options.file_view_type = file_view_type; |
9 | 1294 |
1295 layout_style_set(lw, -1, NULL); | |
1296 } | |
1297 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1298 gboolean layout_views_get(LayoutWindow *lw, DirViewType *dir_view_type, FileViewType *file_view_type) |
9 | 1299 { |
1300 if (!layout_valid(&lw)) return FALSE; | |
1301 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1302 *dir_view_type = lw->options.dir_view_type; |
1412
4e84054a1d7a
fixed saving of file_view_type
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1403
diff
changeset
|
1303 *file_view_type = lw->options.file_view_type; |
9 | 1304 |
1305 return TRUE; | |
1306 } | |
1307 | |
1308 /* | |
1309 *----------------------------------------------------------------------------- | |
1310 * location utils | |
1311 *----------------------------------------------------------------------------- | |
1312 */ | |
1313 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1314 static gboolean layout_location_single(LayoutLocation l) |
9 | 1315 { |
1316 return (l == LAYOUT_LEFT || | |
1317 l == LAYOUT_RIGHT || | |
1318 l == LAYOUT_TOP || | |
1319 l == LAYOUT_BOTTOM); | |
1320 } | |
1321 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1322 static gboolean layout_location_vertical(LayoutLocation l) |
9 | 1323 { |
1324 return (l & LAYOUT_TOP || | |
1325 l & LAYOUT_BOTTOM); | |
1326 } | |
1327 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1328 static gboolean layout_location_first(LayoutLocation l) |
9 | 1329 { |
1330 return (l & LAYOUT_TOP || | |
1331 l & LAYOUT_LEFT); | |
1332 } | |
1333 | |
1334 static LayoutLocation layout_grid_compass(LayoutWindow *lw) | |
1335 { | |
1336 if (layout_location_single(lw->dir_location)) return lw->dir_location; | |
1337 if (layout_location_single(lw->file_location)) return lw->file_location; | |
1338 return lw->image_location; | |
1339 } | |
1340 | |
1341 static void layout_location_compute(LayoutLocation l1, LayoutLocation l2, | |
1342 GtkWidget *s1, GtkWidget *s2, | |
1343 GtkWidget **d1, GtkWidget **d2) | |
1344 { | |
1345 LayoutLocation l; | |
1346 | |
1347 l = l1 & l2; /* get common compass direction */ | |
1348 l = l1 - l; /* remove it */ | |
1349 | |
1350 if (layout_location_first(l)) | |
1351 { | |
1352 *d1 = s1; | |
1353 *d2 = s2; | |
1354 } | |
1355 else | |
1356 { | |
1357 *d1 = s2; | |
1358 *d2 = s1; | |
1359 } | |
1360 } | |
1361 | |
1362 /* | |
1363 *----------------------------------------------------------------------------- | |
1364 * tools window (for floating/hidden) | |
1365 *----------------------------------------------------------------------------- | |
1366 */ | |
1367 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1368 gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos) |
9 | 1369 { |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1370 GdkWindow *window; |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1371 GtkAllocation allocation; |
9 | 1372 if (!layout_valid(&lw)) return FALSE; |
1373 | |
1810
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
1374 if (!lw->tools || !gtk_widget_get_visible(lw->tools)) |
9 | 1375 { |
1376 /* use the stored values (sort of breaks success return value) */ | |
1377 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1378 *divider_pos = lw->options.float_window.vdivider_pos; |
9 | 1379 |
1380 return FALSE; | |
1381 } | |
1382 | |
2436
8cd75e68e050
Save position of tools window
Colin Clark <cclark@mcb.net>
parents:
2433
diff
changeset
|
1383 window = gtk_widget_get_window(lw->tools); |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1384 gdk_window_get_root_origin(window, x, y); |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1385 *w = gdk_window_get_width(window); |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1386 *h = gdk_window_get_height(window); |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1387 gtk_widget_get_allocation(gtk_paned_get_child1(GTK_PANED(lw->tools_pane)), &allocation); |
9 | 1388 |
2806
bcd52f7517c7
Bug Fix: Float file list layout not preserved in GTK3
Colin Clark <colin.clark@cclark.uk>
parents:
2775
diff
changeset
|
1389 if (gtk_orientable_get_orientation(GTK_ORIENTABLE(lw->tools_pane)) == GTK_ORIENTATION_VERTICAL) |
9 | 1390 { |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1391 *divider_pos = allocation.height; |
9 | 1392 } |
1393 else | |
1394 { | |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1395 *divider_pos = allocation.width; |
9 | 1396 } |
1397 | |
1398 return TRUE; | |
1399 } | |
1400 | |
2508
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1401 gboolean layout_geometry_get_log_window(LayoutWindow *lw, gint *x, gint *y, |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1402 gint *w, gint *h) |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1403 { |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1404 GdkWindow *window; |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1405 |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1406 if (!layout_valid(&lw)) return FALSE; |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1407 |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1408 if (!lw->log_window) |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1409 { |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1410 return FALSE; |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1411 } |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1412 |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1413 window = gtk_widget_get_window(lw->log_window); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1414 gdk_window_get_root_origin(window, x, y); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1415 *w = gdk_window_get_width(window); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1416 *h = gdk_window_get_height(window); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1417 |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1418 return TRUE; |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1419 } |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
1420 |
9 | 1421 static void layout_tools_geometry_sync(LayoutWindow *lw) |
1422 { | |
2451
4dcee0e5155a
Fix #326: Save position of float file list
Colin Clark <cclark@mcb.net>
parents:
2450
diff
changeset
|
1423 layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.y, |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1424 &lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos); |
9 | 1425 } |
1426 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1427 static void layout_tools_hide(LayoutWindow *lw, gboolean hide) |
9 | 1428 { |
1429 if (!lw->tools) return; | |
1430 | |
1431 if (hide) | |
1432 { | |
1810
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
1433 if (gtk_widget_get_visible(lw->tools)) |
9 | 1434 { |
1435 layout_tools_geometry_sync(lw); | |
1436 gtk_widget_hide(lw->tools); | |
1437 } | |
1438 } | |
1439 else | |
1440 { | |
1810
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
1441 if (!gtk_widget_get_visible(lw->tools)) |
9 | 1442 { |
1443 gtk_widget_show(lw->tools); | |
574
b2b9c2ae04f8
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
Laurent Monin <geeqie@norz.org>
parents:
573
diff
changeset
|
1444 if (lw->vf) vf_refresh(lw->vf); |
9 | 1445 } |
1446 } | |
1447 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1448 lw->options.tools_hidden = hide; |
9 | 1449 } |
1450 | |
1433
12600de4b59a
Use gboolean where applicable, minor cleanup and indentations fixes.
Laurent Monin <geeqie@norz.org>
parents:
1431
diff
changeset
|
1451 static gboolean layout_tools_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) |
9 | 1452 { |
1453 LayoutWindow *lw = data; | |
1454 | |
1455 layout_tools_float_toggle(lw); | |
1456 | |
1457 return TRUE; | |
1458 } | |
1459 | |
1460 static void layout_tools_setup(LayoutWindow *lw, GtkWidget *tools, GtkWidget *files) | |
1461 { | |
1462 GtkWidget *vbox; | |
1463 GtkWidget *w1, *w2; | |
1433
12600de4b59a
Use gboolean where applicable, minor cleanup and indentations fixes.
Laurent Monin <geeqie@norz.org>
parents:
1431
diff
changeset
|
1464 gboolean vertical; |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1465 gboolean new_window = FALSE; |
9 | 1466 |
1467 vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) || | |
1468 (!layout_location_single(lw->image_location) && layout_location_vertical(layout_grid_compass(lw))); | |
1469 /* for now, tools/dir are always first in order */ | |
1470 w1 = tools; | |
1471 w2 = files; | |
1472 | |
1473 if (!lw->tools) | |
1474 { | |
1475 GdkGeometry geometry; | |
1476 GdkWindowHints hints; | |
1477 | |
289
d4d7e7aa0d88
Simplify and unify gtk_window creation with the help of
Laurent Monin <geeqie@norz.org>
parents:
288
diff
changeset
|
1478 lw->tools = window_new(GTK_WINDOW_TOPLEVEL, "tools", PIXBUF_INLINE_ICON_TOOLS, NULL, _("Tools")); |
9 | 1479 g_signal_connect(G_OBJECT(lw->tools), "delete_event", |
1480 G_CALLBACK(layout_tools_delete_cb), lw); | |
1481 layout_keyboard_init(lw, lw->tools); | |
1482 | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1483 if (options->save_window_positions) |
9 | 1484 { |
41
cac3a3efd1fd
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
23
diff
changeset
|
1485 hints = GDK_HINT_USER_POS; |
9 | 1486 } |
1487 else | |
1488 { | |
1489 hints = 0; | |
1490 } | |
1491 | |
1029
b1a912dee214
Use a constant for minimal window size. Set it to 32 for all dialogs.
Laurent Monin <geeqie@norz.org>
parents:
1006
diff
changeset
|
1492 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE; |
b1a912dee214
Use a constant for minimal window size. Set it to 32 for all dialogs.
Laurent Monin <geeqie@norz.org>
parents:
1006
diff
changeset
|
1493 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE; |
9 | 1494 geometry.base_width = TOOLWINDOW_DEF_WIDTH; |
1495 geometry.base_height = TOOLWINDOW_DEF_HEIGHT; | |
1496 gtk_window_set_geometry_hints(GTK_WINDOW(lw->tools), NULL, &geometry, | |
1497 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hints); | |
1498 | |
1499 | |
268
c439ad915ade
Tidy up, whitespaces and indentation fix.
Laurent Monin <geeqie@norz.org>
parents:
254
diff
changeset
|
1500 gtk_window_set_resizable(GTK_WINDOW(lw->tools), TRUE); |
c439ad915ade
Tidy up, whitespaces and indentation fix.
Laurent Monin <geeqie@norz.org>
parents:
254
diff
changeset
|
1501 gtk_container_set_border_width(GTK_CONTAINER(lw->tools), 0); |
442 | 1502 |
9 | 1503 new_window = TRUE; |
1504 } | |
1505 else | |
1506 { | |
1507 layout_tools_geometry_sync(lw); | |
1508 /* dump the contents */ | |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1509 gtk_widget_destroy(gtk_bin_get_child(GTK_BIN(lw->tools))); |
9 | 1510 } |
1511 | |
1512 layout_actions_add_window(lw, lw->tools); | |
1513 | |
1514 vbox = gtk_vbox_new(FALSE, 0); | |
1515 gtk_container_add(GTK_CONTAINER(lw->tools), vbox); | |
1516 gtk_widget_show(vbox); | |
1517 | |
1518 layout_status_setup(lw, vbox, TRUE); | |
1519 | |
1520 if (vertical) | |
1521 { | |
1522 lw->tools_pane = gtk_vpaned_new(); | |
1523 } | |
1524 else | |
1525 { | |
1526 lw->tools_pane = gtk_hpaned_new(); | |
1527 } | |
1528 gtk_box_pack_start(GTK_BOX(vbox), lw->tools_pane, TRUE, TRUE, 0); | |
1529 gtk_widget_show(lw->tools_pane); | |
1530 | |
1531 gtk_paned_pack1(GTK_PANED(lw->tools_pane), w1, FALSE, TRUE); | |
1532 gtk_paned_pack2(GTK_PANED(lw->tools_pane), w2, TRUE, TRUE); | |
1533 | |
1534 gtk_widget_show(tools); | |
1535 gtk_widget_show(files); | |
1536 | |
1537 if (new_window) | |
1538 { | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1539 if (options->save_window_positions) |
9 | 1540 { |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1541 gtk_window_set_default_size(GTK_WINDOW(lw->tools), lw->options.float_window.w, lw->options.float_window.h); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1542 gtk_window_move(GTK_WINDOW(lw->tools), lw->options.float_window.x, lw->options.float_window.y); |
268
c439ad915ade
Tidy up, whitespaces and indentation fix.
Laurent Monin <geeqie@norz.org>
parents:
254
diff
changeset
|
1543 } |
9 | 1544 else |
1545 { | |
1546 if (vertical) | |
1547 { | |
1548 gtk_window_set_default_size(GTK_WINDOW(lw->tools), | |
1549 TOOLWINDOW_DEF_WIDTH, TOOLWINDOW_DEF_HEIGHT); | |
1550 } | |
1551 else | |
1552 { | |
1553 gtk_window_set_default_size(GTK_WINDOW(lw->tools), | |
1554 TOOLWINDOW_DEF_HEIGHT, TOOLWINDOW_DEF_WIDTH); | |
1555 } | |
1556 } | |
1557 } | |
1558 | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1559 if (!options->save_window_positions) |
9 | 1560 { |
1561 if (vertical) | |
1562 { | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1563 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS; |
9 | 1564 } |
1565 else | |
1566 { | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1567 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_HPOS; |
9 | 1568 } |
1569 } | |
1570 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1571 gtk_paned_set_position(GTK_PANED(lw->tools_pane), lw->options.float_window.vdivider_pos); |
9 | 1572 } |
1573 | |
1574 /* | |
1575 *----------------------------------------------------------------------------- | |
1576 * glue (layout arrangement) | |
1577 *----------------------------------------------------------------------------- | |
1578 */ | |
1579 | |
1580 static void layout_grid_compute(LayoutWindow *lw, | |
1581 GtkWidget *image, GtkWidget *tools, GtkWidget *files, | |
1582 GtkWidget **w1, GtkWidget **w2, GtkWidget **w3) | |
1583 { | |
1584 /* heh, this was fun */ | |
1585 | |
1586 if (layout_location_single(lw->dir_location)) | |
1587 { | |
1588 if (layout_location_first(lw->dir_location)) | |
1589 { | |
1590 *w1 = tools; | |
1591 layout_location_compute(lw->file_location, lw->image_location, files, image, w2, w3); | |
1592 } | |
1593 else | |
1594 { | |
1595 *w3 = tools; | |
1596 layout_location_compute(lw->file_location, lw->image_location, files, image, w1, w2); | |
1597 } | |
1598 } | |
1599 else if (layout_location_single(lw->file_location)) | |
1600 { | |
1601 if (layout_location_first(lw->file_location)) | |
1602 { | |
1603 *w1 = files; | |
1604 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w2, w3); | |
1605 } | |
1606 else | |
1607 { | |
1608 *w3 = files; | |
1609 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w1, w2); | |
1610 } | |
1611 } | |
1612 else | |
1613 { | |
1614 /* image */ | |
1615 if (layout_location_first(lw->image_location)) | |
1616 { | |
1617 *w1 = image; | |
1618 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w2, w3); | |
1619 } | |
1620 else | |
1621 { | |
1622 *w3 = image; | |
1623 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w1, w2); | |
1624 } | |
1625 } | |
1626 } | |
1627 | |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1628 void layout_split_change(LayoutWindow *lw, ImageSplitMode mode) |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1629 { |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1630 GtkWidget *image; |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1631 gint i; |
268
c439ad915ade
Tidy up, whitespaces and indentation fix.
Laurent Monin <geeqie@norz.org>
parents:
254
diff
changeset
|
1632 |
c439ad915ade
Tidy up, whitespaces and indentation fix.
Laurent Monin <geeqie@norz.org>
parents:
254
diff
changeset
|
1633 for (i = 0; i < MAX_SPLIT_IMAGES; i++) |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1634 { |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1635 if (lw->split_images[i]) |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1636 { |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1637 gtk_widget_hide(lw->split_images[i]->widget); |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1638 if (gtk_widget_get_parent(lw->split_images[i]->widget) != lw->utility_paned) |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1639 gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->split_images[i]->widget)), lw->split_images[i]->widget); |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1640 } |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1641 } |
1383
bdd15a0038dd
use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1375
diff
changeset
|
1642 gtk_container_remove(GTK_CONTAINER(lw->utility_paned), lw->split_image_widget); |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1643 |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1644 image = layout_image_setup_split(lw, mode); |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1645 |
1383
bdd15a0038dd
use standard GtkHPaned for sidebar width
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1375
diff
changeset
|
1646 gtk_paned_pack1(GTK_PANED(lw->utility_paned), image, TRUE, FALSE); |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1647 gtk_widget_show(image); |
1669
e8de419b42d4
reordered View menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1635
diff
changeset
|
1648 layout_util_sync(lw); |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1649 } |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1650 |
9 | 1651 static void layout_grid_setup(LayoutWindow *lw) |
1652 { | |
1653 gint priority_location; | |
1654 GtkWidget *h; | |
1655 GtkWidget *v; | |
1656 GtkWidget *w1, *w2, *w3; | |
1657 | |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1658 GtkWidget *image_sb; /* image together with sidebars in utility box */ |
9 | 1659 GtkWidget *tools; |
1660 GtkWidget *files; | |
1661 | |
1662 layout_actions_setup(lw); | |
1663 | |
1664 lw->group_box = gtk_vbox_new(FALSE, 0); | |
1665 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0); | |
1666 gtk_widget_show(lw->group_box); | |
1667 | |
1668 priority_location = layout_grid_compass(lw); | |
1669 | |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1670 if (lw->utility_box) |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1671 { |
1480
82915f832ec5
split-mode cleanup and improvements
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1473
diff
changeset
|
1672 layout_split_change(lw, lw->split_mode); /* this re-creates image frame for the new configuration */ |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1673 image_sb = lw->utility_box; |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1674 } |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1675 else |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1676 { |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1677 GtkWidget *image; /* image or split images together */ |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1678 image = layout_image_setup_split(lw, lw->split_mode); |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1679 image_sb = layout_bars_prepare(lw, image); |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1680 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1681 |
9 | 1682 tools = layout_tools_new(lw); |
1683 files = layout_list_new(lw); | |
1684 | |
1685 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1686 if (lw->options.tools_float || lw->options.tools_hidden) |
9 | 1687 { |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1688 gtk_box_pack_start(GTK_BOX(lw->group_box), image_sb, TRUE, TRUE, 0); |
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1689 gtk_widget_show(image_sb); |
9 | 1690 |
1691 layout_tools_setup(lw, tools, files); | |
1692 | |
1482
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1480
diff
changeset
|
1693 image_grab_focus(lw->image); |
9 | 1694 |
1695 return; | |
1696 } | |
1697 else if (lw->tools) | |
1698 { | |
1699 layout_tools_geometry_sync(lw); | |
1700 gtk_widget_destroy(lw->tools); | |
1701 lw->tools = NULL; | |
1702 lw->tools_pane = NULL; | |
1703 } | |
1704 | |
1705 layout_status_setup(lw, lw->group_box, FALSE); | |
1706 | |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1707 layout_grid_compute(lw, image_sb, tools, files, &w1, &w2, &w3); |
9 | 1708 |
1709 v = lw->v_pane = gtk_vpaned_new(); | |
1710 | |
1711 h = lw->h_pane = gtk_hpaned_new(); | |
1712 | |
1713 if (!layout_location_vertical(priority_location)) | |
1714 { | |
1715 GtkWidget *tmp; | |
1716 | |
1717 tmp = v; | |
1718 v = h; | |
1719 h = tmp; | |
1720 } | |
1721 | |
1722 gtk_box_pack_start(GTK_BOX(lw->group_box), v, TRUE, TRUE, 0); | |
1723 | |
1724 if (!layout_location_first(priority_location)) | |
1725 { | |
1726 gtk_paned_pack1(GTK_PANED(v), h, FALSE, TRUE); | |
1727 gtk_paned_pack2(GTK_PANED(v), w3, TRUE, TRUE); | |
1728 | |
1729 gtk_paned_pack1(GTK_PANED(h), w1, FALSE, TRUE); | |
1730 gtk_paned_pack2(GTK_PANED(h), w2, TRUE, TRUE); | |
1731 } | |
1732 else | |
1733 { | |
1734 gtk_paned_pack1(GTK_PANED(v), w1, FALSE, TRUE); | |
1735 gtk_paned_pack2(GTK_PANED(v), h, TRUE, TRUE); | |
1736 | |
1737 gtk_paned_pack1(GTK_PANED(h), w2, FALSE, TRUE); | |
1738 gtk_paned_pack2(GTK_PANED(h), w3, TRUE, TRUE); | |
1739 } | |
1740 | |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1741 gtk_widget_show(image_sb); |
9 | 1742 gtk_widget_show(tools); |
1743 gtk_widget_show(files); | |
1744 | |
1745 gtk_widget_show(v); | |
1746 gtk_widget_show(h); | |
1747 | |
1748 /* fix to have image pane visible when it is left and priority widget */ | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1749 if (lw->options.main_window.hdivider_pos == -1 && |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1750 w1 == image_sb && |
9 | 1751 !layout_location_vertical(priority_location) && |
1752 layout_location_first(priority_location)) | |
1753 { | |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1754 gtk_widget_set_size_request(image_sb, 200, -1); |
9 | 1755 } |
1756 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1757 gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->options.main_window.hdivider_pos); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1758 gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->options.main_window.vdivider_pos); |
9 | 1759 |
1482
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1480
diff
changeset
|
1760 image_grab_focus(lw->image); |
9 | 1761 } |
1762 | |
1763 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order) | |
1764 { | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1765 FileData *dir_fd; |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
1766 gint i; |
9 | 1767 |
1768 if (!layout_valid(&lw)) return; | |
1769 | |
1770 if (style != -1) | |
1771 { | |
1772 LayoutLocation d, f, i; | |
1773 | |
1774 layout_config_parse(style, order, &d, &f, &i); | |
1775 | |
1776 if (lw->dir_location == d && | |
1777 lw->file_location == f && | |
1778 lw->image_location == i) return; | |
1779 | |
1780 lw->dir_location = d; | |
1781 lw->file_location = f; | |
1782 lw->image_location = i; | |
1783 } | |
1784 | |
1785 /* remember state */ | |
1786 | |
2184 | 1787 /* layout_image_slideshow_stop(lw); slideshow should survive */ |
9 | 1788 layout_image_full_screen_stop(lw); |
1789 | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1790 dir_fd = lw->dir_fd; |
960
066f98cba001
fixed crash with float file list and geeqie --blank
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
959
diff
changeset
|
1791 if (dir_fd) file_data_unregister_real_time_monitor(dir_fd); |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1792 lw->dir_fd = NULL; |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1793 |
1403
b51f9365177b
fixed crash with certain layout configurations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1383
diff
changeset
|
1794 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos); |
b51f9365177b
fixed crash with certain layout configurations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1383
diff
changeset
|
1795 |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
1796 /* preserve utility_box (image + sidebars), menu_bar and toolbars to be reused later in layout_grid_setup */ |
1322
4e4ef96940b9
reuse original utility_box (image + sidebars) on layout change (switch
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1320
diff
changeset
|
1797 /* lw->image is preserved together with lw->utility_box */ |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1798 if (lw->utility_box) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->utility_box)), lw->utility_box); |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1799 if (lw->menu_bar) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->menu_bar)), lw->menu_bar); |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
1800 for (i = 0; i < TOOLBAR_COUNT; i++) |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1801 if (lw->toolbar[i]) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->toolbar[i])), lw->toolbar[i]); |
9 | 1802 |
1803 /* clear it all */ | |
1804 | |
1805 lw->h_pane = NULL; | |
1806 lw->v_pane = NULL; | |
1807 | |
1808 lw->path_entry = NULL; | |
1809 lw->dir_view = NULL; | |
380
41079d11eba7
Introduce a new struct ViewDir to handle directory views common
Laurent Monin <geeqie@norz.org>
parents:
368
diff
changeset
|
1810 lw->vd = NULL; |
9 | 1811 |
1812 lw->file_view = NULL; | |
573
a10da32cacf2
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
Laurent Monin <geeqie@norz.org>
parents:
559
diff
changeset
|
1813 lw->vf = NULL; |
9 | 1814 |
1815 lw->info_box = NULL; | |
1816 lw->info_progress_bar = NULL; | |
1817 lw->info_sort = NULL; | |
1818 lw->info_status = NULL; | |
1819 lw->info_details = NULL; | |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1820 lw->info_pixel = NULL; |
9 | 1821 lw->info_zoom = NULL; |
1822 | |
1470
02f03330d589
do not re-create ui_manager at layout change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1466
diff
changeset
|
1823 /* |
9 | 1824 if (lw->ui_manager) g_object_unref(lw->ui_manager); |
1825 lw->ui_manager = NULL; | |
1826 lw->action_group = NULL; | |
1463
7031da014d97
added function to reload external editors at any time
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1461
diff
changeset
|
1827 lw->action_group_editors = NULL; |
1470
02f03330d589
do not re-create ui_manager at layout change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1466
diff
changeset
|
1828 */ |
9 | 1829 |
1830 gtk_container_remove(GTK_CONTAINER(lw->main_box), lw->group_box); | |
1831 lw->group_box = NULL; | |
1832 | |
1833 /* re-fill */ | |
1834 | |
1835 layout_grid_setup(lw); | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1836 layout_tools_hide(lw, lw->options.tools_hidden); |
9 | 1837 |
1838 layout_util_sync(lw); | |
1839 layout_status_update_all(lw); | |
1840 | |
1470
02f03330d589
do not re-create ui_manager at layout change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1466
diff
changeset
|
1841 |
02f03330d589
do not re-create ui_manager at layout change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1466
diff
changeset
|
1842 // 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); |
02f03330d589
do not re-create ui_manager at layout change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1466
diff
changeset
|
1843 |
9 | 1844 /* sync */ |
1845 | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1846 if (image_get_fd(lw->image)) |
9 | 1847 { |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1848 layout_set_fd(lw, image_get_fd(lw->image)); |
9 | 1849 } |
1850 else | |
1851 { | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1852 layout_set_fd(lw, dir_fd); |
9 | 1853 } |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1854 image_top_window_set_sync(lw->image, (lw->options.tools_float || lw->options.tools_hidden)); |
9 | 1855 |
1856 /* clean up */ | |
1857 | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
1858 file_data_unref(dir_fd); |
9 | 1859 } |
1860 | |
1861 void layout_colors_update(void) | |
1862 { | |
1863 GList *work; | |
1864 | |
1865 work = layout_window_list; | |
1866 while (work) | |
1867 { | |
1626
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1586
diff
changeset
|
1868 gint i; |
9 | 1869 LayoutWindow *lw = work->data; |
1870 work = work->next; | |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1871 |
208
d74cfaa3d146
set user-defined color as image background - patch by Laurent MONIN
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
196
diff
changeset
|
1872 if (!lw->image) continue; |
1626
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1586
diff
changeset
|
1873 |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1586
diff
changeset
|
1874 for (i = 0; i < MAX_SPLIT_IMAGES; i++) |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1586
diff
changeset
|
1875 { |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1586
diff
changeset
|
1876 if (!lw->split_images[i]) continue; |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1586
diff
changeset
|
1877 image_background_set_color_from_options(lw->split_images[i], !!lw->full_screen); |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1586
diff
changeset
|
1878 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1879 |
1626
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1586
diff
changeset
|
1880 image_background_set_color_from_options(lw->image, !!lw->full_screen); |
9 | 1881 } |
1882 } | |
1883 | |
1884 void layout_tools_float_toggle(LayoutWindow *lw) | |
1885 { | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1886 gboolean popped; |
9 | 1887 |
1888 if (!lw) return; | |
1889 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1890 if (!lw->options.tools_hidden) |
9 | 1891 { |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1892 popped = !lw->options.tools_float; |
9 | 1893 } |
1894 else | |
1895 { | |
1896 popped = TRUE; | |
1897 } | |
1898 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1899 if (lw->options.tools_float == popped) |
9 | 1900 { |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1901 if (popped && lw->options.tools_hidden) |
9 | 1902 { |
1903 layout_tools_float_set(lw, popped, FALSE); | |
1904 } | |
1905 } | |
1906 else | |
1907 { | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1908 if (lw->options.tools_float) |
9 | 1909 { |
1910 layout_tools_float_set(lw, FALSE, FALSE); | |
1911 } | |
1912 else | |
1913 { | |
1914 layout_tools_float_set(lw, TRUE, FALSE); | |
1915 } | |
1916 } | |
1917 } | |
1918 | |
1919 void layout_tools_hide_toggle(LayoutWindow *lw) | |
1920 { | |
1921 if (!lw) return; | |
1922 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1923 layout_tools_float_set(lw, lw->options.tools_float, !lw->options.tools_hidden); |
9 | 1924 } |
1925 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1926 void layout_tools_float_set(LayoutWindow *lw, gboolean popped, gboolean hidden) |
9 | 1927 { |
1928 if (!layout_valid(&lw)) return; | |
1929 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1930 if (lw->options.tools_float == popped && lw->options.tools_hidden == hidden) return; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1931 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1932 if (lw->options.tools_float == popped && lw->options.tools_float && lw->tools) |
9 | 1933 { |
1934 layout_tools_hide(lw, hidden); | |
1935 return; | |
1936 } | |
1937 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1938 lw->options.tools_float = popped; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1939 lw->options.tools_hidden = hidden; |
9 | 1940 |
1941 layout_style_set(lw, -1, NULL); | |
1942 } | |
1943 | |
1416
3ba63f325b08
Use gboolean pseudo type where applicable.
Laurent Monin <geeqie@norz.org>
parents:
1415
diff
changeset
|
1944 gboolean layout_tools_float_get(LayoutWindow *lw, gboolean *popped, gboolean *hidden) |
9 | 1945 { |
1946 if (!layout_valid(&lw)) return FALSE; | |
1947 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1948 *popped = lw->options.tools_float; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1949 *hidden = lw->options.tools_hidden; |
9 | 1950 |
1951 return TRUE; | |
1952 } | |
1953 | |
1954 void layout_toolbar_toggle(LayoutWindow *lw) | |
1955 { | |
1956 if (!layout_valid(&lw)) return; | |
2441
a2d4729a3b2d
Fix GCC and Clang compile warnings.
Omari Stephens <xsdg@google.com>
parents:
2412
diff
changeset
|
1957 if (!lw->toolbar[TOOLBAR_MAIN]) return; |
9 | 1958 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1959 lw->options.toolbar_hidden = !lw->options.toolbar_hidden; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1960 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
1961 if (lw->options.toolbar_hidden) |
9 | 1962 { |
1810
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
1963 if (gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]); |
9 | 1964 } |
1965 else | |
1966 { | |
1810
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
1967 if (!gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]); |
9 | 1968 } |
1969 } | |
1970 | |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
1971 void layout_info_pixel_set(LayoutWindow *lw, gboolean show) |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1972 { |
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1973 GtkWidget *frame; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1974 |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1975 if (!layout_valid(&lw)) return; |
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1976 if (!lw->info_pixel) return; |
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1977 |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
1978 lw->options.show_info_pixel = show; |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1979 |
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1980 frame = gtk_widget_get_parent(lw->info_pixel); |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
1981 if (!lw->options.show_info_pixel) |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1982 { |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
1983 gtk_widget_hide(frame); |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1984 } |
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1985 else |
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1986 { |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
1987 gtk_widget_show(frame); |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1988 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1989 |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
1990 g_signal_emit_by_name (lw->image->pr, "update-pixel"); |
1375
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1991 } |
08db75ca4713
Display pixel coordinates and rgb - patch by Ruben Stein
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1372
diff
changeset
|
1992 |
9 | 1993 /* |
1994 *----------------------------------------------------------------------------- | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1995 * configuration |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1996 *----------------------------------------------------------------------------- |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1997 */ |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1998 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
1999 #define CONFIG_WINDOW_DEF_WIDTH 600 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2000 #define CONFIG_WINDOW_DEF_HEIGHT 400 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2001 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2002 typedef struct _LayoutConfig LayoutConfig; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2003 struct _LayoutConfig |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2004 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2005 LayoutWindow *lw; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2006 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2007 GtkWidget *configwindow; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2008 GtkWidget *home_path_entry; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2009 GtkWidget *layout_widget; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2010 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2011 LayoutOptions options; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2012 }; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2013 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2014 static gint layout_config_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2015 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2016 static void layout_config_close_cb(GtkWidget *widget, gpointer data) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2017 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2018 LayoutConfig *lc = data; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2019 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2020 gtk_widget_destroy(lc->configwindow); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2021 free_layout_options_content(&lc->options); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2022 g_free(lc); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2023 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2024 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2025 static gint layout_config_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2026 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2027 layout_config_close_cb(w, data); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2028 return TRUE; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2029 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2030 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2031 static void layout_config_apply_cb(GtkWidget *widget, gpointer data) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2032 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2033 LayoutConfig *lc = data; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2034 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2035 g_free(lc->options.order); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2036 lc->options.order = layout_config_get(lc->layout_widget, &lc->options.style); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2037 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2038 config_entry_to_option(lc->home_path_entry, &lc->options.home_path, remove_trailing_slash); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2039 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2040 layout_apply_options(lc->lw, &lc->options); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2041 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2042 |
2412 | 2043 static void layout_config_help_cb(GtkWidget *widget, gpointer data) |
2044 { | |
2045 help_window_show("GuideOptionsLayout.html"); | |
2046 } | |
2047 | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2048 static void layout_config_ok_cb(GtkWidget *widget, gpointer data) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2049 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2050 LayoutConfig *lc = data; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2051 layout_config_apply_cb(widget, lc); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2052 layout_config_close_cb(widget, lc); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2053 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2054 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2055 static void home_path_set_current_cb(GtkWidget *widget, gpointer data) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2056 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2057 LayoutConfig *lc = data; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2058 gtk_entry_set_text(GTK_ENTRY(lc->home_path_entry), layout_get_path(lc->lw)); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2059 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2060 |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2061 static void startup_path_set_current_cb(GtkWidget *widget, gpointer data) |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2062 { |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2063 LayoutConfig *lc = data; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2064 lc->options.startup_path = STARTUP_PATH_CURRENT; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2065 } |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2066 |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2067 static void startup_path_set_last_cb(GtkWidget *widget, gpointer data) |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2068 { |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2069 LayoutConfig *lc = data; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2070 lc->options.startup_path = STARTUP_PATH_LAST; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2071 } |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2072 |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2073 static void startup_path_set_home_cb(GtkWidget *widget, gpointer data) |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2074 { |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2075 LayoutConfig *lc = data; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2076 lc->options.startup_path = STARTUP_PATH_HOME; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2077 } |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2078 |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2079 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2080 /* |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2081 static void layout_config_save_cb(GtkWidget *widget, gpointer data) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2082 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2083 layout_config_apply(); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2084 save_options(options); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2085 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2086 */ |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2087 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2088 void layout_show_config_window(LayoutWindow *lw) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2089 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2090 LayoutConfig *lc; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2091 GtkWidget *win_vbox; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2092 GtkWidget *hbox; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2093 GtkWidget *vbox; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2094 GtkWidget *button; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2095 GtkWidget *ct_button; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2096 GtkWidget *group; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2097 GtkWidget *frame; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2098 GtkWidget *tabcomp; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2099 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2100 lc = g_new0(LayoutConfig, 1); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2101 lc->lw = lw; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2102 layout_sync_options_with_current_state(lw); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2103 copy_layout_options(&lc->options, &lw->options); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2104 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2105 lc->configwindow = window_new(GTK_WINDOW_TOPLEVEL, "Layout", PIXBUF_INLINE_ICON_CONFIG, NULL, _("Window options and layout")); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2106 gtk_window_set_type_hint(GTK_WINDOW(lc->configwindow), GDK_WINDOW_TYPE_HINT_DIALOG); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2107 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2108 g_signal_connect(G_OBJECT(lc->configwindow), "delete_event", |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2109 G_CALLBACK(layout_config_delete_cb), lc); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2110 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2111 gtk_window_set_default_size(GTK_WINDOW(lc->configwindow), CONFIG_WINDOW_DEF_WIDTH, CONFIG_WINDOW_DEF_HEIGHT); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2112 gtk_window_set_resizable(GTK_WINDOW(lc->configwindow), TRUE); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2113 gtk_container_set_border_width(GTK_CONTAINER(lc->configwindow), PREF_PAD_BORDER); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2114 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2115 win_vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2116 gtk_container_add(GTK_CONTAINER(lc->configwindow), win_vbox); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2117 gtk_widget_show(win_vbox); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2118 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2119 hbox = gtk_hbutton_box_new(); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2120 gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2121 gtk_box_set_spacing(GTK_BOX(hbox), PREF_PAD_BUTTON_GAP); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2122 gtk_box_pack_end(GTK_BOX(win_vbox), hbox, FALSE, FALSE, 0); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2123 gtk_widget_show(hbox); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2124 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2125 button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE, |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2126 G_CALLBACK(layout_config_ok_cb), lc); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2127 gtk_container_add(GTK_CONTAINER(hbox), button); |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2128 gtk_widget_set_can_default(button, TRUE); |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2129 gtk_widget_grab_default(button); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2130 gtk_widget_show(button); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2131 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2132 ct_button = button; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2133 /* |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2134 button = pref_button_new(NULL, GTK_STOCK_SAVE, NULL, FALSE, |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2135 G_CALLBACK(layout_config_save_cb), NULL); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2136 gtk_container_add(GTK_CONTAINER(hbox), button); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2137 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2138 gtk_widget_show(button); |
2184 | 2139 */ |
2412 | 2140 button = pref_button_new(NULL, GTK_STOCK_HELP, NULL, FALSE, |
2141 G_CALLBACK(layout_config_help_cb), lc); | |
2142 gtk_container_add(GTK_CONTAINER(hbox), button); | |
2143 gtk_widget_set_can_default(button, TRUE); | |
2144 gtk_widget_show(button); | |
2145 | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2146 button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE, |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2147 G_CALLBACK(layout_config_apply_cb), lc); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2148 gtk_container_add(GTK_CONTAINER(hbox), button); |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2149 gtk_widget_set_can_default(button, TRUE); |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2150 gtk_widget_show(button); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2151 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2152 button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE, |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2153 G_CALLBACK(layout_config_close_cb), lc); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2154 gtk_container_add(GTK_CONTAINER(hbox), button); |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2155 gtk_widget_set_can_default(button, TRUE); |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2156 gtk_widget_show(button); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2157 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2158 if (!generic_dialog_get_alternative_button_order(lc->configwindow)) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2159 { |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2160 gtk_box_reorder_child(GTK_BOX(hbox), ct_button, -1); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2161 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2162 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2163 frame = pref_frame_new(win_vbox, TRUE, NULL, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2164 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2165 vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2166 gtk_container_add(GTK_CONTAINER(frame), vbox); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2167 gtk_widget_show(vbox); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2168 |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2169 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2170 group = pref_group_new(vbox, FALSE, _("General options"), GTK_ORIENTATION_VERTICAL); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2171 |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2172 pref_label_new(group, _("Home path (empty to use your home directory)")); |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2173 hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2174 |
2723
c3417ff92722
Show .icc files when selecting color profiles
Colin Clark <colin.clark@cclark.uk>
parents:
2670
diff
changeset
|
2175 tabcomp = tab_completion_new(&lc->home_path_entry, lc->options.home_path, NULL, NULL, NULL, NULL); |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2176 tab_completion_add_select_button(lc->home_path_entry, NULL, TRUE); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2177 gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2178 gtk_widget_show(tabcomp); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2179 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2180 button = pref_button_new(hbox, NULL, _("Use current"), FALSE, |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2181 G_CALLBACK(home_path_set_current_cb), lc); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2182 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2183 pref_checkbox_new_int(group, _("Show date in directories list view"), |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2184 lc->options.show_directory_date, &lc->options.show_directory_date); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2185 |
1514
dc14cd399465
added option that simplifies saving of multi-window configurations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1511
diff
changeset
|
2186 pref_checkbox_new_int(group, _("Exit program when this window is closed"), |
dc14cd399465
added option that simplifies saving of multi-window configurations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1511
diff
changeset
|
2187 lc->options.exit_on_close, &lc->options.exit_on_close); |
dc14cd399465
added option that simplifies saving of multi-window configurations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1511
diff
changeset
|
2188 |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2189 group = pref_group_new(vbox, FALSE, _("Start-up directory:"), GTK_ORIENTATION_VERTICAL); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2190 |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2191 button = pref_radiobutton_new(group, NULL, _("No change"), |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2192 (lc->options.startup_path == STARTUP_PATH_CURRENT), |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2193 G_CALLBACK(startup_path_set_current_cb), lc); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2194 button = pref_radiobutton_new(group, button, _("Restore last path"), |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2195 (lc->options.startup_path == STARTUP_PATH_LAST), |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2196 G_CALLBACK(startup_path_set_last_cb), lc); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2197 button = pref_radiobutton_new(group, button, _("Home path"), |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2198 (lc->options.startup_path == STARTUP_PATH_HOME), |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2199 G_CALLBACK(startup_path_set_home_cb), lc); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2200 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2201 group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2202 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2203 lc->layout_widget = layout_config_new(); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2204 layout_config_set(lc->layout_widget, lw->options.style, lw->options.order); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2205 gtk_box_pack_start(GTK_BOX(group), lc->layout_widget, TRUE, TRUE, 0); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2206 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2207 gtk_widget_show(lc->layout_widget); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2208 gtk_widget_show(lc->configwindow); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2209 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2210 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2211 /* |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2212 *----------------------------------------------------------------------------- |
9 | 2213 * base |
2214 *----------------------------------------------------------------------------- | |
2215 */ | |
2216 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2217 void layout_sync_options_with_current_state(LayoutWindow *lw) |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2218 { |
1336
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2219 Histogram *histogram; |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2220 if (!layout_valid(&lw)) return; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2221 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2222 lw->options.main_window.maximized = window_maximized(lw->window); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2223 if (!lw->options.main_window.maximized) |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2224 { |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2225 layout_geometry_get(lw, &lw->options.main_window.x, &lw->options.main_window.y, |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2226 &lw->options.main_window.w, &lw->options.main_window.h); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2227 } |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2228 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2229 layout_geometry_get_dividers(lw, &lw->options.main_window.hdivider_pos, &lw->options.main_window.vdivider_pos); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2230 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2231 // layout_sort_get(NULL, &options->file_sort.method, &options->file_sort.ascending); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2232 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2233 layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.y, |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2234 &lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2235 |
1336
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2236 lw->options.image_overlay.state = image_osd_get(lw->image); |
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2237 histogram = image_osd_get_histogram(lw->image); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2238 |
1336
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2239 lw->options.image_overlay.histogram_channel = histogram->histogram_channel; |
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2240 lw->options.image_overlay.histogram_mode = histogram->histogram_mode; |
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2241 |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2242 g_free(lw->options.last_path); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2243 lw->options.last_path = g_strdup(layout_get_path(lw)); |
2508
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2244 |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2245 layout_geometry_get_log_window(lw, &lw->options.log_window.x, &lw->options.log_window.y, |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2246 &lw->options.log_window.w, &lw->options.log_window.h); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2247 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2248 } |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2249 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2250 void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop) |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2251 { |
1437 | 2252 gboolean refresh_style; |
2253 gboolean refresh_lists; | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2254 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2255 if (!layout_valid(&lw)) return; |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2256 /* FIXME: add other options too */ |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2257 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2258 refresh_style = (lop->style != lw->options.style || strcmp(lop->order, lw->options.order) != 0); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2259 refresh_lists = (lop->show_directory_date != lw->options.show_directory_date); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2260 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2261 copy_layout_options(&lw->options, lop); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2262 |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2263 if (refresh_style) layout_style_set(lw, lw->options.style, lw->options.order); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2264 if (refresh_lists) layout_refresh(lw); |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2265 } |
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2266 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2267 |
9 | 2268 void layout_close(LayoutWindow *lw) |
2269 { | |
1514
dc14cd399465
added option that simplifies saving of multi-window configurations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1511
diff
changeset
|
2270 if (!lw->options.exit_on_close && layout_window_list && layout_window_list->next) |
9 | 2271 { |
2272 layout_free(lw); | |
2273 } | |
2274 else | |
2275 { | |
278
79fed35f1650
exit_gqview() renamed to exit_program().
Laurent Monin <geeqie@norz.org>
parents:
273
diff
changeset
|
2276 exit_program(); |
9 | 2277 } |
2278 } | |
2279 | |
2280 void layout_free(LayoutWindow *lw) | |
2281 { | |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
2282 gint i; |
9 | 2283 if (!lw) return; |
2284 | |
2285 layout_window_list = g_list_remove(layout_window_list, lw); | |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2286 if (current_lw == lw) current_lw = NULL; |
9 | 2287 |
1293
6546ca1fea07
separated "normal" and advanced exif, "Normal" exif is now in the
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1291
diff
changeset
|
2288 if (lw->exif_window) g_signal_handlers_disconnect_matched(G_OBJECT(lw->exif_window), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, lw); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2289 |
9 | 2290 layout_bars_close(lw); |
2291 | |
1470
02f03330d589
do not re-create ui_manager at layout change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1466
diff
changeset
|
2292 g_object_unref(lw->menu_bar); |
02f03330d589
do not re-create ui_manager at layout change
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1466
diff
changeset
|
2293 g_object_unref(lw->utility_box); |
1582
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
2294 |
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
2295 for (i = 0; i < TOOLBAR_COUNT; i++) |
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
2296 { |
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
2297 if (lw->toolbar[i]) g_object_unref(lw->toolbar[i]); |
f137ec3fd85e
- handle color profile and write metadata buttons on statusbar by ui_manager
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1558
diff
changeset
|
2298 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2299 |
9 | 2300 gtk_widget_destroy(lw->window); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2301 |
837
69915f769f3a
use GtkSizeGroup to control initial size of split images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
820
diff
changeset
|
2302 if (lw->split_image_sizegroup) g_object_unref(lw->split_image_sizegroup); |
442 | 2303 |
796
d381f4e9e26d
use new notification in layout and layout_image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
791
diff
changeset
|
2304 file_data_unregister_notify_func(layout_image_notify_cb, lw); |
d381f4e9e26d
use new notification in layout and layout_image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
791
diff
changeset
|
2305 |
995 | 2306 if (lw->dir_fd) |
791
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
2307 { |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
2308 file_data_unregister_real_time_monitor(lw->dir_fd); |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
2309 file_data_unref(lw->dir_fd); |
9ac2f29b065e
realtime file monitor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
787
diff
changeset
|
2310 } |
9 | 2311 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2312 free_layout_options_content(&lw->options); |
9 | 2313 g_free(lw); |
2314 } | |
2315 | |
1433
12600de4b59a
Use gboolean where applicable, minor cleanup and indentations fixes.
Laurent Monin <geeqie@norz.org>
parents:
1431
diff
changeset
|
2316 static gboolean layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) |
9 | 2317 { |
2318 LayoutWindow *lw = data; | |
2319 | |
2320 layout_close(lw); | |
2321 return TRUE; | |
2322 } | |
2323 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2324 LayoutWindow *layout_new(FileData *dir_fd, LayoutOptions *lop) |
9 | 2325 { |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2326 return layout_new_with_geometry(dir_fd, lop, NULL); |
81
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2327 } |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2328 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2329 LayoutWindow *layout_new_with_geometry(FileData *dir_fd, LayoutOptions *lop, |
81
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2330 const gchar *geometry) |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2331 { |
9 | 2332 LayoutWindow *lw; |
81
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2333 GdkGeometry hint; |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2334 GdkWindowHints hint_mask; |
1336
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2335 Histogram *histogram; |
9 | 2336 |
1735
d60ff6f78f81
added messages for debugging startup time
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1669
diff
changeset
|
2337 DEBUG_1("%s layout_new: start", get_exec_time()); |
9 | 2338 lw = g_new0(LayoutWindow, 1); |
2339 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2340 if (lop) |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2341 copy_layout_options(&lw->options, lop); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2342 else |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2343 init_layout_options(&lw->options); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2344 |
9 | 2345 lw->sort_method = SORT_NAME; |
2346 lw->sort_ascend = TRUE; | |
2347 | |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2348 layout_set_unique_id(lw); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2349 // lw->options.tools_float = popped; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2350 // lw->options.tools_hidden = hidden; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2351 // lw->bar_sort_enabled = options->panels.sort.enabled; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2352 // lw->bar_enabled = options->panels.info.enabled; |
9 | 2353 |
2354 /* default layout */ | |
2355 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2356 layout_config_parse(lw->options.style, lw->options.order, |
9 | 2357 &lw->dir_location, &lw->file_location, &lw->image_location); |
2441
a2d4729a3b2d
Fix GCC and Clang compile warnings.
Omari Stephens <xsdg@google.com>
parents:
2412
diff
changeset
|
2358 if (lw->options.dir_view_type > DIRVIEW_LAST) lw->options.dir_view_type = 0; |
a2d4729a3b2d
Fix GCC and Clang compile warnings.
Omari Stephens <xsdg@google.com>
parents:
2412
diff
changeset
|
2359 if (lw->options.file_view_type > FILEVIEW_LAST) lw->options.file_view_type = 0; |
9 | 2360 |
2361 /* divider positions */ | |
2362 | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2363 if (!options->save_window_positions) |
9 | 2364 { |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2365 lw->options.main_window.hdivider_pos = MAIN_WINDOW_DIV_HPOS; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2366 lw->options.main_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2367 lw->options.float_window.vdivider_pos = MAIN_WINDOW_DIV_VPOS; |
9 | 2368 } |
2369 | |
2370 /* window */ | |
2371 | |
1174
f809d57aed0c
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.
Laurent Monin <geeqie@norz.org>
parents:
1167
diff
changeset
|
2372 lw->window = window_new(GTK_WINDOW_TOPLEVEL, GQ_APPNAME_LC, NULL, NULL, NULL); |
9 | 2373 gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE); |
2374 gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0); | |
2375 | |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2376 if (options->save_window_positions) |
9 | 2377 { |
81
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2378 hint_mask = GDK_HINT_USER_POS; |
9 | 2379 } |
2380 else | |
2381 { | |
81
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2382 hint_mask = 0; |
9 | 2383 } |
2384 | |
81
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2385 hint.min_width = 32; |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2386 hint.min_height = 32; |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2387 hint.base_width = 0; |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2388 hint.base_height = 0; |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2389 gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &hint, |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2390 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hint_mask); |
9 | 2391 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2392 if (options->save_window_positions) |
9 | 2393 { |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2394 gtk_window_set_default_size(GTK_WINDOW(lw->window), lw->options.main_window.w, lw->options.main_window.h); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2395 // if (!layout_window_list) |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2396 // { |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2397 gtk_window_move(GTK_WINDOW(lw->window), lw->options.main_window.x, lw->options.main_window.y); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2398 if (lw->options.main_window.maximized) gtk_window_maximize(GTK_WINDOW(lw->window)); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2399 // } |
9 | 2400 } |
2401 else | |
2402 { | |
2403 gtk_window_set_default_size(GTK_WINDOW(lw->window), MAINWINDOW_DEF_WIDTH, MAINWINDOW_DEF_HEIGHT); | |
2404 } | |
2405 | |
2406 g_signal_connect(G_OBJECT(lw->window), "delete_event", | |
2407 G_CALLBACK(layout_delete_cb), lw); | |
2408 | |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2409 g_signal_connect(G_OBJECT(lw->window), "focus-in-event", |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2410 G_CALLBACK(layout_set_current_cb), lw); |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2411 |
9 | 2412 layout_keyboard_init(lw, lw->window); |
2413 | |
528
c09da8b0fee9
Added LIRC patch written by Matteo Beniamino
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
523
diff
changeset
|
2414 #ifdef HAVE_LIRC |
c09da8b0fee9
Added LIRC patch written by Matteo Beniamino
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
523
diff
changeset
|
2415 layout_image_lirc_init(lw); |
c09da8b0fee9
Added LIRC patch written by Matteo Beniamino
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
523
diff
changeset
|
2416 #endif |
c09da8b0fee9
Added LIRC patch written by Matteo Beniamino
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
523
diff
changeset
|
2417 |
9 | 2418 lw->main_box = gtk_vbox_new(FALSE, 0); |
2419 gtk_container_add(GTK_CONTAINER(lw->window), lw->main_box); | |
2420 gtk_widget_show(lw->main_box); | |
2421 | |
2422 layout_grid_setup(lw); | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2423 image_top_window_set_sync(lw->image, (lw->options.tools_float || lw->options.tools_hidden)); |
9 | 2424 |
2425 layout_util_sync(lw); | |
2426 layout_status_update_all(lw); | |
2427 | |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
2428 if (dir_fd) |
9 | 2429 { |
783
0e45ed008a1c
replaced directory path with FileData* dir_fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
774
diff
changeset
|
2430 layout_set_fd(lw, dir_fd); |
9 | 2431 } |
2432 else | |
2433 { | |
2434 GdkPixbuf *pixbuf; | |
2435 | |
2436 pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO); | |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2437 |
1287
c5be18d985a6
Start with "Fit to window" in "Leave Zoom at previous setting" mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
2438 /* FIXME: the zoom value set here is the value, which is then copied again and again |
c5be18d985a6
Start with "Fit to window" in "Leave Zoom at previous setting" mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
2439 in "Leave Zoom at previous setting" mode. This is not ideal. */ |
c5be18d985a6
Start with "Fit to window" in "Leave Zoom at previous setting" mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
2440 image_change_pixbuf(lw->image, pixbuf, 0.0, FALSE); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1029
diff
changeset
|
2441 g_object_unref(pixbuf); |
9 | 2442 } |
2443 | |
81
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2444 if (geometry) |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2445 { |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2446 if (!gtk_window_parse_geometry(GTK_WINDOW(lw->window), geometry)) |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2447 { |
694
547663d27a70
Sort out log_printf() vs printf_term() mix up.
Laurent Monin <geeqie@norz.org>
parents:
671
diff
changeset
|
2448 log_printf("%s", _("Invalid geometry\n")); |
81
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2449 } |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2450 } |
e2c85104c1eb
Thu Oct 19 09:35:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
41
diff
changeset
|
2451 |
9 | 2452 gtk_widget_show(lw->window); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2453 layout_tools_hide(lw, lw->options.tools_hidden); |
9 | 2454 |
1336
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2455 image_osd_set(lw->image, lw->options.image_overlay.state); |
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2456 histogram = image_osd_get_histogram(lw->image); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2457 |
1336
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2458 histogram->histogram_channel = lw->options.image_overlay.histogram_channel; |
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2459 histogram->histogram_mode = lw->options.image_overlay.histogram_mode; |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2460 |
9 | 2461 layout_window_list = g_list_append(layout_window_list, lw); |
2462 | |
796
d381f4e9e26d
use new notification in layout and layout_image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
791
diff
changeset
|
2463 file_data_register_notify_func(layout_image_notify_cb, lw, NOTIFY_PRIORITY_LOW); |
d381f4e9e26d
use new notification in layout and layout_image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
791
diff
changeset
|
2464 |
1735
d60ff6f78f81
added messages for debugging startup time
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1669
diff
changeset
|
2465 DEBUG_1("%s layout_new: end", get_exec_time()); |
d60ff6f78f81
added messages for debugging startup time
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1669
diff
changeset
|
2466 |
9 | 2467 return lw; |
2468 } | |
2469 | |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2470 void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent) |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2471 { |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2472 WRITE_NL(); WRITE_CHAR(*layout, id); |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2473 |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2474 WRITE_NL(); WRITE_INT(*layout, style); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2475 WRITE_NL(); WRITE_CHAR(*layout, order); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2476 WRITE_NL(); WRITE_UINT(*layout, dir_view_type); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2477 WRITE_NL(); WRITE_UINT(*layout, file_view_type); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2478 WRITE_NL(); WRITE_BOOL(*layout, show_marks); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2479 WRITE_NL(); WRITE_BOOL(*layout, show_thumbnails); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2480 WRITE_NL(); WRITE_BOOL(*layout, show_directory_date); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2481 WRITE_NL(); WRITE_CHAR(*layout, home_path); |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2482 WRITE_NL(); WRITE_CHAR(*layout, last_path); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2483 WRITE_NL(); WRITE_UINT(*layout, startup_path); |
1514
dc14cd399465
added option that simplifies saving of multi-window configurations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1511
diff
changeset
|
2484 WRITE_NL(); WRITE_BOOL(*layout, exit_on_close); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2485 WRITE_SEPARATOR(); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2486 |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2487 WRITE_NL(); WRITE_INT(*layout, main_window.x); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2488 WRITE_NL(); WRITE_INT(*layout, main_window.y); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2489 WRITE_NL(); WRITE_INT(*layout, main_window.w); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2490 WRITE_NL(); WRITE_INT(*layout, main_window.h); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2491 WRITE_NL(); WRITE_BOOL(*layout, main_window.maximized); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2492 WRITE_NL(); WRITE_INT(*layout, main_window.hdivider_pos); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2493 WRITE_NL(); WRITE_INT(*layout, main_window.vdivider_pos); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2494 WRITE_SEPARATOR(); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2495 |
2450
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
2496 WRITE_NL(); WRITE_INT(*layout, folder_window.vdivider_pos); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
2497 WRITE_SEPARATOR(); |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
2498 |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2499 WRITE_NL(); WRITE_INT(*layout, float_window.x); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2500 WRITE_NL(); WRITE_INT(*layout, float_window.y); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2501 WRITE_NL(); WRITE_INT(*layout, float_window.w); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2502 WRITE_NL(); WRITE_INT(*layout, float_window.h); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2503 WRITE_NL(); WRITE_INT(*layout, float_window.vdivider_pos); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2504 WRITE_SEPARATOR(); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2505 |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2506 WRITE_NL(); WRITE_INT(*layout, properties_window.w); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2507 WRITE_NL(); WRITE_INT(*layout, properties_window.h); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2508 WRITE_SEPARATOR(); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2509 |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2510 WRITE_NL(); WRITE_BOOL(*layout, tools_float); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2511 WRITE_NL(); WRITE_BOOL(*layout, tools_hidden); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2512 WRITE_SEPARATOR(); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2513 |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2514 WRITE_NL(); WRITE_BOOL(*layout, toolbar_hidden); |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
2515 WRITE_NL(); WRITE_BOOL(*layout, show_info_pixel); |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2516 |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2517 WRITE_NL(); WRITE_UINT(*layout, image_overlay.state); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2518 WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_channel); |
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2519 WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_mode); |
2433 | 2520 |
2508
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2521 WRITE_NL(); WRITE_INT(*layout, log_window.x); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2522 WRITE_NL(); WRITE_INT(*layout, log_window.y); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2523 WRITE_NL(); WRITE_INT(*layout, log_window.w); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2524 WRITE_NL(); WRITE_INT(*layout, log_window.h); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2525 WRITE_SEPARATOR(); |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2526 |
2433 | 2527 WRITE_NL(); WRITE_BOOL(*layout, animate); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2528 } |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2529 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2530 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2531 void layout_write_config(LayoutWindow *lw, GString *outstr, gint indent) |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2532 { |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2533 layout_sync_options_with_current_state(lw); |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2534 WRITE_NL(); WRITE_STRING("<layout"); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2535 layout_write_attributes(&lw->options, outstr, indent + 1); |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2536 WRITE_STRING(">"); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2537 |
1320
f1607e105298
improved bar_sort configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1317
diff
changeset
|
2538 bar_sort_write_config(lw->bar_sort, outstr, indent + 1); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2539 bar_write_config(lw->bar, outstr, indent + 1); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2540 |
2670
ec21b78a088c
Fix #543: Size of dialog windows in the GTK3 version is too small
Colin Clark <colin.clark@cclark.uk>
parents:
2623
diff
changeset
|
2541 WRITE_SEPARATOR(); |
ec21b78a088c
Fix #543: Size of dialog windows in the GTK3 version is too small
Colin Clark <colin.clark@cclark.uk>
parents:
2623
diff
changeset
|
2542 generic_dialog_windows_write_config(outstr, indent + 1); |
ec21b78a088c
Fix #543: Size of dialog windows in the GTK3 version is too small
Colin Clark <colin.clark@cclark.uk>
parents:
2623
diff
changeset
|
2543 |
ec21b78a088c
Fix #543: Size of dialog windows in the GTK3 version is too small
Colin Clark <colin.clark@cclark.uk>
parents:
2623
diff
changeset
|
2544 WRITE_SEPARATOR(); |
2623
f5886b8e1968
Fix #444: User-definable toolbar
Colin Clark <colin.clark@cclark.uk>
parents:
2611
diff
changeset
|
2545 layout_toolbar_write_config(lw, TOOLBAR_MAIN, outstr, indent + 1); |
f5886b8e1968
Fix #444: User-definable toolbar
Colin Clark <colin.clark@cclark.uk>
parents:
2611
diff
changeset
|
2546 |
1461
8f4df7710af8
improved config file formatting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1437
diff
changeset
|
2547 WRITE_NL(); WRITE_STRING("</layout>"); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2548 } |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2549 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2550 void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values) |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2551 { |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2552 gchar *id = NULL; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2553 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2554 while (*attribute_names) |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2555 { |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2556 const gchar *option = *attribute_names++; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2557 const gchar *value = *attribute_values++; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2558 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2559 /* layout options */ |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2560 if (READ_CHAR_FULL("id", id)) continue; |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2561 |
1315
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2562 if (READ_INT(*layout, style)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2563 if (READ_CHAR(*layout, order)) continue; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2564 |
1315
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2565 if (READ_UINT(*layout, dir_view_type)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2566 if (READ_UINT(*layout, file_view_type)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2567 if (READ_BOOL(*layout, show_marks)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2568 if (READ_BOOL(*layout, show_thumbnails)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2569 if (READ_BOOL(*layout, show_directory_date)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2570 if (READ_CHAR(*layout, home_path)) continue; |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2571 if (READ_CHAR(*layout, last_path)) continue; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2572 if (READ_UINT_CLAMP(*layout, startup_path, 0, STARTUP_PATH_HOME)) continue; |
1514
dc14cd399465
added option that simplifies saving of multi-window configurations
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1511
diff
changeset
|
2573 if (READ_BOOL(*layout, exit_on_close)) continue; |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2574 |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2575 /* window positions */ |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2576 |
1315
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2577 if (READ_INT(*layout, main_window.x)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2578 if (READ_INT(*layout, main_window.y)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2579 if (READ_INT(*layout, main_window.w)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2580 if (READ_INT(*layout, main_window.h)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2581 if (READ_BOOL(*layout, main_window.maximized)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2582 if (READ_INT(*layout, main_window.hdivider_pos)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2583 if (READ_INT(*layout, main_window.vdivider_pos)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2584 |
2450
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
2585 if (READ_INT_CLAMP(*layout, folder_window.vdivider_pos, 1, 1000)) continue; |
361d89e79d74
Fix #431: Bookmarks (shortcuts) to folders
Colin Clark <cclark@mcb.net>
parents:
2444
diff
changeset
|
2586 |
1315
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2587 if (READ_INT(*layout, float_window.x)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2588 if (READ_INT(*layout, float_window.y)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2589 if (READ_INT(*layout, float_window.w)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2590 if (READ_INT(*layout, float_window.h)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2591 if (READ_INT(*layout, float_window.vdivider_pos)) continue; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2592 |
1315
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2593 if (READ_INT(*layout, properties_window.w)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2594 if (READ_INT(*layout, properties_window.h)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2595 |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2596 if (READ_BOOL(*layout, tools_float)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2597 if (READ_BOOL(*layout, tools_hidden)) continue; |
4f8f11de5c36
Since READ_*() macros are now exported, do not hide
Laurent Monin <geeqie@norz.org>
parents:
1314
diff
changeset
|
2598 if (READ_BOOL(*layout, toolbar_hidden)) continue; |
1584
c97dea5d82d7
improved pixel info, changed the menu entry from "Hide" to "Show",
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1582
diff
changeset
|
2599 if (READ_BOOL(*layout, show_info_pixel)) continue; |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2600 |
1336
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2601 if (READ_UINT(*layout, image_overlay.state)) continue; |
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2602 if (READ_INT(*layout, image_overlay.histogram_channel)) continue; |
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2603 if (READ_INT(*layout, image_overlay.histogram_mode)) continue; |
7fe7536f02e1
fixed overlay configuration
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1335
diff
changeset
|
2604 |
2508
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2605 if (READ_INT(*layout, log_window.x)) continue; |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2606 if (READ_INT(*layout, log_window.y)) continue; |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2607 if (READ_INT(*layout, log_window.w)) continue; |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2608 if (READ_INT(*layout, log_window.h)) continue; |
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2609 |
2433 | 2610 if (READ_BOOL(*layout, animate)) continue; |
2611 | |
1464
6c71e4a9d06a
be more verbose on parse errors
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1463
diff
changeset
|
2612 log_printf("unknown attribute %s = %s\n", option, value); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2613 } |
1473
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2614 if (id && strcmp(id, LAYOUT_ID_CURRENT) != 0) |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2615 { |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2616 g_free(layout->id); |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2617 layout->id = id; |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2618 } |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2619 else |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2620 { |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2621 g_free(id); |
0b75150d746c
layout id "_current_" matches the currently active layout window
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1470
diff
changeset
|
2622 } |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2623 } |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2624 |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2625 static void layout_config_startup_path(LayoutOptions *lop, gchar **path) |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2626 { |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2627 switch (lop->startup_path) |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2628 { |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2629 case STARTUP_PATH_LAST: |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2630 *path = (lop->last_path && isdir(lop->last_path)) ? g_strdup(lop->last_path) : get_current_dir(); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2631 break; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2632 case STARTUP_PATH_HOME: |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2633 *path = (lop->home_path && isdir(lop->home_path)) ? g_strdup(lop->home_path) : g_strdup(homedir()); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2634 break; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2635 default: |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2636 *path = get_current_dir(); |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2637 break; |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2638 } |
2184 | 2639 } |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2640 |
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2641 |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2642 static void layout_config_commandline(LayoutOptions *lop, gchar **path) |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2643 { |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2644 if (command_line->startup_blank) |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2645 { |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2646 *path = NULL; |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2647 } |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2648 else if (command_line->file) |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2649 { |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2650 *path = g_strdup(command_line->file); |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2651 } |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2652 else if (command_line->path) |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2653 { |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2654 *path = g_strdup(command_line->path); |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2655 } |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2656 else layout_config_startup_path(lop, path); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2657 |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2658 if (command_line->tools_show) |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2659 { |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2660 lop->tools_float = FALSE; |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2661 lop->tools_hidden = FALSE; |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2662 } |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2663 else if (command_line->tools_hide) |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2664 { |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2665 lop->tools_hidden = TRUE; |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2666 } |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2667 } |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2668 |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2669 LayoutWindow *layout_new_from_config(const gchar **attribute_names, const gchar **attribute_values, gboolean use_commandline) |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2670 { |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2671 LayoutOptions lop; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2672 LayoutWindow *lw; |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2673 gchar *path = NULL; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2674 |
1436
13d61fe760fb
completely separated global and layout window options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1433
diff
changeset
|
2675 init_layout_options(&lop); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2676 |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2677 if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2678 |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2679 if (use_commandline) |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2680 { |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2681 layout_config_commandline(&lop, &path); |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2682 } |
2184 | 2683 else |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2684 { |
1511
ce48bdc8350d
startup path options simplified and moved to layout options
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1506
diff
changeset
|
2685 layout_config_startup_path(&lop, &path); |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2686 } |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2687 |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2688 lw = layout_new_with_geometry(NULL, &lop, use_commandline ? command_line->geometry : NULL); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2689 layout_sort_set(lw, options->file_sort.method, options->file_sort.ascending); |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2690 layout_set_path(lw, path); |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2691 |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2692 if (use_commandline && command_line->startup_full_screen) layout_image_full_screen_start(lw); |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2693 if (use_commandline && command_line->startup_in_slideshow) layout_image_slideshow_start(lw); |
2508
a39331032807
Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents:
2468
diff
changeset
|
2694 if (use_commandline && command_line->log_window_show) log_window_new(lw); |
1313
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2695 |
29ff0de0a67e
enabled commandline again
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1309
diff
changeset
|
2696 g_free(path); |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2697 free_layout_options_content(&lop); |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2698 return lw; |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2699 } |
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2700 |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2701 void layout_update_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values) |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2702 { |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2703 LayoutOptions lop; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2704 |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2705 init_layout_options(&lop); |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2706 |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2707 if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values); |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2708 |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2709 layout_apply_options(lw, &lop); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2710 |
1466
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2711 free_layout_options_content(&lop); |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2712 } |
a8a7e7feeefc
added possibility to update existing layout window from config
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1464
diff
changeset
|
2713 |
1309
d89f8c4d593b
config file format changed to XML
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1301
diff
changeset
|
2714 |
1055
4bbdfab3c89a
Adding a vim modeline to all files - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1045
diff
changeset
|
2715 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |