Mercurial > geeqie.yaz
annotate src/view_file.c @ 1724:5276dabe836f
consider sidecars in layout_image popup menu
| author | nadvornik |
|---|---|
| date | Mon, 28 Sep 2009 09:57:06 +0000 |
| parents | b45f0ab6367f |
| children |
| 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" |
|
1606
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
18 #include "thumb.h" |
|
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
19 #include "ui_menu.h" |
| 814 | 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 |
| 1453 | 42 void vf_sort_set(ViewFile *vf, SortType type, gboolean ascend) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
43 { |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
44 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
45 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
46 case FILEVIEW_LIST: vflist_sort_set(vf, type, ascend); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
47 case FILEVIEW_ICON: vficon_sort_set(vf, type, ascend); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
48 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
49 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
50 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
51 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
52 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
53 * row stuff |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
54 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
55 */ |
| 560 | 56 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
57 FileData *vf_index_get_data(ViewFile *vf, gint row) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
58 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
59 FileData *fd = NULL; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
60 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
61 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
62 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
63 case FILEVIEW_LIST: fd = vflist_index_get_data(vf, row); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
64 case FILEVIEW_ICON: fd = vficon_index_get_data(vf, row); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
65 } |
| 560 | 66 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
67 return fd; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
68 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
69 |
| 1503 | 70 gint vf_index_by_fd(ViewFile *vf, FileData *fd) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
71 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
72 gint index = -1; |
| 560 | 73 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
74 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
75 { |
| 1503 | 76 case FILEVIEW_LIST: index = vflist_index_by_fd(vf, fd); break; |
| 77 case FILEVIEW_ICON: index = vficon_index_by_fd(vf, fd); break; | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
78 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
79 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
80 return index; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
81 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
82 |
| 736 | 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 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
87 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
88 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
89 case FILEVIEW_LIST: count = vflist_count(vf, bytes); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
90 case FILEVIEW_ICON: count = vficon_count(vf, bytes); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
91 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
92 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
93 return count; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
94 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
95 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
96 GList *vf_get_list(ViewFile *vf) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
97 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
98 GList *list = NULL; |
| 560 | 99 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
100 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
101 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
102 case FILEVIEW_LIST: list = vflist_get_list(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
103 case FILEVIEW_ICON: list = vficon_get_list(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
104 } |
| 560 | 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 |
| 1453 | 116 static gboolean vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
| 572 | 117 { |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
118 ViewFile *vf = data; |
| 1437 | 119 gboolean ret = FALSE; |
| 572 | 120 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
121 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
122 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
123 case FILEVIEW_LIST: ret = vflist_press_key_cb(widget, event, data); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
124 case FILEVIEW_ICON: ret = vficon_press_key_cb(widget, event, data); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
125 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
126 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
127 return ret; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
128 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
129 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
130 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
131 *------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
132 * mouse |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
133 *------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
134 */ |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
135 |
| 1453 | 136 static gboolean vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
137 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
138 ViewFile *vf = data; |
| 1437 | 139 gboolean ret = FALSE; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
140 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
141 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
142 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
143 case FILEVIEW_LIST: ret = vflist_press_cb(widget, bevent, data); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
144 case FILEVIEW_ICON: ret = vficon_press_cb(widget, bevent, data); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
145 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
146 |
| 572 | 147 return ret; |
| 148 } | |
| 149 | |
| 1453 | 150 static gboolean 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; |
| 1437 | 153 gboolean ret = FALSE; |
| 572 | 154 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
155 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
156 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
157 case FILEVIEW_LIST: ret = vflist_release_cb(widget, bevent, data); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
158 case FILEVIEW_ICON: ret = vficon_release_cb(widget, bevent, data); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
159 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
160 |
| 572 | 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 |
| 1453 | 171 gboolean vf_index_is_selected(ViewFile *vf, gint row) |
| 172 { | |
| 173 gboolean ret = FALSE; | |
| 174 | |
| 175 switch (vf->type) | |
| 176 { | |
| 177 case FILEVIEW_LIST: ret = vflist_index_is_selected(vf, row); break; | |
| 178 case FILEVIEW_ICON: ret = vficon_index_is_selected(vf, row); break; | |
| 179 } | |
| 180 | |
| 181 return ret; | |
| 182 } | |
| 183 | |
| 184 | |
| 736 | 185 guint vf_selection_count(ViewFile *vf, gint64 *bytes) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
186 { |
| 736 | 187 guint count = 0; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
188 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
189 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
190 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
191 case FILEVIEW_LIST: count = vflist_selection_count(vf, bytes); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
192 case FILEVIEW_ICON: count = vficon_selection_count(vf, bytes); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
193 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
194 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
195 return count; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
196 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
197 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
198 GList *vf_selection_get_list(ViewFile *vf) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
199 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
200 GList *list = NULL; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
201 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
202 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
203 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
204 case FILEVIEW_LIST: list = vflist_selection_get_list(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
205 case FILEVIEW_ICON: list = vficon_selection_get_list(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
206 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
207 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
208 return list; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
209 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
210 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
211 GList *vf_selection_get_list_by_index(ViewFile *vf) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
212 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
213 GList *list = NULL; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
214 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
215 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
216 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
217 case FILEVIEW_LIST: list = vflist_selection_get_list_by_index(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
218 case FILEVIEW_ICON: list = vficon_selection_get_list_by_index(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
219 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
220 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
221 return list; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
222 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
223 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
224 void vf_select_all(ViewFile *vf) |
| 572 | 225 { |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
226 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
227 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
228 case FILEVIEW_LIST: vflist_select_all(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
229 case FILEVIEW_ICON: vficon_select_all(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
230 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
231 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
232 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
233 void vf_select_none(ViewFile *vf) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
234 { |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
235 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
236 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
237 case FILEVIEW_LIST: vflist_select_none(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
238 case FILEVIEW_ICON: vficon_select_none(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
239 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
240 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
241 |
| 601 | 242 void vf_select_invert(ViewFile *vf) |
| 243 { | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
244 switch (vf->type) |
| 601 | 245 { |
| 246 case FILEVIEW_LIST: vflist_select_invert(vf); break; | |
| 247 case FILEVIEW_ICON: vficon_select_invert(vf); break; | |
| 248 } | |
| 249 } | |
| 250 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
251 void vf_select_by_fd(ViewFile *vf, FileData *fd) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
252 { |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
253 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
254 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
255 case FILEVIEW_LIST: vflist_select_by_fd(vf, fd); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
256 case FILEVIEW_ICON: vficon_select_by_fd(vf, fd); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
257 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
258 } |
| 572 | 259 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
260 void vf_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
261 { |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
262 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
263 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
264 case FILEVIEW_LIST: vflist_mark_to_selection(vf, mark, mode); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
265 case FILEVIEW_ICON: vficon_mark_to_selection(vf, mark, mode); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
266 } |
| 572 | 267 } |
| 268 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
269 void vf_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
270 { |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
271 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
272 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
273 case FILEVIEW_LIST: vflist_selection_to_mark(vf, mark, mode); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
274 case FILEVIEW_ICON: vficon_selection_to_mark(vf, mark, mode); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
275 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
276 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
277 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
278 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
279 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
280 * dnd |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
281 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
282 */ |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
283 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
284 |
| 572 | 285 static void vf_dnd_init(ViewFile *vf) |
| 286 { | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
287 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
288 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
289 case FILEVIEW_LIST: vflist_dnd_init(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
290 case FILEVIEW_ICON: vficon_dnd_init(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
291 } |
| 572 | 292 } |
| 293 | |
| 634 | 294 /* |
| 295 *----------------------------------------------------------------------------- | |
| 296 * pop-up menu | |
| 297 *----------------------------------------------------------------------------- | |
| 298 */ | |
| 299 | |
| 300 GList *vf_pop_menu_file_list(ViewFile *vf) | |
| 301 { | |
| 302 GList *ret = NULL; | |
| 303 | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
304 switch (vf->type) |
| 634 | 305 { |
| 306 case FILEVIEW_LIST: ret = vflist_pop_menu_file_list(vf); break; | |
| 307 case FILEVIEW_ICON: ret = vficon_pop_menu_file_list(vf); break; | |
| 308 } | |
| 309 | |
| 310 return ret; | |
| 311 } | |
| 312 | |
| 1724 | 313 GList *vf_selection_get_one(ViewFile *vf, FileData *fd) |
| 314 { | |
| 315 GList *ret = NULL; | |
| 316 | |
| 317 switch (vf->type) | |
| 318 { | |
| 319 case FILEVIEW_LIST: ret = vflist_selection_get_one(vf, fd); break; | |
| 320 case FILEVIEW_ICON: ret = vficon_selection_get_one(vf, fd); break; | |
| 321 } | |
| 322 | |
| 323 return ret; | |
| 324 } | |
| 325 | |
| 662 | 326 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
|
327 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
328 ViewFile *vf; |
| 1272 | 329 const gchar *key = data; |
|
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
330 GList *list; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
331 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
332 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
|
333 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
334 if (!vf) return; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
335 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
336 list = vf_pop_menu_file_list(vf); |
| 1272 | 337 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
|
338 filelist_free(list); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
339 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
340 |
| 662 | 341 static void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data) |
| 637 | 342 { |
| 343 ViewFile *vf = data; | |
| 344 | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
345 switch (vf->type) |
| 637 | 346 { |
| 347 case FILEVIEW_LIST: vflist_pop_menu_view_cb(widget, data); break; | |
| 348 case FILEVIEW_ICON: vficon_pop_menu_view_cb(widget, data); break; | |
| 349 } | |
| 350 } | |
| 351 | |
| 662 | 352 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
|
353 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
354 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
355 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
356 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
|
357 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
358 |
| 662 | 359 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
|
360 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
361 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
362 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
363 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
|
364 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
365 |
| 662 | 366 static void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data) |
| 637 | 367 { |
| 368 ViewFile *vf = data; | |
| 369 | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
370 switch (vf->type) |
| 637 | 371 { |
| 372 case FILEVIEW_LIST: vflist_pop_menu_rename_cb(widget, data); break; | |
| 373 case FILEVIEW_ICON: vficon_pop_menu_rename_cb(widget, data); break; | |
| 374 } | |
| 375 } | |
| 376 | |
| 662 | 377 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
|
378 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
379 ViewFile *vf = data; |
|
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 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
|
382 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
383 |
| 662 | 384 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
|
385 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
386 ViewFile *vf = data; |
|
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 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
|
389 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
390 |
| 1599 | 391 static void vf_pop_menu_enable_grouping_cb(GtkWidget *widget, gpointer data) |
| 392 { | |
| 393 ViewFile *vf = data; | |
| 394 | |
| 395 file_data_disable_grouping_list(vf_pop_menu_file_list(vf), FALSE); | |
| 396 } | |
| 397 | |
| 398 static void vf_pop_menu_disable_grouping_cb(GtkWidget *widget, gpointer data) | |
| 399 { | |
| 400 ViewFile *vf = data; | |
| 401 | |
| 402 file_data_disable_grouping_list(vf_pop_menu_file_list(vf), TRUE); | |
| 403 } | |
| 404 | |
| 662 | 405 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
|
406 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
407 ViewFile *vf; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
408 SortType type; |
|
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 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
|
411 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
412 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
|
413 if (!vf) return; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
414 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
415 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
|
416 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
417 if (vf->layout) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
418 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
419 layout_sort_set(vf->layout, type, vf->sort_ascend); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
420 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
421 else |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
422 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
423 vf_sort_set(vf, type, vf->sort_ascend); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
424 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
425 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
426 |
| 662 | 427 static void vf_pop_menu_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
|
428 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
429 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
430 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
431 if (vf->layout) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
432 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
433 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
|
434 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
435 else |
|
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 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
|
438 } |
|
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_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
|
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 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
|
445 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
446 |
| 662 | 447 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
|
448 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
449 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
450 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
|
451 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
452 |
| 662 | 453 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
|
454 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
455 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
456 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
|
457 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
458 |
| 662 | 459 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
|
460 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
461 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
462 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
|
463 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
464 |
| 662 | 465 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
|
466 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
467 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
468 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
|
469 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
470 |
| 662 | 471 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
|
472 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
473 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
474 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
|
475 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
476 |
| 662 | 477 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
|
478 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
479 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
480 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
|
481 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
482 |
| 662 | 483 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
|
484 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
485 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
486 |
|
636
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
487 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
|
488 |
| 1412 | 489 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
|
490 { |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
491 case FILEVIEW_LIST: |
| 1309 | 492 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
|
493 break; |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
494 case FILEVIEW_ICON: |
| 1309 | 495 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
|
496 break; |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
497 } |
|
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
498 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
499 |
| 662 | 500 static void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) |
| 637 | 501 { |
| 502 ViewFile *vf = data; | |
| 503 | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
504 switch (vf->type) |
| 637 | 505 { |
| 506 case FILEVIEW_LIST: vflist_pop_menu_refresh_cb(widget, data); break; | |
| 507 case FILEVIEW_ICON: vficon_pop_menu_refresh_cb(widget, data); break; | |
| 508 } | |
| 509 } | |
| 510 | |
| 662 | 511 static void vf_popup_destroy_cb(GtkWidget *widget, gpointer data) |
| 637 | 512 { |
| 513 ViewFile *vf = data; | |
| 514 | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
515 switch (vf->type) |
| 637 | 516 { |
| 517 case FILEVIEW_LIST: vflist_popup_destroy_cb(widget, data); break; | |
| 518 case FILEVIEW_ICON: vficon_popup_destroy_cb(widget, data); break; | |
| 519 } | |
|
1397
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
520 |
|
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
521 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
|
522 vf->editmenu_fd_list = NULL; |
| 637 | 523 } |
| 634 | 524 |
|
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
525 GtkWidget *vf_pop_menu(ViewFile *vf) |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
526 { |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
527 GtkWidget *menu; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
528 GtkWidget *item; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
529 GtkWidget *submenu; |
| 1453 | 530 gboolean active = FALSE; |
| 634 | 531 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
532 switch (vf->type) |
|
659
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 case FILEVIEW_LIST: |
|
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
535 vflist_color_set(vf, VFLIST(vf)->click_fd, TRUE); |
|
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
536 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
|
537 break; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
538 case FILEVIEW_ICON: |
|
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
539 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
|
540 break; |
|
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 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
543 menu = popup_menu_short_lived(); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
544 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
545 g_signal_connect(G_OBJECT(menu), "destroy", |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
546 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
|
547 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
548 if (vf->clicked_mark > 0) |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
549 { |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
550 gint mark = vf->clicked_mark; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
551 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
|
552 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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 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
|
558 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
559 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
|
560 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
561 vf->active_mark = mark; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
562 vf->clicked_mark = 0; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
563 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
564 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
|
565 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
|
566 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
567 menu_item_add_sensitive(menu, str_res_mark, 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_res_mark_sel_cb), vf); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
569 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
570 menu_item_add_sensitive(menu, str_toggle_mark, 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_toggle_mark_sel_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 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
|
576 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
|
577 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
|
578 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
|
579 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
|
580 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
|
581 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
|
582 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
|
583 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
584 menu_item_add_divider(menu); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
585 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
586 g_free(str_set_mark); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
587 g_free(str_res_mark); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
588 g_free(str_toggle_mark); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
589 g_free(str_sel_mark); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
590 g_free(str_sel_mark_and); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
591 g_free(str_sel_mark_or); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
592 g_free(str_sel_mark_minus); |
|
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 |
|
1397
a0bd58a6535f
In various Edit context menus, only display editors that match the file types in the selection.
zas_
parents:
1365
diff
changeset
|
595 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
|
596 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
|
597 gtk_widget_set_sensitive(item, active); |
|
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_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
|
600 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
|
601 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
602 menu_item_add_divider(menu); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
603 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
|
604 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
|
605 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
|
606 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
|
607 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
|
608 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
|
609 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
|
610 G_CALLBACK(vf_pop_menu_delete_cb), vf); |
| 1513 | 611 menu_item_add_sensitive(menu, _("_Copy path"), active, |
| 612 G_CALLBACK(vf_pop_menu_copy_path_cb), vf); | |
|
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
613 |
| 1599 | 614 menu_item_add_sensitive(menu, _("Enable file _grouping"), active, |
| 615 G_CALLBACK(vf_pop_menu_enable_grouping_cb), vf); | |
| 616 menu_item_add_sensitive(menu, _("Disable file groupi_ng"), active, | |
| 617 G_CALLBACK(vf_pop_menu_disable_grouping_cb), vf); | |
| 618 | |
|
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
619 menu_item_add_divider(menu); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
620 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
621 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
|
622 FALSE, FALSE, TRUE, vf->sort_method); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
623 menu_item_add_divider(submenu); |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
624 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
|
625 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
|
626 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
627 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
|
628 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
|
629 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
630 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
|
631 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
|
632 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
633 switch (vf->type) |
|
659
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
634 { |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
635 case FILEVIEW_LIST: |
|
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
636 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
|
637 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
|
638 break; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
639 case FILEVIEW_ICON: |
|
968
065a129fd42b
Simplify things related to ViewFileInfoList * and ViewFileInfoIcon * type casting:
zas_
parents:
964
diff
changeset
|
640 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
|
641 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
|
642 break; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
643 } |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
644 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
645 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
|
646 |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
647 return menu; |
|
542bb47fef04
Merge vflist_pop_menu() and vficon_pop_menu() into vf_pop_menu().
zas_
parents:
637
diff
changeset
|
648 } |
| 634 | 649 |
| 1453 | 650 gboolean vf_refresh(ViewFile *vf) |
| 572 | 651 { |
| 1437 | 652 gboolean ret = FALSE; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
653 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
654 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
655 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
656 case FILEVIEW_LIST: ret = vflist_refresh(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
657 case FILEVIEW_ICON: ret = vficon_refresh(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
658 } |
| 572 | 659 |
| 660 return ret; | |
| 661 } | |
| 662 | |
| 1453 | 663 gboolean vf_set_fd(ViewFile *vf, FileData *dir_fd) |
| 572 | 664 { |
| 1437 | 665 gboolean ret = FALSE; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
666 |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
667 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
668 { |
| 783 | 669 case FILEVIEW_LIST: ret = vflist_set_fd(vf, dir_fd); break; |
| 670 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
|
671 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
672 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
673 return ret; |
| 572 | 674 } |
| 675 | |
| 676 static void vf_destroy_cb(GtkWidget *widget, gpointer data) | |
| 677 { | |
| 678 ViewFile *vf = data; | |
| 679 | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
680 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
681 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
682 case FILEVIEW_LIST: vflist_destroy_cb(widget, data); break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
683 case FILEVIEW_ICON: vficon_destroy_cb(widget, data); break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
684 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
685 |
| 572 | 686 if (vf->popup) |
| 687 { | |
| 688 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA, | |
| 689 0, 0, 0, NULL, vf); | |
| 690 gtk_widget_destroy(vf->popup); | |
| 691 } | |
| 692 | |
| 783 | 693 file_data_unref(vf->dir_fd); |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
694 g_free(vf->info); |
| 572 | 695 g_free(vf); |
| 696 } | |
| 697 | |
| 964 | 698 static void vf_marks_filter_toggle_cb(GtkWidget *widget, gpointer data) |
| 699 { | |
| 700 ViewFile *vf = data; | |
| 701 vf_refresh_idle(vf); | |
| 702 } | |
| 703 | |
| 704 | |
| 705 static GtkWidget *vf_marks_filter_init(ViewFile *vf) | |
| 706 { | |
| 707 GtkWidget *frame = gtk_frame_new(NULL); | |
| 708 GtkWidget *hbox = gtk_hbox_new(FALSE, 0); | |
| 709 | |
| 710 gint i; | |
| 711 | |
| 712 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++) | |
| 713 { | |
| 714 GtkWidget *check = gtk_check_button_new(); | |
| 715 gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0); | |
| 716 g_signal_connect(G_OBJECT(check), "toggled", | |
| 717 G_CALLBACK(vf_marks_filter_toggle_cb), vf); | |
| 718 | |
| 719 gtk_widget_show(check); | |
| 720 vf->filter_check[i] = check; | |
| 721 } | |
| 722 gtk_container_add(GTK_CONTAINER(frame), hbox); | |
| 723 gtk_widget_show(hbox); | |
| 724 return frame; | |
| 725 } | |
| 726 | |
|
1632
1f3bf4a631df
added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents:
1607
diff
changeset
|
727 void vf_mark_filter_toggle(ViewFile *vf, gint mark) |
|
1f3bf4a631df
added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents:
1607
diff
changeset
|
728 { |
|
1f3bf4a631df
added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents:
1607
diff
changeset
|
729 gint n = mark - 1; |
|
1f3bf4a631df
added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents:
1607
diff
changeset
|
730 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vf->filter_check[n]), |
|
1f3bf4a631df
added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents:
1607
diff
changeset
|
731 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vf->filter_check[n]))); |
|
1f3bf4a631df
added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents:
1607
diff
changeset
|
732 } |
|
1f3bf4a631df
added mark filter to menu - now it is possible to assign hotkeys
nadvornik
parents:
1607
diff
changeset
|
733 |
| 783 | 734 ViewFile *vf_new(FileViewType type, FileData *dir_fd) |
| 572 | 735 { |
| 736 ViewFile *vf; | |
| 737 | |
| 738 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
|
739 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
740 vf->type = type; |
| 572 | 741 vf->sort_method = SORT_NAME; |
| 742 vf->sort_ascend = TRUE; | |
| 814 | 743 |
| 964 | 744 vf->scrolled = gtk_scrolled_window_new(NULL, NULL); |
| 745 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN); | |
| 746 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vf->scrolled), | |
| 572 | 747 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
748 |
| 964 | 749 vf->filter = vf_marks_filter_init(vf); |
| 750 | |
| 751 vf->widget = gtk_vbox_new(FALSE, 0); | |
| 752 gtk_box_pack_start(GTK_BOX(vf->widget), vf->filter, FALSE, FALSE, 0); | |
| 753 gtk_box_pack_start(GTK_BOX(vf->widget), vf->scrolled, TRUE, TRUE, 0); | |
| 754 gtk_widget_show(vf->scrolled); | |
| 755 | |
| 572 | 756 g_signal_connect(G_OBJECT(vf->widget), "destroy", |
| 757 G_CALLBACK(vf_destroy_cb), vf); | |
| 758 | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
759 switch (type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
760 { |
| 783 | 761 case FILEVIEW_LIST: vf = vflist_new(vf, dir_fd); break; |
| 762 case FILEVIEW_ICON: vf = vficon_new(vf, dir_fd); break; | |
|
573
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 |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
765 vf_dnd_init(vf); |
|
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
766 |
| 572 | 767 g_signal_connect(G_OBJECT(vf->listview), "key_press_event", |
| 768 G_CALLBACK(vf_press_key_cb), vf); | |
| 769 g_signal_connect(G_OBJECT(vf->listview), "button_press_event", | |
| 770 G_CALLBACK(vf_press_cb), vf); | |
| 771 g_signal_connect(G_OBJECT(vf->listview), "button_release_event", | |
| 772 G_CALLBACK(vf_release_cb), vf); | |
| 773 | |
| 964 | 774 gtk_container_add(GTK_CONTAINER(vf->scrolled), vf->listview); |
| 572 | 775 gtk_widget_show(vf->listview); |
| 776 | |
| 783 | 777 if (dir_fd) vf_set_fd(vf, dir_fd); |
| 572 | 778 |
| 779 return vf; | |
| 780 } | |
| 781 | |
| 782 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data) | |
| 783 { | |
| 784 vf->func_status = func; | |
| 785 vf->data_status = data; | |
| 786 } | |
| 787 | |
| 788 void vf_set_thumb_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gdouble val, const gchar *text, gpointer data), gpointer data) | |
| 789 { | |
| 790 vf->func_thumb_status = func; | |
| 791 vf->data_thumb_status = data; | |
| 792 } | |
| 793 | |
| 1453 | 794 void vf_thumb_set(ViewFile *vf, gboolean enable) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
795 { |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
796 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
797 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
798 case FILEVIEW_LIST: vflist_thumb_set(vf, enable); break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
799 case FILEVIEW_ICON: /*vficon_thumb_set(vf, enable);*/ break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
800 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
801 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
802 |
|
1606
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
803 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
804 static gboolean vf_thumb_next(ViewFile *vf); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
805 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
806 static gdouble vf_thumb_progress(ViewFile *vf) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
807 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
808 gint count = 0; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
809 gint done = 0; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
810 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
811 switch (vf->type) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
812 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
813 case FILEVIEW_LIST: vflist_thumb_progress_count(vf->list, &count, &done); break; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
814 case FILEVIEW_ICON: vficon_thumb_progress_count(vf->list, &count, &done); break; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
815 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
816 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
817 DEBUG_1("thumb progress: %d of %d", done, count); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
818 return (gdouble)done / count; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
819 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
820 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
821 static void vf_set_thumb_fd(ViewFile *vf, FileData *fd) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
822 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
823 switch (vf->type) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
824 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
825 case FILEVIEW_LIST: vflist_set_thumb_fd(vf, fd); break; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
826 case FILEVIEW_ICON: vficon_set_thumb_fd(vf, fd); break; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
827 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
828 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
829 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
830 static void vf_thumb_status(ViewFile *vf, gdouble val, const gchar *text) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
831 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
832 if (vf->func_thumb_status) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
833 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
834 vf->func_thumb_status(vf, val, text, vf->data_thumb_status); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
835 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
836 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
837 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
838 static void vf_thumb_do(ViewFile *vf, FileData *fd) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
839 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
840 if (!fd) return; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
841 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
842 vf_set_thumb_fd(vf, fd); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
843 vf_thumb_status(vf, vf_thumb_progress(vf), _("Loading thumbs...")); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
844 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
845 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
846 void vf_thumb_cleanup(ViewFile *vf) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
847 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
848 vf_thumb_status(vf, 0.0, NULL); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
849 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
850 vf->thumbs_running = FALSE; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
851 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
852 thumb_loader_free(vf->thumbs_loader); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
853 vf->thumbs_loader = NULL; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
854 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
855 vf->thumbs_filedata = NULL; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
856 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
857 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
858 void vf_thumb_stop(ViewFile *vf) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
859 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
860 if (vf->thumbs_running) vf_thumb_cleanup(vf); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
861 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
862 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
863 static void vf_thumb_common_cb(ThumbLoader *tl, gpointer data) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
864 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
865 ViewFile *vf = data; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
866 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
867 if (vf->thumbs_filedata && vf->thumbs_loader == tl) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
868 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
869 vf_thumb_do(vf, vf->thumbs_filedata); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
870 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
871 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
872 while (vf_thumb_next(vf)); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
873 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
874 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
875 static void vf_thumb_error_cb(ThumbLoader *tl, gpointer data) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
876 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
877 vf_thumb_common_cb(tl, data); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
878 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
879 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
880 static void vf_thumb_done_cb(ThumbLoader *tl, gpointer data) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
881 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
882 vf_thumb_common_cb(tl, data); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
883 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
884 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
885 static gboolean vf_thumb_next(ViewFile *vf) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
886 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
887 FileData *fd = NULL; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
888 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
889 if (!GTK_WIDGET_REALIZED(vf->listview)) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
890 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
891 vf_thumb_status(vf, 0.0, NULL); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
892 return FALSE; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
893 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
894 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
895 switch (vf->type) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
896 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
897 case FILEVIEW_LIST: fd = vflist_thumb_next_fd(vf); break; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
898 case FILEVIEW_ICON: fd = vficon_thumb_next_fd(vf); break; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
899 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
900 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
901 if (!fd) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
902 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
903 /* done */ |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
904 vf_thumb_cleanup(vf); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
905 return FALSE; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
906 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
907 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
908 vf->thumbs_filedata = fd; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
909 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
910 thumb_loader_free(vf->thumbs_loader); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
911 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
912 vf->thumbs_loader = thumb_loader_new(options->thumbnails.max_width, options->thumbnails.max_height); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
913 thumb_loader_set_callbacks(vf->thumbs_loader, |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
914 vf_thumb_done_cb, |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
915 vf_thumb_error_cb, |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
916 NULL, |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
917 vf); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
918 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
919 if (!thumb_loader_start(vf->thumbs_loader, fd)) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
920 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
921 /* set icon to unknown, continue */ |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
922 DEBUG_1("thumb loader start failed %s", fd->path); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
923 vf_thumb_do(vf, fd); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
924 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
925 return TRUE; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
926 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
927 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
928 return FALSE; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
929 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
930 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
931 static void vf_thumb_reset_all(ViewFile *vf) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
932 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
933 switch (vf->type) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
934 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
935 case FILEVIEW_LIST: vflist_thumb_reset_all(vf); break; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
936 case FILEVIEW_ICON: vficon_thumb_reset_all(vf); break; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
937 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
938 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
939 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
940 void vf_thumb_update(ViewFile *vf) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
941 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
942 vf_thumb_stop(vf); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
943 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
944 if (vf->type == FILEVIEW_LIST && !VFLIST(vf)->thumbs_enabled) return; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
945 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
946 vf_thumb_status(vf, 0.0, _("Loading thumbs...")); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
947 vf->thumbs_running = TRUE; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
948 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
949 if (thumb_format_changed) |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
950 { |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
951 vf_thumb_reset_all(vf); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
952 thumb_format_changed = FALSE; |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
953 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
954 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
955 while (vf_thumb_next(vf)); |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
956 } |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
957 |
|
74a7f9ea32a1
Merge common thumb code from view_file_list and view_file_icon to view_file.
zas_
parents:
1599
diff
changeset
|
958 |
| 1453 | 959 void vf_marks_set(ViewFile *vf, gboolean enable) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
960 { |
| 852 | 961 if (vf->marks_enabled == enable) return; |
| 962 | |
| 963 vf->marks_enabled = enable; | |
| 964 | |
|
1347
79937bc55f3a
Add missing space between switch and first parenthesis.
zas_
parents:
1309
diff
changeset
|
965 switch (vf->type) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
966 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
967 case FILEVIEW_LIST: vflist_marks_set(vf, enable); break; |
| 852 | 968 case FILEVIEW_ICON: vficon_marks_set(vf, enable); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
969 } |
| 964 | 970 if (enable) |
| 971 gtk_widget_show(vf->filter); | |
| 972 else | |
| 973 gtk_widget_hide(vf->filter); | |
| 974 | |
| 975 vf_refresh_idle(vf); | |
| 976 } | |
| 977 | |
| 978 guint vf_marks_get_filter(ViewFile *vf) | |
| 979 { | |
| 980 guint ret = 0; | |
| 981 gint i; | |
| 982 if (!vf->marks_enabled) return 0; | |
| 983 | |
| 984 for (i = 0; i < FILEDATA_MARKS_SIZE ; i++) | |
| 985 { | |
| 986 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vf->filter_check[i]))) | |
| 987 { | |
| 988 ret |= 1 << i; | |
| 989 } | |
| 990 } | |
| 991 return ret; | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
992 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
993 |
| 572 | 994 void vf_set_layout(ViewFile *vf, LayoutWindow *layout) |
| 995 { | |
| 996 vf->layout = layout; | |
| 997 } | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
998 |
| 814 | 999 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1000 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1001 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1002 * maintenance (for rename, move, remove) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1003 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1004 */ |
| 995 | 1005 |
| 1453 | 1006 static gboolean vf_refresh_idle_cb(gpointer data) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1007 { |
| 814 | 1008 ViewFile *vf = data; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1009 |
| 814 | 1010 vf_refresh(vf); |
| 1523 | 1011 vf->refresh_idle_id = 0; |
| 814 | 1012 return FALSE; |
| 1013 } | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1014 |
| 814 | 1015 void vf_refresh_idle_cancel(ViewFile *vf) |
| 1016 { | |
| 1523 | 1017 if (vf->refresh_idle_id) |
| 1018 { | |
| 1019 g_source_remove(vf->refresh_idle_id); | |
| 1020 vf->refresh_idle_id = 0; | |
| 1021 } | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1022 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1023 |
| 814 | 1024 |
| 964 | 1025 void vf_refresh_idle(ViewFile *vf) |
| 1026 { | |
| 1523 | 1027 if (!vf->refresh_idle_id) |
| 964 | 1028 { |
| 1654 | 1029 vf->time_refresh_set = time(NULL); |
| 1030 /* file operations run with G_PRIORITY_DEFAULT_IDLE */ | |
| 1031 vf->refresh_idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE + 50, vf_refresh_idle_cb, vf, NULL); | |
| 1032 } | |
| 1033 else if (time(NULL) - vf->time_refresh_set > 1) | |
| 1034 { | |
| 1035 /* more than 1 sec since last update - increase priority */ | |
| 1036 vf_refresh_idle_cancel(vf); | |
| 1037 vf->time_refresh_set = time(NULL); | |
| 1038 vf->refresh_idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE - 50, vf_refresh_idle_cb, vf, NULL); | |
| 964 | 1039 } |
| 1040 } | |
| 1041 | |
| 814 | 1042 void vf_notify_cb(FileData *fd, NotifyType type, gpointer data) |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1043 { |
| 814 | 1044 ViewFile *vf = data; |
| 1045 gboolean refresh; | |
| 1046 | |
| 1432 | 1047 NotifyType interested = NOTIFY_CHANGE | NOTIFY_REREAD | NOTIFY_GROUPING; |
| 1048 if (vf->marks_enabled) interested |= NOTIFY_MARKS | NOTIFY_METADATA; | |
| 1049 /* FIXME: NOTIFY_METADATA should be checked by the keyword-to-mark functions and converted to NOTIFY_MARKS only if there was a change */ | |
| 971 | 1050 |
| 1523 | 1051 if (!(type & interested) || vf->refresh_idle_id || !vf->dir_fd) return; |
| 1432 | 1052 |
| 814 | 1053 refresh = (fd == vf->dir_fd); |
| 1054 | |
| 1055 if (!refresh) | |
| 1056 { | |
| 1057 gchar *base = remove_level_from_path(fd->path); | |
| 1058 refresh = (strcmp(base, vf->dir_fd->path) == 0); | |
| 1059 g_free(base); | |
| 1060 } | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1061 |
| 1432 | 1062 if ((type & NOTIFY_CHANGE) && fd->change) |
| 814 | 1063 { |
| 1064 if (!refresh && fd->change->dest) | |
| 1065 { | |
| 1066 gchar *dest_base = remove_level_from_path(fd->change->dest); | |
| 1067 refresh = (strcmp(dest_base, vf->dir_fd->path) == 0); | |
| 1068 g_free(dest_base); | |
| 1069 } | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1070 |
| 814 | 1071 if (!refresh && fd->change->source) |
| 1072 { | |
| 1073 gchar *source_base = remove_level_from_path(fd->change->source); | |
| 1074 refresh = (strcmp(source_base, vf->dir_fd->path) == 0); | |
| 1075 g_free(source_base); | |
| 1076 } | |
| 1077 } | |
| 1078 | |
| 964 | 1079 if (refresh) |
| 814 | 1080 { |
| 1498 | 1081 DEBUG_1("Notify vf: %s %04x", fd->path, type); |
| 964 | 1082 vf_refresh_idle(vf); |
| 814 | 1083 } |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1084 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
1085 |
|
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
995
diff
changeset
|
1086 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |
