Mercurial > geeqie
annotate src/view_file.c @ 1437:a3d3208b0c50
gint -> gboolean.
author | zas_ |
---|---|
date | Sun, 15 Mar 2009 07:07:52 +0000 |
parents | cf4029d10d38 |
children | bc3f5c0432f6 |
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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
41 void vf_sort_set(ViewFile *vf, SortType type, gint ascend) |
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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
69 gint vf_index_by_path(ViewFile *vf, const gchar *path) |
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 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
75 case FILEVIEW_LIST: index = vflist_index_by_path(vf, path); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
76 case FILEVIEW_ICON: index = vficon_index_by_path(vf, path); 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 |
115 static gint vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | |
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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
135 static gint vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
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 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
149 static gint 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 |
736 | 170 guint vf_selection_count(ViewFile *vf, gint64 *bytes) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
171 { |
736 | 172 guint count = 0; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
173 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
174 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
175 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
176 case FILEVIEW_LIST: count = vflist_selection_count(vf, bytes); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
177 case FILEVIEW_ICON: count = vficon_selection_count(vf, bytes); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
178 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
179 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
180 return count; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
181 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
182 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
183 GList *vf_selection_get_list(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
184 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
185 GList *list = NULL; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
186 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
187 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
188 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
189 case FILEVIEW_LIST: list = vflist_selection_get_list(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
190 case FILEVIEW_ICON: list = vficon_selection_get_list(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
191 } |
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 return list; |
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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
196 GList *vf_selection_get_list_by_index(ViewFile *vf) |
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 *list = NULL; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
199 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
200 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
201 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
202 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
|
203 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
|
204 } |
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 return list; |
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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
209 void vf_select_all(ViewFile *vf) |
572 | 210 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
211 switch (vf->type) |
573
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 case FILEVIEW_LIST: vflist_select_all(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
214 case FILEVIEW_ICON: vficon_select_all(vf); break; |
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 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
217 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
218 void vf_select_none(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
219 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
220 switch (vf->type) |
573
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 case FILEVIEW_LIST: vflist_select_none(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
223 case FILEVIEW_ICON: vficon_select_none(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
224 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
225 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
226 |
601 | 227 void vf_select_invert(ViewFile *vf) |
228 { | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
229 switch (vf->type) |
601 | 230 { |
231 case FILEVIEW_LIST: vflist_select_invert(vf); break; | |
232 case FILEVIEW_ICON: vficon_select_invert(vf); break; | |
233 } | |
234 } | |
235 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
236 void vf_select_by_fd(ViewFile *vf, FileData *fd) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
237 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
238 switch (vf->type) |
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 case FILEVIEW_LIST: vflist_select_by_fd(vf, fd); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
241 case FILEVIEW_ICON: vficon_select_by_fd(vf, fd); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
242 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
243 } |
572 | 244 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
245 void vf_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
246 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
247 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
248 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
249 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
|
250 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
|
251 } |
572 | 252 } |
253 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
254 void vf_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
255 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
256 switch (vf->type) |
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 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
|
259 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
|
260 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
261 } |
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 /* |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
264 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
265 * dnd |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
266 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
267 */ |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
268 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
269 |
572 | 270 static void vf_dnd_init(ViewFile *vf) |
271 { | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
272 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
273 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
274 case FILEVIEW_LIST: vflist_dnd_init(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
275 case FILEVIEW_ICON: vficon_dnd_init(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
276 } |
572 | 277 } |
278 | |
634 | 279 /* |
280 *----------------------------------------------------------------------------- | |
281 * pop-up menu | |
282 *----------------------------------------------------------------------------- | |
283 */ | |
284 | |
285 GList *vf_pop_menu_file_list(ViewFile *vf) | |
286 { | |
287 GList *ret = NULL; | |
288 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
289 switch (vf->type) |
634 | 290 { |
291 case FILEVIEW_LIST: ret = vflist_pop_menu_file_list(vf); break; | |
292 case FILEVIEW_ICON: ret = vficon_pop_menu_file_list(vf); break; | |
293 } | |
294 | |
295 return ret; | |
296 } | |
297 | |
662 | 298 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
|
299 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
300 ViewFile *vf; |
1272 | 301 const gchar *key = data; |
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
302 GList *list; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
303 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
304 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
|
305 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
306 if (!vf) return; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
307 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
308 list = vf_pop_menu_file_list(vf); |
1272 | 309 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
|
310 filelist_free(list); |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
311 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
312 |
662 | 313 static void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data) |
637 | 314 { |
315 ViewFile *vf = data; | |
316 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
317 switch (vf->type) |
637 | 318 { |
319 case FILEVIEW_LIST: vflist_pop_menu_view_cb(widget, data); break; | |
320 case FILEVIEW_ICON: vficon_pop_menu_view_cb(widget, data); break; | |
321 } | |
322 } | |
323 | |
662 | 324 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
|
325 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
326 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
327 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
328 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
|
329 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
330 |
662 | 331 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
|
332 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
333 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
334 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
335 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
|
336 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
337 |
662 | 338 static void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data) |
637 | 339 { |
340 ViewFile *vf = data; | |
341 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
342 switch (vf->type) |
637 | 343 { |
344 case FILEVIEW_LIST: vflist_pop_menu_rename_cb(widget, data); break; | |
345 case FILEVIEW_ICON: vficon_pop_menu_rename_cb(widget, data); break; | |
346 } | |
347 } | |
348 | |
662 | 349 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
|
350 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
351 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
352 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
353 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
|
354 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
355 |
662 | 356 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
|
357 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
358 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
359 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
360 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
|
361 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
362 |
662 | 363 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
|
364 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
365 ViewFile *vf; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
366 SortType type; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
367 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
368 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
|
369 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
370 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
|
371 if (!vf) return; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
372 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
373 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
|
374 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
375 if (vf->layout) |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
376 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
377 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
|
378 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
379 else |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
380 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
381 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
|
382 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
383 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
384 |
662 | 385 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
|
386 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
387 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
388 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
389 if (vf->layout) |
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 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
|
392 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
393 else |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
394 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
395 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
|
396 } |
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 |
662 | 399 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
|
400 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
401 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
402 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
|
403 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
404 |
662 | 405 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
|
406 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
407 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
408 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
|
409 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
410 |
662 | 411 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
|
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 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
|
415 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
416 |
662 | 417 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
|
418 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
419 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
420 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
|
421 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
422 |
662 | 423 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
|
424 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
425 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
426 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
|
427 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
428 |
662 | 429 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
|
430 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
431 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
432 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
|
433 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
434 |
662 | 435 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
|
436 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
437 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
438 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
|
439 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
440 |
662 | 441 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
|
442 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
443 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
444 |
636
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
445 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
|
446 |
1412 | 447 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
|
448 { |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
449 case FILEVIEW_LIST: |
1309 | 450 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
|
451 break; |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
452 case FILEVIEW_ICON: |
1309 | 453 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
|
454 break; |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
455 } |
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 |
662 | 458 static void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) |
637 | 459 { |
460 ViewFile *vf = data; | |
461 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
462 switch (vf->type) |
637 | 463 { |
464 case FILEVIEW_LIST: vflist_pop_menu_refresh_cb(widget, data); break; | |
465 case FILEVIEW_ICON: vficon_pop_menu_refresh_cb(widget, data); break; | |
466 } | |
467 } | |
468 | |
662 | 469 static void vf_popup_destroy_cb(GtkWidget *widget, gpointer data) |
637 | 470 { |
471 ViewFile *vf = data; | |
472 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
473 switch (vf->type) |
637 | 474 { |
475 case FILEVIEW_LIST: vflist_popup_destroy_cb(widget, data); break; | |
476 case FILEVIEW_ICON: vficon_popup_destroy_cb(widget, data); break; | |
477 } | |
1397
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
478 |
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
479 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
|
480 vf->editmenu_fd_list = NULL; |
637 | 481 } |
634 | 482 |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
483 GtkWidget *vf_pop_menu(ViewFile *vf) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
484 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
485 GtkWidget *menu; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
486 GtkWidget *item; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
487 GtkWidget *submenu; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
488 gint active = 0; |
634 | 489 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
490 switch (vf->type) |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
491 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
492 case FILEVIEW_LIST: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
493 vflist_color_set(vf, VFLIST(vf)->click_fd, TRUE); |
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
494 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
|
495 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
496 case FILEVIEW_ICON: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
497 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
|
498 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
499 } |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
500 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
501 menu = popup_menu_short_lived(); |
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 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
|
504 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
|
505 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
506 if (vf->clicked_mark > 0) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
507 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
508 gint mark = vf->clicked_mark; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
509 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
|
510 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
|
511 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
|
512 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
|
513 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
|
514 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
|
515 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
|
516 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
517 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
|
518 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
519 vf->active_mark = mark; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
520 vf->clicked_mark = 0; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
521 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
522 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
|
523 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
|
524 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
525 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
|
526 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
|
527 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
528 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
|
529 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
|
530 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
531 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
532 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
533 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 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
|
541 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
542 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
543 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
544 g_free(str_set_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
545 g_free(str_res_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
546 g_free(str_toggle_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
547 g_free(str_sel_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
548 g_free(str_sel_mark_and); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
549 g_free(str_sel_mark_or); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
550 g_free(str_sel_mark_minus); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
551 } |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
552 |
1397
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
553 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
|
554 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
|
555 gtk_widget_set_sensitive(item, active); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
556 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
557 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
|
558 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
|
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 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 G_CALLBACK(vf_pop_menu_delete_cb), vf); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
569 if (options->show_copy_path) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
570 menu_item_add_sensitive(menu, _("_Copy path"), active, |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
571 G_CALLBACK(vf_pop_menu_copy_path_cb), vf); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
572 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
573 menu_item_add_divider(menu); |
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 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
|
576 FALSE, FALSE, TRUE, vf->sort_method); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
577 menu_item_add_divider(submenu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
578 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
|
579 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
|
580 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
581 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
|
582 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
|
583 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
584 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
|
585 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
|
586 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
587 switch (vf->type) |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
588 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
589 case FILEVIEW_LIST: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
590 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
|
591 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
|
592 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
593 case FILEVIEW_ICON: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
594 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
|
595 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
|
596 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
597 } |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
598 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
599 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
|
600 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
601 return menu; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
602 } |
634 | 603 |
572 | 604 gint vf_refresh(ViewFile *vf) |
605 { | |
1437 | 606 gboolean ret = FALSE; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
607 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
608 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
609 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
610 case FILEVIEW_LIST: ret = vflist_refresh(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
611 case FILEVIEW_ICON: ret = vficon_refresh(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
612 } |
572 | 613 |
614 return ret; | |
615 } | |
616 | |
783 | 617 gint vf_set_fd(ViewFile *vf, FileData *dir_fd) |
572 | 618 { |
1437 | 619 gboolean ret = FALSE; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
620 |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
621 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
622 { |
783 | 623 case FILEVIEW_LIST: ret = vflist_set_fd(vf, dir_fd); break; |
624 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
|
625 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
626 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
627 return ret; |
572 | 628 } |
629 | |
630 static void vf_destroy_cb(GtkWidget *widget, gpointer data) | |
631 { | |
632 ViewFile *vf = data; | |
633 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
634 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
635 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
636 case FILEVIEW_LIST: vflist_destroy_cb(widget, data); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
637 case FILEVIEW_ICON: vficon_destroy_cb(widget, data); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
638 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
639 |
572 | 640 if (vf->popup) |
641 { | |
642 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA, | |
643 0, 0, 0, NULL, vf); | |
644 gtk_widget_destroy(vf->popup); | |
645 } | |
646 | |
783 | 647 file_data_unref(vf->dir_fd); |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
648 g_free(vf->info); |
572 | 649 g_free(vf); |
650 } | |
651 | |
964 | 652 static void vf_marks_filter_toggle_cb(GtkWidget *widget, gpointer data) |
653 { | |
654 ViewFile *vf = data; | |
655 vf_refresh_idle(vf); | |
656 } | |
657 | |
658 | |
659 static GtkWidget *vf_marks_filter_init(ViewFile *vf) | |
660 { | |
661 GtkWidget *frame = gtk_frame_new(NULL); | |
662 GtkWidget *hbox = gtk_hbox_new(FALSE, 0); | |
663 | |
664 gint i; | |
665 | |
666 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++) | |
667 { | |
668 GtkWidget *check = gtk_check_button_new(); | |
669 gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0); | |
670 g_signal_connect(G_OBJECT(check), "toggled", | |
671 G_CALLBACK(vf_marks_filter_toggle_cb), vf); | |
672 | |
673 gtk_widget_show(check); | |
674 vf->filter_check[i] = check; | |
675 } | |
676 gtk_container_add(GTK_CONTAINER(frame), hbox); | |
677 gtk_widget_show(hbox); | |
678 return frame; | |
679 } | |
680 | |
783 | 681 ViewFile *vf_new(FileViewType type, FileData *dir_fd) |
572 | 682 { |
683 ViewFile *vf; | |
684 | |
685 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
|
686 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
687 vf->type = type; |
572 | 688 vf->sort_method = SORT_NAME; |
689 vf->sort_ascend = TRUE; | |
814 | 690 vf->refresh_idle_id = -1; |
691 | |
964 | 692 vf->scrolled = gtk_scrolled_window_new(NULL, NULL); |
693 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN); | |
694 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vf->scrolled), | |
572 | 695 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
696 |
964 | 697 vf->filter = vf_marks_filter_init(vf); |
698 | |
699 vf->widget = gtk_vbox_new(FALSE, 0); | |
700 gtk_box_pack_start(GTK_BOX(vf->widget), vf->filter, FALSE, FALSE, 0); | |
701 gtk_box_pack_start(GTK_BOX(vf->widget), vf->scrolled, TRUE, TRUE, 0); | |
702 gtk_widget_show(vf->scrolled); | |
703 | |
572 | 704 g_signal_connect(G_OBJECT(vf->widget), "destroy", |
705 G_CALLBACK(vf_destroy_cb), vf); | |
706 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
707 switch (type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
708 { |
783 | 709 case FILEVIEW_LIST: vf = vflist_new(vf, dir_fd); break; |
710 case FILEVIEW_ICON: vf = vficon_new(vf, dir_fd); break; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
711 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
712 |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
713 vf_dnd_init(vf); |
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
714 |
572 | 715 g_signal_connect(G_OBJECT(vf->listview), "key_press_event", |
716 G_CALLBACK(vf_press_key_cb), vf); | |
717 g_signal_connect(G_OBJECT(vf->listview), "button_press_event", | |
718 G_CALLBACK(vf_press_cb), vf); | |
719 g_signal_connect(G_OBJECT(vf->listview), "button_release_event", | |
720 G_CALLBACK(vf_release_cb), vf); | |
721 | |
964 | 722 gtk_container_add(GTK_CONTAINER(vf->scrolled), vf->listview); |
572 | 723 gtk_widget_show(vf->listview); |
724 | |
783 | 725 if (dir_fd) vf_set_fd(vf, dir_fd); |
572 | 726 |
727 return vf; | |
728 } | |
729 | |
730 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data) | |
731 { | |
732 vf->func_status = func; | |
733 vf->data_status = data; | |
734 } | |
735 | |
736 void vf_set_thumb_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gdouble val, const gchar *text, gpointer data), gpointer data) | |
737 { | |
738 vf->func_thumb_status = func; | |
739 vf->data_thumb_status = data; | |
740 } | |
741 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
742 void vf_thumb_set(ViewFile *vf, gint enable) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
743 { |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
744 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
745 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
746 case FILEVIEW_LIST: vflist_thumb_set(vf, enable); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
747 case FILEVIEW_ICON: /*vficon_thumb_set(vf, enable);*/ break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
748 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
749 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
750 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
751 void vf_marks_set(ViewFile *vf, gint enable) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
752 { |
852 | 753 if (vf->marks_enabled == enable) return; |
754 | |
755 vf->marks_enabled = enable; | |
756 | |
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
757 switch (vf->type) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
758 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
759 case FILEVIEW_LIST: vflist_marks_set(vf, enable); break; |
852 | 760 case FILEVIEW_ICON: vficon_marks_set(vf, enable); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
761 } |
964 | 762 if (enable) |
763 gtk_widget_show(vf->filter); | |
764 else | |
765 gtk_widget_hide(vf->filter); | |
766 | |
767 vf_refresh_idle(vf); | |
768 } | |
769 | |
770 guint vf_marks_get_filter(ViewFile *vf) | |
771 { | |
772 guint ret = 0; | |
773 gint i; | |
774 if (!vf->marks_enabled) return 0; | |
775 | |
776 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++) | |
777 { | |
778 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vf->filter_check[i]))) | |
779 { | |
780 ret |= 1 << i; | |
781 } | |
782 } | |
783 return ret; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
784 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
785 |
572 | 786 void vf_set_layout(ViewFile *vf, LayoutWindow *layout) |
787 { | |
788 vf->layout = layout; | |
789 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
790 |
814 | 791 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
792 /* |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
793 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
794 * maintenance (for rename, move, remove) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
795 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
796 */ |
995 | 797 |
814 | 798 static gint vf_refresh_idle_cb(gpointer data) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
799 { |
814 | 800 ViewFile *vf = data; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
801 |
814 | 802 vf_refresh(vf); |
803 vf->refresh_idle_id = -1; | |
804 return FALSE; | |
805 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
806 |
814 | 807 void vf_refresh_idle_cancel(ViewFile *vf) |
808 { | |
809 if (vf->refresh_idle_id != -1) g_source_remove(vf->refresh_idle_id); | |
810 vf->refresh_idle_id = -1; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
811 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
812 |
814 | 813 |
964 | 814 void vf_refresh_idle(ViewFile *vf) |
815 { | |
816 if (vf->refresh_idle_id == -1) | |
817 { | |
818 vf->refresh_idle_id = g_idle_add(vf_refresh_idle_cb, vf); | |
819 } | |
820 } | |
821 | |
814 | 822 void vf_notify_cb(FileData *fd, NotifyType type, gpointer data) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
823 { |
814 | 824 ViewFile *vf = data; |
825 gboolean refresh; | |
826 | |
1432 | 827 NotifyType interested = NOTIFY_CHANGE | NOTIFY_REREAD | NOTIFY_GROUPING; |
828 if (vf->marks_enabled) interested |= NOTIFY_MARKS | NOTIFY_METADATA; | |
829 /* FIXME: NOTIFY_METADATA should be checked by the keyword-to-mark functions and converted to NOTIFY_MARKS only if there was a change */ | |
971 | 830 |
1432 | 831 if (!(type & interested) || vf->refresh_idle_id != -1 || !vf->dir_fd) return; |
832 | |
814 | 833 refresh = (fd == vf->dir_fd); |
834 | |
835 if (!refresh) | |
836 { | |
837 gchar *base = remove_level_from_path(fd->path); | |
838 refresh = (strcmp(base, vf->dir_fd->path) == 0); | |
839 g_free(base); | |
840 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
841 |
1432 | 842 if ((type & NOTIFY_CHANGE) && fd->change) |
814 | 843 { |
844 if (!refresh && fd->change->dest) | |
845 { | |
846 gchar *dest_base = remove_level_from_path(fd->change->dest); | |
847 refresh = (strcmp(dest_base, vf->dir_fd->path) == 0); | |
848 g_free(dest_base); | |
849 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
850 |
814 | 851 if (!refresh && fd->change->source) |
852 { | |
853 gchar *source_base = remove_level_from_path(fd->change->source); | |
854 refresh = (strcmp(source_base, vf->dir_fd->path) == 0); | |
855 g_free(source_base); | |
856 } | |
857 } | |
858 | |
964 | 859 if (refresh) |
814 | 860 { |
964 | 861 vf_refresh_idle(vf); |
814 | 862 } |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
863 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
864 |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
995
diff
changeset
|
865 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |