annotate src/layout.c @ 70:13e76f7b2cbb

Fri Oct 13 12:18:01 2006 John Ellis <johne@verizon.net> * ru.po: Update Russian translation [merge from 2.0.2], submitted by Vitaly Lipatov <lav@altlinux.ru>.
author gqview
date Fri, 13 Oct 2006 16:22:44 +0000
parents 6281cc38e5ca
children 0ef72a64930b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2 * GQview
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12 #include "gqview.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 #include "image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "layout_config.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "layout_util.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "menu.h"
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
20 #include "pixbuf-renderer.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "pixbuf_util.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "view_dir_list.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "view_dir_tree.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "view_file_list.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "view_file_icon.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 #include "ui_misc.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 #include "ui_tabcomp.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 #include "icons/tools.xpm"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
34 #define MAINWINDOW_DEF_WIDTH 700
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
35 #define MAINWINDOW_DEF_HEIGHT 500
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
37 #define MAIN_WINDOW_DIV_HPOS 270
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 #define MAIN_WINDOW_DIV_VPOS 200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 #define TOOLWINDOW_DEF_WIDTH 260
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 #define TOOLWINDOW_DEF_HEIGHT 450
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 #define PROGRESS_WIDTH 150
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 #define ZOOM_LABEL_WIDTH 64
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 #define PANE_DIVIDER_SIZE 10
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 GList *layout_window_list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 gint layout_valid(LayoutWindow **lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 if (*lw == NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 if (layout_window_list) *lw = layout_window_list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 return (*lw != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 return (g_list_find(layout_window_list, *lw) != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 LayoutWindow *layout_find_by_image(ImageWindow *imd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 if (lw->image == imd) return lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 * menu, toolbar, and dir view
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 static void layout_path_entry_changed_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 buf = g_strdup(gtk_entry_get_text(GTK_ENTRY(lw->path_entry)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 if (!buf || (lw->path && strcmp(buf, lw->path) == 0))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 layout_set_path(lw, buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 static void layout_path_entry_tab_cb(const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 gchar *base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 buf = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 parse_out_relatives(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 base = remove_level_from_path(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 if (isdir(buf))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 if ((!lw->path || strcmp(lw->path, buf) != 0) && layout_set_path(lw, buf))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 gint pos = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 /* put the '/' back, if we are in tab completion for a dir and result was path change */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), "/", -1, &pos);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 gtk_editable_set_position(GTK_EDITABLE(lw->path_entry),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 strlen(gtk_entry_get_text(GTK_ENTRY(lw->path_entry))));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 else if (lw->path && strcmp(lw->path, base) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135 layout_list_scroll_to_subpart(lw, filename_from_path(buf));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 static void layout_path_entry_cb(const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 buf = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 parse_out_relatives(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 layout_set_path(lw, buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 static void layout_vdlist_select_cb(ViewDirList *vdl, const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 layout_set_path(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 static void layout_vdtree_select_cb(ViewDirTree *vdt, const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 layout_set_path(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 static GtkWidget *layout_tool_setup(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 GtkWidget *box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 GtkWidget *menu_bar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 GtkWidget *tabcomp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 menu_bar = layout_actions_menu_bar(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 gtk_widget_show(menu_bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 lw->toolbar = layout_button_bar(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 gtk_box_pack_start(GTK_BOX(box), lw->toolbar, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 if (!lw->toolbar_hidden) gtk_widget_show(lw->toolbar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 layout_path_entry_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 gtk_widget_show(tabcomp);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 G_CALLBACK(layout_path_entry_changed_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 if (lw->tree_view)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 lw->vdt = vdtree_new(lw->path, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 vdtree_set_layout(lw->vdt, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 vdtree_set_select_func(lw->vdt, layout_vdtree_select_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 lw->dir_view = lw->vdt->widget;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 lw->vdl = vdlist_new(lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 vdlist_set_layout(lw->vdl, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 vdlist_set_select_func(lw->vdl, layout_vdlist_select_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 lw->dir_view = lw->vdl->widget;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 gtk_box_pack_start(GTK_BOX(box), lw->dir_view, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 gtk_widget_show(lw->dir_view);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 gtk_widget_show(box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 return box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 * sort button (and menu)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 static void layout_sort_menu_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 LayoutWindow *lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 SortType type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 lw = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 type = (SortType)GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 layout_sort_set(lw, type, lw->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 static void layout_sort_menu_ascend_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242 layout_sort_set(lw, lw->sort_method, !lw->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 /* destroy the menu */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 gtk_widget_unref(GTK_WIDGET(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 GtkWidget *menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 GdkEvent *event;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 guint32 etime;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 menu = submenu_add_sort(NULL, G_CALLBACK(layout_sort_menu_cb), lw, FALSE, FALSE, TRUE, lw->sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 /* apparently the menu is never sunk, even on a popup */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 g_object_ref(G_OBJECT(menu));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 gtk_object_sink(GTK_OBJECT(menu));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 /* ascending option */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 menu_item_add_check(menu, _("Ascending"), lw->sort_ascend, G_CALLBACK(layout_sort_menu_ascend_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 g_signal_connect(G_OBJECT(menu), "selection_done",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 G_CALLBACK(layout_sort_menu_hide_cb), NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 event = gtk_get_current_event();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 if (event)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 etime = gdk_event_get_time(event);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 gdk_event_free(event);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 etime = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, etime);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 static GtkWidget *layout_sort_button(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 button = gtk_button_new_with_label(sort_type_get_text(lw->sort_method));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 g_signal_connect(G_OBJECT(button), "clicked",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 G_CALLBACK(layout_sort_button_press_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 return button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 * status bar
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 void layout_status_update_progress(LayoutWindow *lw, gdouble val, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 if (!lw->info_progress_bar) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(lw->info_progress_bar), val);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(lw->info_progress_bar), (text) ? text : " ");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 void layout_status_update_info(LayoutWindow *lw, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 gchar *buf = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 if (!text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 gint64 n_bytes = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 gint s;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 gint64 s_bytes = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 const gchar *ss;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 gchar *b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 gchar *sb;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 if (layout_image_slideshow_active(lw))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 if (!layout_image_slideshow_paused(lw))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 ss = _(" Slideshow");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 ss = _(" Paused");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 ss = "";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 n = layout_list_count(lw, &n_bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 s = layout_selection_count(lw, &s_bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 layout_bars_new_selection(lw, s);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 if (s > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
351 b = text_from_size_abrev(n_bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352 sb = text_from_size_abrev(s_bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353 buf = g_strdup_printf(_("%s, %d files (%s, %d)%s"), b, n, sb, s, ss);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 g_free(b);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 g_free(sb);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 else if (n > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 b = text_from_size_abrev(n_bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 buf = g_strdup_printf(_("%s, %d files%s"), b, n, ss);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 g_free(b);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 buf = g_strdup_printf(_("%d files%s"), n, ss);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 text = buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 layout_image_overlay_update(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 gtk_label_set_text(GTK_LABEL(lw->info_status), text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 void layout_status_update_image(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 gchar *text;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 gchar *b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 if (!layout_valid(&lw) || !lw->image) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 text = image_zoom_get_as_text(lw->image);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385 gtk_label_set_text(GTK_LABEL(lw->info_zoom), text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388 b = text_from_size(lw->image->size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 if (lw->image->unknown)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 if (image_get_path(lw->image) && !access_file(image_get_path(lw->image), R_OK))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 text = g_strdup_printf(_("(no read permission) %s bytes"), b);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 text = g_strdup_printf(_("( ? x ? ) %s bytes"), b);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
403 gint width, height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
404
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
405 pixbuf_renderer_get_image_size(PIXBUF_RENDERER(lw->image->pr), &width, &height);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 text = g_strdup_printf(_("( %d x %d ) %s bytes"),
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
407 width, height, b);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 gtk_label_set_text(GTK_LABEL(lw->info_details), text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 g_free(b);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 void layout_status_update_all(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 layout_status_update_progress(lw, 0.0, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 layout_status_update_info(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420 layout_status_update_image(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423 static GtkWidget *layout_status_label(gchar *text, GtkWidget *box, gint start, gint size, gint expand)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 GtkWidget *frame;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 frame = gtk_frame_new(NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 if (size) gtk_widget_set_size_request(frame, size, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431 if (start)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 gtk_box_pack_start(GTK_BOX(box), frame, expand, expand, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 gtk_box_pack_end(GTK_BOX(box), frame, expand, expand, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 gtk_widget_show(frame);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 label = gtk_label_new(text ? text : "");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 gtk_container_add(GTK_CONTAINER(frame), label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 gtk_widget_show(label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 return label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gint small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 if (lw->info_box) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 lw->info_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 lw->info_box = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 gtk_box_pack_end(GTK_BOX(box), lw->info_box, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 gtk_widget_show(lw->info_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
466 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467 hbox = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
469 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
471 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
472 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
473 hbox = lw->info_box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
474 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475 lw->info_progress_bar = gtk_progress_bar_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
476 gtk_widget_set_size_request(lw->info_progress_bar, PROGRESS_WIDTH, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
477 gtk_box_pack_start(GTK_BOX(hbox), lw->info_progress_bar, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 gtk_widget_show(lw->info_progress_bar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 lw->info_sort = layout_sort_button(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 gtk_box_pack_start(GTK_BOX(hbox), lw->info_sort, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 gtk_widget_show(lw->info_sort);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484 lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, (!small_format));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 if (small_format)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 hbox = gtk_hbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489 gtk_box_pack_start(GTK_BOX(lw->info_box), hbox, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 gtk_widget_show(hbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
493 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
494 hbox = lw->info_box;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
496 lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
497 lw->info_zoom = layout_status_label(NULL, hbox, FALSE, ZOOM_LABEL_WIDTH, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
499
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502 * views
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
505
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 static GtkWidget *layout_tools_new(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508 lw->dir_view = layout_tool_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 return lw->dir_view;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 static void layout_list_status_cb(ViewFileList *vfl, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 layout_status_update_info(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 static void layout_list_thumb_cb(ViewFileList *vfl, gdouble val, const gchar *text, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523 layout_status_update_progress(lw, val, text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
525
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 static void layout_icon_status_cb(ViewFileIcon *vfi, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 layout_status_update_info(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 static void layout_icon_thumb_cb(ViewFileIcon *vfi, gdouble val, const gchar *text, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537 layout_status_update_progress(lw, val, text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540 static GtkWidget *layout_list_new(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 if (lw->icon_view)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 lw->vfi = vficon_new(NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545 vficon_set_layout(lw->vfi, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
546
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
547 vficon_set_status_func(lw->vfi, layout_icon_status_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
548 vficon_set_thumb_status_func(lw->vfi, layout_icon_thumb_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
549
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
550 return lw->vfi->widget;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553 lw->vfl = vflist_new(NULL, lw->thumbs_enabled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 vflist_set_layout(lw->vfl, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
555
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
556 vflist_set_status_func(lw->vfl, layout_list_status_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557 vflist_set_thumb_status_func(lw->vfl, layout_list_thumb_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
558
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 return lw->vfl->widget;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 static void layout_list_sync_thumb(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
564 if (lw->vfl) vflist_thumb_set(lw->vfl, lw->thumbs_enabled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 if (lw->vfl) vflist_scroll_to_subpart(lw->vfl, needle);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572 if (lw->vfi) vficon_scroll_to_subpart(lw->vfi, needle);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 GList *layout_list(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 if (lw->vfl) return vflist_get_list(lw->vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 if (lw->vfi) return vficon_get_list(lw->vfi);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 gint layout_list_count(LayoutWindow *lw, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 if (!layout_valid(&lw)) return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 if (lw->vfl) return vflist_count(lw->vfl, bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 if (lw->vfi) return vficon_count(lw->vfi, bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 const gchar *layout_list_get_path(LayoutWindow *lw, gint index)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 if (lw->vfl) return vflist_index_get_path(lw->vfl, index);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 if (lw->vfi) return vficon_index_get_path(lw->vfi, index);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 gint layout_list_get_index(LayoutWindow *lw, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 if (!layout_valid(&lw)) return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 if (lw->vfl) return vflist_index_by_path(lw->vfl, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 if (lw->vfi) return vficon_index_by_path(lw->vfi, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 void layout_list_sync_path(LayoutWindow *lw, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 if (lw->vfl) vflist_select_by_path(lw->vfl, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 if (lw->vfi) vficon_select_by_path(lw->vfi, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 static void layout_list_sync_sort(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 if (lw->vfl) vflist_sort_set(lw->vfl, lw->sort_method, lw->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 if (lw->vfi) vficon_sort_set(lw->vfi, lw->sort_method, lw->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 GList *layout_selection_list(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 if (layout_image_get_collection(lw, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 const gchar *path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 path = layout_image_get_path(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641 if (path) return g_list_append(NULL, g_strdup(path));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645 if (lw->vfl) return vflist_selection_get_list(lw->vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646 if (lw->vfi) return vficon_selection_get_list(lw->vfi);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 GList *layout_selection_list_by_index(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 if (lw->vfl) return vflist_selection_get_list_by_index(lw->vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 if (lw->vfi) return vficon_selection_get_list_by_index(lw->vfi);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661 gint layout_selection_count(LayoutWindow *lw, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663 if (!layout_valid(&lw)) return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 if (lw->vfl) return vflist_selection_count(lw->vfl, bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 if (lw->vfi) return vficon_selection_count(lw->vfi, bytes);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671 void layout_select_all(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 if (lw->vfl) vflist_select_all(lw->vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 if (lw->vfi) vficon_select_all(lw->vfi);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679 void layout_select_none(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 if (lw->vfl) vflist_select_none(lw->vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684 if (lw->vfi) vficon_select_none(lw->vfi);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 * access
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
691 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 const gchar *layout_get_path(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695 if (!layout_valid(&lw)) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 return lw->path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 static void layout_sync_path(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 if (!lw->path) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 lw->last_time = filetime(lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 gtk_entry_set_text(GTK_ENTRY(lw->path_entry), lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 if (lw->vdl) vdlist_set_path(lw->vdl, lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 if (lw->vdt) vdtree_set_path(lw->vdt, lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
708
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
709 if (lw->vfl) vflist_set_path(lw->vfl, lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 if (lw->vfi) vficon_set_path(lw->vfi, lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 gint layout_set_path(LayoutWindow *lw, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715 gint have_file = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
716
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
717 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 if (!path || !isname(path)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 if (lw->path && path && strcmp(path, lw->path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
723 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 if (isdir(path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 g_free(lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 lw->path = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
730 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
731 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
732 gchar *base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
734 base = remove_level_from_path(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 if (lw->path && strcmp(lw->path, base) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 else if (isdir(base))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
741 g_free(lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742 lw->path = base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
745 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
746 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749 if (isfile(path)) have_file = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 if (lw->path_entry) tab_completion_append_to_history(lw->path_entry, lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 layout_sync_path(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755 if (have_file)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 row = layout_list_get_index(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760 if (row >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
762 layout_image_set_index(lw, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766 layout_image_set_path(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 else if (!lazy_image_sync)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
771 layout_image_set_index(lw, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
774 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
776
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777 static void layout_refresh_lists(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
778 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779 if (lw->path) lw->last_time = filetime(lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
780
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
781 if (lw->vdl) vdlist_refresh(lw->vdl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782 if (lw->vdt) vdtree_refresh(lw->vdt);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
783
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
784 if (lw->vfl) vflist_refresh(lw->vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 if (lw->vfi) vficon_refresh(lw->vfi);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
786 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
787
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 static void layout_refresh_by_time(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790 layout_refresh_lists(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 if (lw->image && filetime(layout_image_get_path(lw)) >= lw->last_time)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
793 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
794 layout_image_refresh(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 void layout_refresh(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
801
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
802 if (debug) printf("layout refresh\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
803
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
804 layout_refresh_lists(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 if (lw->image) layout_image_refresh(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 static gint layout_check_for_update_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
813 if (!update_on_time_change) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815 if (lw->path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 time_t new_time;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 new_time = filetime(lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 if (new_time > 0 && new_time > lw->last_time)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
823 if (debug) printf("layout path time changed, refreshing...\n");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824 layout_refresh_by_time(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 void layout_thumb_set(LayoutWindow *lw, gint enable)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 if (lw->thumbs_enabled == enable) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 lw->thumbs_enabled = enable;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
838
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 layout_util_sync_thumb(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 layout_list_sync_thumb(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 gint layout_thumb_get(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847 return lw->thumbs_enabled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 void layout_sort_set(LayoutWindow *lw, SortType type, gint ascend)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
853 if (lw->sort_method == type && lw->sort_ascend == ascend) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855 lw->sort_method = type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856 lw->sort_ascend = ascend;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
857
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
858 if (lw->info_sort) gtk_label_set_text(GTK_LABEL(GTK_BIN(lw->info_sort)->child),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
859 sort_type_get_text(type));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 layout_list_sync_sort(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
861 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
862
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
863 gint layout_sort_get(LayoutWindow *lw, SortType *type, gint *ascend)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
864 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
865 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
866
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
867 if (type) *type = lw->sort_method;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
868 if (ascend) *ascend = lw->sort_ascend;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
869
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
870 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 gint layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
874 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
877 gdk_window_get_root_origin(lw->window->window, x, y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 gdk_drawable_get_size(lw->window->window, w, h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
881 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
882
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 gint layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 if (lw->h_pane && GTK_PANED(lw->h_pane)->child1->allocation.x >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
889 *h = GTK_PANED(lw->h_pane)->child1->allocation.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891 else if (h != &lw->div_h)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
893 *h = lw->div_h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
894 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896 if (lw->v_pane && GTK_PANED(lw->v_pane)->child1->allocation.x >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 *v = GTK_PANED(lw->v_pane)->child1->allocation.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
900 else if (v != &lw->div_v)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
902 *v = lw->div_v;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
904
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
905 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
907
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
908 void layout_views_set(LayoutWindow *lw, gint tree, gint icons)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
909 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
910 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
911
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
912 if (lw->tree_view == tree && lw->icon_view == icons) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
913
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
914 lw->tree_view = tree;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
915 lw->icon_view = icons;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
916
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917 layout_style_set(lw, -1, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
920 gint layout_views_get(LayoutWindow *lw, gint *tree, gint *icons)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
921 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
922 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
923
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
924 *tree = lw->tree_view;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925 *icons = lw->icon_view;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
926
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
927 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
928 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
929
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
930 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
931 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
932 * location utils
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
933 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
934 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
935
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
936 static gint layout_location_single(LayoutLocation l)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
937 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
938 return (l == LAYOUT_LEFT ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
939 l == LAYOUT_RIGHT ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
940 l == LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
941 l == LAYOUT_BOTTOM);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
942 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
943
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
944 static gint layout_location_vertical(LayoutLocation l)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
945 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
946 return (l & LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
947 l & LAYOUT_BOTTOM);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
948 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
949
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
950 static gint layout_location_first(LayoutLocation l)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
951 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
952 return (l & LAYOUT_TOP ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
953 l & LAYOUT_LEFT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
954 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
955
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
956 static LayoutLocation layout_grid_compass(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
957 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
958 if (layout_location_single(lw->dir_location)) return lw->dir_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
959 if (layout_location_single(lw->file_location)) return lw->file_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
960 return lw->image_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
961 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
962
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
963 static void layout_location_compute(LayoutLocation l1, LayoutLocation l2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
964 GtkWidget *s1, GtkWidget *s2,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
965 GtkWidget **d1, GtkWidget **d2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
966 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
967 LayoutLocation l;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
968
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
969 l = l1 & l2; /* get common compass direction */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
970 l = l1 - l; /* remove it */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
971
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
972 if (layout_location_first(l))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
973 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
974 *d1 = s1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
975 *d2 = s2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
976 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
977 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
978 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
979 *d1 = s2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
980 *d2 = s1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
981 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
982 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
983
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
984 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
985 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
986 * tools window (for floating/hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
987 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
988 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
989
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
990 gint layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
991 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
992 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
993
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
994 if (!lw->tools || !GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
995 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
996 /* use the stored values (sort of breaks success return value) */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
997
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
998 *divider_pos = lw->div_float;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
999
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1000 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1001 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1002
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1003 gdk_window_get_root_origin(lw->tools->window, x, y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1004 gdk_drawable_get_size(lw->tools->window, w, h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1005
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1006 if (GTK_IS_VPANED(lw->tools_pane))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1007 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1008 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1009 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1010 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1011 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1012 *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1013 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1014
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1015 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1016 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1017
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1018 static void layout_tools_geometry_sync(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1019 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1020 layout_geometry_get_tools(lw, &float_window_x, &float_window_x,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1021 &float_window_w, &float_window_h, &lw->div_float);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1022 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1023
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1024 static void layout_tools_hide(LayoutWindow *lw, gint hide)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1025 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1026 if (!lw->tools) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1027
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1028 if (hide)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1029 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1030 if (GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1031 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1032 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1033 gtk_widget_hide(lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1034 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1035 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1036 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1037 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1038 if (!GTK_WIDGET_VISIBLE(lw->tools))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1039 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1040 gtk_widget_show(lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1041 if (lw->vfi) vficon_refresh(lw->vfi);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1042 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1043 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1044
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1045 lw->tools_hidden = hide;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1046 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1047
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1048 static gint layout_tools_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1049 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1050 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1051
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1052 layout_tools_float_toggle(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1053
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1054 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1055 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1056
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1057 static void layout_tools_setup(LayoutWindow *lw, GtkWidget *tools, GtkWidget *files)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1058 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1059 GtkWidget *vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1060 GtkWidget *w1, *w2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1061 gint vertical;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1062 gint new_window = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1063
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1064 vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1065 (!layout_location_single(lw->image_location) && layout_location_vertical(layout_grid_compass(lw)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1066 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1067 layout_location_compute(lw->dir_location, lw->file_location,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1068 tools, files, &w1, &w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1069 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1070 /* for now, tools/dir are always first in order */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1071 w1 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1072 w2 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1073
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1074 if (!lw->tools)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1075 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1076 GdkGeometry geometry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1077 GdkWindowHints hints;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1078
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1079 lw->tools = gtk_window_new(GTK_WINDOW_TOPLEVEL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1080 g_signal_connect(G_OBJECT(lw->tools), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1081 G_CALLBACK(layout_tools_delete_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1082 layout_keyboard_init(lw, lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1083
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1084 if (save_window_positions)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1085 {
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
1086 hints = GDK_HINT_USER_POS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1087 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1088 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1089 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1090 hints = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1091 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1092
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1093 geometry.min_width = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1094 geometry.min_height = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1095 geometry.base_width = TOOLWINDOW_DEF_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1096 geometry.base_height = TOOLWINDOW_DEF_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1097 gtk_window_set_geometry_hints(GTK_WINDOW(lw->tools), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1098 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hints);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1099
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1100
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1101 gtk_window_set_resizable(GTK_WINDOW(lw->tools), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1102 gtk_window_set_title(GTK_WINDOW(lw->tools), _("GQview Tools"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1103 gtk_window_set_wmclass(GTK_WINDOW(lw->tools), "tools", "GQview");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1104 gtk_container_set_border_width(GTK_CONTAINER(lw->tools), 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1105
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1106 window_set_icon(lw->tools, (const gchar **)tools_xpm, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1107
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1108 new_window = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1109 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1110 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1111 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1112 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1113 /* dump the contents */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1114 gtk_widget_destroy(GTK_BIN(lw->tools)->child);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1115 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1116
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1117 layout_actions_add_window(lw, lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1118
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1119 vbox = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1120 gtk_container_add(GTK_CONTAINER(lw->tools), vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1121 gtk_widget_show(vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1122
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1123 layout_status_setup(lw, vbox, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1124
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1125 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1126 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1127 lw->tools_pane = gtk_vpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1128 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1129 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1130 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1131 lw->tools_pane = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1132 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1133 gtk_box_pack_start(GTK_BOX(vbox), lw->tools_pane, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1134 gtk_widget_show(lw->tools_pane);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1135
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1136 gtk_paned_pack1(GTK_PANED(lw->tools_pane), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1137 gtk_paned_pack2(GTK_PANED(lw->tools_pane), w2, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1138
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1139 gtk_widget_show(tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1140 gtk_widget_show(files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1141
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1142 if (new_window)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1143 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1144 if (save_window_positions)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1145 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1146 gtk_window_set_default_size(GTK_WINDOW(lw->tools), float_window_w, float_window_h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1147 gtk_window_move(GTK_WINDOW(lw->tools), float_window_x, float_window_y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1148 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1149 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1150 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1151 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1153 gtk_window_set_default_size(GTK_WINDOW(lw->tools),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1154 TOOLWINDOW_DEF_WIDTH, TOOLWINDOW_DEF_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1155 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1156 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1157 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1158 gtk_window_set_default_size(GTK_WINDOW(lw->tools),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1159 TOOLWINDOW_DEF_HEIGHT, TOOLWINDOW_DEF_WIDTH);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1160 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1161 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1162 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1163
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1164 if (!save_window_positions)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1165 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1166 if (vertical)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168 lw->div_float = MAIN_WINDOW_DIV_VPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1169 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1170 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1171 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1172 lw->div_float = MAIN_WINDOW_DIV_HPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1173 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1174 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1175
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1176 gtk_paned_set_position(GTK_PANED(lw->tools_pane), lw->div_float);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1179 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1180 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1181 * glue (layout arrangement)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1182 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1183 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1184
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1185 static void layout_grid_compute(LayoutWindow *lw,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1186 GtkWidget *image, GtkWidget *tools, GtkWidget *files,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1187 GtkWidget **w1, GtkWidget **w2, GtkWidget **w3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1188 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1189 /* heh, this was fun */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1190
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1191 if (layout_location_single(lw->dir_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1192 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1193 if (layout_location_first(lw->dir_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1194 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1195 *w1 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1196 layout_location_compute(lw->file_location, lw->image_location, files, image, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1197 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1198 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1199 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1200 *w3 = tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1201 layout_location_compute(lw->file_location, lw->image_location, files, image, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1202 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1203 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1204 else if (layout_location_single(lw->file_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1205 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1206 if (layout_location_first(lw->file_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1207 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1208 *w1 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1209 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1210 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1211 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1212 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1213 *w3 = files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1214 layout_location_compute(lw->dir_location, lw->image_location, tools, image, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1215 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1216 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1217 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1218 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1219 /* image */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1220 if (layout_location_first(lw->image_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1221 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1222 *w1 = image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1223 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w2, w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1224 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1225 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1226 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1227 *w3 = image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1228 layout_location_compute(lw->file_location, lw->dir_location, files, tools, w1, w2);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1229 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1230 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1231 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1232
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1233 static void layout_grid_setup(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1234 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1235 gint priority_location;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1236 GtkWidget *h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1237 GtkWidget *v;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1238 GtkWidget *w1, *w2, *w3;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1239
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1240 GtkWidget *image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1241 GtkWidget *tools;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1242 GtkWidget *files;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1243
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1244 layout_actions_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1245 layout_actions_add_window(lw, lw->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1246
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1247 lw->group_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1248 gtk_box_pack_start(GTK_BOX(lw->main_box), lw->group_box, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1249 gtk_widget_show(lw->group_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1250
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1251 priority_location = layout_grid_compass(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1252
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1253 image = layout_image_new(lw, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1254 tools = layout_tools_new(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1255 files = layout_list_new(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1256
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1257 image = layout_bars_prepare(lw, image);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1258
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1259 if (lw->tools_float || lw->tools_hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1260 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1261 gtk_box_pack_start(GTK_BOX(lw->group_box), image, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1262 gtk_widget_show(image);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1263
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1264 layout_tools_setup(lw, tools, files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1265
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1266 gtk_widget_grab_focus(lw->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1267
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1268 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1269 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1270 else if (lw->tools)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1271 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1272 layout_tools_geometry_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1273 gtk_widget_destroy(lw->tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1274 lw->tools = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1275 lw->tools_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1276 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1277
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1278 layout_status_setup(lw, lw->group_box, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1279
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1280 layout_grid_compute(lw, image, tools, files, &w1, &w2, &w3);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1281
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1282 v = lw->v_pane = gtk_vpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1283
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1284 h = lw->h_pane = gtk_hpaned_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1285
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 if (!layout_location_vertical(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1287 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1288 GtkWidget *tmp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1290 tmp = v;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1291 v = h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1292 h = tmp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1293 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1294
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1295 gtk_box_pack_start(GTK_BOX(lw->group_box), v, TRUE, TRUE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1297 if (!layout_location_first(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1298 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1299 gtk_paned_pack1(GTK_PANED(v), h, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1300 gtk_paned_pack2(GTK_PANED(v), w3, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1301
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1302 gtk_paned_pack1(GTK_PANED(h), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1303 gtk_paned_pack2(GTK_PANED(h), w2, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1304 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1305 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1306 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1307 gtk_paned_pack1(GTK_PANED(v), w1, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1308 gtk_paned_pack2(GTK_PANED(v), h, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1309
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1310 gtk_paned_pack1(GTK_PANED(h), w2, FALSE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1311 gtk_paned_pack2(GTK_PANED(h), w3, TRUE, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1312 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1313
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1314 gtk_widget_show(image);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1315 gtk_widget_show(tools);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316 gtk_widget_show(files);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318 gtk_widget_show(v);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319 gtk_widget_show(h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1320
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1321 /* fix to have image pane visible when it is left and priority widget */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1322 if (lw->div_h == -1 &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1323 w1 == image &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1324 !layout_location_vertical(priority_location) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1325 layout_location_first(priority_location))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1326 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1327 gtk_widget_set_size_request(image, 200, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1328 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1329
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1330 gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->div_h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1331 gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->div_v);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1332
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1333 gtk_widget_grab_focus(lw->image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1334 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1335
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1336 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1337 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1338 gchar *path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1339 ImageWindow *old_image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1340
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1341 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1342
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1343 if (style != -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1344 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1345 LayoutLocation d, f, i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1346
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1347 layout_config_parse(style, order, &d, &f, &i);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1349 if (lw->dir_location == d &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1350 lw->file_location == f &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351 lw->image_location == i) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1352
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353 lw->dir_location = d;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 lw->file_location = f;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1355 lw->image_location = i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1356 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1357
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358 /* remember state */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1360 layout_image_slideshow_stop(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1361 layout_image_full_screen_stop(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1362
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363 path = lw->path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1364 lw->path = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1365 old_image = lw->image;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1366 lw->image = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367 lw->utility_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1368
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1369 layout_geometry_get_dividers(lw, &lw->div_h, &lw->div_v);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1370
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1371 /* clear it all */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1372
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1373 gtk_widget_hide(old_image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1374 gtk_widget_ref(old_image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1375 gtk_container_remove(GTK_CONTAINER(old_image->widget->parent), old_image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1376
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1377 lw->h_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1378 lw->v_pane = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1380 lw->toolbar = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381 lw->thumb_button = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1382 lw->path_entry = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1383 lw->dir_view = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 lw->vdl = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1385 lw->vdt = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1386
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387 lw->file_view = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1388 lw->vfl = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1389 lw->vfi = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 lw->info_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392 lw->info_progress_bar = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1393 lw->info_sort = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1394 lw->info_status = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1395 lw->info_details = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1396 lw->info_zoom = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1397
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1398 if (lw->ui_manager) g_object_unref(lw->ui_manager);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1399 lw->ui_manager = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1400 lw->action_group = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1401
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1402 gtk_container_remove(GTK_CONTAINER(lw->main_box), lw->group_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403 lw->group_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1404
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1405 /* re-fill */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1406
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1407 layout_grid_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1408 layout_tools_hide(lw, lw->tools_hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1409
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1410 layout_list_sync_sort(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1411 layout_util_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1412 layout_status_update_all(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1413
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1414 /* sync */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1415
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1416 if (image_get_path(old_image))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1417 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1418 layout_set_path(lw, image_get_path(old_image));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1420 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1422 layout_set_path(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1423 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1424 image_change_from_image(lw->image, old_image);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1425 image_top_window_set_sync(lw->image, (lw->tools_float || lw->tools_hidden));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1426
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1427 /* clean up */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1428
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1429 gtk_widget_unref(old_image->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1430 g_free(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1431 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1432
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1433 void layout_styles_update(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1434 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1435 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1436
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1437 work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1438 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1439 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1440 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1441 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1442
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1443 layout_style_set(lw, layout_style, layout_order);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1444 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1445 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1446
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1447 void layout_colors_update(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1448 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1449 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1450
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1451 work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1452 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1453 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1454 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1455 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1456
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1457 if (lw->image) image_background_set_black(lw->image, black_window_background);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1458 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1459 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1460
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1461 void layout_tools_float_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1462 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1463 gint popped;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1464
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1465 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1466
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1467 if (!lw->tools_hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1468 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1469 popped = !lw->tools_float;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1470 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1471 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1472 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1473 popped = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1474 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1475
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1476 if (lw->tools_float == popped)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1477 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1478 if (popped && lw->tools_hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1479 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1480 layout_tools_float_set(lw, popped, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1481 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1482 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1483 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1484 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1485 if (lw->tools_float)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1486 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1487 layout_tools_float_set(lw, FALSE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1488 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1489 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1490 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1491 layout_tools_float_set(lw, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1492 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1493 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1494 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1495
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1496 void layout_tools_hide_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1497 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1498 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1499
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1500 layout_tools_float_set(lw, lw->tools_float, !lw->tools_hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1501 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1502
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1503 void layout_tools_float_set(LayoutWindow *lw, gint popped, gint hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1504 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1505 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1506
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1507 if (lw->tools_float == popped && lw->tools_hidden == hidden) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1508
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1509 if (lw->tools_float == popped && lw->tools_float && lw->tools)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1510 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1511 layout_tools_hide(lw, hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1512 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1513 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1514
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515 lw->tools_float = popped;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1516 lw->tools_hidden = hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1517
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1518 layout_style_set(lw, -1, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1519 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1520
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1521 gint layout_tools_float_get(LayoutWindow *lw, gint *popped, gint *hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1522 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1523 if (!layout_valid(&lw)) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1524
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1525 *popped = lw->tools_float;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1526 *hidden = lw->tools_hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1527
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1528 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1529 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1530
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1531 void layout_toolbar_toggle(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1532 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1533 if (!layout_valid(&lw)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1534 if (!lw->toolbar) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1535
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1536 lw->toolbar_hidden = !lw->toolbar_hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1537
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1538 if (lw->toolbar_hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1539 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1540 if (GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_hide(lw->toolbar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1541 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1542 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1543 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1544 if (!GTK_WIDGET_VISIBLE(lw->toolbar)) gtk_widget_show(lw->toolbar);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1545 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1546 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1547
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1548 gint layout_toolbar_hidden(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1549 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1550 if (!layout_valid(&lw)) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1551
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1552 return lw->toolbar_hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1553 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1554
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1555 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1556 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1557 * base
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1558 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1559 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1560
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1561 void layout_close(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1562 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1563 if (layout_window_list && layout_window_list->next)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1564 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1565 layout_free(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1566 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1567 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1568 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1569 exit_gqview();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1570 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1571 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1572
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1573 void layout_free(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1574 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1575 if (!lw) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1576
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1577 layout_window_list = g_list_remove(layout_window_list, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1578
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1579 if (lw->last_time_id != -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1580 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1581 g_source_remove(lw->last_time_id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1582 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1583
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1584 layout_bars_close(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1585
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1586 gtk_widget_destroy(lw->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1587
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1588 g_free(lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1589
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1590 g_free(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1591 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1592
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1593 static gint layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1594 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1595 LayoutWindow *lw = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1596
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1597 layout_close(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1598 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1599 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1600
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1601 LayoutWindow *layout_new(const gchar *path, gint popped, gint hidden)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1602 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1603 LayoutWindow *lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1604 GdkGeometry geometry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1605 GdkWindowHints hints;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1606
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1607 lw = g_new0(LayoutWindow, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1608
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1609 lw->thumbs_enabled = thumbnails_enabled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1610 lw->sort_method = SORT_NAME;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1611 lw->sort_ascend = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1612
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1613 lw->tools_float = popped;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1614 lw->tools_hidden = hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1615
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1616 lw->toolbar_hidden = toolbar_hidden;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1617
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1618 lw->utility_box = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1619 lw->bar_sort = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1620 lw->bar_sort_enabled = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1621 lw->bar_exif = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1622 lw->bar_exif_enabled = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1623 lw->bar_exif_size = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1624 lw->bar_exif_advanced = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1625
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1626 lw->full_screen_overlay_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1627 lw->full_screen_overlay_on = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1628
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1629 /* default layout */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1630
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1631 layout_config_parse(layout_style, layout_order,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1632 &lw->dir_location, &lw->file_location, &lw->image_location);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1633 lw->tree_view = layout_view_tree;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1634 lw->icon_view = layout_view_icons;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1635
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1636 /* divider positions */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1637
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1638 if (save_window_positions)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1639 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1640 lw->div_h = window_hdivider_pos;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1641 lw->div_v = window_vdivider_pos;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1642 lw->div_float = float_window_divider;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1643 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1644 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1645 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1646 lw->div_h = MAIN_WINDOW_DIV_HPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1647 lw->div_v = MAIN_WINDOW_DIV_VPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1648 lw->div_float = MAIN_WINDOW_DIV_VPOS;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1649 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1650
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1651 /* window */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1652
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1653 lw->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1654 gtk_window_set_resizable(GTK_WINDOW(lw->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1655
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1656 gtk_window_set_title(GTK_WINDOW(lw->window), "GQview");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1657 gtk_window_set_wmclass(GTK_WINDOW(lw->window), "gqview", "GQview");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1658 gtk_container_set_border_width(GTK_CONTAINER(lw->window), 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1659
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1660 window_set_icon(lw->window, NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1661
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1662 if (save_window_positions)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1663 {
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
1664 hints = GDK_HINT_USER_POS;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1665 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1666 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1667 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1668 hints = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1669 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1670
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1671 geometry.min_width = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1672 geometry.min_height = 32;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1673 geometry.base_width = MAINWINDOW_DEF_WIDTH;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1674 geometry.base_height = MAINWINDOW_DEF_HEIGHT;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1675 gtk_window_set_geometry_hints(GTK_WINDOW(lw->window), NULL, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1676 GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | hints);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1677
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1678 if (save_window_positions)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1679 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1680 gtk_window_set_default_size(GTK_WINDOW(lw->window), main_window_w, main_window_h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1681 if (!layout_window_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1682 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1683 gtk_window_move(GTK_WINDOW(lw->window), main_window_x, main_window_y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1684 if (main_window_maximized) gtk_window_maximize(GTK_WINDOW(lw->window));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1685 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1686 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1687 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1688 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1689 gtk_window_set_default_size(GTK_WINDOW(lw->window), MAINWINDOW_DEF_WIDTH, MAINWINDOW_DEF_HEIGHT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1690 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1691
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1692 g_signal_connect(G_OBJECT(lw->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1693 G_CALLBACK(layout_delete_cb), lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1694
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1695 layout_keyboard_init(lw, lw->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1696
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1697 lw->main_box = gtk_vbox_new(FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1698 gtk_container_add(GTK_CONTAINER(lw->window), lw->main_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1699 gtk_widget_show(lw->main_box);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1700
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1701 layout_grid_setup(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1702 image_top_window_set_sync(lw->image, (lw->tools_float || lw->tools_hidden));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1703
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1704 layout_util_sync(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1705 layout_status_update_all(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1706
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1707 if (path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1708 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1709 layout_set_path(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1710 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1711 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1712 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1713 GdkPixbuf *pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1714
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1715 pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1716 image_change_pixbuf(lw->image, pixbuf, 1.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1717 gdk_pixbuf_unref(pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1718 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1719
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1720 /* set up the time stat timeout */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1721 lw->last_time = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1722 lw->last_time_id = g_timeout_add(5000, layout_check_for_update_cb, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1723
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1724 gtk_widget_show(lw->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1725 layout_tools_hide(lw, lw->tools_hidden);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1726
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1727 layout_window_list = g_list_append(layout_window_list, lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1728
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1729 return lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1730 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1731
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1732 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1733 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1734 * maintenance (for rename, move, remove)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1735 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1736 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1737
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1738 static void layout_real_time_update(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1739 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1740 /* this resets the last time stamp of path so that a refresh does not occur
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1741 * from an internal file operation.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1742 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1743
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1744 if (lw->path) lw->last_time = filetime(lw->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1745 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1746
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1747 static void layout_real_renamed(LayoutWindow *lw, const gchar *source, const gchar *dest)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1748 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1749 gint update = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1750
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1751 if (lw->image) layout_image_maint_renamed(lw, source, dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1752
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1753 if (lw->vfl) update |= vflist_maint_renamed(lw->vfl, source, dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1754 if (lw->vfi) update |= vficon_maint_renamed(lw->vfi, source, dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1755
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1756 if (update) layout_real_time_update(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1757 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1758
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1759 static void layout_real_removed(LayoutWindow *lw, const gchar *path, GList *ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1760 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1761 gint update = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1762
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1763 if (lw->image) layout_image_maint_removed(lw, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1764
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1765 if (lw->vfl) update |= vflist_maint_removed(lw->vfl, path, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1766 if (lw->vfi) update |= vficon_maint_removed(lw->vfi, path, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1767
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1768 if (update) layout_real_time_update(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1769 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1770
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1771 static void layout_real_moved(LayoutWindow *lw, const gchar *source, const gchar *dest, GList *ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1772 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1773 gint update = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1774
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1775 if (lw->image) layout_image_maint_moved(lw, source, dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1776
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1777 if (lw->vfl) update |= vflist_maint_moved(lw->vfl, source, dest, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1778 if (lw->vfi) update |= vficon_maint_moved(lw->vfi, source, dest, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1779
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1780 if (update) layout_real_time_update(lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1781 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1782
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1783 void layout_maint_renamed(const gchar *source, const gchar *dest)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1784 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1785 GList *work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1786 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1787 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1788 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1789 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1790
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1791 layout_real_renamed(lw, source, dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1792 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1793 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1794
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1795 void layout_maint_removed(const gchar *path, GList *ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1796 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1797 GList *work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1798 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1799 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1800 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1801 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1802
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1803 layout_real_removed(lw, path, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1804 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1805 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1806
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1807 void layout_maint_moved(const gchar *source, const gchar *dest, GList *ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1808 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1809 GList *work = layout_window_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1810 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1811 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1812 LayoutWindow *lw = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1813 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1814
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1815 layout_real_moved(lw, source, dest, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1816 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1817 }