annotate src/view_file_list.c @ 150:976fba0add7c

more operations with file marks
author nadvornik
date Sun, 25 Nov 2007 10:25:25 +0000
parents f0c79a514c06
children b73743a01384
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 "view_file_list.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 "cache_maint.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "dnd.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "editors.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "img-view.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "info.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "thumb.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #include "ui_tree_edit.h"
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
29 #include "typedefs.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 #include <gdk/gdkkeysyms.h> /* for keyboard values */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 FILE_COLUMN_POINTER = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 FILE_COLUMN_THUMB,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 FILE_COLUMN_NAME,
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
38 FILE_COLUMN_SIDECARS,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 FILE_COLUMN_SIZE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 FILE_COLUMN_DATE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 FILE_COLUMN_COLOR,
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
42 FILE_COLUMN_MARKS,
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
43 FILE_COLUMN_MARKS_LAST = FILE_COLUMN_MARKS + FILEDATA_MARKS_SIZE - 1,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 FILE_COLUMN_COUNT
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 };
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 static gint vflist_row_is_selected(ViewFileList *vfl, FileData *fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 static gint vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 static void vflist_populate_view(ViewFileList *vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51
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 * signals
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 */
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 static void vflist_send_update(ViewFileList *vfl)
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 if (vfl->func_status) vfl->func_status(vfl, vfl->data_status);
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
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 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 * misc
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 static gint vflist_find_row(ViewFileList *vfl, FileData *fd, GtkTreeIter *iter)
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 gint row = 0;
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 valid = gtk_tree_model_get_iter_first(store, iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 FileData *fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, FILE_COLUMN_POINTER, &fd_n, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 if (fd_n == fd) return row;
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 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 row++;
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 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 static void vflist_color_set(ViewFileList *vfl, FileData *fd, gint color_set)
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 GtkTreeIter iter;
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 if (vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
97 gtk_tree_store_set(GTK_TREE_STORE(store), &iter, FILE_COLUMN_COLOR, color_set, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 }
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 static void vflist_move_cursor(ViewFileList *vfl, GtkTreeIter *iter)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
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 tpath = gtk_tree_model_get_path(store, iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 gtk_tree_view_set_cursor(GTK_TREE_VIEW(vfl->listview), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 gtk_tree_path_free(tpath);
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 /*
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 * dnd
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 static void vflist_dnd_get(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 guint time, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 gchar *uri_text = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 gint total;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 if (!vfl->click_fd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 list = vflist_selection_get_list(vfl);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
135 list = g_list_append(NULL, file_data_ref(vfl->click_fd));
9
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 if (!list) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
140 uri_text = uri_text_from_filelist(list, &total, (info == TARGET_TEXT_PLAIN));
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
141 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 if (debug) printf(uri_text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144
64
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
145 gtk_selection_data_set(selection_data, selection_data->target,
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
146 8, (guchar *)uri_text, total);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 g_free(uri_text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 }
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 static void vflist_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
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 ViewFileList *vfl = data;
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 vflist_color_set(vfl, vfl->click_fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 if (vfl->thumbs_enabled &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 vfl->click_fd && vfl->click_fd->pixbuf)
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 gint items;
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 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 items = vflist_selection_count(vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 items = 1;
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 dnd_set_drag_icon(widget, context, vfl->click_fd->pixbuf, items);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 static void vflist_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 if (context->action == GDK_ACTION_MOVE)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 static void vflist_dnd_init(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 gtk_drag_source_set(vfl->listview, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 g_signal_connect(G_OBJECT(vfl->listview), "drag_data_get",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 G_CALLBACK(vflist_dnd_get), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 g_signal_connect(G_OBJECT(vfl->listview), "drag_begin",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 G_CALLBACK(vflist_dnd_begin), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 g_signal_connect(G_OBJECT(vfl->listview), "drag_end",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 G_CALLBACK(vflist_dnd_end), vfl);
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
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 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 * pop-up menu
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 static GList *vflist_pop_menu_file_list(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 if (!vfl->click_fd) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 return vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
210 return g_list_append(NULL, file_data_ref(vfl->click_fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 static void vflist_pop_menu_edit_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 ViewFileList *vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 GList *list;
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 vfl = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 n = GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 if (!vfl) return;
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 list = vflist_pop_menu_file_list(vfl);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
225 start_editor_from_filelist(n, list);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
226 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 static void vflist_pop_menu_info_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 ViewFileList *vfl = data;
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 info_window_new(NULL, vflist_pop_menu_file_list(vfl));
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 static void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data)
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 ViewFileList *vfl = 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 if (vflist_row_is_selected(vfl, vfl->click_fd))
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 GList *list;
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 list = vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 view_window_new_from_list(list);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
246 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
250 view_window_new(vfl->click_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 static void vflist_pop_menu_copy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 ViewFileList *vfl = data;
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 file_util_copy(NULL, vflist_pop_menu_file_list(vfl), NULL, vfl->listview);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 static void vflist_pop_menu_move_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 file_util_move(NULL, vflist_pop_menu_file_list(vfl), NULL, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 }
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 static void vflist_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 list = vflist_pop_menu_file_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 if (enable_in_place_rename &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 list && !list->next && vfl->click_fd)
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
280 filelist_free(list);
9
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 if (vflist_find_row(vfl, vfl->click_fd, &iter) >= 0)
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 GtkTreePath *tpath;
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 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 tree_edit_by_path(GTK_TREE_VIEW(vfl->listview), tpath,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 FILE_COLUMN_NAME -1, vfl->click_fd->name,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 vflist_row_rename_cb, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 }
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 file_util_rename(NULL, list, vfl->listview);
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 static void vflist_pop_menu_delete_cb(GtkWidget *widget, gpointer data)
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 ViewFileList *vfl = data;
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 file_util_delete(NULL, vflist_pop_menu_file_list(vfl), vfl->listview);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 static void vflist_pop_menu_sort_cb(GtkWidget *widget, gpointer data)
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 ViewFileList *vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 SortType type;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 111
diff changeset
310
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 111
diff changeset
311 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313 vfl = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 if (!vfl) return;
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 type = (SortType)GPOINTER_TO_INT(data);
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 (vfl->layout)
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 layout_sort_set(vfl->layout, type, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 vflist_sort_set(vfl, type, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 static void vflist_pop_menu_sort_ascend_cb(GtkWidget *widget, gpointer data)
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 ViewFileList *vfl = data;
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 if (vfl->layout)
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 layout_sort_set(vfl->layout, vfl->sort_method, !vfl->sort_ascend);
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 else
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 vflist_sort_set(vfl, vfl->sort_method, !vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 static void vflist_pop_menu_icons_cb(GtkWidget *widget, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346 if (vfl->layout) layout_views_set(vfl->layout, vfl->layout->tree_view, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 static void vflist_pop_menu_thumbs_cb(GtkWidget *widget, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 if (vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 layout_thumb_set(vfl->layout, !vfl->thumbs_enabled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 vflist_thumb_set(vfl, !vfl->thumbs_enabled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364 static void vflist_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 ViewFileList *vfl = data;
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 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
372 static void vflist_pop_menu_sel_mark_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
373 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
374 ViewFileList *vfl = data;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
375 vflist_select_marked(vfl, vfl->active_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
376 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
377
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
378 static void vflist_pop_menu_set_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
379 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
380 ViewFileList *vfl = data;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
381 vflist_mark_selected(vfl, vfl->active_mark, 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
382 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
383
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
384 static void vflist_pop_menu_res_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
385 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
386 ViewFileList *vfl = data;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
387 vflist_mark_selected(vfl, vfl->active_mark, 0);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
388 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
389
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
390 static void vflist_pop_menu_toggle_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
391 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
392 ViewFileList *vfl = data;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
393 vflist_mark_selected(vfl, vfl->active_mark, -1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
394 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
395
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
396
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 static void vflist_popup_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 vfl->popup = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
405
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
406 static GtkWidget *vflist_pop_menu(ViewFileList *vfl, FileData *fd, gint col_idx)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 GtkWidget *menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 GtkWidget *submenu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 gint active;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 vflist_color_set(vfl, fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 active = (fd != NULL);
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 menu = popup_menu_short_lived();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 g_signal_connect(G_OBJECT(menu), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 G_CALLBACK(vflist_popup_destroy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
420 if (col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
421 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
422 gint mark = col_idx - FILE_COLUMN_MARKS;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
423 gchar *str_set_mark = g_strdup_printf(_("_Set mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
424 gchar *str_res_mark = g_strdup_printf(_("_Reset mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
425 gchar *str_toggle_mark = g_strdup_printf(_("_Toggle mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
426 gchar *str_sel_mark = g_strdup_printf(_("_Select mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
427
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
428
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
429 vfl->active_mark = mark;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
430 menu_item_add_sensitive(menu, str_set_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
431 G_CALLBACK(vflist_pop_menu_set_mark_sel_cb), vfl);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
432
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
433 menu_item_add_sensitive(menu, str_res_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
434 G_CALLBACK(vflist_pop_menu_res_mark_sel_cb), vfl);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
435
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
436 menu_item_add_sensitive(menu, str_toggle_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
437 G_CALLBACK(vflist_pop_menu_toggle_mark_sel_cb), vfl);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
438
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
439 menu_item_add_sensitive(menu, str_sel_mark, active,
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
440 G_CALLBACK(vflist_pop_menu_sel_mark_cb), vfl);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
441
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
442 menu_item_add_divider(menu);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
443
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
444 g_free(str_set_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
445 g_free(str_res_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
446 g_free(str_toggle_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
447 g_free(str_sel_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
448 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
449
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 submenu_add_edit(menu, &item, G_CALLBACK(vflist_pop_menu_edit_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 gtk_widget_set_sensitive(item, active);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 G_CALLBACK(vflist_pop_menu_info_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 G_CALLBACK(vflist_pop_menu_view_cb), vfl);
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 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 G_CALLBACK(vflist_pop_menu_copy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 menu_item_add_sensitive(menu, _("_Move..."), active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 G_CALLBACK(vflist_pop_menu_move_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 menu_item_add_sensitive(menu, _("_Rename..."), active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464 G_CALLBACK(vflist_pop_menu_rename_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465 menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
466 G_CALLBACK(vflist_pop_menu_delete_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
469
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 submenu = submenu_add_sort(NULL, G_CALLBACK(vflist_pop_menu_sort_cb), vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
471 FALSE, FALSE, TRUE, vfl->sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
472 menu_item_add_divider(submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
473 menu_item_add_check(submenu, _("Ascending"), vfl->sort_ascend,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
474 G_CALLBACK(vflist_pop_menu_sort_ascend_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
476 item = menu_item_add(menu, _("_Sort"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
477 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479 menu_item_add_check(menu, _("View as _icons"), FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 G_CALLBACK(vflist_pop_menu_icons_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 menu_item_add_check(menu, _("Show _thumbnails"), vfl->thumbs_enabled,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 G_CALLBACK(vflist_pop_menu_thumbs_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483 menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, G_CALLBACK(vflist_pop_menu_refresh_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485 return menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 }
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 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 * callbacks
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 */
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 static gint vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
497 gchar *old_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 gchar *new_path;
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 if (strlen(new) == 0) return FALSE;
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 old_path = concat_dir_and_file(vfl->path, old);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 new_path = concat_dir_and_file(vfl->path, new);
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 if (strchr(new, '/') != NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507 gchar *text = g_strdup_printf(_("Invalid file name:\n%s"), new);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 g_free(text);
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 else if (isfile(new_path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 gchar *text = g_strdup_printf(_("A file with name %s already exists."), new);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 }
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
517 else
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
519 gint row = vflist_index_by_path(vfl, old_path);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
520 if (row >= 0)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
521 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
522 GList *work = g_list_nth(vfl->list, row);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
523 FileData *fd = work->data;
143
0d1bf3ac6cd8 improved FileDataChangeInfo structure, check for another file operation in progress
nadvornik
parents: 142
diff changeset
524
0d1bf3ac6cd8 improved FileDataChangeInfo structure, check for another file operation in progress
nadvornik
parents: 142
diff changeset
525 if (!file_data_add_change_info(fd, FILEDATA_CHANGE_RENAME, old_path, new_path) || !rename_file_ext(fd))
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
526 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
527 gchar *text = g_strdup_printf(_("Unable to rename file:\n%s\nto:\n%s"), old, new);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
528 file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vfl->listview);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
529 g_free(text);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
530 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
531 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
532
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534 g_free(old_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 g_free(new_path);
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 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540 static void vflist_menu_position_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
546 gint cw, ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
547
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
548 if (vflist_find_row(vfl, vfl->click_fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
549 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
550 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551 tree_view_get_cell_clamped(GTK_TREE_VIEW(vfl->listview), tpath, FILE_COLUMN_NAME - 1, TRUE, x, y, &cw, &ch);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553 *y += ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 popup_menu_position_clamp(menu, x, y, 0);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557 static gint vflist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 GtkTreePath *tpath;
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 if (event->keyval != GDK_Menu) return FALSE;
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 gtk_tree_view_get_cursor(GTK_TREE_VIEW(vfl->listview), &tpath, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 if (tpath)
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &vfl->click_fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 gtk_tree_path_free(tpath);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
580 vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, 0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 gtk_menu_popup(GTK_MENU(vfl->popup), NULL, NULL, vflist_menu_position_cb, vfl, 0, GDK_CURRENT_TIME);
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 TRUE;
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 static gint vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 FileData *fd = NULL;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
592 GtkTreeViewColumn *column;
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
593 gint col_idx = 0;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
594
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y,
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
596 &tpath, &column, NULL, NULL))
9
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 GtkTreeModel *store;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
599 col_idx = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(column), "column_store_idx"));
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
600
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
601 if (bevent->button == 1 &&
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
602 col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
603 return FALSE;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
604
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
605 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 vfl->click_fd = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 if (bevent->button == 3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 {
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
619 vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, col_idx);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 gtk_menu_popup(GTK_MENU(vfl->popup), NULL, NULL, NULL, NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 bevent->button, bevent->time);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 return TRUE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 if (!fd) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 if (bevent->button == 2)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 if (!vflist_row_is_selected(vfl, fd))
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 vflist_color_set(vfl, fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637 if (bevent->button == 1 && bevent->type == GDK_BUTTON_PRESS &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 !(bevent->state & GDK_SHIFT_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 !(bevent->state & GDK_CONTROL_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642 gtk_widget_grab_focus(widget);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
643 // return TRUE; // FIXME - expand
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647 if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 if (vfl->layout) layout_image_full_screen_start(vfl->layout);
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 #endif
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 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 static gint vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661 FileData *fd = NULL;
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 (bevent->button == 2)
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 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 }
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 if (bevent->button != 1 && bevent->button != 2)
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 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671 }
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 ((bevent->x != 0 || bevent->y != 0) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 GtkTreeModel *store;
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 if (bevent->button == 2)
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 if (fd && vfl->click_fd == fd)
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 GtkTreeSelection *selection;
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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692 if (vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 gtk_tree_selection_unselect_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 else
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 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 }
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 return TRUE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
704 if (fd && vfl->click_fd == fd &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 !(bevent->state & GDK_SHIFT_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 !(bevent->state & GDK_CONTROL_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 vflist_row_is_selected(vfl, fd))
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 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 vflist_move_cursor(vfl, &iter);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
715 // return TRUE;// FIXME - expand
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
721 static void vflist_select_image(ViewFileList *vfl, FileData *sel_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
723 FileData *read_ahead_fd = NULL;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
724 gint row;
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
725 FileData *cur_fd;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
726 if (!sel_fd) return;
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
727
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
728 cur_fd = layout_image_get_fd(vfl->layout);
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
729 if (sel_fd == cur_fd) return; /* no change */
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
730
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
731 row = g_list_index(vfl->list, sel_fd);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
732 // FIXME sidecar data
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
734 if (sel_fd && enable_read_ahead && row >= 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
736 if (row > g_list_index(vfl->list, cur_fd) &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 row + 1 < vflist_count(vfl, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
739 read_ahead_fd = vflist_index_get_data(vfl, row + 1);
9
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 else if (row > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
743 read_ahead_fd = vflist_index_get_data(vfl, row - 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744 }
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
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
747 layout_image_set_with_ahead(vfl->layout, sel_fd, read_ahead_fd);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750 static gint vflist_select_idle_cb(gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754 if (!vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 return FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
760 vflist_send_update(vfl);
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 if (vfl->select_fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
764 vflist_select_image(vfl, vfl->select_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
766 }
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 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 return FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
772 static void vflist_select_idle_cancel(ViewFileList *vfl)
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 if (vfl->select_idle_id != -1) g_source_remove(vfl->select_idle_id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775 vfl->select_idle_id = -1;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
778 static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779 gboolean path_currently_selected, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782 GtkTreeIter iter;
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 (!path_currently_selected &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
785 gtk_tree_model_get_iter(store, &iter, tpath))
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 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &vfl->select_fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
788 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
789 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
790 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
791 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
792 }
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 if (vfl->layout &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 vfl->select_idle_id == -1)
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 vfl->select_idle_id = g_idle_add(vflist_select_idle_cb, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800 return TRUE;
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
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 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
805 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
806 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
807 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
808
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
809 static gboolean vflist_dummy_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
810 gboolean path_currently_selected, gpointer data)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
811 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
812 return TRUE;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
813 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
814
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
815
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
816
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
817 void vflist_setup_iter(ViewFileList *vfl, GtkTreeStore *store, GtkTreeIter *iter, FileData *fd, GtkTreeIter *before)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
818 {
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
819 gchar *size;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
820 gchar *sidecars;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
821 int i;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
822 GList *work;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
823
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
824 sidecars = sidecar_file_data_list_to_string(fd);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
825 size = text_from_size(fd->size);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
826
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
827 if (before)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
828 {
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
829 gtk_tree_store_insert_before(store, iter, NULL, before);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
830 }
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
831 else
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
832 {
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
833 gtk_tree_store_append(store, iter, NULL);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
834 }
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
835
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
836 gtk_tree_store_set(store, iter, FILE_COLUMN_POINTER, fd,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
837 FILE_COLUMN_THUMB, (vfl->thumbs_enabled) ? fd->pixbuf : NULL,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
838 FILE_COLUMN_NAME, fd->name,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
839 FILE_COLUMN_SIDECARS, sidecars,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
840 FILE_COLUMN_SIZE, size,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
841 FILE_COLUMN_DATE, text_from_time(fd->date),
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
842 FILE_COLUMN_COLOR, FALSE, -1);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
843 for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
844 gtk_tree_store_set(store, iter, FILE_COLUMN_MARKS + i, fd->marks[i], -1);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
845
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
846 g_free(size);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
847 g_free(sidecars);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
848
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
849
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
850 work = fd->sidecar_files;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
851 while (work)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
852 {
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
853 GtkTreeIter s_iter;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
854
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
855 FileData *sfd = work->data;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
856 work = work->next;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
857
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
858 size = text_from_size(sfd->size);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
859 gtk_tree_store_append(store, &s_iter, iter);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
860 gtk_tree_store_set(store, &s_iter,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
861 FILE_COLUMN_POINTER, sfd,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
862 FILE_COLUMN_NAME, sfd->name,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
863 FILE_COLUMN_SIZE, size,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
864 FILE_COLUMN_DATE, text_from_time(sfd->date),
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
865 -1);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
866 g_free(size);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
867 }
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
868
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
869 }
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
870
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
871
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
872 void vflist_sort_set(ViewFileList *vfl, SortType type, gint ascend)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 {
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
874 GtkTreeModel *model;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
875 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876 GList *work;
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
877 GtkTreeSelection *selection;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
878 GtkTreePath *tpath;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
879 GtkTreeIter iter;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
880 GList *select_list;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
881 FileData *cursor_fd = NULL;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
882 gint single_select;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884 if (vfl->sort_method == type && vfl->sort_ascend == ascend) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
885
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
886 vfl->sort_method = type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887 vfl->sort_ascend = ascend;
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 if (!vfl->list) return;
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 vfl->list = filelist_sort(vfl->list, vfl->sort_method, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
893 /* now reorder the treeview, maintaining current selection */
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
894
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
895 #if 0
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
896 /* this is simpler, but much slower */
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
897 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899 work = g_list_last(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
900 while (work)
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 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903 GtkTreeIter iter;
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 fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
907 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
908 gtk_tree_store_move_after(store, &iter, NULL);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
911 work = work->prev;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
912 }
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
913 #endif
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
914
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
915 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
916
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
917 gtk_tree_selection_set_select_function(selection, vflist_dummy_select_cb, vfl, NULL);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
918
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
919 select_list = gtk_tree_selection_get_selected_rows(selection, &model);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
920 work = select_list;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
921 while (work) // FIXME this does not work for tree view
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
922 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
923 FileData *fd;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
924
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
925 tpath = work->data;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
926 gtk_tree_model_get_iter(model, &iter, tpath);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
927 gtk_tree_model_get(model, &iter, FILE_COLUMN_POINTER, &fd, -1);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
928 gtk_tree_path_free(tpath);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
929
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
930 work->data = fd;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
931 work = work->next;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
932 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
933
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
934 select_list = filelist_sort(select_list, vfl->sort_method, vfl->sort_ascend);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
935
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
936 gtk_tree_view_get_cursor(GTK_TREE_VIEW(vfl->listview), &tpath, NULL);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
937 if (tpath)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
938 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
939 if (gtk_tree_model_get_iter(model, &iter, tpath))
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
940 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
941 gtk_tree_model_get(model, &iter, FILE_COLUMN_POINTER, &cursor_fd, -1);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
942 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
943 gtk_tree_path_free(tpath);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
944 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
945
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
946 single_select = (select_list && !select_list->next);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
947 if (single_select) cursor_fd = select_list->data;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
948
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
949 store = GTK_TREE_STORE(model);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
950 gtk_tree_store_clear(store);
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
951
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
952 work = vfl->list;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
953 while (work)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
954 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
955 FileData *fd = work->data;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
956
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
957 vflist_setup_iter(vfl, store, &iter, fd, NULL);
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
958
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
959 if (select_list && select_list->data == fd)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
960 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
961 select_list = g_list_remove(select_list, fd);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
962 gtk_tree_selection_select_iter(selection, &iter);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
963 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
964
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
965 work = work->next;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
966 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
967
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
968 g_list_free(select_list);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
969
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
970 if (cursor_fd &&
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
971 vflist_find_row(vfl, cursor_fd, &iter) >= 0)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
972 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
973 if (single_select)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
974 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
975 vflist_move_cursor(vfl, &iter);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
976 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
977 else
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
978 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
979 tree_view_row_make_visible(GTK_TREE_VIEW(vfl->listview), &iter, TRUE);
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
980 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
981 }
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
982
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
983 gtk_tree_selection_set_select_function(selection, vflist_select_cb, vfl, NULL);
9
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 /*
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 * thumb updates
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 */
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 static gint vflist_thumb_next(ViewFileList *vfl);
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 static void vflist_thumb_status(ViewFileList *vfl, gdouble val, const gchar *text)
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 if (vfl->func_thumb_status)
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 vfl->func_thumb_status(vfl, val, text, vfl->data_thumb_status);
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 }
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 static void vflist_thumb_cleanup(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1003 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1004 vflist_thumb_status(vfl, 0.0, NULL);
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 vfl->thumbs_count = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1007 vfl->thumbs_running = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1008
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1009 thumb_loader_free(vfl->thumbs_loader);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1010 vfl->thumbs_loader = NULL;
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 vfl->thumbs_filedata = NULL;
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 static void vflist_thumb_stop(ViewFileList *vfl)
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 if (vfl->thumbs_running) vflist_thumb_cleanup(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1018 }
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 static void vflist_thumb_do(ViewFileList *vfl, ThumbLoader *tl, FileData *fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1021 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1022 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1023 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1024
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1025 if (!fd || vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1026
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1027 if (fd->pixbuf) g_object_unref(fd->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1028 fd->pixbuf = thumb_loader_get_pixbuf(tl, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1029
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1030 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1031 gtk_tree_store_set(store, &iter, FILE_COLUMN_THUMB, fd->pixbuf, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1032
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1033 vflist_thumb_status(vfl, (gdouble)(vfl->thumbs_count) / g_list_length(vfl->list), _("Loading thumbs..."));
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 static void vflist_thumb_error_cb(ThumbLoader *tl, gpointer data)
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 ViewFileList *vfl = data;
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 if (vfl->thumbs_filedata && vfl->thumbs_loader == tl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1041 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1042 vflist_thumb_do(vfl, tl, vfl->thumbs_filedata);
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 while (vflist_thumb_next(vfl));
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 void vflist_thumb_done_cb(ThumbLoader *tl, 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 ViewFileList *vfl = 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 if (vfl->thumbs_filedata && vfl->thumbs_loader == tl)
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 vflist_thumb_do(vfl, tl, vfl->thumbs_filedata);
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 while (vflist_thumb_next(vfl));
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1060 static gint vflist_thumb_next(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1061 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1062 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1063 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1064
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1065 /* first check the visible files */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1066
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1067 if (GTK_WIDGET_REALIZED(vfl->listview) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1068 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vfl->listview), 0, 0, &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1069 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1070 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1071 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1072 gint valid = TRUE;
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1075 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1076 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1077
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1078 while (!fd && valid && tree_view_row_get_visibility(GTK_TREE_VIEW(vfl->listview), &iter, FALSE) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1079 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1080 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1081 if (fd->pixbuf) fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1082
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1083 valid = gtk_tree_model_iter_next(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1084 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1085 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1086
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1087 /* then find first undone */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1088
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1089 if (!fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1090 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1091 GList *work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1092 while (work && !fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1093 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1094 FileData *fd_p = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1095 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1096
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1097 if (!fd_p->pixbuf) fd = fd_p;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1098 }
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 if (!fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1102 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1103 /* done */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1104 vflist_thumb_cleanup(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1105 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1106 }
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 vfl->thumbs_count++;
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 vfl->thumbs_filedata = fd;
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 thumb_loader_free(vfl->thumbs_loader);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1113
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1114 vfl->thumbs_loader = thumb_loader_new(thumb_max_width, thumb_max_height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1115 thumb_loader_set_callbacks(vfl->thumbs_loader,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1116 vflist_thumb_done_cb,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1117 vflist_thumb_error_cb,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1118 NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1119 vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1120
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1121 if (!thumb_loader_start(vfl->thumbs_loader, fd->path))
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 /* set icon to unknown, continue */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1124 if (debug) printf("thumb loader start failed %s\n", vfl->thumbs_loader->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1125 vflist_thumb_do(vfl, vfl->thumbs_loader, fd);
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 return TRUE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1130 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1131 }
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 static void vflist_thumb_update(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1134 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1135 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1136 if (!vfl->thumbs_enabled) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1137
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1138 vflist_thumb_status(vfl, 0.0, _("Loading thumbs..."));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1139 vfl->thumbs_running = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1140
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1141 while (vflist_thumb_next(vfl));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1142 }
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 /*
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 * row stuff
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1147 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1150 FileData *vflist_index_get_data(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1151 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152 return g_list_nth_data(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1153 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1155 gchar *vflist_index_get_path(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1156 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1157 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1158
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1159 fd = g_list_nth_data(vfl->list, row);
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 return (fd ? fd->path : NULL);
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 static gint vflist_row_by_path(ViewFileList *vfl, const gchar *path, FileData **fd)
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 gint p = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1169 if (!path) return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1170
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1171 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1172 while (work)
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 FileData *fd_n = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1175 if (strcmp(path, fd_n->path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1176 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177 if (fd) *fd = fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178 return p;
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 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1181 p++;
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 if (fd) *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1185 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1186 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1187
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1188 gint vflist_index_by_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1189 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1190 return vflist_row_by_path(vfl, path, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1191 }
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 gint vflist_count(ViewFileList *vfl, gint64 *bytes)
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 if (bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1196 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1197 gint64 b = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1198 GList *work;
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 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1201 while (work)
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 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1204 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1205 b += fd->size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1206 }
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 *bytes = b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1209 }
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 return g_list_length(vfl->list);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1214 GList *vflist_get_list(ViewFileList *vfl)
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 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1217 GList *work;
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 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1220 while (work)
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 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1223 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1224
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1225 list = g_list_prepend(list, file_data_ref(fd));
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1228 return g_list_reverse(list);
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 * selections
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1236
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1237 static gint vflist_row_is_selected(ViewFileList *vfl, FileData *fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1238 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1239 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1240 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1241 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1242 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1243 gint found = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1244
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1245 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1246 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1247 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1248 while (!found && work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1249 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1250 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1251 FileData *fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1252 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1253
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1254 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1255 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1256 if (fd_n == fd) found = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1257 work = work->next;
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 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1260 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1261
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1262 return found;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1265 gint vflist_index_is_selected(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1266 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1267 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1268
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1269 fd = vflist_index_get_data(vfl, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1270 return vflist_row_is_selected(vfl, fd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1273 gint vflist_selection_count(ViewFileList *vfl, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1274 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1275 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1276 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1277 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1278 gint count;
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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1281 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1282
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1283 if (bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1284 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1285 gint64 b = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 GList *work;
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 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1290 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1291 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1292 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1293 FileData *fd;
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_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1297 b += fd->size;
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 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1300 }
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 *bytes = b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1303 }
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 count = g_list_length(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1306 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1307 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1308
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1309 return count;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1310 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1311
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1312 GList *vflist_selection_get_list(ViewFileList *vfl)
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1315 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1320 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1321 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1322 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1323 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1324 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1325 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1326 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1327 GtkTreeIter iter;
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 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1330 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1331
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1332 list = g_list_prepend(list, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1333
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1334 work = work->next;
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 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1337 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1338
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1339 return g_list_reverse(list);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1342 GList *vflist_selection_get_list_by_index(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1343 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1344 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1345 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1346 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1347 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1349
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1350 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1352 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1355 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1356 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1357 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1360 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1361
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1362 list = g_list_prepend(list, GINT_TO_POINTER(g_list_index(vfl->list, fd)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1364 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1365 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1366 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367 g_list_free(slist);
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 return g_list_reverse(list);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1372 void vflist_select_all(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1373 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1374 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1375
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1376 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1377 gtk_tree_selection_select_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1378
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1380 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1382 void vflist_select_none(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1383 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1385
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1386 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1388 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1389
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390 void vflist_select_by_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392 FileData *fd;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1393
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1394 if (vflist_row_by_path(vfl, path, &fd) < 0) return;
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1395
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1396 vflist_select_by_fd(vfl, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1397 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1398
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1399 void vflist_select_by_fd(ViewFileList *vfl, FileData *fd)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1400 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1401 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1402
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403 if (vflist_find_row(vfl, fd, &iter) < 0) return;
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 tree_view_row_make_visible(GTK_TREE_VIEW(vfl->listview), &iter, TRUE);
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 if (!vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1408 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1409 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1410 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1411 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1412
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1413 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1414 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1415 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1416 vflist_move_cursor(vfl, &iter);
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1420 gtk_tree_view_set_cursor(GTK_TREE_VIEW(vfl->listview), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1422 }
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
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1425 void vflist_select_marked(ViewFileList *vfl, gint mark)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1426 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1427 GtkTreeModel *store;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1428 GtkTreeIter iter;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1429 GtkTreeSelection *selection;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1430 gint valid;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1431
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1432 g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1433
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1434 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1435 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1436 gtk_tree_selection_unselect_all(selection);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1437
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1438 valid = gtk_tree_model_get_iter_first(store, &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1439 while (valid)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1440 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1441 FileData *fd;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1442 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, -1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1443
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1444 if (fd->marks[mark])
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1445 gtk_tree_selection_select_iter(selection, &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1446
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1447 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1448 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1449
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1450 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1451
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1452 void vflist_mark_selected(ViewFileList *vfl, gint mark, gint value)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1453 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1454 GtkTreeModel *store;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1455 GtkTreeSelection *selection;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1456 GList *slist;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1457 GList *work;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1458
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1459 g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1460
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1461 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1462 slist = gtk_tree_selection_get_selected_rows(selection, &store);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1463 work = slist;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1464 while (work)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1465 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1466 GtkTreePath *tpath = work->data;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1467 FileData *fd;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1468 GtkTreeIter iter;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1469
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1470 gtk_tree_model_get_iter(store, &iter, tpath);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1471 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1472
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1473 if (value == -1)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1474 fd->marks[mark] = !fd->marks[mark];
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1475 else
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1476 fd->marks[mark] = value;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1477
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1478 gtk_tree_store_set(GTK_TREE_STORE(store), &iter, FILE_COLUMN_MARKS + mark, fd->marks[mark], -1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1479
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1480 work = work->next;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1481 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1482 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1483 g_list_free(slist);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1484 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1485
9
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 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1488 * core (population)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1489 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1492 static void vflist_listview_set_height(GtkWidget *listview, gint thumb)
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 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1495 GtkCellRenderer *cell;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1496 GList *list;
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 column = gtk_tree_view_get_column(GTK_TREE_VIEW(listview), FILE_COLUMN_THUMB - 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1499 if (!column) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1500
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1501 gtk_tree_view_column_set_fixed_width(column, ((thumb) ? thumb_max_width : 4) + 10);
9
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 list = gtk_tree_view_column_get_cell_renderers(column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1504 if (!list) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1505 cell = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1506 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1507
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1508 g_object_set(G_OBJECT(cell), "height", (thumb) ? thumb_max_height : -1, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1509 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(listview));
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1512 static void vflist_populate_view(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1513 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1514 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1516 gint thumbs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1517 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1518 GtkTreeRowReference *visible_row = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1519 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1520 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1521
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1522 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1523 thumbs = vfl->thumbs_enabled;
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 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1526
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1527 if (!vfl->list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1528 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1529 gtk_tree_store_clear(store);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1530 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1531 return;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1534 if (GTK_WIDGET_REALIZED(vfl->listview) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1535 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vfl->listview), 0, 0, &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1536 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1537 visible_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1538 gtk_tree_path_free(tpath);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1541 vflist_listview_set_height(vfl->listview, thumbs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1542
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1543 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1544
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1545 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1546 while (work)
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 match;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1549 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1550 gint done = FALSE;
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 while (!done)
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 FileData *old_fd = NULL;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1555 int i;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1556
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1557 if (valid)
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 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &old_fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1560 match = CASE_SORT(fd->name, old_fd->name);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1561 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1562 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1563 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1564 match = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1565 }
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 if (match < 0)
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 GtkTreeIter new;
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1570
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1571 if (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1572 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1573 vflist_setup_iter(vfl, store, &new, fd, &iter);
9
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1576 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1577 vflist_setup_iter(vfl, store, &new, fd, NULL);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1580 done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1581 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1582 else if (match > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1583 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1584 valid = gtk_tree_store_remove(store, &iter);
9
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1587 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1588 gtk_tree_store_set(store, &iter, FILE_COLUMN_POINTER, fd, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1589 if (fd->date != old_fd->date)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1590 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1591 gchar *size;
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 /* update, file changed */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1594 size = text_from_size(fd->size);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1595 gtk_tree_store_set(store, &iter, FILE_COLUMN_SIZE, size,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1596 FILE_COLUMN_DATE, text_from_time(fd->date), -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1597 g_free(size);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1598 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1599 else if (fd != old_fd)
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 /* preserve thumbnail */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1602 if (fd->pixbuf) g_object_unref(fd->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1603 fd->pixbuf = old_fd->pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1604 if (fd->pixbuf) g_object_ref(fd->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1605 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1606
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1607 gtk_tree_store_set(store, &iter, FILE_COLUMN_THUMB, (thumbs) ? fd->pixbuf : NULL, -1);
9
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 if (vfl->select_fd == old_fd) vfl->select_fd = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1610
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1611 if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
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 done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1614 }
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 work = work->next;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1619 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1620 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1621 valid = gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1622 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1623
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1624 if (visible_row)
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 if (gtk_tree_row_reference_valid(visible_row))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1627 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1628 tpath = gtk_tree_row_reference_get_path(visible_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1629 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(vfl->listview), tpath, NULL, TRUE, 0.0, 0.0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1630 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1631 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1632 gtk_tree_row_reference_free(visible_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1633 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1634
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1635 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1636 vflist_thumb_update(vfl);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1639 gint vflist_refresh(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1640 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1641 GList *old_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1642 gint ret = TRUE;
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 old_list = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1645 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1646
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1647 if (vfl->path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1648 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1649 ret = filelist_read(vfl->path, &vfl->list, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1652 vfl->list = filelist_sort(vfl->list, vfl->sort_method, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1653 vflist_populate_view(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1654
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1655 filelist_free(old_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1656
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1657 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1658 }
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 /* this overrides the low default of a GtkCellRenderer from 100 to CELL_HEIGHT_OVERRIDE, something sane for our purposes */
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 #define CELL_HEIGHT_OVERRIDE 512
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1663
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1664 static void cell_renderer_height_override(GtkCellRenderer *renderer)
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 GParamSpec *spec;
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 spec = g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(renderer)), "height");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1669 if (spec && G_IS_PARAM_SPEC_INT(spec))
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 GParamSpecInt *spec_int;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1672
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1673 spec_int = G_PARAM_SPEC_INT(spec);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1674 if (spec_int->maximum < CELL_HEIGHT_OVERRIDE) spec_int->maximum = CELL_HEIGHT_OVERRIDE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1675 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1676 }
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 static GdkColor *vflist_listview_color_shifted(GtkWidget *widget)
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 static GdkColor color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1681 static GtkWidget *done = NULL;
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 if (done != widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1684 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1685 GtkStyle *style;
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 style = gtk_widget_get_style(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1688 memcpy(&color, &style->base[GTK_STATE_NORMAL], sizeof(color));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1689 shift_color(&color, -1, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1690 done = widget;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1693 return &color;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1696 static void vflist_listview_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1697 GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1698 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1699 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1700 gboolean set;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1701
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1702 gtk_tree_model_get(tree_model, iter, FILE_COLUMN_COLOR, &set, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1703 g_object_set(G_OBJECT(cell),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1704 "cell-background-gdk", vflist_listview_color_shifted(vfl->listview),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1705 "cell-background-set", set, NULL);
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
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1708 static void vflist_listview_add_column(ViewFileList *vfl, gint n, const gchar *title, gint image, gint right_justify, gint expand)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1709 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1710 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1711 GtkCellRenderer *renderer;
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 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1714 gtk_tree_view_column_set_title(column, title);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1715 gtk_tree_view_column_set_min_width(column, 4);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1716
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1717 if (!image)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1718 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1719 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1720 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1721 if (right_justify)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1722 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1723 g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1724 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1725 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1726 gtk_tree_view_column_add_attribute(column, renderer, "text", n);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1727 if (expand)
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1728 gtk_tree_view_column_set_expand(column, TRUE);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1729 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1730 else
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 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1733 renderer = gtk_cell_renderer_pixbuf_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1734 cell_renderer_height_override(renderer);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1735 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1736 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", n);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1739 gtk_tree_view_column_set_cell_data_func(column, renderer, vflist_listview_color_cb, vfl, NULL);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1740 g_object_set_data (G_OBJECT (column), "column_store_idx", GUINT_TO_POINTER(n));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1741 g_object_set_data (G_OBJECT (renderer), "column_store_idx", GUINT_TO_POINTER(n));
9
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 gtk_tree_view_append_column(GTK_TREE_VIEW(vfl->listview), column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1744 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1745
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1746 static void vflist_listview_mark_toggled(GtkCellRendererToggle *cell, gchar *path_str, GtkTreeStore *store)
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1747 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1748 GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1749 guint *marks;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1750 GtkTreeIter iter;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1751 FileData *fd;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1752 gboolean mark;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1753 guint col_idx;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1754
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1755 if (!path || !gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path))
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1756 return;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1757
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1758 col_idx = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(cell), "column_store_idx"));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1759
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1760 g_assert(col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1761
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1762 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, col_idx, &mark, -1);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1763 mark = !mark;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1764 fd->marks[col_idx - FILE_COLUMN_MARKS] = mark;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1765
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1766 gtk_tree_store_set(store, &iter, col_idx, mark, -1);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1767 gtk_tree_path_free(path);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1768 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1769
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1770 static void vflist_listview_add_column_toggle(ViewFileList *vfl, gint n, const gchar *title)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1771 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1772 GtkTreeViewColumn *column;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1773 GtkCellRenderer *renderer;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1774 GtkTreeStore *store;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1775 gint index;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1776
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1777 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1778
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1779 renderer = gtk_cell_renderer_toggle_new();
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1780 column = gtk_tree_view_column_new_with_attributes(title, renderer, "active", n, NULL);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1781
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1782 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1783 g_object_set_data (G_OBJECT (column), "column_store_idx", GUINT_TO_POINTER(n));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1784 g_object_set_data (G_OBJECT (renderer), "column_store_idx", GUINT_TO_POINTER(n));
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1785
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1786 index = gtk_tree_view_append_column(GTK_TREE_VIEW(vfl->listview), column);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1787 gtk_tree_view_column_set_fixed_width(column, 16);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1788 gtk_tree_view_column_set_visible(column, vfl->marks_enabled);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1789
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1790
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1791 g_signal_connect(G_OBJECT(renderer), "toggled", G_CALLBACK(vflist_listview_mark_toggled), store);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1792 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1793
9
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 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1796 * base
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1797 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1798 */
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 gint vflist_set_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1801 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1802 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1803
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1804 if (!path) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1805 if (vfl->path && strcmp(path, vfl->path) == 0) return TRUE;
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 g_free(vfl->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1808 vfl->path = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1809
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1810 /* force complete reload */
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1811 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1812 gtk_tree_store_clear(store);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1813
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1814 filelist_free(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1815 vfl->list = NULL;
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 return vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1818 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1819
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1820 static void vflist_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1821 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1822 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1823
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1824 if (vfl->popup)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1825 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1826 g_signal_handlers_disconnect_matched(G_OBJECT(vfl->popup), G_SIGNAL_MATCH_DATA,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1827 0, 0, 0, NULL, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1828 gtk_widget_destroy(vfl->popup);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1829 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1830
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1831 vflist_select_idle_cancel(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1832 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1833
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1834 g_free(vfl->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1835 filelist_free(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1836 g_free(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1837 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1838
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1839 ViewFileList *vflist_new(const gchar *path, gint thumbs)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1840 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1841 ViewFileList *vfl;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1842 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1843 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1844
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1845 GType flist_types[FILE_COLUMN_COUNT];
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1846 int i;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1847
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1848 vfl = g_new0(ViewFileList, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1849
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1850 vfl->path = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1851 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1852 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1853 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1854 vfl->sort_method = SORT_NAME;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1855 vfl->sort_ascend = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1856 vfl->thumbs_enabled = thumbs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1857
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1858 vfl->thumbs_running = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1859 vfl->thumbs_count = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1860 vfl->thumbs_loader = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1861 vfl->thumbs_filedata = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1862
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1863 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1864
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1865 vfl->popup = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1866
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1867 vfl->widget = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1868 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vfl->widget), GTK_SHADOW_IN);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1869 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vfl->widget),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1870 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1871 g_signal_connect(G_OBJECT(vfl->widget), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1872 G_CALLBACK(vflist_destroy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1873
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1874 flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1875 flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1876 flist_types[FILE_COLUMN_NAME] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1877 flist_types[FILE_COLUMN_SIDECARS] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1878 flist_types[FILE_COLUMN_SIZE] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1879 flist_types[FILE_COLUMN_DATE] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1880 flist_types[FILE_COLUMN_COLOR] = G_TYPE_BOOLEAN;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1881 for (i = FILE_COLUMN_MARKS; i < FILE_COLUMN_MARKS + FILEDATA_MARKS_SIZE; i++)
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1882 flist_types[i] = G_TYPE_BOOLEAN;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1883
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1884 store = gtk_tree_store_newv(FILE_COLUMN_COUNT, flist_types);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1885
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1886 vfl->listview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1887 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1888
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1889 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1890 gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_MULTIPLE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1891 gtk_tree_selection_set_select_function(selection, vflist_select_cb, vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1892
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1893 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vfl->listview), FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1894 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vfl->listview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1895
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1896 vflist_listview_add_column(vfl, FILE_COLUMN_THUMB, "", TRUE, FALSE, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1897
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1898 for(i = 0; i < FILEDATA_MARKS_SIZE;i++)
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1899 vflist_listview_add_column_toggle(vfl, i + FILE_COLUMN_MARKS, "");
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1900
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1901 vflist_listview_add_column(vfl, FILE_COLUMN_NAME, _("Name"), FALSE, FALSE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1902 vflist_listview_add_column(vfl, FILE_COLUMN_SIDECARS, _("SC"), FALSE, FALSE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1903
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1904 vflist_listview_add_column(vfl, FILE_COLUMN_SIZE, _("Size"), FALSE, TRUE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1905 vflist_listview_add_column(vfl, FILE_COLUMN_DATE, _("Date"), FALSE, TRUE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1906
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1907
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
1908 g_signal_connect(G_OBJECT(vfl->listview), "key_press_event",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1909 G_CALLBACK(vflist_press_key_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1910
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1911 gtk_container_add (GTK_CONTAINER(vfl->widget), vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1912 gtk_widget_show(vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1913
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1914 vflist_dnd_init(vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1915
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1916 g_signal_connect(G_OBJECT(vfl->listview), "button_press_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1917 G_CALLBACK(vflist_press_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1918 g_signal_connect(G_OBJECT(vfl->listview), "button_release_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1919 G_CALLBACK(vflist_release_cb), vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1920
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1921
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1922 if (path) vflist_set_path(vfl, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1923
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1924 return vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1925 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1926
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1927 void vflist_set_status_func(ViewFileList *vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1928 void (*func)(ViewFileList *vfl, gpointer data), gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1929 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1930 vfl->func_status = func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1931 vfl->data_status = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1932 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1933
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1934 void vflist_set_thumb_status_func(ViewFileList *vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1935 void (*func)(ViewFileList *vfl, gdouble val, const gchar *text, gpointer data),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1936 gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1937 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1938 vfl->func_thumb_status = func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1939 vfl->data_thumb_status = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1940 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1941
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1942 void vflist_thumb_set(ViewFileList *vfl, gint enable)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1943 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1944 if (vfl->thumbs_enabled == enable) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1945
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1946 vfl->thumbs_enabled = enable;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1947 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1948 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1949
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1950 void vflist_marks_set(ViewFileList *vfl, gint enable)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1951 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1952 GtkTreeStore *store;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1953 GtkTreeViewColumn *column;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1954 GList *columns, *work;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1955
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1956 if (vfl->marks_enabled == enable) return;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1957
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1958 vfl->marks_enabled = enable;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1959
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1960 columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vfl->listview));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1961
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1962 work = columns;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1963 while (work)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1964 {
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1965 GtkTreeViewColumn *column = work->data;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1966 gint col_idx = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(column), "column_store_idx"));
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1967 work = work->next;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1968
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1969 if (col_idx <= FILE_COLUMN_MARKS_LAST && col_idx >= FILE_COLUMN_MARKS)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1970 gtk_tree_view_column_set_visible(column, enable);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1971 }
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1972
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1973 g_list_free(columns);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1974 //vflist_refresh(vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1975 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1976
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1977 void vflist_set_layout(ViewFileList *vfl, LayoutWindow *layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1978 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1979 vfl->layout = layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1980 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1981
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1982 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1983 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1984 * maintenance (for rename, move, remove)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1985 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1986 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1987
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1988 static gint vflist_maint_find_closest(ViewFileList *vfl, gint row, gint count, GList *ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1989 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1990 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1991 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1992 gint rev = row - 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1993 row ++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1994
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1995 work = ignore_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1996 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1997 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1998 gint f = vflist_index_by_path(vfl, work->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1999 if (f >= 0) list = g_list_prepend(list, GINT_TO_POINTER(f));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2000 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2001 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2002
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2003 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2004 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2005 gint c = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2006 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2007 while (work && c)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2008 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2009 gpointer p = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2010 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2011 if (row == GPOINTER_TO_INT(p))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2012 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2013 row++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2014 c = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2015 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2016 if (rev == GPOINTER_TO_INT(p))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2017 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2018 rev--;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2019 c = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2020 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2021 if (!c) list = g_list_remove(list, p);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2022 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2023 if (c && list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2024 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2025 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2026 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2027 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2028 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2029 if (row > count - 1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2030 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2031 if (rev < 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2032 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2033 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2034 return rev;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2035 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2036 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2037 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2038 return row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2039 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2040 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2041
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2042 gint vflist_maint_renamed(ViewFileList *vfl, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2043 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2044 gint ret = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2045 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2046 gchar *source_base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2047 gchar *dest_base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2048 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2049
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2050 row = g_list_index(vfl->list, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2051 if (row < 0) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2052
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2053 source_base = remove_level_from_path(fd->change->source);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2054 dest_base = remove_level_from_path(fd->change->dest);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2055
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2056
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2057 if (strcmp(source_base, dest_base) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2058 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2059 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2060 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2061 GtkTreeIter position;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2062 gint old_row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2063 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2064
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2065 old_row = g_list_index(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2066
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2067 vfl->list = g_list_remove(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2068
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2069 vfl->list = filelist_insert_sort(vfl->list, fd, vfl->sort_method, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2070 n = g_list_index(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2071
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2072 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2073 row = vflist_find_row(vfl, fd, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2074 if (vflist_find_row(vfl, fd, &iter) >= 0 &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2075 gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &position, NULL, n))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2076 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2077 if (old_row >= n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2078 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2079 gtk_tree_store_move_before(store, &iter, &position);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2080 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2081 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2082 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2083 gtk_tree_store_move_after(store, &iter, &position);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2084 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2085 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2086 gtk_tree_store_set(store, &iter, FILE_COLUMN_NAME, fd->name, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2087
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2088 ret = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2089 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2090 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2091 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2092 ret = vflist_maint_removed(vfl, fd, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2093 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2094
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2095 g_free(source_base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2096 g_free(dest_base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2097
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2098 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2099 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2100
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2101 gint vflist_maint_removed(ViewFileList *vfl, FileData *fd, GList *ignore_list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2102 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2103 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2104 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2105 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2106 gint new_row = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2107
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2108 row = g_list_index(vfl->list, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2109 if (row < 0) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2110
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2111 if (vflist_index_is_selected(vfl, row) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2112 layout_image_get_collection(vfl->layout, NULL) == NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2113 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2114 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2115
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2116 n = vflist_count(vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2117 if (ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2118 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2119 new_row = vflist_maint_find_closest(vfl, row, n, ignore_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2120 if (debug) printf("row = %d, closest is %d\n", row, new_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2121 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2122 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2123 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2124 if (row + 1 < n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2125 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2126 new_row = row + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2127 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2128 else if (row > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2129 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2130 new_row = row - 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2131 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2132 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2133 vflist_select_none(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2134 if (new_row >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2135 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2136 fd = vflist_index_get_data(vfl, new_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2137 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2138 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2139 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2140
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2141 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2142 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2143 vflist_move_cursor(vfl, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2144 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2145 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2146 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2147
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2148 fd = vflist_index_get_data(vfl, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2149 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2150 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2151 GtkTreeStore *store;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2152 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2153 gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2154 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2155 list = g_list_nth(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2156 fd = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2157
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2158 /* thumbnail loader check */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2159 if (fd == vfl->thumbs_filedata) vfl->thumbs_filedata = NULL;
111
3a69a7a3f461 Wed Nov 15 02:05:27 2006 John Ellis <johne@verizon.net>
gqview
parents: 93
diff changeset
2160 if (vfl->thumbs_count > 0) vfl->thumbs_count--;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2161
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2162 vfl->list = g_list_remove(vfl->list, fd);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2163 file_data_unref(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2164
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2165 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2166
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2167 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2168 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2169
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2170 gint vflist_maint_moved(ViewFileList *vfl, FileData *fd, GList *ignore_list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2171 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2172 gint ret = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2173 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2174
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2175 if (!fd->change->source || !vfl->path) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2176
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2177 buf = remove_level_from_path(fd->change->source);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2178
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2179 if (strcmp(buf, vfl->path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2180 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2181 ret = vflist_maint_removed(vfl, fd, ignore_list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2182 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2183
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2184 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2185
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2186 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2187 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2188