annotate src/view_file_list.c @ 555:cca1c3b1b948

Set thumbs_enabled through new function vflist_thumbs_set() instead of vflist_new().
author zas_
date Sat, 03 May 2008 10:31:37 +0000
parents 92b5a033a279
children d8d61dc4ff52
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 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 169
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 448
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * 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
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 259
diff changeset
13 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "view_file_list.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "cache_maint.h"
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
17 #include "debug.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "dnd.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "editors.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "img-view.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "info.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "thumb.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 #include "ui_tree_edit.h"
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
31 #include "typedefs.h"
9
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 #include <gdk/gdkkeysyms.h> /* for keyboard values */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 FILE_COLUMN_POINTER = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 FILE_COLUMN_THUMB,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 FILE_COLUMN_NAME,
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
40 FILE_COLUMN_SIDECARS,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 FILE_COLUMN_SIZE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 FILE_COLUMN_DATE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 FILE_COLUMN_COLOR,
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
44 FILE_COLUMN_MARKS,
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
45 FILE_COLUMN_MARKS_LAST = FILE_COLUMN_MARKS + FILEDATA_MARKS_SIZE - 1,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 FILE_COLUMN_COUNT
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 static gint vflist_row_is_selected(ViewFileList *vfl, FileData *fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 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
52 static void vflist_populate_view(ViewFileList *vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 * signals
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 static void vflist_send_update(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 if (vfl->func_status) vfl->func_status(vfl, vfl->data_status);
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 /*
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 * misc
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 */
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
70 typedef struct {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
71 FileData *fd;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
72 GtkTreeIter *iter;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
73 gint found;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
74 gint row;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
75 } ViewFileListFindRowData;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
76
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
77 static gboolean vflist_find_row_cb(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
78 {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
79 ViewFileListFindRowData *find = data;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
80 FileData *fd;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
81 gtk_tree_model_get(model, iter, FILE_COLUMN_POINTER, &fd, -1);
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
82 if (fd == find->fd)
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
83 {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
84 *find->iter = *iter;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
85 find->found = 1;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
86 return TRUE;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
87 }
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
88 find->row++;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
89 return FALSE;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
90 }
9
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 static gint vflist_find_row(ViewFileList *vfl, FileData *fd, GtkTreeIter *iter)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 GtkTreeModel *store;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
95 ViewFileListFindRowData data = {fd, iter, 0, 0};
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
96
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
97 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
98 gtk_tree_model_foreach(store, vflist_find_row_cb, &data);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
100 if (data.found)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 {
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
102 return data.row;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 }
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 return -1;
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
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
108
259
fa7d69e7d02d Comment out unused code.
zas_
parents: 250
diff changeset
109 /*
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
110 static gint vflist_find_sidecar_list_idx(GList *work, FileData *fd)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
111 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
112 gint i = 0;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
113 while (work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
114 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
115 FileData *fd_p = work->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
116 if (fd == fd_p) return i;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
117
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
118 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
119
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
120 GList *work2 = fd_p->sidecar_files;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
121 while (work2)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
122 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
123 fd_p = work2->data;
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
124 if (fd == fd_p) return i;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
125
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
126 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
127 work2 = work2->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
128 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
129 work = work->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
130 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
131 return -1;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
132 }
259
fa7d69e7d02d Comment out unused code.
zas_
parents: 250
diff changeset
133 */
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
134
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
135 static gint vflist_sidecar_list_count(GList *work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
136 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
137 gint i = 0;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
138 while (work)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
139 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
140 FileData *fd = work->data;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
141 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
142
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
143 GList *work2 = fd->sidecar_files;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
144 while (work2)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
145 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
146 i++;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
147 work2 = work2->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
148 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
149 work = work->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
150 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
151 return i;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
152 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
153
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
154
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 static void vflist_color_set(ViewFileList *vfl, FileData *fd, gint color_set)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 if (vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 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
162 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
163 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 static void vflist_move_cursor(ViewFileList *vfl, GtkTreeIter *iter)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 GtkTreePath *tpath;
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
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 tpath = gtk_tree_model_get_path(store, iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 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
174 gtk_tree_path_free(tpath);
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
157
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
177
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
178 static gint vflist_column_idx(ViewFileList *vfl, gint store_idx)
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
179 {
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
180 GList *columns, *work;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
181 gint i = 0;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
182
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
183 columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vfl->listview));
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
184 work = columns;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
185 while (work)
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
186 {
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
187 GtkTreeViewColumn *column = work->data;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
188 if (store_idx == GPOINTER_TO_INT(g_object_get_data (G_OBJECT(column), "column_store_idx")))
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
189 break;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
190 work = work->next;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
191 i++;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
192 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
193
157
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
194 g_list_free(columns);
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
195 return i;
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
196 }
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
197
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
198
9
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 * dnd
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 */
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 static void vflist_dnd_get(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 guint time, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 gchar *uri_text = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 gint total;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 if (!vfl->click_fd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 list = vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
222 list = g_list_append(NULL, file_data_ref(vfl->click_fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 if (!list) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
227 uri_text = uri_text_from_filelist(list, &total, (info == TARGET_TEXT_PLAIN));
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
228 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229
495
c7a2471e5c4e Introduce macros to display debug messages.
zas_
parents: 479
diff changeset
230 DEBUG_1(uri_text);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231
64
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
232 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
233 8, (guchar *)uri_text, total);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 g_free(uri_text);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237 static void vflist_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 vflist_color_set(vfl, vfl->click_fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 if (vfl->thumbs_enabled &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 vfl->click_fd && vfl->click_fd->pixbuf)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 gint items;
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 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 items = vflist_selection_count(vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 items = 1;
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 dnd_set_drag_icon(widget, context, vfl->click_fd->pixbuf, items);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257 static void vflist_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 ViewFileList *vfl = data;
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 vflist_color_set(vfl, vfl->click_fd, FALSE);
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 if (context->action == GDK_ACTION_MOVE)
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 vflist_refresh(vfl);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 static void vflist_dnd_init(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 gtk_drag_source_set(vfl->listview, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 g_signal_connect(G_OBJECT(vfl->listview), "drag_data_get",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 G_CALLBACK(vflist_dnd_get), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 g_signal_connect(G_OBJECT(vfl->listview), "drag_begin",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 G_CALLBACK(vflist_dnd_begin), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 g_signal_connect(G_OBJECT(vfl->listview), "drag_end",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 G_CALLBACK(vflist_dnd_end), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 * pop-up menu
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 static GList *vflist_pop_menu_file_list(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 if (!vfl->click_fd) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 return vflist_selection_get_list(vfl);
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
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
297 return g_list_append(NULL, file_data_ref(vfl->click_fd));
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 static void vflist_pop_menu_edit_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 ViewFileList *vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 GList *list;
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 vfl = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 n = GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 if (!vfl) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 list = vflist_pop_menu_file_list(vfl);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
312 start_editor_from_filelist(n, list);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
313 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 }
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 static void vflist_pop_menu_info_cb(GtkWidget *widget, gpointer 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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319
479
5212d4fed37f Ensure Properties dialog is displayed above fullscreen window.
zas_
parents: 475
diff changeset
320 info_window_new(NULL, vflist_pop_menu_file_list(vfl), NULL);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 static void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 ViewFileList *vfl = data;
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 if (vflist_row_is_selected(vfl, vfl->click_fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 list = vflist_selection_get_list(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 view_window_new_from_list(list);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
333 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
337 view_window_new(vfl->click_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 }
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 static void vflist_pop_menu_copy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 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
346 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347
497
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
348 static void vflist_pop_menu_copy_path_cb(GtkWidget *widget, gpointer data)
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
349 {
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
350 ViewFileList *vfl = data;
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
351
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
352 file_util_copy_path_list_to_clipboard(vflist_pop_menu_file_list(vfl));
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
353 }
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
354
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 static void vflist_pop_menu_move_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 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
360 }
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 static void vflist_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 list = vflist_pop_menu_file_list(vfl);
341
15c6b94545a2 Move safe_delete* and in place rename options to file_ops
zas_
parents: 334
diff changeset
368 if (options->file_ops.enable_in_place_rename &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 list && !list->next && vfl->click_fd)
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
374 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 if (vflist_find_row(vfl, vfl->click_fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 tree_edit_by_path(GTK_TREE_VIEW(vfl->listview), tpath,
157
b73743a01384 fixed in-place rename
nadvornik
parents: 150
diff changeset
383 vflist_column_idx(vfl, FILE_COLUMN_NAME), vfl->click_fd->name,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 vflist_row_rename_cb, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 file_util_rename(NULL, list, vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 static void vflist_pop_menu_delete_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 file_util_delete(NULL, vflist_pop_menu_file_list(vfl), vfl->listview);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 static void vflist_pop_menu_sort_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 ViewFileList *vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 SortType type;
113
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 111
diff changeset
404
55166d93498d Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents: 111
diff changeset
405 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
406
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 vfl = submenu_item_get_data(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 if (!vfl) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 type = (SortType)GPOINTER_TO_INT(data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 if (vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 layout_sort_set(vfl->layout, type, vfl->sort_ascend);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 vflist_sort_set(vfl, type, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422 static void vflist_pop_menu_sort_ascend_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 if (vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 layout_sort_set(vfl->layout, vfl->sort_method, !vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 vflist_sort_set(vfl, vfl->sort_method, !vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 static void vflist_pop_menu_icons_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 341
diff changeset
440 if (vfl->layout) layout_views_set(vfl->layout, vfl->layout->dir_view_type, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 static void vflist_pop_menu_thumbs_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 if (vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 layout_thumb_set(vfl->layout, !vfl->thumbs_enabled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 vflist_thumb_set(vfl, !vfl->thumbs_enabled);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 }
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 static void vflist_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
466 static void vflist_pop_menu_sel_mark_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
467 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
468 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
469 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_SET);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
470 }
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
471
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
472 static void vflist_pop_menu_sel_mark_and_cb(GtkWidget *widget, gpointer data)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
473 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
474 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
475 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_AND);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
476 }
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
477
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
478 static void vflist_pop_menu_sel_mark_or_cb(GtkWidget *widget, gpointer data)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
479 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
480 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
481 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_OR);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
482 }
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
483
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
484 static void vflist_pop_menu_sel_mark_minus_cb(GtkWidget *widget, gpointer data)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
485 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
486 ViewFileList *vfl = data;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
487 vflist_mark_to_selection(vfl, vfl->active_mark, MTS_MODE_MINUS);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
488 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
489
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
490 static void vflist_pop_menu_set_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
491 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
492 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
493 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_SET);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
494 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
495
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
496 static void vflist_pop_menu_res_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
497 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
498 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
499 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_RESET);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
500 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
501
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
502 static void vflist_pop_menu_toggle_mark_sel_cb(GtkWidget *widget, gpointer data)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
503 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
504 ViewFileList *vfl = data;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
505 vflist_selection_to_mark(vfl, vfl->active_mark, STM_MODE_TOGGLE);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
506 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
507
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
508
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 static void vflist_popup_destroy_cb(GtkWidget *widget, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 vflist_color_set(vfl, vfl->click_fd, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 vfl->popup = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
517
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
518 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
519 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 GtkWidget *menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 GtkWidget *item;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522 GtkWidget *submenu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523 gint active;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
525 vflist_color_set(vfl, fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 active = (fd != NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 menu = popup_menu_short_lived();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 g_signal_connect(G_OBJECT(menu), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 G_CALLBACK(vflist_popup_destroy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
532 if (col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
533 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
534 gint mark = col_idx - FILE_COLUMN_MARKS;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
535 gchar *str_set_mark = g_strdup_printf(_("_Set mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
536 gchar *str_res_mark = g_strdup_printf(_("_Reset mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
537 gchar *str_toggle_mark = g_strdup_printf(_("_Toggle mark %d"), mark + 1);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
538 gchar *str_sel_mark = g_strdup_printf(_("_Select mark %d"), mark + 1);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
539 gchar *str_sel_mark_or = g_strdup_printf(_("_Add mark %d"), mark + 1);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
540 gchar *str_sel_mark_and = g_strdup_printf(_("_Intersection with mark %d"), mark + 1);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
541 gchar *str_sel_mark_minus = g_strdup_printf(_("_Unselect mark %d"), mark + 1);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
542
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
543
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
544 vfl->active_mark = mark;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
545 menu_item_add_sensitive(menu, str_set_mark, active,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
546 G_CALLBACK(vflist_pop_menu_set_mark_sel_cb), vfl);
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
547
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
548 menu_item_add_sensitive(menu, str_res_mark, active,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
549 G_CALLBACK(vflist_pop_menu_res_mark_sel_cb), vfl);
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
550
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
551 menu_item_add_sensitive(menu, str_toggle_mark, active,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
552 G_CALLBACK(vflist_pop_menu_toggle_mark_sel_cb), vfl);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
553
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
554 menu_item_add_divider(menu);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
555
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
556 menu_item_add_sensitive(menu, str_sel_mark, active,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
557 G_CALLBACK(vflist_pop_menu_sel_mark_cb), vfl);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
558 menu_item_add_sensitive(menu, str_sel_mark_or, active,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
559 G_CALLBACK(vflist_pop_menu_sel_mark_or_cb), vfl);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
560 menu_item_add_sensitive(menu, str_sel_mark_and, active,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
561 G_CALLBACK(vflist_pop_menu_sel_mark_and_cb), vfl);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
562 menu_item_add_sensitive(menu, str_sel_mark_minus, active,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
563 G_CALLBACK(vflist_pop_menu_sel_mark_minus_cb), vfl);
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
564
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
565 menu_item_add_divider(menu);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
566
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
567 g_free(str_set_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
568 g_free(str_res_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
569 g_free(str_toggle_mark);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
570 g_free(str_sel_mark);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
571 g_free(str_sel_mark_and);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
572 g_free(str_sel_mark_or);
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
573 g_free(str_sel_mark_minus);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
574 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
575
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 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
577 gtk_widget_set_sensitive(item, active);
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 menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 G_CALLBACK(vflist_pop_menu_info_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 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
582 G_CALLBACK(vflist_pop_menu_view_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 G_CALLBACK(vflist_pop_menu_copy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 menu_item_add_sensitive(menu, _("_Move..."), active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 G_CALLBACK(vflist_pop_menu_move_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 menu_item_add_sensitive(menu, _("_Rename..."), active,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 G_CALLBACK(vflist_pop_menu_rename_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
497
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
592 G_CALLBACK(vflist_pop_menu_delete_cb), vfl);
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
593 if (options->show_copy_path)
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
594 menu_item_add_sensitive(menu, _("_Copy path"), active,
a33badd85f16 Allow the copy of file paths to clipboard.
zas_
parents: 495
diff changeset
595 G_CALLBACK(vflist_pop_menu_copy_path_cb), vfl);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 menu_item_add_divider(menu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 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
600 FALSE, FALSE, TRUE, vfl->sort_method);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 menu_item_add_divider(submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 menu_item_add_check(submenu, _("Ascending"), vfl->sort_ascend,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 G_CALLBACK(vflist_pop_menu_sort_ascend_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 item = menu_item_add(menu, _("_Sort"), NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 menu_item_add_check(menu, _("View as _icons"), FALSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 G_CALLBACK(vflist_pop_menu_icons_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 menu_item_add_check(menu, _("Show _thumbnails"), vfl->thumbs_enabled,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 G_CALLBACK(vflist_pop_menu_thumbs_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612 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
613
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 return menu;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 * callbacks
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 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
624 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626 gchar *old_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 gchar *new_path;
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 (strlen(new) == 0) return FALSE;
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 old_path = concat_dir_and_file(vfl->path, old);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 new_path = concat_dir_and_file(vfl->path, new);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 if (strchr(new, '/') != NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 gchar *text = g_strdup_printf(_("Invalid file name:\n%s"), new);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637 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
638 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 else if (isfile(new_path))
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 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
643 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
644 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
646 else
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
648 gint row = vflist_index_by_path(vfl, old_path);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
649 if (row >= 0)
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
650 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
651 GList *work = g_list_nth(vfl->list, row);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
652 FileData *fd = work->data;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
653
143
0d1bf3ac6cd8 improved FileDataChangeInfo structure, check for another file operation in progress
nadvornik
parents: 142
diff changeset
654 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
655 {
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
656 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
657 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
658 g_free(text);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
659 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
660 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
661
9
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 g_free(old_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 g_free(new_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 return FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 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
670 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 gint cw, ch;
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 if (vflist_find_row(vfl, vfl->click_fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 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
681 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682 *y += ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 popup_menu_position_clamp(menu, x, y, 0);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686 static gint vflist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 GtkTreePath *tpath;
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 if (event->keyval != GDK_Menu) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 gtk_tree_view_get_cursor(GTK_TREE_VIEW(vfl->listview), &tpath, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 if (tpath)
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 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
702 gtk_tree_path_free(tpath);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
708
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
709 vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, 0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 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
711
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
715 static gint vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
718 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
720 FileData *fd = NULL;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
721 GtkTreeViewColumn *column;
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
722 gint col_idx = 0;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
723
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 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
725 &tpath, &column, NULL, NULL))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 GtkTreeModel *store;
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
728 col_idx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(column), "column_store_idx"));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
729
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
730 if (bevent->button == MOUSE_BUTTON_LEFT &&
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
731 col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
732 return FALSE;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
733
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
734 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
737 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
738 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739 gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
740 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
741 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
742 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
744 vfl->click_fd = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
745
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
746 if (bevent->button == MOUSE_BUTTON_RIGHT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 {
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
748 vfl->popup = vflist_pop_menu(vfl, vfl->click_fd, col_idx);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749 gtk_menu_popup(GTK_MENU(vfl->popup), NULL, NULL, NULL, NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750 bevent->button, bevent->time);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 }
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 (!fd) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
755
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
756 if (bevent->button == MOUSE_BUTTON_MIDDLE)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 if (!vflist_row_is_selected(vfl, fd))
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_color_set(vfl, fd, TRUE);
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 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
764
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
765
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
766 if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_BUTTON_PRESS &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
767 !(bevent->state & GDK_SHIFT_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768 !(bevent->state & GDK_CONTROL_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
769 vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770 {
526
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
771 GtkTreeSelection *selection;
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
772
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
773 gtk_widget_grab_focus(widget);
526
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
774
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
775
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
776 /* returning FALSE and further processing of the event is needed for
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
777 correct operation of the expander, to show the sidecar files.
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
778 It however resets the selection of multiple files. With this condition
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
779 it should work for both cases */
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
780 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
92b5a033a279 fixed dragging multiple files from file list
nadvornik
parents: 518
diff changeset
781 return (gtk_tree_selection_count_selected_rows(selection) > 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
782 }
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 0
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
785 if (bevent->button == MOUSE_BUTTON_LEFT && bevent->type == GDK_2BUTTON_PRESS)
9
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 if (vfl->layout) layout_image_full_screen_start(vfl->layout);
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 #endif
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 return FALSE;
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 static gint vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
795 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
796 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
797 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
798 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
799 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
800
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
801 if (bevent->button == MOUSE_BUTTON_MIDDLE)
9
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 vflist_color_set(vfl, vfl->click_fd, FALSE);
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
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
806 if (bevent->button != MOUSE_BUTTON_LEFT && bevent->button != MOUSE_BUTTON_MIDDLE)
9
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 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
809 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
810
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
811 if ((bevent->x != 0 || bevent->y != 0) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
812 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
813 &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
814 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
815 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
816
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
817 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
818 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
819 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
820 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
821 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
822
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
823 if (bevent->button == MOUSE_BUTTON_MIDDLE)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
824 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
825 if (fd && vfl->click_fd == fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
826 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
827 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
828
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
829 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
830 if (vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
831 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
832 gtk_tree_selection_unselect_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
833 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
834 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
835 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
836 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
837 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
838 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
839 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
840 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
841
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
842 if (fd && vfl->click_fd == fd &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
843 !(bevent->state & GDK_SHIFT_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
844 !(bevent->state & GDK_CONTROL_MASK ) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
845 vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
846 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
847 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
848
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
849 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
850 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
851 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
852 vflist_move_cursor(vfl, &iter);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
853 // return TRUE;// FIXME - expand
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
854 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
855
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
856 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
857 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
858
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
859 static void vflist_select_image(ViewFileList *vfl, FileData *sel_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
860 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
861 FileData *read_ahead_fd = NULL;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
862 gint row;
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
863 FileData *cur_fd;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
864 if (!sel_fd) return;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
865
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
866 cur_fd = layout_image_get_fd(vfl->layout);
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
867 if (sel_fd == cur_fd) return; /* no change */
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
868
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
869 row = g_list_index(vfl->list, sel_fd);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
870 // FIXME sidecar data
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
871
334
df868b947aa0 Rename image-related options.
zas_
parents: 333
diff changeset
872 if (sel_fd && options->image.enable_read_ahead && row >= 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
873 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
874 if (row > g_list_index(vfl->list, cur_fd) &&
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
875 row + 1 < vflist_count(vfl, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
876 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
877 read_ahead_fd = vflist_index_get_data(vfl, row + 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
878 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
879 else if (row > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
880 {
144
2310066cc55a fixed preloading images in file list
nadvornik
parents: 143
diff changeset
881 read_ahead_fd = vflist_index_get_data(vfl, row - 1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
882 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
883 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
884
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
885 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
886 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
887
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
888 static gint vflist_select_idle_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
889 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
890 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
891
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
892 if (!vfl->layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
893 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
894 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
895 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
896 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
897
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
898 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
899
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
900 if (vfl->select_fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
901 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
902 vflist_select_image(vfl, vfl->select_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
903 vfl->select_fd = NULL;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
906 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
907 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
908 }
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 static void vflist_select_idle_cancel(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
911 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
912 if (vfl->select_idle_id != -1) g_source_remove(vfl->select_idle_id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
913 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
914 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
915
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
916 static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
917 gboolean path_currently_selected, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
918 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
919 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
920 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
921
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
922 if (!path_currently_selected &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
923 gtk_tree_model_get_iter(store, &iter, tpath))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
924 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
925 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
926 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
927 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
928 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
929 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
930 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
931
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
932 if (vfl->layout &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
933 vfl->select_idle_id == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
934 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
935 vfl->select_idle_id = g_idle_add(vflist_select_idle_cb, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
936 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
937
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
938 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
939 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
940
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
941 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
942 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
943 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
944 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
945 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
946
259
fa7d69e7d02d Comment out unused code.
zas_
parents: 250
diff changeset
947 /*
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
948 static gboolean vflist_dummy_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
949 gboolean path_currently_selected, gpointer data)
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
950 {
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
951 return TRUE;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
952 }
259
fa7d69e7d02d Comment out unused code.
zas_
parents: 250
diff changeset
953 */
93
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
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
956 static void vflist_setup_iter(ViewFileList *vfl, GtkTreeStore *store, GtkTreeIter *iter, FileData *fd)
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
957 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
958 int i;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
959 gchar *size;
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
960 gchar *sidecars = NULL;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
961
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
962 if (fd->sidecar_files)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
963 sidecars = sidecar_file_data_list_to_string(fd);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
964 size = text_from_size(fd->size);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
965
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
966 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
967 FILE_COLUMN_THUMB, (vfl->thumbs_enabled) ? fd->pixbuf : NULL,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
968 FILE_COLUMN_NAME, fd->name,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
969 FILE_COLUMN_SIDECARS, sidecars,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
970 FILE_COLUMN_SIZE, size,
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
971 FILE_COLUMN_DATE, text_from_time(fd->date),
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
972 FILE_COLUMN_COLOR, FALSE, -1);
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
973 for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
974 gtk_tree_store_set(store, iter, FILE_COLUMN_MARKS + i, fd->marks[i], -1);
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
975
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
976 g_free(size);
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
977 if (sidecars)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
978 g_free(sidecars);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
979 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
980
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
981 static void vflist_setup_iter_with_sidecars(ViewFileList *vfl, GtkTreeStore *store, GtkTreeIter *iter, FileData *fd)
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
982 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
983 GList *work;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
984 GtkTreeIter s_iter;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
985 gint valid;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
986
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
987 vflist_setup_iter(vfl, store, iter, fd);
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
988
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
989
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
990 /* this is almost the same code as in vflist_populate_view
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
991 maybe it should be made more generic and used in both places */
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
992
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
993
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
994 valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(store), &s_iter, iter);
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
995
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
996 work = fd->sidecar_files;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
997 while (work)
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
998 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
999 gint match;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1000 FileData *sfd = work->data;
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1001 gint done = FALSE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1002
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1003 while (!done)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1004 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1005 FileData *old_sfd = NULL;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1006
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1007 if (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1008 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1009 gtk_tree_model_get(GTK_TREE_MODEL(store), &s_iter, FILE_COLUMN_POINTER, &old_sfd, -1);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1010
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1011 if (sfd == old_sfd)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1012 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1013 match = 0;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1014 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1015 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1016 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1017 match = filelist_sort_compare_filedata_full(sfd, old_sfd, SORT_NAME, TRUE);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1018 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1019 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1020
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1021 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1022 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1023 match = -1;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1024 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1025
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1026 if (match < 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1027 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1028 GtkTreeIter new;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1029
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1030 if (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1031 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1032 gtk_tree_store_insert_before(store, &new, iter, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1033 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1034 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1035 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1036 gtk_tree_store_append(store, &new, iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1037 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1038
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1039 vflist_setup_iter(vfl, store, &new, sfd);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1040
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1041 done = TRUE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1042 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1043 else if (match > 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1044 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1045 valid = gtk_tree_store_remove(store, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1046 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1047 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1048 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1049 vflist_setup_iter(vfl, store, &s_iter, sfd);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1050
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1051 if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1052
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1053 done = TRUE;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1054 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1055 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1056 work = work->next;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1057 }
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1058
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1059 while (valid)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1060 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1061 valid = gtk_tree_store_remove(store, &s_iter);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1062 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1063 }
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1064
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1065 void vflist_sort_set(ViewFileList *vfl, SortType type, gint ascend)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1066 {
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1067 gint i;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1068 GHashTable *fd_idx_hash = g_hash_table_new(NULL, NULL);
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1069 gint *new_order;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1070 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1071 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1072
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1073 if (vfl->sort_method == type && vfl->sort_ascend == ascend) return;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1074 if (!vfl->list) return;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1075
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1076 work = vfl->list;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1077 i = 0;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1078 while (work)
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1079 {
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1080 FileData *fd = work->data;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1081 g_hash_table_insert(fd_idx_hash, fd, GINT_TO_POINTER(i));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1082 i++;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1083 work = work->next;
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1084 }
9
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 vfl->sort_method = type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1087 vfl->sort_ascend = ascend;
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 vfl->list = filelist_sort(vfl->list, vfl->sort_method, vfl->sort_ascend);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1090
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1091 new_order = g_malloc(i * sizeof(gint));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1092
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1093 work = vfl->list;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1094 i = 0;
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1095 while (work)
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1096 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1097 FileData *fd = work->data;
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1098 new_order[i] = GPOINTER_TO_INT(g_hash_table_lookup(fd_idx_hash, fd));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1099 i++;
93
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1100 work = work->next;
f1c8f8632e23 Thu Nov 2 14:38:54 2006 John Ellis <johne@verizon.net>
gqview
parents: 64
diff changeset
1101 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1102
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1103 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview)));
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1104 gtk_tree_store_reorder(store, NULL, new_order);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1105
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1106 g_free(new_order);
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
1107 g_hash_table_destroy(fd_idx_hash);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1108 }
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 /*
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 updates
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 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1115
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1116 static gint vflist_thumb_next(ViewFileList *vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1117
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1118 static void vflist_thumb_status(ViewFileList *vfl, gdouble val, const gchar *text)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1119 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1120 if (vfl->func_thumb_status)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1121 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1122 vfl->func_thumb_status(vfl, val, text, vfl->data_thumb_status);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1123 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1124 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1125
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1126 static void vflist_thumb_cleanup(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1127 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1128 vflist_thumb_status(vfl, 0.0, NULL);
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 vfl->thumbs_count = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1131 vfl->thumbs_running = FALSE;
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 thumb_loader_free(vfl->thumbs_loader);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1134 vfl->thumbs_loader = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1135
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1136 vfl->thumbs_filedata = NULL;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1139 static void vflist_thumb_stop(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1140 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1141 if (vfl->thumbs_running) vflist_thumb_cleanup(vfl);
9
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 static void vflist_thumb_do(ViewFileList *vfl, ThumbLoader *tl, FileData *fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1145 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1146 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1147 GtkTreeIter iter;
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 if (!fd || vflist_find_row(vfl, fd, &iter) < 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1150
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1151 if (fd->pixbuf) g_object_unref(fd->pixbuf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1152 fd->pixbuf = thumb_loader_get_pixbuf(tl, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1153
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1154 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
1155 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
1156
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1157 vflist_thumb_status(vfl, (gdouble)(vfl->thumbs_count) / vflist_sidecar_list_count(vfl->list), _("Loading thumbs..."));
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1160 static void vflist_thumb_error_cb(ThumbLoader *tl, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1161 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1162 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1163
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1164 if (vfl->thumbs_filedata && vfl->thumbs_loader == tl)
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 vflist_thumb_do(vfl, tl, vfl->thumbs_filedata);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1167 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1168
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1169 while (vflist_thumb_next(vfl));
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1172 static void vflist_thumb_done_cb(ThumbLoader *tl, gpointer data)
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 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1175
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1176 if (vfl->thumbs_filedata && vfl->thumbs_loader == tl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1177 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1178 vflist_thumb_do(vfl, tl, vfl->thumbs_filedata);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1179 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1180
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1181 while (vflist_thumb_next(vfl));
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 static gint vflist_thumb_next(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1185 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1186 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1187 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1189 /* first check the visible files */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1190
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1191 if (GTK_WIDGET_REALIZED(vfl->listview) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1192 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
1193 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1194 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1195 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1196 gint valid = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1197
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1198 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1199 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1200 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1201
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1202 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
1203 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1204 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1205 if (fd->pixbuf) fd = NULL;
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 valid = gtk_tree_model_iter_next(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1208 }
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 /* then find first undone */
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 if (!fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1214 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1215 GList *work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1216 while (work && !fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1217 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1218 FileData *fd_p = work->data;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1219 if (!fd_p->pixbuf)
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1220 fd = fd_p;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1221 else
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1222 {
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1223 GList *work2 = fd_p->sidecar_files;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1224
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1225 while (work2 && !fd)
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1226 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1227 fd_p = work2->data;
169
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1228 if (!fd_p->pixbuf) fd = fd_p;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1229 work2 = work2->next;
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1230 }
501010403a04 fixed loading thumbnails for sidecar files
nadvornik
parents: 168
diff changeset
1231 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1232 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1233 }
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 if (!fd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1237 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1238 /* done */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1239 vflist_thumb_cleanup(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1240 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1241 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1242
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1243 vfl->thumbs_count++;
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 vfl->thumbs_filedata = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1246
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1247 thumb_loader_free(vfl->thumbs_loader);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1248
333
767b53cd9ab7 Rename thumbnails related options.
zas_
parents: 318
diff changeset
1249 vfl->thumbs_loader = thumb_loader_new(options->thumbnails.max_width, options->thumbnails.max_height);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1250 thumb_loader_set_callbacks(vfl->thumbs_loader,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1251 vflist_thumb_done_cb,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1252 vflist_thumb_error_cb,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1253 NULL,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1254 vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1255
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1256 if (!thumb_loader_start(vfl->thumbs_loader, fd->path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1257 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1258 /* set icon to unknown, continue */
506
fc9c8a3e1a8b Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents: 497
diff changeset
1259 DEBUG_1("thumb loader start failed %s", vfl->thumbs_loader->path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1260 vflist_thumb_do(vfl, vfl->thumbs_loader, fd);
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 TRUE;
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 return FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1268 static void vflist_thumb_update(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1269 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1270 vflist_thumb_stop(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1271 if (!vfl->thumbs_enabled) return;
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 vflist_thumb_status(vfl, 0.0, _("Loading thumbs..."));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1274 vfl->thumbs_running = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1275
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1276 while (vflist_thumb_next(vfl));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1277 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1278
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 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1281 * row stuff
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 */
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 FileData *vflist_index_get_data(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1286 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1287 return g_list_nth_data(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1288 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1289
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1290 gchar *vflist_index_get_path(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1291 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1292 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1293
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1294 fd = g_list_nth_data(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1295
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1296 return (fd ? fd->path : NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1297 }
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 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
1300 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1301 gint p = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1302 GList *work;
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 if (!path) return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1305
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1306 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1307 while (work)
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 FileData *fd_n = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1310 if (strcmp(path, fd_n->path) == 0)
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 if (fd) *fd = fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1313 return p;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1314 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1315 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1316 p++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1317 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1318
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1319 if (fd) *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1320 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1321 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1322
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1323 gint vflist_index_by_path(ViewFileList *vfl, const gchar *path)
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 return vflist_row_by_path(vfl, path, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1326 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1327
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1328 gint vflist_count(ViewFileList *vfl, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1329 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1330 if (bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1331 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1332 gint64 b = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1333 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1334
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1335 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1336 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1337 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1338 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1339 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1340 b += fd->size;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1343 *bytes = b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1344 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1345
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1346 return g_list_length(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1347 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1348
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1349 GList *vflist_get_list(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1350 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1351 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1352 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1353
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1354 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1355 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1356 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1357 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1358 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1359
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1360 list = g_list_prepend(list, file_data_ref(fd));
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1363 return g_list_reverse(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1364 }
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 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1367 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1368 * selections
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1369 *-----------------------------------------------------------------------------
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 static gint vflist_row_is_selected(ViewFileList *vfl, FileData *fd)
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1375 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1376 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1377 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1378 gint found = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1379
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1380 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1381 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1382 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1383 while (!found && work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1384 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1385 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1386 FileData *fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1387 GtkTreeIter iter;
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 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1390 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd_n, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1391 if (fd_n == fd) found = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1392 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1393 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1394 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1395 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1396
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1397 return found;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1398 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1399
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1400 gint vflist_index_is_selected(ViewFileList *vfl, gint row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1401 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1402 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1403
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1404 fd = vflist_index_get_data(vfl, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1405 return vflist_row_is_selected(vfl, fd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1408 gint vflist_selection_count(ViewFileList *vfl, gint64 *bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1409 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1410 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1411 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1412 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1413 gint count;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1414
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1415 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1416 slist = gtk_tree_selection_get_selected_rows(selection, &store);
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 if (bytes)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1419 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1420 gint64 b = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1421 GList *work;
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 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1424 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1425 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1426 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1427 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1428 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1429
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1430 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1431 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1432 b += fd->size;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1433
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1434 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1435 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1436
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1437 *bytes = b;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1438 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1439
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1440 count = g_list_length(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1441 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1442 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1443
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1444 return count;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1445 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1446
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1447 GList *vflist_selection_get_list(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1448 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1449 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1450 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1451 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1452 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1453 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1454
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1455 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1456 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1457 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1458 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1459 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1460 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1461 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1462 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1463
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1464 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1465 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1466
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1467 list = g_list_prepend(list, file_data_ref(fd));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1468
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1469 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1470 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1471 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1472 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1473
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1474 return g_list_reverse(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1475 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1476
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1477 GList *vflist_selection_get_list_by_index(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1478 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1479 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1480 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1481 GList *slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1482 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1483 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1484
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1485 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1486 slist = gtk_tree_selection_get_selected_rows(selection, &store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1487 work = slist;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1488 while (work)
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 GtkTreePath *tpath = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1491 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1492 GtkTreeIter iter;
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 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1495 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1496
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1497 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
1498
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1499 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1500 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1501 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1502 g_list_free(slist);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1503
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1504 return g_list_reverse(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1505 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1506
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1507 void vflist_select_all(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1508 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1509 GtkTreeSelection *selection;
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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1512 gtk_tree_selection_select_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1513
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1514 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1515 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1516
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1517 void vflist_select_none(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1518 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1519 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1520
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1521 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1522 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1523 }
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 void vflist_select_by_path(ViewFileList *vfl, const gchar *path)
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 FileData *fd;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1528
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1529 if (vflist_row_by_path(vfl, path, &fd) < 0) return;
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1530
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1531 vflist_select_by_fd(vfl, fd);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1532 }
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1533
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1534 void vflist_select_by_fd(ViewFileList *vfl, FileData *fd)
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
1535 {
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1536 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1537
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1538 if (vflist_find_row(vfl, fd, &iter) < 0) return;
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 tree_view_row_make_visible(GTK_TREE_VIEW(vfl->listview), &iter, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1541
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1542 if (!vflist_row_is_selected(vfl, fd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1543 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1544 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1545 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1546 GtkTreePath *tpath;
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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1549 gtk_tree_selection_unselect_all(selection);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1550 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1551 vflist_move_cursor(vfl, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1552
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1553 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1554 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1555 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
1556 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1557 }
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
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1560 void vflist_mark_to_selection(ViewFileList *vfl, gint mark, MarkToSelectionMode mode)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1561 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1562 GtkTreeModel *store;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1563 GtkTreeIter iter;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1564 GtkTreeSelection *selection;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1565 gint valid;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1566
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1567 g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1568
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1569 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1570 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1571
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1572 valid = gtk_tree_model_get_iter_first(store, &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1573 while (valid)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1574 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1575 FileData *fd;
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1576 gboolean mark_val, selected;
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1577 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, -1);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1578
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1579 mark_val = fd->marks[mark];
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1580 selected = gtk_tree_selection_iter_is_selected(selection, &iter);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1581
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1582 switch (mode)
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1583 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1584 case MTS_MODE_SET: selected = mark_val;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1585 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1586 case MTS_MODE_OR: selected = mark_val | selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1587 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1588 case MTS_MODE_AND: selected = mark_val & selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1589 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1590 case MTS_MODE_MINUS: selected = !mark_val & selected;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1591 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1592 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1593
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1594 if (selected)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1595 gtk_tree_selection_select_iter(selection, &iter);
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1596 else
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1597 gtk_tree_selection_unselect_iter(selection, &iter);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1598
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1599 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1600 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1601 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1602
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1603 void vflist_selection_to_mark(ViewFileList *vfl, gint mark, SelectionToMarkMode mode)
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1604 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1605 GtkTreeModel *store;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1606 GtkTreeSelection *selection;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1607 GList *slist;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1608 GList *work;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1609
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1610 g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1611
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1612 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1613 slist = gtk_tree_selection_get_selected_rows(selection, &store);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1614 work = slist;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1615 while (work)
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1616 {
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1617 GtkTreePath *tpath = work->data;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1618 FileData *fd;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1619 GtkTreeIter iter;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1620
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1621 gtk_tree_model_get_iter(store, &iter, tpath);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1622 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1623
161
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1624 switch (mode)
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1625 {
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1626 case STM_MODE_SET: fd->marks[mark] = 1;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1627 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1628 case STM_MODE_RESET: fd->marks[mark] = 0;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1629 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1630 case STM_MODE_TOGGLE: fd->marks[mark] = !fd->marks[mark];
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1631 break;
08ab6367b4e6 complete set of boolean operation with marks -
nadvornik
parents: 157
diff changeset
1632 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1633
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1634 gtk_tree_store_set(GTK_TREE_STORE(store), &iter, FILE_COLUMN_MARKS + mark, fd->marks[mark], -1);
150
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1635
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1636 work = work->next;
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1637 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1638 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1639 g_list_free(slist);
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1640 }
976fba0add7c more operations with file marks
nadvornik
parents: 149
diff changeset
1641
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1642 /*
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 * core (population)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1645 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1646 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1647
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1648 static void vflist_listview_set_height(GtkWidget *listview, gint thumb)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1649 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1650 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1651 GtkCellRenderer *cell;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1652 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1653
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1654 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
1655 if (!column) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1656
333
767b53cd9ab7 Rename thumbnails related options.
zas_
parents: 318
diff changeset
1657 gtk_tree_view_column_set_fixed_width(column, ((thumb) ? options->thumbnails.max_width : 4) + 10);
9
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 list = gtk_tree_view_column_get_cell_renderers(column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1660 if (!list) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1661 cell = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1662 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1663
333
767b53cd9ab7 Rename thumbnails related options.
zas_
parents: 318
diff changeset
1664 g_object_set(G_OBJECT(cell), "height", (thumb) ? options->thumbnails.max_height : -1, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1665 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1666 }
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 static void vflist_populate_view(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1669 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1670 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1671 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1672 gint thumbs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1673 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1674 GtkTreeRowReference *visible_row = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1675 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1676 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1677
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1678 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
1679 thumbs = vfl->thumbs_enabled;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1680
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1681 vflist_thumb_stop(vfl);
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 (!vfl->list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1684 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1685 gtk_tree_store_clear(store);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1686 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1687 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1688 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1689
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1690 if (GTK_WIDGET_REALIZED(vfl->listview) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1691 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
1692 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1693 visible_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1694 gtk_tree_path_free(tpath);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1697 vflist_listview_set_height(vfl->listview, thumbs);
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 valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1700
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1701 work = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1702 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1703 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1704 gint match;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1705 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1706 gint done = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1707
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1708 while (!done)
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 FileData *old_fd = NULL;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1711
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1712 if (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1713 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1714 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &old_fd, -1);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1715
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1716 if (fd == old_fd)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1717 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1718 match = 0;
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1719 }
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1720 else
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1721 {
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1722 match = filelist_sort_compare_filedata_full(fd, old_fd, vfl->sort_method, vfl->sort_ascend);
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1723 if (match == 0)
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1724 match = -1; /* probably should not happen*/
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1725 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1726 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1727
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1728 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1729 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1730 match = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1731 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1732
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1733 if (match < 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1734 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1735 GtkTreeIter new;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1736
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1737 if (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1738 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1739 gtk_tree_store_insert_before(store, &new, NULL, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1740 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1741 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1742 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1743 gtk_tree_store_append(store, &new, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1744 }
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1745 vflist_setup_iter_with_sidecars(vfl, store, &new, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1746
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1747 done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1748 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1749 else if (match > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1750 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1751 valid = gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1752 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1753 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1754 {
167
05bf5d364dba fixed filelist refresh
nadvornik
parents: 161
diff changeset
1755 vflist_setup_iter_with_sidecars(vfl, store, &iter, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1756
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1757 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
1758
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1759 done = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1760 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1761 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1762 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1763 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1764
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1765 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1766 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1767 valid = gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1768 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1769
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1770 if (visible_row)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1771 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1772 if (gtk_tree_row_reference_valid(visible_row))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1773 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1774 tpath = gtk_tree_row_reference_get_path(visible_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1775 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
1776 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1777 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1778 gtk_tree_row_reference_free(visible_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1779 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1780
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1781 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1782 vflist_thumb_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1783 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1784
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1785 gint vflist_refresh(ViewFileList *vfl)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1786 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1787 GList *old_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1788 gint ret = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1789
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1790 old_list = vfl->list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1791 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1792
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1793 if (vfl->path)
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 ret = filelist_read(vfl->path, &vfl->list, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1796 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1797
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1798 vfl->list = filelist_sort(vfl->list, vfl->sort_method, vfl->sort_ascend);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1799 vflist_populate_view(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1800
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1801 filelist_free(old_list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1802
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1803 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1804 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1805
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1806 /* 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
1807
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1808 #define CELL_HEIGHT_OVERRIDE 512
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 static void cell_renderer_height_override(GtkCellRenderer *renderer)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1811 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1812 GParamSpec *spec;
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 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
1815 if (spec && G_IS_PARAM_SPEC_INT(spec))
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 GParamSpecInt *spec_int;
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 spec_int = G_PARAM_SPEC_INT(spec);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1820 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
1821 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1822 }
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 static GdkColor *vflist_listview_color_shifted(GtkWidget *widget)
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 static GdkColor color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1827 static GtkWidget *done = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1828
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1829 if (done != widget)
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 GtkStyle *style;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1832
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1833 style = gtk_widget_get_style(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1834 memcpy(&color, &style->base[GTK_STATE_NORMAL], sizeof(color));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1835 shift_color(&color, -1, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1836 done = widget;
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 return &color;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1842 static void vflist_listview_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1843 GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1844 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1845 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1846 gboolean set;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1847
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1848 gtk_tree_model_get(tree_model, iter, FILE_COLUMN_COLOR, &set, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1849 g_object_set(G_OBJECT(cell),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1850 "cell-background-gdk", vflist_listview_color_shifted(vfl->listview),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1851 "cell-background-set", set, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1852 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1853
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1854 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
1855 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1856 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1857 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1858
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1859 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1860 gtk_tree_view_column_set_title(column, title);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1861 gtk_tree_view_column_set_min_width(column, 4);
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 if (!image)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1864 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1865 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
1866 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1867 if (right_justify)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1868 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1869 g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1870 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1871 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1872 gtk_tree_view_column_add_attribute(column, renderer, "text", n);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1873 if (expand)
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1874 gtk_tree_view_column_set_expand(column, TRUE);
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1875 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1876 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1877 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1878 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1879 renderer = gtk_cell_renderer_pixbuf_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1880 cell_renderer_height_override(renderer);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1881 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1882 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", n);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1883 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1884
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1885 gtk_tree_view_column_set_cell_data_func(column, renderer, vflist_listview_color_cb, vfl, NULL);
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 507
diff changeset
1886 g_object_set_data(G_OBJECT(column), "column_store_idx", GUINT_TO_POINTER(n));
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 507
diff changeset
1887 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
1888
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1889 gtk_tree_view_append_column(GTK_TREE_VIEW(vfl->listview), column);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1890 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1891
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1892 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
1893 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1894 GtkTreePath *path = gtk_tree_path_new_from_string(path_str);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1895 GtkTreeIter iter;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1896 FileData *fd;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1897 gboolean mark;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1898 guint col_idx;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1899
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1900 if (!path || !gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path))
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1901 return;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1902
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
1903 col_idx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cell), "column_store_idx"));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1904
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1905 g_assert(col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1906
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1907 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
1908 mark = !mark;
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1909 fd->marks[col_idx - FILE_COLUMN_MARKS] = mark;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1910
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1911 gtk_tree_store_set(store, &iter, col_idx, mark, -1);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1912 gtk_tree_path_free(path);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1913 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1914
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1915 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
1916 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1917 GtkTreeViewColumn *column;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1918 GtkCellRenderer *renderer;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1919 GtkTreeStore *store;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1920 gint index;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1921
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1922 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
1923
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1924 renderer = gtk_cell_renderer_toggle_new();
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1925 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
1926
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1927 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 507
diff changeset
1928 g_object_set_data(G_OBJECT(column), "column_store_idx", GUINT_TO_POINTER(n));
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 507
diff changeset
1929 g_object_set_data(G_OBJECT(renderer), "column_store_idx", GUINT_TO_POINTER(n));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1930
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1931 index = gtk_tree_view_append_column(GTK_TREE_VIEW(vfl->listview), column);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1932 gtk_tree_view_column_set_fixed_width(column, 16);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1933 gtk_tree_view_column_set_visible(column, vfl->marks_enabled);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1934
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1935
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1936 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
1937 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
1938
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1939 /*
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 * base
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1942 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1945 gint vflist_set_path(ViewFileList *vfl, const gchar *path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1946 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1947 GtkTreeStore *store;
9
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 if (!path) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1950 if (vfl->path && strcmp(path, vfl->path) == 0) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1951
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1952 g_free(vfl->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1953 vfl->path = g_strdup(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1954
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1955 /* force complete reload */
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1956 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
1957 gtk_tree_store_clear(store);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1958
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1959 filelist_free(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1960 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1961
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1962 return vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1963 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1964
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1965 static void vflist_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1966 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1967 ViewFileList *vfl = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1968
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1969 if (vfl->popup)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1970 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1971 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
1972 0, 0, 0, NULL, vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1973 gtk_widget_destroy(vfl->popup);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1974 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1975
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1976 vflist_select_idle_cancel(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1977 vflist_thumb_stop(vfl);
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 g_free(vfl->path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1980 filelist_free(vfl->list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1981 g_free(vfl);
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
555
cca1c3b1b948 Set thumbs_enabled through new function vflist_thumbs_set() instead
zas_
parents: 526
diff changeset
1984 void vflist_thumbs_set(ViewFileList *vfl, gint enabled)
cca1c3b1b948 Set thumbs_enabled through new function vflist_thumbs_set() instead
zas_
parents: 526
diff changeset
1985 {
cca1c3b1b948 Set thumbs_enabled through new function vflist_thumbs_set() instead
zas_
parents: 526
diff changeset
1986 vfl->thumbs_enabled = enabled;
cca1c3b1b948 Set thumbs_enabled through new function vflist_thumbs_set() instead
zas_
parents: 526
diff changeset
1987 }
cca1c3b1b948 Set thumbs_enabled through new function vflist_thumbs_set() instead
zas_
parents: 526
diff changeset
1988
cca1c3b1b948 Set thumbs_enabled through new function vflist_thumbs_set() instead
zas_
parents: 526
diff changeset
1989 ViewFileList *vflist_new(const gchar *path)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1990 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1991 ViewFileList *vfl;
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
1992 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1993 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1994
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1995 GType flist_types[FILE_COLUMN_COUNT];
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
1996 int i;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
1997
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1998 vfl = g_new0(ViewFileList, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1999
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2000 vfl->path = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2001 vfl->list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2002 vfl->click_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2003 vfl->select_fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2004 vfl->sort_method = SORT_NAME;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2005 vfl->sort_ascend = TRUE;
555
cca1c3b1b948 Set thumbs_enabled through new function vflist_thumbs_set() instead
zas_
parents: 526
diff changeset
2006 vfl->thumbs_enabled = FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2007
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2008 vfl->thumbs_running = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2009 vfl->thumbs_count = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2010 vfl->thumbs_loader = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2011 vfl->thumbs_filedata = NULL;
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 vfl->select_idle_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2014
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2015 vfl->popup = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2016
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2017 vfl->widget = gtk_scrolled_window_new(NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2018 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
2019 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vfl->widget),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2020 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2021 g_signal_connect(G_OBJECT(vfl->widget), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2022 G_CALLBACK(vflist_destroy_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2023
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2024 flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2025 flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2026 flist_types[FILE_COLUMN_NAME] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2027 flist_types[FILE_COLUMN_SIDECARS] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2028 flist_types[FILE_COLUMN_SIZE] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2029 flist_types[FILE_COLUMN_DATE] = G_TYPE_STRING;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2030 flist_types[FILE_COLUMN_COLOR] = G_TYPE_BOOLEAN;
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2031 for (i = FILE_COLUMN_MARKS; i < FILE_COLUMN_MARKS + FILEDATA_MARKS_SIZE; i++)
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2032 flist_types[i] = G_TYPE_BOOLEAN;
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2033
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2034 store = gtk_tree_store_newv(FILE_COLUMN_COUNT, flist_types);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2035
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2036 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
2037 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2038
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2039 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2040 gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_MULTIPLE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2041 gtk_tree_selection_set_select_function(selection, vflist_select_cb, vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2042
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2043 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
2044 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vfl->listview), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2045
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2046 vflist_listview_add_column(vfl, FILE_COLUMN_THUMB, "", TRUE, FALSE, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2047
518
e56c74e89da9 Add missing space.
zas_
parents: 517
diff changeset
2048 for (i = 0; i < FILEDATA_MARKS_SIZE; i++)
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2049 vflist_listview_add_column_toggle(vfl, i + FILE_COLUMN_MARKS, "");
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2050
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2051 vflist_listview_add_column(vfl, FILE_COLUMN_NAME, _("Name"), FALSE, FALSE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2052 vflist_listview_add_column(vfl, FILE_COLUMN_SIDECARS, _("SC"), FALSE, FALSE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2053
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2054 vflist_listview_add_column(vfl, FILE_COLUMN_SIZE, _("Size"), FALSE, TRUE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2055 vflist_listview_add_column(vfl, FILE_COLUMN_DATE, _("Date"), FALSE, TRUE, FALSE);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2056
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2057
139
754c1e4349b6 display sidecar extensions in filelist
nadvornik
parents: 138
diff changeset
2058 g_signal_connect(G_OBJECT(vfl->listview), "key_press_event",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2059 G_CALLBACK(vflist_press_key_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2060
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 507
diff changeset
2061 gtk_container_add(GTK_CONTAINER(vfl->widget), vfl->listview);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2062 gtk_widget_show(vfl->listview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2063
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2064 vflist_dnd_init(vfl);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2065
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2066 g_signal_connect(G_OBJECT(vfl->listview), "button_press_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2067 G_CALLBACK(vflist_press_cb), vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2068 g_signal_connect(G_OBJECT(vfl->listview), "button_release_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2069 G_CALLBACK(vflist_release_cb), vfl);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2070
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2071
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2072 if (path) vflist_set_path(vfl, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2073
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2074 return vfl;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2075 }
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 void vflist_set_status_func(ViewFileList *vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2078 void (*func)(ViewFileList *vfl, gpointer data), gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2079 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2080 vfl->func_status = func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2081 vfl->data_status = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2082 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2083
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2084 void vflist_set_thumb_status_func(ViewFileList *vfl,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2085 void (*func)(ViewFileList *vfl, gdouble val, const gchar *text, gpointer data),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2086 gpointer data)
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 vfl->func_thumb_status = func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2089 vfl->data_thumb_status = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2090 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2091
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2092 void vflist_thumb_set(ViewFileList *vfl, gint enable)
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 if (vfl->thumbs_enabled == enable) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2095
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2096 vfl->thumbs_enabled = enable;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2097 vflist_refresh(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2098 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2099
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2100 void vflist_marks_set(ViewFileList *vfl, gint enable)
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2101 {
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2102 GList *columns, *work;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2103
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2104 if (vfl->marks_enabled == enable) return;
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2105
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2106 vfl->marks_enabled = enable;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2107
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2108 columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(vfl->listview));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2109
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2110 work = columns;
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2111 while (work)
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2112 {
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2113 GtkTreeViewColumn *column = work->data;
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
2114 gint col_idx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(column), "column_store_idx"));
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2115 work = work->next;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2116
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2117 if (col_idx <= FILE_COLUMN_MARKS_LAST && col_idx >= FILE_COLUMN_MARKS)
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2118 gtk_tree_view_column_set_visible(column, enable);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2119 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 380
diff changeset
2120
149
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2121 g_list_free(columns);
f0c79a514c06 marks: fixes and cleanup
nadvornik
parents: 144
diff changeset
2122 //vflist_refresh(vfl);
132
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2123 }
661cd91e5a7e First implementation of marks for all photos.
bruclik
parents: 113
diff changeset
2124
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2125 void vflist_set_layout(ViewFileList *vfl, LayoutWindow *layout)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2126 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2127 vfl->layout = layout;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2128 }
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 /*
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 * maintenance (for rename, move, remove)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2133 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2134 */
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 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
2137 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2138 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2139 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2140 gint rev = row - 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2141 row ++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2142
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2143 work = ignore_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2144 while (work)
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 gint f = vflist_index_by_path(vfl, work->data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2147 if (f >= 0) list = g_list_prepend(list, GINT_TO_POINTER(f));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2148 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2149 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2150
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2151 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2152 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2153 gint c = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2154 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2155 while (work && c)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2156 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2157 gpointer p = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2158 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2159 if (row == GPOINTER_TO_INT(p))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2160 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2161 row++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2162 c = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2163 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2164 if (rev == GPOINTER_TO_INT(p))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2165 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2166 rev--;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2167 c = FALSE;
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 if (!c) list = g_list_remove(list, p);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2170 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2171 if (c && list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2172 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2173 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2174 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2175 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2176 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2177 if (row > count - 1)
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 (rev < 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2180 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2181 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2182 return rev;
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 else
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 row;
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2189
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2190 gint vflist_maint_renamed(ViewFileList *vfl, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2191 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2192 gint ret = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2193 gchar *source_base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2194 gchar *dest_base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2195
168
a55ada12322a fixed vflist_find_row and vflist_sort_set to work correctly with sidecar
nadvornik
parents: 167
diff changeset
2196 if (g_list_index(vfl->list, fd) < 0) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2197
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2198 source_base = remove_level_from_path(fd->change->source);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2199 dest_base = remove_level_from_path(fd->change->dest);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2201
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2202 if (strcmp(source_base, dest_base) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2203 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2204 GtkTreeStore *store;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2205 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2206 GtkTreeIter position;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2207 gint old_row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2208 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2209
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2210 old_row = g_list_index(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2211
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2212 vfl->list = g_list_remove(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2213
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2214 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
2215 n = g_list_index(vfl->list, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2216
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2217 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
2218 if (vflist_find_row(vfl, fd, &iter) >= 0 &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2219 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
2220 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2221 if (old_row >= n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2222 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2223 gtk_tree_store_move_before(store, &iter, &position);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2224 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2225 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2226 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2227 gtk_tree_store_move_after(store, &iter, &position);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2228 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2229 }
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2230 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
2231
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2232 ret = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2233 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2234 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2235 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2236 ret = vflist_maint_removed(vfl, fd, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2237 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2238
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2239 g_free(source_base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2240 g_free(dest_base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2241
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2242 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2243 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2244
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2245 gint vflist_maint_removed(ViewFileList *vfl, FileData *fd, GList *ignore_list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2246 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2247 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2248 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2249 gint row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2250 gint new_row = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2251
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2252 row = g_list_index(vfl->list, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2253 if (row < 0) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2254
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2255 if (vflist_index_is_selected(vfl, row) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2256 layout_image_get_collection(vfl->layout, NULL) == NULL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2257 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2258 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2259
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2260 n = vflist_count(vfl, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2261 if (ignore_list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2262 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2263 new_row = vflist_maint_find_closest(vfl, row, n, ignore_list);
506
fc9c8a3e1a8b Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents: 497
diff changeset
2264 DEBUG_1("row = %d, closest is %d", row, new_row);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2265 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2266 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2267 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2268 if (row + 1 < n)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2269 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2270 new_row = row + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2271 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2272 else if (row > 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2273 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2274 new_row = row - 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2275 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2276 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2277 vflist_select_none(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2278 if (new_row >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2279 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2280 fd = vflist_index_get_data(vfl, new_row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2281 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2282 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2283 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2284
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2285 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vfl->listview));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2286 gtk_tree_selection_select_iter(selection, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2287 vflist_move_cursor(vfl, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2288 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2289 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2290 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2291
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2292 fd = vflist_index_get_data(vfl, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2293 if (vflist_find_row(vfl, fd, &iter) >= 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2294 {
142
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2295 GtkTreeStore *store;
b5aa95241859 display sidecar files (jpeg + raw) using gtk_tree_store
nadvornik
parents: 139
diff changeset
2296 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
2297 gtk_tree_store_remove(store, &iter);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2298 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2299 list = g_list_nth(vfl->list, row);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2300 fd = list->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2301
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2302 /* thumbnail loader check */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2303 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
2304 if (vfl->thumbs_count > 0) vfl->thumbs_count--;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2305
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2306 vfl->list = g_list_remove(vfl->list, fd);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2307 file_data_unref(fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2308
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2309 vflist_send_update(vfl);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2310
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2311 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2312 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2313
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2314 gint vflist_maint_moved(ViewFileList *vfl, FileData *fd, GList *ignore_list)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2315 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2316 gint ret = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2317 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2318
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2319 if (!fd->change->source || !vfl->path) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2320
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2321 buf = remove_level_from_path(fd->change->source);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2322
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2323 if (strcmp(buf, vfl->path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2324 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 132
diff changeset
2325 ret = vflist_maint_removed(vfl, fd, ignore_list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2326 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2327
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2328 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2329
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2330 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2331 }