annotate src/view_file.c @ 1757:8ecdf8445ef5

fixed and simplified sidecar grouping code
author nadvornik
date Thu, 24 Sep 2009 21:52:44 +0000
parents 8ebc26a4383f
children caf0e4b8319d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
554
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
1 /*
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
2 * Geeqie
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1272
diff changeset
3 * Copyright (C) 2008 - 2009 The Geeqie Team
554
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
4 *
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
5 * Author: Laurent Monin
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
6 *
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
8 * Please read the included file COPYING for more information.
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
10 */
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
11
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
12 #include "main.h"
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
13 #include "view_file.h"
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
14
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
15 #include "editors.h"
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
16 #include "layout.h"
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
17 #include "menu.h"
1608
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
18 #include "thumb.h"
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
19 #include "ui_menu.h"
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
20 #include "ui_fileops.h"
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
21 #include "utilops.h"
554
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
22 #include "view_file_list.h"
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
23 #include "view_file_icon.h"
2da72a136070 Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff changeset
24
633
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
25 /*
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
26 *-----------------------------------------------------------------------------
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
27 * signals
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
28 *-----------------------------------------------------------------------------
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
29 */
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
30
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
31 void vf_send_update(ViewFile *vf)
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
32 {
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
33 if (vf->func_status) vf->func_status(vf, vf->data_status);
fe700864cb5a Use vf_* functions where possible.
zas_
parents: 632
diff changeset
34 }
560
ebb2c2b1454d Add function prototypes (yet unused).
zas_
parents: 554
diff changeset
35
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
36 /*
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
37 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
38 * misc
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
39 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
40 */
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
41
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
42 void vf_sort_set(ViewFile *vf, SortType type, gboolean ascend)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
43 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
44 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
45 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
46 case FILEVIEW_LIST: vflist_sort_set(vf, type, ascend); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
47 case FILEVIEW_ICON: vficon_sort_set(vf, type, ascend); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
48 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
49 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
50
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
51 /*
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
52 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
53 * row stuff
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
54 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
55 */
560
ebb2c2b1454d Add function prototypes (yet unused).
zas_
parents: 554
diff changeset
56
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
57 FileData *vf_index_get_data(ViewFile *vf, gint row)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
58 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
59 FileData *fd = NULL;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
60
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
61 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
62 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
63 case FILEVIEW_LIST: fd = vflist_index_get_data(vf, row); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
64 case FILEVIEW_ICON: fd = vficon_index_get_data(vf, row); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
65 }
560
ebb2c2b1454d Add function prototypes (yet unused).
zas_
parents: 554
diff changeset
66
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
67 return fd;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
68 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
69
1503
331e2d60d447 improved next/prev operation on sidecar files
nadvornik
parents: 1498
diff changeset
70 gint vf_index_by_fd(ViewFile *vf, FileData *fd)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
71 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
72 gint index = -1;
560
ebb2c2b1454d Add function prototypes (yet unused).
zas_
parents: 554
diff changeset
73
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
74 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
75 {
1503
331e2d60d447 improved next/prev operation on sidecar files
nadvornik
parents: 1498
diff changeset
76 case FILEVIEW_LIST: index = vflist_index_by_fd(vf, fd); break;
331e2d60d447 improved next/prev operation on sidecar files
nadvornik
parents: 1498
diff changeset
77 case FILEVIEW_ICON: index = vficon_index_by_fd(vf, fd); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
78 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
79
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
80 return index;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
81 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
82
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 671
diff changeset
83 guint vf_count(ViewFile *vf, gint64 *bytes)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
84 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 671
diff changeset
85 guint count = 0;
560
ebb2c2b1454d Add function prototypes (yet unused).
zas_
parents: 554
diff changeset
86
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
87 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
88 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
89 case FILEVIEW_LIST: count = vflist_count(vf, bytes); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
90 case FILEVIEW_ICON: count = vficon_count(vf, bytes); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
91 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
92
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
93 return count;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
94 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
95
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
96 GList *vf_get_list(ViewFile *vf)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
97 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
98 GList *list = NULL;
560
ebb2c2b1454d Add function prototypes (yet unused).
zas_
parents: 554
diff changeset
99
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
100 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
101 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
102 case FILEVIEW_LIST: list = vflist_get_list(vf); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
103 case FILEVIEW_ICON: list = vficon_get_list(vf); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
104 }
560
ebb2c2b1454d Add function prototypes (yet unused).
zas_
parents: 554
diff changeset
105
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
106 return list;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
107 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
108
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
109
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
110 /*
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
111 *-------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
112 * keyboard
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
113 *-------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
114 */
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
115
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
116 static gboolean vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
117 {
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
118 ViewFile *vf = data;
1437
a3d3208b0c50 gint -> gboolean.
zas_
parents: 1432
diff changeset
119 gboolean ret = FALSE;
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
120
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
121 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
122 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
123 case FILEVIEW_LIST: ret = vflist_press_key_cb(widget, event, data); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
124 case FILEVIEW_ICON: ret = vficon_press_key_cb(widget, event, data); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
125 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
126
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
127 return ret;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
128 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
129
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
130 /*
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
131 *-------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
132 * mouse
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
133 *-------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
134 */
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
135
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
136 static gboolean vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
137 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
138 ViewFile *vf = data;
1437
a3d3208b0c50 gint -> gboolean.
zas_
parents: 1432
diff changeset
139 gboolean ret = FALSE;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
140
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
141 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
142 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
143 case FILEVIEW_LIST: ret = vflist_press_cb(widget, bevent, data); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
144 case FILEVIEW_ICON: ret = vficon_press_cb(widget, bevent, data); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
145 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
146
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
147 return ret;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
148 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
149
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
150 static gboolean vf_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
151 {
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
152 ViewFile *vf = data;
1437
a3d3208b0c50 gint -> gboolean.
zas_
parents: 1432
diff changeset
153 gboolean ret = FALSE;
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
154
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
155 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
156 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
157 case FILEVIEW_LIST: ret = vflist_release_cb(widget, bevent, data); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
158 case FILEVIEW_ICON: ret = vficon_release_cb(widget, bevent, data); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
159 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
160
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
161 return ret;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
162 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
163
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
164
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
165 /*
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
166 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
167 * selections
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
168 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
169 */
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
170
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
171 gboolean vf_index_is_selected(ViewFile *vf, gint row)
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
172 {
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
173 gboolean ret = FALSE;
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
174
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
175 switch (vf->type)
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
176 {
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
177 case FILEVIEW_LIST: ret = vflist_index_is_selected(vf, row); break;
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
178 case FILEVIEW_ICON: ret = vficon_index_is_selected(vf, row); break;
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
179 }
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
180
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
181 return ret;
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
182 }
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
183
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
184
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 671
diff changeset
185 guint vf_selection_count(ViewFile *vf, gint64 *bytes)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
186 {
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 671
diff changeset
187 guint count = 0;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
188
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
189 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
190 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
191 case FILEVIEW_LIST: count = vflist_selection_count(vf, bytes); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
192 case FILEVIEW_ICON: count = vficon_selection_count(vf, bytes); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
193 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
194
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
195 return count;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
196 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
197
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
198 GList *vf_selection_get_list(ViewFile *vf)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
199 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
200 GList *list = NULL;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
201
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
202 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
203 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
204 case FILEVIEW_LIST: list = vflist_selection_get_list(vf); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
205 case FILEVIEW_ICON: list = vficon_selection_get_list(vf); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
206 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
207
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
208 return list;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
209 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
210
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
211 GList *vf_selection_get_list_by_index(ViewFile *vf)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
212 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
213 GList *list = NULL;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
214
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
215 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
216 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
217 case FILEVIEW_LIST: list = vflist_selection_get_list_by_index(vf); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
218 case FILEVIEW_ICON: list = vficon_selection_get_list_by_index(vf); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
219 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
220
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
221 return list;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
222 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
223
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
224 void vf_select_all(ViewFile *vf)
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
225 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
226 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
227 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
228 case FILEVIEW_LIST: vflist_select_all(vf); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
229 case FILEVIEW_ICON: vficon_select_all(vf); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
230 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
231 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
232
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
233 void vf_select_none(ViewFile *vf)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
234 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
235 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
236 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
237 case FILEVIEW_LIST: vflist_select_none(vf); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
238 case FILEVIEW_ICON: vficon_select_none(vf); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
239 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
240 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
241
601
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 574
diff changeset
242 void vf_select_invert(ViewFile *vf)
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 574
diff changeset
243 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
244 switch (vf->type)
601
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 574
diff changeset
245 {
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 574
diff changeset
246 case FILEVIEW_LIST: vflist_select_invert(vf); break;
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 574
diff changeset
247 case FILEVIEW_ICON: vficon_select_invert(vf); break;
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 574
diff changeset
248 }
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 574
diff changeset
249 }
93c6dc4c537b Add a way to invert the current selection.
zas_
parents: 574
diff changeset
250
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
251 void vf_select_by_fd(ViewFile *vf, FileData *fd)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
252 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
253 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
254 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
255 case FILEVIEW_LIST: vflist_select_by_fd(vf, fd); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
256 case FILEVIEW_ICON: vficon_select_by_fd(vf, fd); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
257 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
258 }
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
259
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
260 void vf_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
261 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
262 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
263 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
264 case FILEVIEW_LIST: vflist_mark_to_selection(vf, mark, mode); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
265 case FILEVIEW_ICON: vficon_mark_to_selection(vf, mark, mode); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
266 }
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
267 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
268
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
269 void vf_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
270 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
271 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
272 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
273 case FILEVIEW_LIST: vflist_selection_to_mark(vf, mark, mode); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
274 case FILEVIEW_ICON: vficon_selection_to_mark(vf, mark, mode); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
275 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
276 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
277
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
278 /*
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
279 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
280 * dnd
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
281 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
282 */
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
283
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
284
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
285 static void vf_dnd_init(ViewFile *vf)
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
286 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
287 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
288 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
289 case FILEVIEW_LIST: vflist_dnd_init(vf); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
290 case FILEVIEW_ICON: vficon_dnd_init(vf); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
291 }
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
292 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
293
634
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
294 /*
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
295 *-----------------------------------------------------------------------------
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
296 * pop-up menu
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
297 *-----------------------------------------------------------------------------
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
298 */
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
299
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
300 GList *vf_pop_menu_file_list(ViewFile *vf)
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
301 {
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
302 GList *ret = NULL;
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
303
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
304 switch (vf->type)
634
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
305 {
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
306 case FILEVIEW_LIST: ret = vflist_pop_menu_file_list(vf); break;
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
307 case FILEVIEW_ICON: ret = vficon_pop_menu_file_list(vf); break;
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
308 }
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
309
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
310 return ret;
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
311 }
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
312
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
313 static void vf_pop_menu_edit_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
314 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
315 ViewFile *vf;
1272
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
316 const gchar *key = data;
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
317
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
318 vf = submenu_item_get_data(widget);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
319
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
320 if (!vf) return;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
321
1656
349ebc02b8e2 fixed leak in file_util_* functions
nadvornik
parents: 1652
diff changeset
322 file_util_start_editor_from_filelist(key, vf_pop_menu_file_list(vf), vf->dir_fd->path, vf->listview);
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
323 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
324
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
325 static void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data)
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
326 {
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
327 ViewFile *vf = data;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
328
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
329 switch (vf->type)
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
330 {
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
331 case FILEVIEW_LIST: vflist_pop_menu_view_cb(widget, data); break;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
332 case FILEVIEW_ICON: vficon_pop_menu_view_cb(widget, data); break;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
333 }
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
334 }
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
335
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
336 static void vf_pop_menu_copy_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
337 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
338 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
339
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
340 file_util_copy(NULL, vf_pop_menu_file_list(vf), NULL, vf->listview);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
341 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
342
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
343 static void vf_pop_menu_move_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
344 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
345 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
346
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
347 file_util_move(NULL, vf_pop_menu_file_list(vf), NULL, vf->listview);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
348 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
349
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
350 static void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
351 {
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
352 ViewFile *vf = data;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
353
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
354 switch (vf->type)
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
355 {
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
356 case FILEVIEW_LIST: vflist_pop_menu_rename_cb(widget, data); break;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
357 case FILEVIEW_ICON: vficon_pop_menu_rename_cb(widget, data); break;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
358 }
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
359 }
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
360
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
361 static void vf_pop_menu_delete_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
362 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
363 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
364
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
365 file_util_delete(NULL, vf_pop_menu_file_list(vf), vf->listview);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
366 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
367
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
368 static void vf_pop_menu_copy_path_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
369 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
370 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
371
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
372 file_util_copy_path_list_to_clipboard(vf_pop_menu_file_list(vf));
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
373 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
374
1598
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
375 static void vf_pop_menu_enable_grouping_cb(GtkWidget *widget, gpointer data)
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
376 {
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
377 ViewFile *vf = data;
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
378
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
379 file_data_disable_grouping_list(vf_pop_menu_file_list(vf), FALSE);
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
380 }
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
381
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
382 static void vf_pop_menu_disable_grouping_cb(GtkWidget *widget, gpointer data)
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
383 {
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
384 ViewFile *vf = data;
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
385
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
386 file_data_disable_grouping_list(vf_pop_menu_file_list(vf), TRUE);
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
387 }
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
388
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
389 static void vf_pop_menu_sort_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
390 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
391 ViewFile *vf;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
392 SortType type;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
393
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
394 if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
395
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
396 vf = submenu_item_get_data(widget);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
397 if (!vf) return;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
398
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
399 type = (SortType)GPOINTER_TO_INT(data);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
400
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
401 if (vf->layout)
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
402 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
403 layout_sort_set(vf->layout, type, vf->sort_ascend);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
404 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
405 else
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
406 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
407 vf_sort_set(vf, type, vf->sort_ascend);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
408 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
409 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
410
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
411 static void vf_pop_menu_sort_ascend_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
412 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
413 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
414
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
415 if (vf->layout)
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
416 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
417 layout_sort_set(vf->layout, vf->sort_method, !vf->sort_ascend);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
418 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
419 else
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
420 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
421 vf_sort_set(vf, vf->sort_method, !vf->sort_ascend);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
422 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
423 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
424
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
425 static void vf_pop_menu_sel_mark_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
426 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
427 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
428 vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_SET);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
429 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
430
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
431 static void vf_pop_menu_sel_mark_and_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
432 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
433 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
434 vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_AND);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
435 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
436
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
437 static void vf_pop_menu_sel_mark_or_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
438 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
439 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
440 vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_OR);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
441 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
442
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
443 static void vf_pop_menu_sel_mark_minus_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
444 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
445 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
446 vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_MINUS);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
447 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
448
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
449 static void vf_pop_menu_set_mark_sel_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
450 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
451 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
452 vf_selection_to_mark(vf, vf->active_mark, STM_MODE_SET);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
453 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
454
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
455 static void vf_pop_menu_res_mark_sel_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
456 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
457 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
458 vf_selection_to_mark(vf, vf->active_mark, STM_MODE_RESET);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
459 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
460
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
461 static void vf_pop_menu_toggle_mark_sel_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
462 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
463 ViewFile *vf = data;
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
464 vf_selection_to_mark(vf, vf->active_mark, STM_MODE_TOGGLE);
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
465 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
466
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
467 static void vf_pop_menu_toggle_view_type_cb(GtkWidget *widget, gpointer data)
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
468 {
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
469 ViewFile *vf = data;
1668
8ebc26a4383f use radio buttons for file and dir mode in popup menu
nadvornik
parents: 1660
diff changeset
470 FileViewType new_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "menu_item_radio_data"));
636
2ea7af1fbfe0 Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents: 635
diff changeset
471 if (!vf->layout) return;
2ea7af1fbfe0 Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents: 635
diff changeset
472
1668
8ebc26a4383f use radio buttons for file and dir mode in popup menu
nadvornik
parents: 1660
diff changeset
473 layout_views_set(vf->layout, vf->layout->options.dir_view_type, new_type);
635
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
474 }
eaca3e910ecd Move a part of pop up menu common code to view_file.[ch].
zas_
parents: 634
diff changeset
475
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
476 static void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
477 {
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
478 ViewFile *vf = data;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
479
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
480 switch (vf->type)
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
481 {
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
482 case FILEVIEW_LIST: vflist_pop_menu_refresh_cb(widget, data); break;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
483 case FILEVIEW_ICON: vficon_pop_menu_refresh_cb(widget, data); break;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
484 }
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
485 }
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
486
662
a1b68aca7289 Make vf_pop_menu_*_cb static.
zas_
parents: 659
diff changeset
487 static void vf_popup_destroy_cb(GtkWidget *widget, gpointer data)
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
488 {
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
489 ViewFile *vf = data;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
490
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
491 switch (vf->type)
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
492 {
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
493 case FILEVIEW_LIST: vflist_popup_destroy_cb(widget, data); break;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
494 case FILEVIEW_ICON: vficon_popup_destroy_cb(widget, data); break;
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
495 }
1397
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1365
diff changeset
496
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1365
diff changeset
497 filelist_free(vf->editmenu_fd_list);
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1365
diff changeset
498 vf->editmenu_fd_list = NULL;
637
8a1202efa51e Add some wrapper functions for not yet common code.
zas_
parents: 636
diff changeset
499 }
634
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
500
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
501 GtkWidget *vf_pop_menu(ViewFile *vf)
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
502 {
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
503 GtkWidget *menu;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
504 GtkWidget *item;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
505 GtkWidget *submenu;
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
506 gboolean active = FALSE;
634
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
507
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
508 switch (vf->type)
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
509 {
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
510 case FILEVIEW_LIST:
968
065a129fd42b Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents: 964
diff changeset
511 vflist_color_set(vf, VFLIST(vf)->click_fd, TRUE);
065a129fd42b Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents: 964
diff changeset
512 active = (VFLIST(vf)->click_fd != NULL);
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
513 break;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
514 case FILEVIEW_ICON:
968
065a129fd42b Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents: 964
diff changeset
515 active = (VFICON(vf)->click_id != NULL);
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
516 break;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
517 }
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
518
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
519 menu = popup_menu_short_lived();
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
520
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
521 g_signal_connect(G_OBJECT(menu), "destroy",
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
522 G_CALLBACK(vf_popup_destroy_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
523
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
524 if (vf->clicked_mark > 0)
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
525 {
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
526 gint mark = vf->clicked_mark;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
527 gchar *str_set_mark = g_strdup_printf(_("_Set mark %d"), mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
528 gchar *str_res_mark = g_strdup_printf(_("_Reset mark %d"), mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
529 gchar *str_toggle_mark = g_strdup_printf(_("_Toggle mark %d"), mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
530 gchar *str_sel_mark = g_strdup_printf(_("_Select mark %d"), mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
531 gchar *str_sel_mark_or = g_strdup_printf(_("_Add mark %d"), mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
532 gchar *str_sel_mark_and = g_strdup_printf(_("_Intersection with mark %d"), mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
533 gchar *str_sel_mark_minus = g_strdup_printf(_("_Unselect mark %d"), mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
534
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
535 g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
536
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
537 vf->active_mark = mark;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
538 vf->clicked_mark = 0;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
539
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
540 menu_item_add_sensitive(menu, str_set_mark, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
541 G_CALLBACK(vf_pop_menu_set_mark_sel_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
542
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
543 menu_item_add_sensitive(menu, str_res_mark, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
544 G_CALLBACK(vf_pop_menu_res_mark_sel_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
545
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
546 menu_item_add_sensitive(menu, str_toggle_mark, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
547 G_CALLBACK(vf_pop_menu_toggle_mark_sel_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
548
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
549 menu_item_add_divider(menu);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
550
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
551 menu_item_add_sensitive(menu, str_sel_mark, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
552 G_CALLBACK(vf_pop_menu_sel_mark_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
553 menu_item_add_sensitive(menu, str_sel_mark_or, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
554 G_CALLBACK(vf_pop_menu_sel_mark_or_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
555 menu_item_add_sensitive(menu, str_sel_mark_and, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
556 G_CALLBACK(vf_pop_menu_sel_mark_and_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
557 menu_item_add_sensitive(menu, str_sel_mark_minus, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
558 G_CALLBACK(vf_pop_menu_sel_mark_minus_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
559
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
560 menu_item_add_divider(menu);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
561
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
562 g_free(str_set_mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
563 g_free(str_res_mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
564 g_free(str_toggle_mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
565 g_free(str_sel_mark);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
566 g_free(str_sel_mark_and);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
567 g_free(str_sel_mark_or);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
568 g_free(str_sel_mark_minus);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
569 }
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
570
1656
349ebc02b8e2 fixed leak in file_util_* functions
nadvornik
parents: 1652
diff changeset
571 vf->editmenu_fd_list = vf_pop_menu_file_list(vf);
1397
a0bd58a6535f In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents: 1365
diff changeset
572 submenu_add_edit(menu, &item, G_CALLBACK(vf_pop_menu_edit_cb), vf, vf->editmenu_fd_list);
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
573 gtk_widget_set_sensitive(item, active);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
574
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
575 menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
576 G_CALLBACK(vf_pop_menu_view_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
577
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
578 menu_item_add_divider(menu);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
579 menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
580 G_CALLBACK(vf_pop_menu_copy_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
581 menu_item_add_sensitive(menu, _("_Move..."), active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
582 G_CALLBACK(vf_pop_menu_move_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
583 menu_item_add_sensitive(menu, _("_Rename..."), active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
584 G_CALLBACK(vf_pop_menu_rename_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
585 menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
586 G_CALLBACK(vf_pop_menu_delete_cb), vf);
1513
c9ed5a43c576 dropped show_copy_path option
nadvornik
parents: 1506
diff changeset
587 menu_item_add_sensitive(menu, _("_Copy path"), active,
c9ed5a43c576 dropped show_copy_path option
nadvornik
parents: 1506
diff changeset
588 G_CALLBACK(vf_pop_menu_copy_path_cb), vf);
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
589
1598
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
590 menu_item_add_sensitive(menu, _("Enable file _grouping"), active,
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
591 G_CALLBACK(vf_pop_menu_enable_grouping_cb), vf);
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
592 menu_item_add_sensitive(menu, _("Disable file groupi_ng"), active,
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
593 G_CALLBACK(vf_pop_menu_disable_grouping_cb), vf);
c03a8e19a43a expose the file grouping flag to the user
nadvornik
parents: 1523
diff changeset
594
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
595 menu_item_add_divider(menu);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
596
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
597 submenu = submenu_add_sort(NULL, G_CALLBACK(vf_pop_menu_sort_cb), vf,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
598 FALSE, FALSE, TRUE, vf->sort_method);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
599 menu_item_add_divider(submenu);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
600 menu_item_add_check(submenu, _("Ascending"), vf->sort_ascend,
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
601 G_CALLBACK(vf_pop_menu_sort_ascend_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
602
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
603 item = menu_item_add(menu, _("_Sort"), NULL, NULL);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
604 gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
605
1668
8ebc26a4383f use radio buttons for file and dir mode in popup menu
nadvornik
parents: 1660
diff changeset
606 item = menu_item_add_radio(menu, _("View as _List"), GINT_TO_POINTER(FILEVIEW_LIST), vf->type == FILEVIEW_LIST,
8ebc26a4383f use radio buttons for file and dir mode in popup menu
nadvornik
parents: 1660
diff changeset
607 G_CALLBACK(vf_pop_menu_toggle_view_type_cb), vf);
8ebc26a4383f use radio buttons for file and dir mode in popup menu
nadvornik
parents: 1660
diff changeset
608
8ebc26a4383f use radio buttons for file and dir mode in popup menu
nadvornik
parents: 1660
diff changeset
609 item = menu_item_add_radio(menu, _("View as _Icons"), GINT_TO_POINTER(FILEVIEW_ICON), vf->type == FILEVIEW_ICON,
8ebc26a4383f use radio buttons for file and dir mode in popup menu
nadvornik
parents: 1660
diff changeset
610 G_CALLBACK(vf_pop_menu_toggle_view_type_cb), vf);
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
611
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
612 switch (vf->type)
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
613 {
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
614 case FILEVIEW_LIST:
968
065a129fd42b Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents: 964
diff changeset
615 menu_item_add_check(menu, _("Show _thumbnails"), VFLIST(vf)->thumbs_enabled,
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
616 G_CALLBACK(vflist_pop_menu_thumbs_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
617 break;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
618 case FILEVIEW_ICON:
968
065a129fd42b Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents: 964
diff changeset
619 menu_item_add_check(menu, _("Show filename _text"), VFICON(vf)->show_text,
659
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
620 G_CALLBACK(vficon_pop_menu_show_names_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
621 break;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
622 }
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
623
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
624 menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, G_CALLBACK(vf_pop_menu_refresh_cb), vf);
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
625
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
626 return menu;
542bb47fef04 Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents: 637
diff changeset
627 }
634
92208e71673b Introduce vf_pop_menu_file_list() as a wrapper to
zas_
parents: 633
diff changeset
628
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
629 gboolean vf_refresh(ViewFile *vf)
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
630 {
1437
a3d3208b0c50 gint -> gboolean.
zas_
parents: 1432
diff changeset
631 gboolean ret = FALSE;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
632
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
633 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
634 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
635 case FILEVIEW_LIST: ret = vflist_refresh(vf); break;
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
636 case FILEVIEW_ICON: ret = vficon_refresh(vf); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
637 }
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
638
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
639 return ret;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
640 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
641
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
642 gboolean vf_set_fd(ViewFile *vf, FileData *dir_fd)
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
643 {
1437
a3d3208b0c50 gint -> gboolean.
zas_
parents: 1432
diff changeset
644 gboolean ret = FALSE;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
645
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
646 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
647 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 753
diff changeset
648 case FILEVIEW_LIST: ret = vflist_set_fd(vf, dir_fd); break;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 753
diff changeset
649 case FILEVIEW_ICON: ret = vficon_set_fd(vf, dir_fd); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
650 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
651
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
652 return ret;
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
653 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
654
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
655 static void vf_destroy_cb(GtkWidget *widget, gpointer data)
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
656 {
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
657 ViewFile *vf = data;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
658
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
659 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
660 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
661 case FILEVIEW_LIST: vflist_destroy_cb(widget, data); break;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
662 case FILEVIEW_ICON: vficon_destroy_cb(widget, data); break;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
663 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
664
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
665 if (vf->popup)
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
666 {
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
667 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA,
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
668 0, 0, 0, NULL, vf);
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
669 gtk_widget_destroy(vf->popup);
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
670 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
671
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 753
diff changeset
672 file_data_unref(vf->dir_fd);
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
673 g_free(vf->info);
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
674 g_free(vf);
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
675 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
676
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
677 static void vf_marks_filter_toggle_cb(GtkWidget *widget, gpointer data)
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
678 {
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
679 ViewFile *vf = data;
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
680 vf_refresh_idle(vf);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
681 }
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
682
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
683
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
684 static GtkWidget *vf_marks_filter_init(ViewFile *vf)
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
685 {
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
686 GtkWidget *frame = gtk_frame_new(NULL);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
687 GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
688
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
689 gint i;
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
690
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
691 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++)
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
692 {
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
693 GtkWidget *check = gtk_check_button_new();
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
694 gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
695 g_signal_connect(G_OBJECT(check), "toggled",
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
696 G_CALLBACK(vf_marks_filter_toggle_cb), vf);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
697
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
698 gtk_widget_show(check);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
699 vf->filter_check[i] = check;
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
700 }
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
701 gtk_container_add(GTK_CONTAINER(frame), hbox);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
702 gtk_widget_show(hbox);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
703 return frame;
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
704 }
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
705
1635
5ad450d67878 added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents: 1609
diff changeset
706 void vf_mark_filter_toggle(ViewFile *vf, gint mark)
5ad450d67878 added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents: 1609
diff changeset
707 {
5ad450d67878 added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents: 1609
diff changeset
708 gint n = mark - 1;
5ad450d67878 added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents: 1609
diff changeset
709 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vf->filter_check[n]),
5ad450d67878 added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents: 1609
diff changeset
710 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vf->filter_check[n])));
5ad450d67878 added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents: 1609
diff changeset
711 }
5ad450d67878 added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents: 1609
diff changeset
712
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 753
diff changeset
713 ViewFile *vf_new(FileViewType type, FileData *dir_fd)
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
714 {
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
715 ViewFile *vf;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
716
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
717 vf = g_new0(ViewFile, 1);
1365
249bf204004a When g_new0() is used, drop redundant initializations to NULL, FALSE or 0.
zas_
parents: 1347
diff changeset
718
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
719 vf->type = type;
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
720 vf->sort_method = SORT_NAME;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
721 vf->sort_ascend = TRUE;
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
722
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
723 vf->scrolled = gtk_scrolled_window_new(NULL, NULL);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
724 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
725 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vf->scrolled),
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
726 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
727
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
728 vf->filter = vf_marks_filter_init(vf);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
729
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
730 vf->widget = gtk_vbox_new(FALSE, 0);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
731 gtk_box_pack_start(GTK_BOX(vf->widget), vf->filter, FALSE, FALSE, 0);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
732 gtk_box_pack_start(GTK_BOX(vf->widget), vf->scrolled, TRUE, TRUE, 0);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
733 gtk_widget_show(vf->scrolled);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
734
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
735 g_signal_connect(G_OBJECT(vf->widget), "destroy",
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
736 G_CALLBACK(vf_destroy_cb), vf);
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
737
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
738 switch (type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
739 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 753
diff changeset
740 case FILEVIEW_LIST: vf = vflist_new(vf, dir_fd); break;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 753
diff changeset
741 case FILEVIEW_ICON: vf = vficon_new(vf, dir_fd); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
742 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
743
574
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
744 vf_dnd_init(vf);
3da75054d4e1 Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents: 573
diff changeset
745
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
746 g_signal_connect(G_OBJECT(vf->listview), "key_press_event",
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
747 G_CALLBACK(vf_press_key_cb), vf);
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
748 g_signal_connect(G_OBJECT(vf->listview), "button_press_event",
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
749 G_CALLBACK(vf_press_cb), vf);
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
750 g_signal_connect(G_OBJECT(vf->listview), "button_release_event",
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
751 G_CALLBACK(vf_release_cb), vf);
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
752
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
753 gtk_container_add(GTK_CONTAINER(vf->scrolled), vf->listview);
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
754 gtk_widget_show(vf->listview);
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
755
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 753
diff changeset
756 if (dir_fd) vf_set_fd(vf, dir_fd);
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
757
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
758 return vf;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
759 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
760
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
761 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data)
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
762 {
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
763 vf->func_status = func;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
764 vf->data_status = data;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
765 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
766
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
767 void vf_set_thumb_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gdouble val, const gchar *text, gpointer data), gpointer data)
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
768 {
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
769 vf->func_thumb_status = func;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
770 vf->data_thumb_status = data;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
771 }
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
772
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
773 void vf_thumb_set(ViewFile *vf, gboolean enable)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
774 {
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
775 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
776 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
777 case FILEVIEW_LIST: vflist_thumb_set(vf, enable); break;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
778 case FILEVIEW_ICON: /*vficon_thumb_set(vf, enable);*/ break;
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
779 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
780 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
781
1608
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
782
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
783 static gboolean vf_thumb_next(ViewFile *vf);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
784
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
785 static gdouble vf_thumb_progress(ViewFile *vf)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
786 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
787 gint count = 0;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
788 gint done = 0;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
789
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
790 switch (vf->type)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
791 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
792 case FILEVIEW_LIST: vflist_thumb_progress_count(vf->list, &count, &done); break;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
793 case FILEVIEW_ICON: vficon_thumb_progress_count(vf->list, &count, &done); break;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
794 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
795
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
796 DEBUG_1("thumb progress: %d of %d", done, count);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
797 return (gdouble)done / count;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
798 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
799
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
800 static void vf_set_thumb_fd(ViewFile *vf, FileData *fd)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
801 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
802 switch (vf->type)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
803 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
804 case FILEVIEW_LIST: vflist_set_thumb_fd(vf, fd); break;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
805 case FILEVIEW_ICON: vficon_set_thumb_fd(vf, fd); break;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
806 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
807 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
808
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
809 static void vf_thumb_status(ViewFile *vf, gdouble val, const gchar *text)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
810 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
811 if (vf->func_thumb_status)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
812 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
813 vf->func_thumb_status(vf, val, text, vf->data_thumb_status);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
814 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
815 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
816
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
817 static void vf_thumb_do(ViewFile *vf, FileData *fd)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
818 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
819 if (!fd) return;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
820
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
821 vf_set_thumb_fd(vf, fd);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
822 vf_thumb_status(vf, vf_thumb_progress(vf), _("Loading thumbs..."));
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
823 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
824
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
825 void vf_thumb_cleanup(ViewFile *vf)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
826 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
827 vf_thumb_status(vf, 0.0, NULL);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
828
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
829 vf->thumbs_running = FALSE;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
830
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
831 thumb_loader_free(vf->thumbs_loader);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
832 vf->thumbs_loader = NULL;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
833
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
834 vf->thumbs_filedata = NULL;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
835 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
836
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
837 void vf_thumb_stop(ViewFile *vf)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
838 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
839 if (vf->thumbs_running) vf_thumb_cleanup(vf);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
840 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
841
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
842 static void vf_thumb_common_cb(ThumbLoader *tl, gpointer data)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
843 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
844 ViewFile *vf = data;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
845
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
846 if (vf->thumbs_filedata && vf->thumbs_loader == tl)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
847 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
848 vf_thumb_do(vf, vf->thumbs_filedata);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
849 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
850
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
851 while (vf_thumb_next(vf));
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
852 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
853
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
854 static void vf_thumb_error_cb(ThumbLoader *tl, gpointer data)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
855 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
856 vf_thumb_common_cb(tl, data);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
857 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
858
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
859 static void vf_thumb_done_cb(ThumbLoader *tl, gpointer data)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
860 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
861 vf_thumb_common_cb(tl, data);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
862 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
863
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
864 static gboolean vf_thumb_next(ViewFile *vf)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
865 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
866 FileData *fd = NULL;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
867
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
868 if (!GTK_WIDGET_REALIZED(vf->listview))
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
869 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
870 vf_thumb_status(vf, 0.0, NULL);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
871 return FALSE;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
872 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
873
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
874 switch (vf->type)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
875 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
876 case FILEVIEW_LIST: fd = vflist_thumb_next_fd(vf); break;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
877 case FILEVIEW_ICON: fd = vficon_thumb_next_fd(vf); break;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
878 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
879
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
880 if (!fd)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
881 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
882 /* done */
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
883 vf_thumb_cleanup(vf);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
884 return FALSE;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
885 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
886
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
887 vf->thumbs_filedata = fd;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
888
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
889 thumb_loader_free(vf->thumbs_loader);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
890
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
891 vf->thumbs_loader = thumb_loader_new(options->thumbnails.max_width, options->thumbnails.max_height);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
892 thumb_loader_set_callbacks(vf->thumbs_loader,
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
893 vf_thumb_done_cb,
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
894 vf_thumb_error_cb,
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
895 NULL,
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
896 vf);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
897
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
898 if (!thumb_loader_start(vf->thumbs_loader, fd))
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
899 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
900 /* set icon to unknown, continue */
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
901 DEBUG_1("thumb loader start failed %s", fd->path);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
902 vf_thumb_do(vf, fd);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
903
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
904 return TRUE;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
905 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
906
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
907 return FALSE;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
908 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
909
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
910 static void vf_thumb_reset_all(ViewFile *vf)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
911 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
912 switch (vf->type)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
913 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
914 case FILEVIEW_LIST: vflist_thumb_reset_all(vf); break;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
915 case FILEVIEW_ICON: vficon_thumb_reset_all(vf); break;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
916 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
917 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
918
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
919 void vf_thumb_update(ViewFile *vf)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
920 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
921 vf_thumb_stop(vf);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
922
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
923 if (vf->type == FILEVIEW_LIST && !VFLIST(vf)->thumbs_enabled) return;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
924
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
925 vf_thumb_status(vf, 0.0, _("Loading thumbs..."));
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
926 vf->thumbs_running = TRUE;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
927
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
928 if (thumb_format_changed)
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
929 {
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
930 vf_thumb_reset_all(vf);
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
931 thumb_format_changed = FALSE;
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
932 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
933
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
934 while (vf_thumb_next(vf));
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
935 }
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
936
fe9ac4a5c969 Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents: 1598
diff changeset
937
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
938 void vf_marks_set(ViewFile *vf, gboolean enable)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
939 {
852
8308d3606991 show marks in iconview
nadvornik
parents: 843
diff changeset
940 if (vf->marks_enabled == enable) return;
8308d3606991 show marks in iconview
nadvornik
parents: 843
diff changeset
941
8308d3606991 show marks in iconview
nadvornik
parents: 843
diff changeset
942 vf->marks_enabled = enable;
8308d3606991 show marks in iconview
nadvornik
parents: 843
diff changeset
943
1347
79937bc55f3a Add missing space between switch and first parenthesis.
zas_
parents: 1309
diff changeset
944 switch (vf->type)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
945 {
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
946 case FILEVIEW_LIST: vflist_marks_set(vf, enable); break;
852
8308d3606991 show marks in iconview
nadvornik
parents: 843
diff changeset
947 case FILEVIEW_ICON: vficon_marks_set(vf, enable); break;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
948 }
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
949 if (enable)
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
950 gtk_widget_show(vf->filter);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
951 else
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
952 gtk_widget_hide(vf->filter);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
953
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
954 vf_refresh_idle(vf);
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
955 }
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
956
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
957 guint vf_marks_get_filter(ViewFile *vf)
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
958 {
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
959 guint ret = 0;
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
960 gint i;
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
961 if (!vf->marks_enabled) return 0;
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
962
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
963 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++)
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
964 {
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
965 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vf->filter_check[i])))
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
966 {
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
967 ret |= 1 << i;
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
968 }
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
969 }
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
970 return ret;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
971 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
972
572
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
973 void vf_set_layout(ViewFile *vf, LayoutWindow *layout)
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
974 {
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
975 vf->layout = layout;
4dee80352786 Prepare switch to ViewFile (unused yet).
zas_
parents: 560
diff changeset
976 }
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
977
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
978
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
979 /*
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
980 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
981 * maintenance (for rename, move, remove)
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
982 *-----------------------------------------------------------------------------
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
983 */
995
6ca2c5fd7b13 Whitespaces cleanup.
zas_
parents: 971
diff changeset
984
1453
bc3f5c0432f6 gint -> gboolean where applicable. The end (ouf!).
zas_
parents: 1437
diff changeset
985 static gboolean vf_refresh_idle_cb(gpointer data)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
986 {
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
987 ViewFile *vf = data;
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
988
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
989 vf_refresh(vf);
1523
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1513
diff changeset
990 vf->refresh_idle_id = 0;
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
991 return FALSE;
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
992 }
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
993
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
994 void vf_refresh_idle_cancel(ViewFile *vf)
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
995 {
1523
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1513
diff changeset
996 if (vf->refresh_idle_id)
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1513
diff changeset
997 {
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1513
diff changeset
998 g_source_remove(vf->refresh_idle_id);
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1513
diff changeset
999 vf->refresh_idle_id = 0;
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1513
diff changeset
1000 }
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
1001 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
1002
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1003
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
1004 void vf_refresh_idle(ViewFile *vf)
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
1005 {
1523
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1513
diff changeset
1006 if (!vf->refresh_idle_id)
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
1007 {
1660
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1008 vf->time_refresh_set = time(NULL);
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1009 /* file operations run with G_PRIORITY_DEFAULT_IDLE */
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1010 vf->refresh_idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE + 50, vf_refresh_idle_cb, vf, NULL);
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1011 }
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1012 else if (time(NULL) - vf->time_refresh_set > 1)
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1013 {
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1014 /* more than 1 sec since last update - increase priority */
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1015 vf_refresh_idle_cancel(vf);
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1016 vf->time_refresh_set = time(NULL);
da8afd03152f improved file list update priority
nadvornik
parents: 1656
diff changeset
1017 vf->refresh_idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE - 50, vf_refresh_idle_cb, vf, NULL);
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
1018 }
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
1019 }
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
1020
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1021 void vf_notify_cb(FileData *fd, NotifyType type, gpointer data)
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
1022 {
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1023 ViewFile *vf = data;
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1024 gboolean refresh;
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1025
1432
cf4029d10d38 improved notification system
nadvornik
parents: 1412
diff changeset
1026 NotifyType interested = NOTIFY_CHANGE | NOTIFY_REREAD | NOTIFY_GROUPING;
cf4029d10d38 improved notification system
nadvornik
parents: 1412
diff changeset
1027 if (vf->marks_enabled) interested |= NOTIFY_MARKS | NOTIFY_METADATA;
cf4029d10d38 improved notification system
nadvornik
parents: 1412
diff changeset
1028 /* FIXME: NOTIFY_METADATA should be checked by the keyword-to-mark functions and converted to NOTIFY_MARKS only if there was a change */
971
33db1ec31e85 fixed possible segfault
nadvornik
parents: 968
diff changeset
1029
1523
24a12aa0cb54 Fix up event source ids type: gint -> guint.
zas_
parents: 1513
diff changeset
1030 if (!(type & interested) || vf->refresh_idle_id || !vf->dir_fd) return;
1432
cf4029d10d38 improved notification system
nadvornik
parents: 1412
diff changeset
1031
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1032 refresh = (fd == vf->dir_fd);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1033
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1034 if (!refresh)
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1035 {
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1036 gchar *base = remove_level_from_path(fd->path);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1037 refresh = (strcmp(base, vf->dir_fd->path) == 0);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1038 g_free(base);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1039 }
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
1040
1432
cf4029d10d38 improved notification system
nadvornik
parents: 1412
diff changeset
1041 if ((type & NOTIFY_CHANGE) && fd->change)
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1042 {
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1043 if (!refresh && fd->change->dest)
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1044 {
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1045 gchar *dest_base = remove_level_from_path(fd->change->dest);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1046 refresh = (strcmp(dest_base, vf->dir_fd->path) == 0);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1047 g_free(dest_base);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1048 }
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
1049
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1050 if (!refresh && fd->change->source)
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1051 {
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1052 gchar *source_base = remove_level_from_path(fd->change->source);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1053 refresh = (strcmp(source_base, vf->dir_fd->path) == 0);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1054 g_free(source_base);
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1055 }
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1056 }
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1057
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
1058 if (refresh)
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1059 {
1498
5f49f305a6b6 improved debug messages
nadvornik
parents: 1453
diff changeset
1060 DEBUG_1("Notify vf: %s %04x", fd->path, type);
964
ba1d3c4bc0cd implemented marks filter
nadvornik
parents: 852
diff changeset
1061 vf_refresh_idle(vf);
814
721c2bbaceec moved notification to view_file.c
nadvornik
parents: 788
diff changeset
1062 }
573
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
1063 }
2996f1bbc305 Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents: 572
diff changeset
1064
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 995
diff changeset
1065 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */