Mercurial > geeqie.yaz
annotate src/view_file.c @ 1599:b8e2690c440a
expose the file grouping flag to the user
author | nadvornik |
---|---|
date | Sat, 09 May 2009 19:45:24 +0000 |
parents | 24a12aa0cb54 |
children | 74a7f9ea32a1 |
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 | 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" |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
18 #include "ui_menu.h" |
814 | 19 #include "ui_fileops.h" |
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
20 #include "utilops.h" |
554
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
21 #include "view_file_list.h" |
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
22 #include "view_file_icon.h" |
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
23 |
633 | 24 /* |
25 *----------------------------------------------------------------------------- | |
26 * signals | |
27 *----------------------------------------------------------------------------- | |
28 */ | |
29 | |
30 void vf_send_update(ViewFile *vf) | |
31 { | |
32 if (vf->func_status) vf->func_status(vf, vf->data_status); | |
33 } | |
560 | 34 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
35 /* |
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 * misc |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
38 *----------------------------------------------------------------------------- |
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 |
1453 | 41 void vf_sort_set(ViewFile *vf, SortType type, gboolean ascend) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
42 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
43 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
44 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
45 case FILEVIEW_LIST: vflist_sort_set(vf, type, ascend); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
46 case FILEVIEW_ICON: vficon_sort_set(vf, type, ascend); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
47 } |
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 * row stuff |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
53 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
54 */ |
560 | 55 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
56 FileData *vf_index_get_data(ViewFile *vf, gint row) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
57 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
58 FileData *fd = NULL; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
59 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
60 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
61 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
62 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
|
63 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
|
64 } |
560 | 65 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
66 return fd; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
67 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
68 |
1503 | 69 gint vf_index_by_fd(ViewFile *vf, FileData *fd) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
70 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
71 gint index = -1; |
560 | 72 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
73 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
74 { |
1503 | 75 case FILEVIEW_LIST: index = vflist_index_by_fd(vf, fd); break; |
76 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
|
77 } |
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 return index; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
80 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
81 |
736 | 82 guint vf_count(ViewFile *vf, gint64 *bytes) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
83 { |
736 | 84 guint count = 0; |
560 | 85 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
86 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
87 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
88 case FILEVIEW_LIST: count = vflist_count(vf, bytes); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
89 case FILEVIEW_ICON: count = vficon_count(vf, bytes); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
90 } |
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 return count; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
93 } |
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 GList *vf_get_list(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
96 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
97 GList *list = NULL; |
560 | 98 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
99 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
100 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
101 case FILEVIEW_LIST: list = vflist_get_list(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
102 case FILEVIEW_ICON: list = vficon_get_list(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
103 } |
560 | 104 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
105 return list; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
106 } |
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 * keyboard |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
112 *------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
113 */ |
572 | 114 |
1453 | 115 static gboolean vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
572 | 116 { |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
117 ViewFile *vf = data; |
1437 | 118 gboolean ret = FALSE; |
572 | 119 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
120 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
121 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
122 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
|
123 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
|
124 } |
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 return ret; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
127 } |
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 * mouse |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
132 *------------------------------------------------------------------- |
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 |
1453 | 135 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
|
136 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
137 ViewFile *vf = data; |
1437 | 138 gboolean ret = FALSE; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
139 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
140 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
141 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
142 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
|
143 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
|
144 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
145 |
572 | 146 return ret; |
147 } | |
148 | |
1453 | 149 static gboolean vf_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
572 | 150 { |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
151 ViewFile *vf = data; |
1437 | 152 gboolean ret = FALSE; |
572 | 153 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
154 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
155 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
156 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
|
157 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
|
158 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
159 |
572 | 160 return ret; |
161 } | |
162 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
163 |
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 * selections |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
167 *----------------------------------------------------------------------------- |
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 |
1453 | 170 gboolean vf_index_is_selected(ViewFile *vf, gint row) |
171 { | |
172 gboolean ret = FALSE; | |
173 | |
174 switch (vf->type) | |
175 { | |
176 case FILEVIEW_LIST: ret = vflist_index_is_selected(vf, row); break; | |
177 case FILEVIEW_ICON: ret = vficon_index_is_selected(vf, row); break; | |
178 } | |
179 | |
180 return ret; | |
181 } | |
182 | |
183 | |
736 | 184 guint vf_selection_count(ViewFile *vf, gint64 *bytes) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
185 { |
736 | 186 guint count = 0; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
187 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
188 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
189 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
190 case FILEVIEW_LIST: count = vflist_selection_count(vf, bytes); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
191 case FILEVIEW_ICON: count = vficon_selection_count(vf, bytes); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
192 } |
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 return count; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
195 } |
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 GList *vf_selection_get_list(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
198 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
199 GList *list = NULL; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
200 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
201 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
202 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
203 case FILEVIEW_LIST: list = vflist_selection_get_list(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
204 case FILEVIEW_ICON: list = vficon_selection_get_list(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
205 } |
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 return list; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
208 } |
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 GList *vf_selection_get_list_by_index(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
211 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
212 GList *list = NULL; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
213 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
214 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
215 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
216 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
|
217 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
|
218 } |
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 return list; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
221 } |
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 void vf_select_all(ViewFile *vf) |
572 | 224 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
225 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
226 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
227 case FILEVIEW_LIST: vflist_select_all(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
228 case FILEVIEW_ICON: vficon_select_all(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
229 } |
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 void vf_select_none(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
233 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
234 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
235 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
236 case FILEVIEW_LIST: vflist_select_none(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
237 case FILEVIEW_ICON: vficon_select_none(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
238 } |
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 |
601 | 241 void vf_select_invert(ViewFile *vf) |
242 { | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
243 switch (vf->type) |
601 | 244 { |
245 case FILEVIEW_LIST: vflist_select_invert(vf); break; | |
246 case FILEVIEW_ICON: vficon_select_invert(vf); break; | |
247 } | |
248 } | |
249 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
250 void vf_select_by_fd(ViewFile *vf, FileData *fd) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
251 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
252 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
253 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
254 case FILEVIEW_LIST: vflist_select_by_fd(vf, fd); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
255 case FILEVIEW_ICON: vficon_select_by_fd(vf, fd); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
256 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
257 } |
572 | 258 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
259 void vf_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
260 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
261 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
262 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
263 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
|
264 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
|
265 } |
572 | 266 } |
267 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
268 void vf_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
269 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
270 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
271 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
272 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
|
273 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
|
274 } |
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 * dnd |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
280 *----------------------------------------------------------------------------- |
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 |
572 | 284 static void vf_dnd_init(ViewFile *vf) |
285 { | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
286 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
287 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
288 case FILEVIEW_LIST: vflist_dnd_init(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
289 case FILEVIEW_ICON: vficon_dnd_init(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
290 } |
572 | 291 } |
292 | |
634 | 293 /* |
294 *----------------------------------------------------------------------------- | |
295 * pop-up menu | |
296 *----------------------------------------------------------------------------- | |
297 */ | |
298 | |
299 GList *vf_pop_menu_file_list(ViewFile *vf) | |
300 { | |
301 GList *ret = NULL; | |
302 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
303 switch (vf->type) |
634 | 304 { |
305 case FILEVIEW_LIST: ret = vflist_pop_menu_file_list(vf); break; | |
306 case FILEVIEW_ICON: ret = vficon_pop_menu_file_list(vf); break; | |
307 } | |
308 | |
309 return ret; | |
310 } | |
311 | |
662 | 312 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
|
313 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
314 ViewFile *vf; |
1272 | 315 const gchar *key = data; |
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
316 GList *list; |
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 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
322 list = vf_pop_menu_file_list(vf); |
1272 | 323 file_util_start_editor_from_filelist(key, list, vf->listview); |
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
324 filelist_free(list); |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
325 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
326 |
662 | 327 static void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data) |
637 | 328 { |
329 ViewFile *vf = data; | |
330 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
331 switch (vf->type) |
637 | 332 { |
333 case FILEVIEW_LIST: vflist_pop_menu_view_cb(widget, data); break; | |
334 case FILEVIEW_ICON: vficon_pop_menu_view_cb(widget, data); break; | |
335 } | |
336 } | |
337 | |
662 | 338 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
|
339 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
340 ViewFile *vf = data; |
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 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
|
343 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
344 |
662 | 345 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
|
346 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
347 ViewFile *vf = data; |
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 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
|
350 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
351 |
662 | 352 static void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data) |
637 | 353 { |
354 ViewFile *vf = data; | |
355 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
356 switch (vf->type) |
637 | 357 { |
358 case FILEVIEW_LIST: vflist_pop_menu_rename_cb(widget, data); break; | |
359 case FILEVIEW_ICON: vficon_pop_menu_rename_cb(widget, data); break; | |
360 } | |
361 } | |
362 | |
662 | 363 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
|
364 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
365 ViewFile *vf = data; |
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 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
|
368 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
369 |
662 | 370 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
|
371 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
372 ViewFile *vf = data; |
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 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
|
375 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
376 |
1599 | 377 static void vf_pop_menu_enable_grouping_cb(GtkWidget *widget, gpointer data) |
378 { | |
379 ViewFile *vf = data; | |
380 | |
381 file_data_disable_grouping_list(vf_pop_menu_file_list(vf), FALSE); | |
382 } | |
383 | |
384 static void vf_pop_menu_disable_grouping_cb(GtkWidget *widget, gpointer data) | |
385 { | |
386 ViewFile *vf = data; | |
387 | |
388 file_data_disable_grouping_list(vf_pop_menu_file_list(vf), TRUE); | |
389 } | |
390 | |
662 | 391 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
|
392 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
393 ViewFile *vf; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
394 SortType type; |
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 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
|
397 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
398 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
|
399 if (!vf) return; |
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 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
|
402 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
403 if (vf->layout) |
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 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
|
406 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
407 else |
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 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
|
410 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
411 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
412 |
662 | 413 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
|
414 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
415 ViewFile *vf = data; |
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 if (vf->layout) |
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 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
|
420 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
421 else |
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 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
|
424 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
425 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
426 |
662 | 427 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
|
428 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
429 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
430 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
|
431 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
432 |
662 | 433 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
|
434 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
435 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
436 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
|
437 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
438 |
662 | 439 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
|
440 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
441 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
442 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
|
443 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
444 |
662 | 445 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
|
446 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
447 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
448 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
|
449 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
450 |
662 | 451 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
|
452 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
453 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
454 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
|
455 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
456 |
662 | 457 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
|
458 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
459 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
460 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
|
461 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
462 |
662 | 463 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
|
464 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
465 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
466 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
|
467 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
468 |
662 | 469 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
|
470 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
471 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
472 |
636
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
473 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
|
474 |
1412 | 475 switch (vf->type) |
636
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
476 { |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
477 case FILEVIEW_LIST: |
1309 | 478 layout_views_set(vf->layout, vf->layout->options.dir_view_type, FILEVIEW_ICON); |
636
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
479 break; |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
480 case FILEVIEW_ICON: |
1309 | 481 layout_views_set(vf->layout, vf->layout->options.dir_view_type, FILEVIEW_LIST); |
636
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
482 break; |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
483 } |
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
484 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
485 |
662 | 486 static void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) |
637 | 487 { |
488 ViewFile *vf = data; | |
489 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
490 switch (vf->type) |
637 | 491 { |
492 case FILEVIEW_LIST: vflist_pop_menu_refresh_cb(widget, data); break; | |
493 case FILEVIEW_ICON: vficon_pop_menu_refresh_cb(widget, data); break; | |
494 } | |
495 } | |
496 | |
662 | 497 static void vf_popup_destroy_cb(GtkWidget *widget, gpointer data) |
637 | 498 { |
499 ViewFile *vf = data; | |
500 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
501 switch (vf->type) |
637 | 502 { |
503 case FILEVIEW_LIST: vflist_popup_destroy_cb(widget, data); break; | |
504 case FILEVIEW_ICON: vficon_popup_destroy_cb(widget, data); break; | |
505 } | |
1397
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
506 |
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
507 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
|
508 vf->editmenu_fd_list = NULL; |
637 | 509 } |
634 | 510 |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
511 GtkWidget *vf_pop_menu(ViewFile *vf) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
512 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
513 GtkWidget *menu; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
514 GtkWidget *item; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
515 GtkWidget *submenu; |
1453 | 516 gboolean active = FALSE; |
634 | 517 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
518 switch (vf->type) |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
519 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
520 case FILEVIEW_LIST: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
521 vflist_color_set(vf, VFLIST(vf)->click_fd, TRUE); |
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
522 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
|
523 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
524 case FILEVIEW_ICON: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
525 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
|
526 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
527 } |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
528 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
529 menu = popup_menu_short_lived(); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
530 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
531 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
|
532 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
|
533 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
534 if (vf->clicked_mark > 0) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
535 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
536 gint mark = vf->clicked_mark; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
537 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
|
538 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
|
539 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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
545 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
|
546 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
547 vf->active_mark = mark; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
548 vf->clicked_mark = 0; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
549 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
550 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
|
551 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
|
552 |
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_res_mark, 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_res_mark_sel_cb), vf); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
555 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
556 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
|
557 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
|
558 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
559 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
560 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 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
|
569 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
570 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
571 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
572 g_free(str_set_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
573 g_free(str_res_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
574 g_free(str_toggle_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
575 g_free(str_sel_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
576 g_free(str_sel_mark_and); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
577 g_free(str_sel_mark_or); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
578 g_free(str_sel_mark_minus); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
579 } |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
580 |
1397
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
581 vf->editmenu_fd_list = vf_selection_get_list(vf); |
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
582 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
|
583 gtk_widget_set_sensitive(item, active); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
584 |
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, _("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
|
586 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
|
587 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
588 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
589 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
|
590 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
|
591 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
|
592 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
|
593 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
|
594 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
|
595 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
|
596 G_CALLBACK(vf_pop_menu_delete_cb), vf); |
1513 | 597 menu_item_add_sensitive(menu, _("_Copy path"), active, |
598 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
|
599 |
1599 | 600 menu_item_add_sensitive(menu, _("Enable file _grouping"), active, |
601 G_CALLBACK(vf_pop_menu_enable_grouping_cb), vf); | |
602 menu_item_add_sensitive(menu, _("Disable file groupi_ng"), active, | |
603 G_CALLBACK(vf_pop_menu_disable_grouping_cb), vf); | |
604 | |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
605 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
606 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
607 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
|
608 FALSE, FALSE, TRUE, vf->sort_method); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
609 menu_item_add_divider(submenu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
610 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
|
611 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
|
612 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
613 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
|
614 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
|
615 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
616 menu_item_add_check(menu, _("View as _icons"), (vf->type == FILEVIEW_ICON), |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
617 G_CALLBACK(vf_pop_menu_toggle_view_type_cb), vf); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
618 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
619 switch (vf->type) |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
620 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
621 case FILEVIEW_LIST: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
622 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
|
623 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
|
624 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
625 case FILEVIEW_ICON: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
626 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
|
627 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
|
628 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
629 } |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
630 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
631 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
|
632 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
633 return menu; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
634 } |
634 | 635 |
1506
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
636 void vf_thumb_update(ViewFile *vf) |
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
637 { |
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
638 switch (vf->type) |
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
639 { |
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
640 case FILEVIEW_LIST: vflist_thumb_update(vf); break; |
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
641 case FILEVIEW_ICON: vficon_thumb_update(vf); break; |
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
642 } |
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
643 } |
d352a44545a6
Force thumbnails refreshing when thumbnails dimensions are modified through Preferences.
zas_
parents:
1503
diff
changeset
|
644 |
1453 | 645 gboolean vf_refresh(ViewFile *vf) |
572 | 646 { |
1437 | 647 gboolean ret = FALSE; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
648 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
649 switch (vf->type) |
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 case FILEVIEW_LIST: ret = vflist_refresh(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
652 case FILEVIEW_ICON: ret = vficon_refresh(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
653 } |
572 | 654 |
655 return ret; | |
656 } | |
657 | |
1453 | 658 gboolean vf_set_fd(ViewFile *vf, FileData *dir_fd) |
572 | 659 { |
1437 | 660 gboolean ret = FALSE; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
661 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
662 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
663 { |
783 | 664 case FILEVIEW_LIST: ret = vflist_set_fd(vf, dir_fd); break; |
665 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
|
666 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
667 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
668 return ret; |
572 | 669 } |
670 | |
671 static void vf_destroy_cb(GtkWidget *widget, gpointer data) | |
672 { | |
673 ViewFile *vf = data; | |
674 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
675 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
676 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
677 case FILEVIEW_LIST: vflist_destroy_cb(widget, data); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
678 case FILEVIEW_ICON: vficon_destroy_cb(widget, data); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
679 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
680 |
572 | 681 if (vf->popup) |
682 { | |
683 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA, | |
684 0, 0, 0, NULL, vf); | |
685 gtk_widget_destroy(vf->popup); | |
686 } | |
687 | |
783 | 688 file_data_unref(vf->dir_fd); |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
689 g_free(vf->info); |
572 | 690 g_free(vf); |
691 } | |
692 | |
964 | 693 static void vf_marks_filter_toggle_cb(GtkWidget *widget, gpointer data) |
694 { | |
695 ViewFile *vf = data; | |
696 vf_refresh_idle(vf); | |
697 } | |
698 | |
699 | |
700 static GtkWidget *vf_marks_filter_init(ViewFile *vf) | |
701 { | |
702 GtkWidget *frame = gtk_frame_new(NULL); | |
703 GtkWidget *hbox = gtk_hbox_new(FALSE, 0); | |
704 | |
705 gint i; | |
706 | |
707 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++) | |
708 { | |
709 GtkWidget *check = gtk_check_button_new(); | |
710 gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0); | |
711 g_signal_connect(G_OBJECT(check), "toggled", | |
712 G_CALLBACK(vf_marks_filter_toggle_cb), vf); | |
713 | |
714 gtk_widget_show(check); | |
715 vf->filter_check[i] = check; | |
716 } | |
717 gtk_container_add(GTK_CONTAINER(frame), hbox); | |
718 gtk_widget_show(hbox); | |
719 return frame; | |
720 } | |
721 | |
783 | 722 ViewFile *vf_new(FileViewType type, FileData *dir_fd) |
572 | 723 { |
724 ViewFile *vf; | |
725 | |
726 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
|
727 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
728 vf->type = type; |
572 | 729 vf->sort_method = SORT_NAME; |
730 vf->sort_ascend = TRUE; | |
814 | 731 |
964 | 732 vf->scrolled = gtk_scrolled_window_new(NULL, NULL); |
733 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN); | |
734 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vf->scrolled), | |
572 | 735 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
736 |
964 | 737 vf->filter = vf_marks_filter_init(vf); |
738 | |
739 vf->widget = gtk_vbox_new(FALSE, 0); | |
740 gtk_box_pack_start(GTK_BOX(vf->widget), vf->filter, FALSE, FALSE, 0); | |
741 gtk_box_pack_start(GTK_BOX(vf->widget), vf->scrolled, TRUE, TRUE, 0); | |
742 gtk_widget_show(vf->scrolled); | |
743 | |
572 | 744 g_signal_connect(G_OBJECT(vf->widget), "destroy", |
745 G_CALLBACK(vf_destroy_cb), vf); | |
746 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
747 switch (type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
748 { |
783 | 749 case FILEVIEW_LIST: vf = vflist_new(vf, dir_fd); break; |
750 case FILEVIEW_ICON: vf = vficon_new(vf, dir_fd); break; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
751 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
752 |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
753 vf_dnd_init(vf); |
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
754 |
572 | 755 g_signal_connect(G_OBJECT(vf->listview), "key_press_event", |
756 G_CALLBACK(vf_press_key_cb), vf); | |
757 g_signal_connect(G_OBJECT(vf->listview), "button_press_event", | |
758 G_CALLBACK(vf_press_cb), vf); | |
759 g_signal_connect(G_OBJECT(vf->listview), "button_release_event", | |
760 G_CALLBACK(vf_release_cb), vf); | |
761 | |
964 | 762 gtk_container_add(GTK_CONTAINER(vf->scrolled), vf->listview); |
572 | 763 gtk_widget_show(vf->listview); |
764 | |
783 | 765 if (dir_fd) vf_set_fd(vf, dir_fd); |
572 | 766 |
767 return vf; | |
768 } | |
769 | |
770 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data) | |
771 { | |
772 vf->func_status = func; | |
773 vf->data_status = data; | |
774 } | |
775 | |
776 void vf_set_thumb_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gdouble val, const gchar *text, gpointer data), gpointer data) | |
777 { | |
778 vf->func_thumb_status = func; | |
779 vf->data_thumb_status = data; | |
780 } | |
781 | |
1453 | 782 void vf_thumb_set(ViewFile *vf, gboolean enable) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
783 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
784 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
785 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
786 case FILEVIEW_LIST: vflist_thumb_set(vf, enable); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
787 case FILEVIEW_ICON: /*vficon_thumb_set(vf, enable);*/ break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
788 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
789 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
790 |
1453 | 791 void vf_marks_set(ViewFile *vf, gboolean enable) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
792 { |
852 | 793 if (vf->marks_enabled == enable) return; |
794 | |
795 vf->marks_enabled = enable; | |
796 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
797 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
798 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
799 case FILEVIEW_LIST: vflist_marks_set(vf, enable); break; |
852 | 800 case FILEVIEW_ICON: vficon_marks_set(vf, enable); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
801 } |
964 | 802 if (enable) |
803 gtk_widget_show(vf->filter); | |
804 else | |
805 gtk_widget_hide(vf->filter); | |
806 | |
807 vf_refresh_idle(vf); | |
808 } | |
809 | |
810 guint vf_marks_get_filter(ViewFile *vf) | |
811 { | |
812 guint ret = 0; | |
813 gint i; | |
814 if (!vf->marks_enabled) return 0; | |
815 | |
816 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++) | |
817 { | |
818 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vf->filter_check[i]))) | |
819 { | |
820 ret |= 1 << i; | |
821 } | |
822 } | |
823 return ret; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
824 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
825 |
572 | 826 void vf_set_layout(ViewFile *vf, LayoutWindow *layout) |
827 { | |
828 vf->layout = layout; | |
829 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
830 |
814 | 831 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
832 /* |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
833 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
834 * maintenance (for rename, move, remove) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
835 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
836 */ |
995 | 837 |
1453 | 838 static gboolean vf_refresh_idle_cb(gpointer data) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
839 { |
814 | 840 ViewFile *vf = data; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
841 |
814 | 842 vf_refresh(vf); |
1523 | 843 vf->refresh_idle_id = 0; |
814 | 844 return FALSE; |
845 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
846 |
814 | 847 void vf_refresh_idle_cancel(ViewFile *vf) |
848 { | |
1523 | 849 if (vf->refresh_idle_id) |
850 { | |
851 g_source_remove(vf->refresh_idle_id); | |
852 vf->refresh_idle_id = 0; | |
853 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
854 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
855 |
814 | 856 |
964 | 857 void vf_refresh_idle(ViewFile *vf) |
858 { | |
1523 | 859 if (!vf->refresh_idle_id) |
964 | 860 { |
861 vf->refresh_idle_id = g_idle_add(vf_refresh_idle_cb, vf); | |
862 } | |
863 } | |
864 | |
814 | 865 void vf_notify_cb(FileData *fd, NotifyType type, gpointer data) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
866 { |
814 | 867 ViewFile *vf = data; |
868 gboolean refresh; | |
869 | |
1432 | 870 NotifyType interested = NOTIFY_CHANGE | NOTIFY_REREAD | NOTIFY_GROUPING; |
871 if (vf->marks_enabled) interested |= NOTIFY_MARKS | NOTIFY_METADATA; | |
872 /* FIXME: NOTIFY_METADATA should be checked by the keyword-to-mark functions and converted to NOTIFY_MARKS only if there was a change */ | |
971 | 873 |
1523 | 874 if (!(type & interested) || vf->refresh_idle_id || !vf->dir_fd) return; |
1432 | 875 |
814 | 876 refresh = (fd == vf->dir_fd); |
877 | |
878 if (!refresh) | |
879 { | |
880 gchar *base = remove_level_from_path(fd->path); | |
881 refresh = (strcmp(base, vf->dir_fd->path) == 0); | |
882 g_free(base); | |
883 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
884 |
1432 | 885 if ((type & NOTIFY_CHANGE) && fd->change) |
814 | 886 { |
887 if (!refresh && fd->change->dest) | |
888 { | |
889 gchar *dest_base = remove_level_from_path(fd->change->dest); | |
890 refresh = (strcmp(dest_base, vf->dir_fd->path) == 0); | |
891 g_free(dest_base); | |
892 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
893 |
814 | 894 if (!refresh && fd->change->source) |
895 { | |
896 gchar *source_base = remove_level_from_path(fd->change->source); | |
897 refresh = (strcmp(source_base, vf->dir_fd->path) == 0); | |
898 g_free(source_base); | |
899 } | |
900 } | |
901 | |
964 | 902 if (refresh) |
814 | 903 { |
1498 | 904 DEBUG_1("Notify vf: %s %04x", fd->path, type); |
964 | 905 vf_refresh_idle(vf); |
814 | 906 } |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
907 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
908 |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
995
diff
changeset
|
909 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |