Mercurial > geeqie
annotate src/view_file.c @ 1236:a501721c4ec6
French translation was updated.
author | zas_ |
---|---|
date | Sun, 04 Jan 2009 10:32:47 +0000 |
parents | 1646720364cf |
children | e0e12512cde2 |
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 |
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
3 * Copyright (C) 2008 The Geeqie Team |
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 "info.h" |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
17 #include "layout.h" |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
18 #include "menu.h" |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
19 #include "ui_menu.h" |
814 | 20 #include "ui_fileops.h" |
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
21 #include "utilops.h" |
554
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
22 #include "view_file_list.h" |
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
23 #include "view_file_icon.h" |
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
24 |
633 | 25 /* |
26 *----------------------------------------------------------------------------- | |
27 * signals | |
28 *----------------------------------------------------------------------------- | |
29 */ | |
30 | |
31 void vf_send_update(ViewFile *vf) | |
32 { | |
33 if (vf->func_status) vf->func_status(vf, vf->data_status); | |
34 } | |
560 | 35 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
36 /* |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
37 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
38 * misc |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
39 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
40 */ |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
41 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
42 void vf_sort_set(ViewFile *vf, SortType type, gint ascend) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
43 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
44 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
45 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
46 case FILEVIEW_LIST: vflist_sort_set(vf, type, ascend); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
47 case FILEVIEW_ICON: vficon_sort_set(vf, type, ascend); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
48 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
49 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
50 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
51 /* |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
52 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
53 * row stuff |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
54 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
55 */ |
560 | 56 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
57 FileData *vf_index_get_data(ViewFile *vf, gint row) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
58 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
59 FileData *fd = NULL; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
60 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
61 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
62 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
63 case FILEVIEW_LIST: fd = vflist_index_get_data(vf, row); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
64 case FILEVIEW_ICON: fd = vficon_index_get_data(vf, row); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
65 } |
560 | 66 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
67 return fd; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
68 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
69 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
70 gint vf_index_by_path(ViewFile *vf, const gchar *path) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
71 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
72 gint index = -1; |
560 | 73 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
74 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
75 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
76 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
|
77 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
|
78 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
79 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
80 return index; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
81 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
82 |
736 | 83 guint vf_count(ViewFile *vf, gint64 *bytes) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
84 { |
736 | 85 guint count = 0; |
560 | 86 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
87 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
88 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
89 case FILEVIEW_LIST: count = vflist_count(vf, bytes); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
90 case FILEVIEW_ICON: count = vficon_count(vf, bytes); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
91 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
92 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
93 return count; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
94 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
95 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
96 GList *vf_get_list(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
97 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
98 GList *list = NULL; |
560 | 99 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
100 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
101 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
102 case FILEVIEW_LIST: list = vflist_get_list(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
103 case FILEVIEW_ICON: list = vficon_get_list(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
104 } |
560 | 105 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
106 return list; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
107 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
108 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
109 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
110 /* |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
111 *------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
112 * keyboard |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
113 *------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
114 */ |
572 | 115 |
116 static gint vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | |
117 { | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
118 ViewFile *vf = data; |
572 | 119 gint ret = FALSE; |
120 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
121 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
122 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
123 case FILEVIEW_LIST: ret = vflist_press_key_cb(widget, event, data); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
124 case FILEVIEW_ICON: ret = vficon_press_key_cb(widget, event, data); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
125 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
126 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
127 return ret; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
128 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
129 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
130 /* |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
131 *------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
132 * mouse |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
133 *------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
134 */ |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
135 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
136 static gint vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
137 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
138 ViewFile *vf = data; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
139 gint ret = FALSE; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
140 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
141 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
142 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
143 case FILEVIEW_LIST: ret = vflist_press_cb(widget, bevent, data); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
144 case FILEVIEW_ICON: ret = vficon_press_cb(widget, bevent, data); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
145 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
146 |
572 | 147 return ret; |
148 } | |
149 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
150 static gint vf_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
572 | 151 { |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
152 ViewFile *vf = data; |
572 | 153 gint ret = FALSE; |
154 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
155 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
156 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
157 case FILEVIEW_LIST: ret = vflist_release_cb(widget, bevent, data); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
158 case FILEVIEW_ICON: ret = vficon_release_cb(widget, bevent, data); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
159 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
160 |
572 | 161 return ret; |
162 } | |
163 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
164 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
165 /* |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
166 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
167 * selections |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
168 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
169 */ |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
170 |
736 | 171 guint vf_selection_count(ViewFile *vf, gint64 *bytes) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
172 { |
736 | 173 guint count = 0; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
174 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
175 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
176 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
177 case FILEVIEW_LIST: count = vflist_selection_count(vf, bytes); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
178 case FILEVIEW_ICON: count = vficon_selection_count(vf, bytes); break; |
573
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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
181 return count; |
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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
184 GList *vf_selection_get_list(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
185 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
186 GList *list = NULL; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
187 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
188 switch(vf->type) |
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: list = vflist_selection_get_list(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
191 case FILEVIEW_ICON: list = vficon_selection_get_list(vf); 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 list; |
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_by_index(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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
201 switch(vf->type) |
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_by_index(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_by_index(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 void vf_select_all(ViewFile *vf) |
572 | 211 { |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
212 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
213 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
214 case FILEVIEW_LIST: vflist_select_all(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
215 case FILEVIEW_ICON: vficon_select_all(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
216 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
217 } |
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 void vf_select_none(ViewFile *vf) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
220 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
221 switch(vf->type) |
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 case FILEVIEW_LIST: vflist_select_none(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
224 case FILEVIEW_ICON: vficon_select_none(vf); break; |
573
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 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
227 |
601 | 228 void vf_select_invert(ViewFile *vf) |
229 { | |
230 switch(vf->type) | |
231 { | |
232 case FILEVIEW_LIST: vflist_select_invert(vf); break; | |
233 case FILEVIEW_ICON: vficon_select_invert(vf); break; | |
234 } | |
235 } | |
236 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
237 void vf_select_by_fd(ViewFile *vf, FileData *fd) |
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 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
240 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
241 case FILEVIEW_LIST: vflist_select_by_fd(vf, fd); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
242 case FILEVIEW_ICON: vficon_select_by_fd(vf, fd); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
243 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
244 } |
572 | 245 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
246 void vf_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
247 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
248 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
249 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
250 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
|
251 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
|
252 } |
572 | 253 } |
254 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
255 void vf_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode) |
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 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
258 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
259 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
|
260 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
|
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 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
266 * dnd |
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 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
270 |
572 | 271 static void vf_dnd_init(ViewFile *vf) |
272 { | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
273 switch(vf->type) |
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 case FILEVIEW_LIST: vflist_dnd_init(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
276 case FILEVIEW_ICON: vficon_dnd_init(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
277 } |
572 | 278 } |
279 | |
634 | 280 /* |
281 *----------------------------------------------------------------------------- | |
282 * pop-up menu | |
283 *----------------------------------------------------------------------------- | |
284 */ | |
285 | |
286 GList *vf_pop_menu_file_list(ViewFile *vf) | |
287 { | |
288 GList *ret = NULL; | |
289 | |
290 switch(vf->type) | |
291 { | |
292 case FILEVIEW_LIST: ret = vflist_pop_menu_file_list(vf); break; | |
293 case FILEVIEW_ICON: ret = vficon_pop_menu_file_list(vf); break; | |
294 } | |
295 | |
296 return ret; | |
297 } | |
298 | |
662 | 299 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
|
300 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
301 ViewFile *vf; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
302 gint n; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
303 GList *list; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
304 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
305 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
|
306 n = GPOINTER_TO_INT(data); |
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 if (!vf) return; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
309 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
310 list = vf_pop_menu_file_list(vf); |
753 | 311 file_util_start_editor_from_filelist(n, list, vf->listview); |
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
312 filelist_free(list); |
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 |
662 | 315 static void vf_pop_menu_info_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
|
316 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
317 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
318 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
319 info_window_new(NULL, vf_pop_menu_file_list(vf), NULL); |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
320 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
321 |
662 | 322 static void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data) |
637 | 323 { |
324 ViewFile *vf = data; | |
325 | |
326 switch(vf->type) | |
327 { | |
328 case FILEVIEW_LIST: vflist_pop_menu_view_cb(widget, data); break; | |
329 case FILEVIEW_ICON: vficon_pop_menu_view_cb(widget, data); break; | |
330 } | |
331 } | |
332 | |
662 | 333 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
|
334 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
335 ViewFile *vf = data; |
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 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
|
338 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
339 |
662 | 340 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
|
341 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
342 ViewFile *vf = data; |
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 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
|
345 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
346 |
662 | 347 static void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data) |
637 | 348 { |
349 ViewFile *vf = data; | |
350 | |
351 switch(vf->type) | |
352 { | |
353 case FILEVIEW_LIST: vflist_pop_menu_rename_cb(widget, data); break; | |
354 case FILEVIEW_ICON: vficon_pop_menu_rename_cb(widget, data); break; | |
355 } | |
356 } | |
357 | |
662 | 358 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
|
359 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
360 ViewFile *vf = data; |
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 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
|
363 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
364 |
662 | 365 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
|
366 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
367 ViewFile *vf = data; |
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 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
|
370 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
371 |
662 | 372 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
|
373 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
374 ViewFile *vf; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
375 SortType type; |
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 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
|
378 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
379 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
|
380 if (!vf) return; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
381 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
382 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
|
383 |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
384 if (vf->layout) |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
385 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
386 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
|
387 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
388 else |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
389 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
390 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
|
391 } |
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 |
662 | 394 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
|
395 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
396 ViewFile *vf = data; |
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 if (vf->layout) |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
399 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
400 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
|
401 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
402 else |
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 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
|
405 } |
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 |
662 | 408 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
|
409 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
410 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
411 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
|
412 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
413 |
662 | 414 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
|
415 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
416 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
417 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
|
418 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
419 |
662 | 420 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
|
421 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
422 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
423 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
|
424 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
425 |
662 | 426 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
|
427 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
428 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
429 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
|
430 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
431 |
662 | 432 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
|
433 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
434 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
435 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
|
436 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
437 |
662 | 438 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
|
439 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
440 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
441 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
|
442 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
443 |
662 | 444 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
|
445 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
446 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
447 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
|
448 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
449 |
662 | 450 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
|
451 { |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
452 ViewFile *vf = data; |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
453 |
636
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
454 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
|
455 |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
456 switch(vf->layout->file_view_type) |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
457 { |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
458 case FILEVIEW_LIST: |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
459 layout_views_set(vf->layout, vf->layout->dir_view_type, FILEVIEW_ICON); |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
460 break; |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
461 case FILEVIEW_ICON: |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
462 layout_views_set(vf->layout, vf->layout->dir_view_type, FILEVIEW_LIST); |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
463 break; |
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
464 } |
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
465 } |
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
466 |
662 | 467 static void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) |
637 | 468 { |
469 ViewFile *vf = data; | |
470 | |
471 switch(vf->type) | |
472 { | |
473 case FILEVIEW_LIST: vflist_pop_menu_refresh_cb(widget, data); break; | |
474 case FILEVIEW_ICON: vficon_pop_menu_refresh_cb(widget, data); break; | |
475 } | |
476 } | |
477 | |
662 | 478 static void vf_popup_destroy_cb(GtkWidget *widget, gpointer data) |
637 | 479 { |
480 ViewFile *vf = data; | |
481 | |
482 switch(vf->type) | |
483 { | |
484 case FILEVIEW_LIST: vflist_popup_destroy_cb(widget, data); break; | |
485 case FILEVIEW_ICON: vficon_popup_destroy_cb(widget, data); break; | |
486 } | |
487 } | |
634 | 488 |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
489 GtkWidget *vf_pop_menu(ViewFile *vf) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
490 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
491 GtkWidget *menu; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
492 GtkWidget *item; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
493 GtkWidget *submenu; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
494 gint active = 0; |
634 | 495 |
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
496 switch(vf->type) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
497 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
498 case FILEVIEW_LIST: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
499 vflist_color_set(vf, VFLIST(vf)->click_fd, TRUE); |
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
500 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
|
501 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
502 case FILEVIEW_ICON: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
503 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
|
504 break; |
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 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
507 menu = popup_menu_short_lived(); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
508 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
509 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
|
510 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
|
511 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
512 if (vf->clicked_mark > 0) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
513 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
514 gint mark = vf->clicked_mark; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
515 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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 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
|
521 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
|
522 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
523 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
|
524 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
525 vf->active_mark = mark; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
526 vf->clicked_mark = 0; |
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_set_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_set_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_sensitive(menu, str_res_mark, active, |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
532 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
|
533 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
534 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
|
535 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
|
536 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
537 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
538 |
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, 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_cb), vf); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
541 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
|
542 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
|
543 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
|
544 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
|
545 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
|
546 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
|
547 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
548 menu_item_add_divider(menu); |
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 g_free(str_set_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
551 g_free(str_res_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
552 g_free(str_toggle_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
553 g_free(str_sel_mark); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
554 g_free(str_sel_mark_and); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
555 g_free(str_sel_mark_or); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
556 g_free(str_sel_mark_minus); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
557 } |
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 submenu_add_edit(menu, &item, G_CALLBACK(vf_pop_menu_edit_cb), vf); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
560 gtk_widget_set_sensitive(item, active); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
561 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
562 menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, active, |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
563 G_CALLBACK(vf_pop_menu_info_cb), vf); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
564 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
|
565 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
|
566 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
567 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
568 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 if (options->show_copy_path) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
577 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
|
578 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
|
579 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
580 menu_item_add_divider(menu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
581 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
582 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
|
583 FALSE, FALSE, TRUE, vf->sort_method); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
584 menu_item_add_divider(submenu); |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
585 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
|
586 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
|
587 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
588 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
|
589 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
|
590 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
591 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
|
592 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
|
593 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
594 switch(vf->type) |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
595 { |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
596 case FILEVIEW_LIST: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
597 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
|
598 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
|
599 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
600 case FILEVIEW_ICON: |
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
601 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
|
602 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
|
603 break; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
604 } |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
605 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
606 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
|
607 |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
608 return menu; |
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
609 } |
634 | 610 |
572 | 611 gint vf_refresh(ViewFile *vf) |
612 { | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
613 gint ret = FALSE; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
614 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
615 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
616 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
617 case FILEVIEW_LIST: ret = vflist_refresh(vf); break; |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
618 case FILEVIEW_ICON: ret = vficon_refresh(vf); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
619 } |
572 | 620 |
621 return ret; | |
622 } | |
623 | |
783 | 624 gint vf_set_fd(ViewFile *vf, FileData *dir_fd) |
572 | 625 { |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
626 gint ret = FALSE; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
627 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
628 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
629 { |
783 | 630 case FILEVIEW_LIST: ret = vflist_set_fd(vf, dir_fd); break; |
631 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
|
632 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
633 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
634 return ret; |
572 | 635 } |
636 | |
637 static void vf_destroy_cb(GtkWidget *widget, gpointer data) | |
638 { | |
639 ViewFile *vf = data; | |
640 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
641 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
642 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
643 case FILEVIEW_LIST: vflist_destroy_cb(widget, data); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
644 case FILEVIEW_ICON: vficon_destroy_cb(widget, data); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
645 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
646 |
572 | 647 if (vf->popup) |
648 { | |
649 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA, | |
650 0, 0, 0, NULL, vf); | |
651 gtk_widget_destroy(vf->popup); | |
652 } | |
653 | |
783 | 654 file_data_unref(vf->dir_fd); |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
655 g_free(vf->info); |
572 | 656 g_free(vf); |
657 } | |
658 | |
964 | 659 static void vf_marks_filter_toggle_cb(GtkWidget *widget, gpointer data) |
660 { | |
661 ViewFile *vf = data; | |
662 vf_refresh_idle(vf); | |
663 } | |
664 | |
665 | |
666 static GtkWidget *vf_marks_filter_init(ViewFile *vf) | |
667 { | |
668 GtkWidget *frame = gtk_frame_new(NULL); | |
669 GtkWidget *hbox = gtk_hbox_new(FALSE, 0); | |
670 | |
671 gint i; | |
672 | |
673 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++) | |
674 { | |
675 GtkWidget *check = gtk_check_button_new(); | |
676 gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0); | |
677 g_signal_connect(G_OBJECT(check), "toggled", | |
678 G_CALLBACK(vf_marks_filter_toggle_cb), vf); | |
679 | |
680 gtk_widget_show(check); | |
681 vf->filter_check[i] = check; | |
682 } | |
683 gtk_container_add(GTK_CONTAINER(frame), hbox); | |
684 gtk_widget_show(hbox); | |
685 return frame; | |
686 } | |
687 | |
783 | 688 ViewFile *vf_new(FileViewType type, FileData *dir_fd) |
572 | 689 { |
690 ViewFile *vf; | |
691 | |
692 vf = g_new0(ViewFile, 1); | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
693 vf->type = type; |
572 | 694 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
695 vf->info = NULL; |
783 | 696 vf->dir_fd = NULL; |
572 | 697 vf->list = NULL; |
698 | |
699 vf->sort_method = SORT_NAME; | |
700 vf->sort_ascend = TRUE; | |
701 | |
702 vf->thumbs_running = FALSE; | |
703 vf->thumbs_loader = NULL; | |
704 vf->thumbs_filedata = NULL; | |
705 | |
706 vf->popup = NULL; | |
707 | |
814 | 708 vf->refresh_idle_id = -1; |
709 | |
964 | 710 vf->scrolled = gtk_scrolled_window_new(NULL, NULL); |
711 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN); | |
712 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vf->scrolled), | |
572 | 713 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
714 |
964 | 715 vf->filter = vf_marks_filter_init(vf); |
716 | |
717 vf->widget = gtk_vbox_new(FALSE, 0); | |
718 gtk_box_pack_start(GTK_BOX(vf->widget), vf->filter, FALSE, FALSE, 0); | |
719 gtk_box_pack_start(GTK_BOX(vf->widget), vf->scrolled, TRUE, TRUE, 0); | |
720 gtk_widget_show(vf->scrolled); | |
721 | |
572 | 722 g_signal_connect(G_OBJECT(vf->widget), "destroy", |
723 G_CALLBACK(vf_destroy_cb), vf); | |
724 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
725 switch(type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
726 { |
783 | 727 case FILEVIEW_LIST: vf = vflist_new(vf, dir_fd); break; |
728 case FILEVIEW_ICON: vf = vficon_new(vf, dir_fd); break; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
729 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
730 |
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
731 vf_dnd_init(vf); |
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
732 |
572 | 733 g_signal_connect(G_OBJECT(vf->listview), "key_press_event", |
734 G_CALLBACK(vf_press_key_cb), vf); | |
735 g_signal_connect(G_OBJECT(vf->listview), "button_press_event", | |
736 G_CALLBACK(vf_press_cb), vf); | |
737 g_signal_connect(G_OBJECT(vf->listview), "button_release_event", | |
738 G_CALLBACK(vf_release_cb), vf); | |
739 | |
964 | 740 gtk_container_add(GTK_CONTAINER(vf->scrolled), vf->listview); |
572 | 741 gtk_widget_show(vf->listview); |
742 | |
783 | 743 if (dir_fd) vf_set_fd(vf, dir_fd); |
572 | 744 |
745 return vf; | |
746 } | |
747 | |
748 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data) | |
749 { | |
750 vf->func_status = func; | |
751 vf->data_status = data; | |
752 } | |
753 | |
754 void vf_set_thumb_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gdouble val, const gchar *text, gpointer data), gpointer data) | |
755 { | |
756 vf->func_thumb_status = func; | |
757 vf->data_thumb_status = data; | |
758 } | |
759 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
760 void vf_thumb_set(ViewFile *vf, gint enable) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
761 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
762 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
763 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
764 case FILEVIEW_LIST: vflist_thumb_set(vf, enable); break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
765 case FILEVIEW_ICON: /*vficon_thumb_set(vf, enable);*/ break; |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
766 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
767 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
768 |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
769 void vf_marks_set(ViewFile *vf, gint enable) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
770 { |
852 | 771 if (vf->marks_enabled == enable) return; |
772 | |
773 vf->marks_enabled = enable; | |
774 | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
775 switch(vf->type) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
776 { |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
777 case FILEVIEW_LIST: vflist_marks_set(vf, enable); break; |
852 | 778 case FILEVIEW_ICON: vficon_marks_set(vf, enable); break; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
779 } |
964 | 780 if (enable) |
781 gtk_widget_show(vf->filter); | |
782 else | |
783 gtk_widget_hide(vf->filter); | |
784 | |
785 vf_refresh_idle(vf); | |
786 } | |
787 | |
788 guint vf_marks_get_filter(ViewFile *vf) | |
789 { | |
790 guint ret = 0; | |
791 gint i; | |
792 if (!vf->marks_enabled) return 0; | |
793 | |
794 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++) | |
795 { | |
796 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vf->filter_check[i]))) | |
797 { | |
798 ret |= 1 << i; | |
799 } | |
800 } | |
801 return ret; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
802 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
803 |
572 | 804 void vf_set_layout(ViewFile *vf, LayoutWindow *layout) |
805 { | |
806 vf->layout = layout; | |
807 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
808 |
814 | 809 |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
810 /* |
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 * maintenance (for rename, move, remove) |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
813 *----------------------------------------------------------------------------- |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
814 */ |
995 | 815 |
814 | 816 static gint vf_refresh_idle_cb(gpointer data) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
817 { |
814 | 818 ViewFile *vf = data; |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
819 |
814 | 820 vf_refresh(vf); |
821 vf->refresh_idle_id = -1; | |
822 return FALSE; | |
823 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
824 |
814 | 825 void vf_refresh_idle_cancel(ViewFile *vf) |
826 { | |
827 if (vf->refresh_idle_id != -1) g_source_remove(vf->refresh_idle_id); | |
828 vf->refresh_idle_id = -1; | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
829 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
830 |
814 | 831 |
964 | 832 void vf_refresh_idle(ViewFile *vf) |
833 { | |
834 if (vf->refresh_idle_id == -1) | |
835 { | |
836 vf->refresh_idle_id = g_idle_add(vf_refresh_idle_cb, vf); | |
837 } | |
838 } | |
839 | |
814 | 840 void vf_notify_cb(FileData *fd, NotifyType type, gpointer data) |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
841 { |
814 | 842 ViewFile *vf = data; |
843 gboolean refresh; | |
844 | |
845 if (vf->refresh_idle_id != -1) return; | |
971 | 846 |
847 if (!vf->dir_fd) return; | |
848 | |
814 | 849 refresh = (fd == vf->dir_fd); |
850 | |
851 if (!refresh) | |
852 { | |
853 gchar *base = remove_level_from_path(fd->path); | |
854 refresh = (strcmp(base, vf->dir_fd->path) == 0); | |
855 g_free(base); | |
856 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
857 |
814 | 858 if (type == NOTIFY_TYPE_CHANGE && fd->change) |
859 { | |
860 if (!refresh && fd->change->dest) | |
861 { | |
862 gchar *dest_base = remove_level_from_path(fd->change->dest); | |
863 refresh = (strcmp(dest_base, vf->dir_fd->path) == 0); | |
864 g_free(dest_base); | |
865 } | |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
866 |
814 | 867 if (!refresh && fd->change->source) |
868 { | |
869 gchar *source_base = remove_level_from_path(fd->change->source); | |
870 refresh = (strcmp(source_base, vf->dir_fd->path) == 0); | |
871 g_free(source_base); | |
872 } | |
873 } | |
874 | |
964 | 875 if (refresh) |
814 | 876 { |
964 | 877 vf_refresh_idle(vf); |
814 | 878 } |
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
879 } |
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
880 |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
995
diff
changeset
|
881 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |