Mercurial > geeqie.yaz
annotate src/view_file.c @ 637:8a1202efa51e
Add some wrapper functions for not yet common code.
| author | zas_ |
|---|---|
| date | Mon, 12 May 2008 00:22:38 +0000 |
| parents | 2ea7af1fbfe0 |
| children | 542bb47fef04 |
| rev | line source |
|---|---|
|
554
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
1 /* |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
2 * Geeqie |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
3 * Copyright (C) 2008 The Geeqie Team |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
4 * |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
5 * Author: Laurent Monin |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
6 * |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
7 * This software is released under the GNU General Public License (GNU GPL). |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
8 * Please read the included file COPYING for more information. |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
9 * This software comes with no warranty of any kind, use at your own risk! |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
10 */ |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
11 |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
12 #include "main.h" |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
13 #include "view_file.h" |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
14 |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
15 #include "debug.h" |
|
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
16 #include "editors.h" |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
17 #include "info.h" |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
18 #include "layout.h" |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
19 #include "menu.h" |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
20 #include "utilops.h" |
|
554
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
21 #include "view_file_list.h" |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
22 #include "view_file_icon.h" |
|
2da72a136070
Prepare merging of some parts of view_file_list and view_file_icon and
zas_
parents:
diff
changeset
|
23 |
| 633 | 24 /* |
| 25 *----------------------------------------------------------------------------- | |
| 26 * signals | |
| 27 *----------------------------------------------------------------------------- | |
| 28 */ | |
| 29 | |
| 30 void vf_send_update(ViewFile *vf) | |
| 31 { | |
| 32 if (vf->func_status) vf->func_status(vf, vf->data_status); | |
| 33 } | |
| 560 | 34 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
35 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
36 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
37 * misc |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
38 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
39 */ |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
40 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
41 void vf_sort_set(ViewFile *vf, SortType type, gint ascend) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
42 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
43 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
44 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
45 case FILEVIEW_LIST: vflist_sort_set(vf, type, ascend); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
46 case FILEVIEW_ICON: vficon_sort_set(vf, type, ascend); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
47 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
48 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
49 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
50 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
51 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
52 * row stuff |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
53 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
54 */ |
| 560 | 55 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
56 FileData *vf_index_get_data(ViewFile *vf, gint row) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
57 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
58 FileData *fd = NULL; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
59 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
60 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
61 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
62 case FILEVIEW_LIST: fd = vflist_index_get_data(vf, row); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
63 case FILEVIEW_ICON: fd = vficon_index_get_data(vf, row); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
64 } |
| 560 | 65 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
66 return fd; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
67 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
68 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
69 gint vf_index_by_path(ViewFile *vf, const gchar *path) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
70 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
71 gint index = -1; |
| 560 | 72 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
73 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
74 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
75 case FILEVIEW_LIST: index = vflist_index_by_path(vf, path); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
76 case FILEVIEW_ICON: index = vficon_index_by_path(vf, path); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
77 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
78 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
79 return index; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
80 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
81 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
82 gint vf_count(ViewFile *vf, gint64 *bytes) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
83 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
84 gint count = 0; |
| 560 | 85 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
86 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
87 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
88 case FILEVIEW_LIST: count = vflist_count(vf, bytes); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
89 case FILEVIEW_ICON: count = vficon_count(vf, bytes); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
90 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
91 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
92 return count; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
93 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
94 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
95 GList *vf_get_list(ViewFile *vf) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
96 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
97 GList *list = NULL; |
| 560 | 98 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
99 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
100 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
101 case FILEVIEW_LIST: list = vflist_get_list(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
102 case FILEVIEW_ICON: list = vficon_get_list(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
103 } |
| 560 | 104 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
105 return list; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
106 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
107 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
108 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
109 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
110 *------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
111 * keyboard |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
112 *------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
113 */ |
| 572 | 114 |
| 115 static gint vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | |
| 116 { | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
117 ViewFile *vf = data; |
| 572 | 118 gint ret = FALSE; |
| 119 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
120 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
121 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
122 case FILEVIEW_LIST: ret = vflist_press_key_cb(widget, event, data); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
123 case FILEVIEW_ICON: ret = vficon_press_key_cb(widget, event, data); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
124 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
125 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
126 return ret; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
127 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
128 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
129 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
130 *------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
131 * mouse |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
132 *------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
133 */ |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
134 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
135 static gint vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
136 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
137 ViewFile *vf = data; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
138 gint ret = FALSE; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
139 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
140 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
141 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
142 case FILEVIEW_LIST: ret = vflist_press_cb(widget, bevent, data); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
143 case FILEVIEW_ICON: ret = vficon_press_cb(widget, bevent, data); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
144 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
145 |
| 572 | 146 return ret; |
| 147 } | |
| 148 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
149 static gint vf_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) |
| 572 | 150 { |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
151 ViewFile *vf = data; |
| 572 | 152 gint ret = FALSE; |
| 153 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
154 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
155 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
156 case FILEVIEW_LIST: ret = vflist_release_cb(widget, bevent, data); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
157 case FILEVIEW_ICON: ret = vficon_release_cb(widget, bevent, data); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
158 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
159 |
| 572 | 160 return ret; |
| 161 } | |
| 162 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
163 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
164 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
165 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
166 * selections |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
167 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
168 */ |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
169 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
170 gint vf_selection_count(ViewFile *vf, gint64 *bytes) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
171 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
172 gint count = 0; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
173 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
174 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
175 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
176 case FILEVIEW_LIST: count = vflist_selection_count(vf, bytes); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
177 case FILEVIEW_ICON: count = vficon_selection_count(vf, bytes); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
178 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
179 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
180 return count; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
181 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
182 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
183 GList *vf_selection_get_list(ViewFile *vf) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
184 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
185 GList *list = NULL; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
186 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
187 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
188 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
189 case FILEVIEW_LIST: list = vflist_selection_get_list(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
190 case FILEVIEW_ICON: list = vficon_selection_get_list(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
191 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
192 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
193 return list; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
194 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
195 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
196 GList *vf_selection_get_list_by_index(ViewFile *vf) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
197 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
198 GList *list = NULL; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
199 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
200 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
201 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
202 case FILEVIEW_LIST: list = vflist_selection_get_list_by_index(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
203 case FILEVIEW_ICON: list = vficon_selection_get_list_by_index(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
204 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
205 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
206 return list; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
207 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
208 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
209 void vf_select_all(ViewFile *vf) |
| 572 | 210 { |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
211 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
212 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
213 case FILEVIEW_LIST: vflist_select_all(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
214 case FILEVIEW_ICON: vficon_select_all(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
215 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
216 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
217 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
218 void vf_select_none(ViewFile *vf) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
219 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
220 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
221 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
222 case FILEVIEW_LIST: vflist_select_none(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
223 case FILEVIEW_ICON: vficon_select_none(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
224 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
225 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
226 |
| 601 | 227 void vf_select_invert(ViewFile *vf) |
| 228 { | |
| 229 switch(vf->type) | |
| 230 { | |
| 231 case FILEVIEW_LIST: vflist_select_invert(vf); break; | |
| 232 case FILEVIEW_ICON: vficon_select_invert(vf); break; | |
| 233 } | |
| 234 } | |
| 235 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
236 void vf_select_by_fd(ViewFile *vf, FileData *fd) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
237 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
238 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
239 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
240 case FILEVIEW_LIST: vflist_select_by_fd(vf, fd); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
241 case FILEVIEW_ICON: vficon_select_by_fd(vf, fd); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
242 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
243 } |
| 572 | 244 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
245 void vf_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
246 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
247 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
248 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
249 case FILEVIEW_LIST: vflist_mark_to_selection(vf, mark, mode); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
250 case FILEVIEW_ICON: vficon_mark_to_selection(vf, mark, mode); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
251 } |
| 572 | 252 } |
| 253 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
254 void vf_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
255 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
256 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
257 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
258 case FILEVIEW_LIST: vflist_selection_to_mark(vf, mark, mode); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
259 case FILEVIEW_ICON: vficon_selection_to_mark(vf, mark, mode); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
260 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
261 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
262 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
263 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
264 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
265 * dnd |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
266 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
267 */ |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
268 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
269 |
| 572 | 270 static void vf_dnd_init(ViewFile *vf) |
| 271 { | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
272 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
273 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
274 case FILEVIEW_LIST: vflist_dnd_init(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
275 case FILEVIEW_ICON: vficon_dnd_init(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
276 } |
| 572 | 277 } |
| 278 | |
| 634 | 279 /* |
| 280 *----------------------------------------------------------------------------- | |
| 281 * pop-up menu | |
| 282 *----------------------------------------------------------------------------- | |
| 283 */ | |
| 284 | |
| 285 GList *vf_pop_menu_file_list(ViewFile *vf) | |
| 286 { | |
| 287 GList *ret = NULL; | |
| 288 | |
| 289 switch(vf->type) | |
| 290 { | |
| 291 case FILEVIEW_LIST: ret = vflist_pop_menu_file_list(vf); break; | |
| 292 case FILEVIEW_ICON: ret = vficon_pop_menu_file_list(vf); break; | |
| 293 } | |
| 294 | |
| 295 return ret; | |
| 296 } | |
| 297 | |
|
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
298 void vf_pop_menu_edit_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
299 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
300 ViewFile *vf; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
301 gint n; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
302 GList *list; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
303 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
304 vf = submenu_item_get_data(widget); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
305 n = GPOINTER_TO_INT(data); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
306 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
307 if (!vf) return; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
308 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
309 list = 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
|
310 start_editor_from_filelist(n, list); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
311 filelist_free(list); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
312 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
313 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
314 void vf_pop_menu_info_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
315 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
316 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
317 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
318 info_window_new(NULL, vf_pop_menu_file_list(vf), NULL); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
319 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
320 |
| 637 | 321 void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data) |
| 322 { | |
| 323 ViewFile *vf = data; | |
| 324 | |
| 325 switch(vf->type) | |
| 326 { | |
| 327 case FILEVIEW_LIST: vflist_pop_menu_view_cb(widget, data); break; | |
| 328 case FILEVIEW_ICON: vficon_pop_menu_view_cb(widget, data); break; | |
| 329 } | |
| 330 } | |
| 331 | |
|
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
332 void vf_pop_menu_copy_cb(GtkWidget *widget, gpointer data) |
|
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 ViewFile *vf = data; |
|
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 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
|
337 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
338 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
339 void vf_pop_menu_move_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
340 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
341 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
342 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
343 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
|
344 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
345 |
| 637 | 346 void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data) |
| 347 { | |
| 348 ViewFile *vf = data; | |
| 349 | |
| 350 switch(vf->type) | |
| 351 { | |
| 352 case FILEVIEW_LIST: vflist_pop_menu_rename_cb(widget, data); break; | |
| 353 case FILEVIEW_ICON: vficon_pop_menu_rename_cb(widget, data); break; | |
| 354 } | |
| 355 } | |
| 356 | |
|
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
357 void vf_pop_menu_delete_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
358 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
359 ViewFile *vf = data; |
|
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 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
|
362 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
363 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
364 void vf_pop_menu_copy_path_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
365 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
366 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
367 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
368 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
|
369 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
370 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
371 void vf_pop_menu_sort_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
372 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
373 ViewFile *vf; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
374 SortType type; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
375 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
376 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
|
377 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
378 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
|
379 if (!vf) return; |
|
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 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
|
382 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
383 if (vf->layout) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
384 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
385 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
|
386 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
387 else |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
388 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
389 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
|
390 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
391 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
392 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
393 void vf_pop_menu_sort_ascend_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
394 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
395 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
396 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
397 if (vf->layout) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
398 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
399 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
|
400 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
401 else |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
402 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
403 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
|
404 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
405 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
406 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
407 void vf_pop_menu_sel_mark_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
408 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
409 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
410 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
|
411 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
412 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
413 void vf_pop_menu_sel_mark_and_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
414 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
415 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
416 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
|
417 } |
|
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 void vf_pop_menu_sel_mark_or_cb(GtkWidget *widget, gpointer data) |
|
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 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
422 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
|
423 } |
|
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 void vf_pop_menu_sel_mark_minus_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
426 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
427 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
428 vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_MINUS); |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
429 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
430 |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
431 void vf_pop_menu_set_mark_sel_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
432 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
433 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
434 vf_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
|
435 } |
|
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 void vf_pop_menu_res_mark_sel_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
438 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
439 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
440 vf_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
|
441 } |
|
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 void vf_pop_menu_toggle_mark_sel_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
444 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
445 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
446 vf_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
|
447 } |
|
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 void vf_pop_menu_toggle_view_type_cb(GtkWidget *widget, gpointer data) |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
450 { |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
451 ViewFile *vf = data; |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
452 |
|
636
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
453 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
|
454 |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
455 switch(vf->layout->file_view_type) |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
456 { |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
457 case FILEVIEW_LIST: |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
458 layout_views_set(vf->layout, vf->layout->dir_view_type, FILEVIEW_ICON); |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
459 break; |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
460 case FILEVIEW_ICON: |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
461 layout_views_set(vf->layout, vf->layout->dir_view_type, FILEVIEW_LIST); |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
462 break; |
|
2ea7af1fbfe0
Make vf_pop_menu_toggle_view_type_cb() independent of FILEVIEW_LIST/FILEVIEW_ICON real values.
zas_
parents:
635
diff
changeset
|
463 } |
|
635
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
464 } |
|
eaca3e910ecd
Move a part of pop up menu common code to view_file.[ch].
zas_
parents:
634
diff
changeset
|
465 |
| 637 | 466 void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) |
| 467 { | |
| 468 ViewFile *vf = data; | |
| 469 | |
| 470 switch(vf->type) | |
| 471 { | |
| 472 case FILEVIEW_LIST: vflist_pop_menu_refresh_cb(widget, data); break; | |
| 473 case FILEVIEW_ICON: vficon_pop_menu_refresh_cb(widget, data); break; | |
| 474 } | |
| 475 } | |
| 476 | |
| 477 void vf_popup_destroy_cb(GtkWidget *widget, gpointer data) | |
| 478 { | |
| 479 ViewFile *vf = data; | |
| 480 | |
| 481 switch(vf->type) | |
| 482 { | |
| 483 case FILEVIEW_LIST: vflist_popup_destroy_cb(widget, data); break; | |
| 484 case FILEVIEW_ICON: vficon_popup_destroy_cb(widget, data); break; | |
| 485 } | |
| 486 } | |
| 634 | 487 |
| 488 | |
| 489 | |
| 572 | 490 gint vf_refresh(ViewFile *vf) |
| 491 { | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
492 gint ret = FALSE; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
493 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
494 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
495 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
496 case FILEVIEW_LIST: ret = vflist_refresh(vf); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
497 case FILEVIEW_ICON: ret = vficon_refresh(vf); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
498 } |
| 572 | 499 |
| 500 return ret; | |
| 501 } | |
| 502 | |
| 503 gint vf_set_path(ViewFile *vf, const gchar *path) | |
| 504 { | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
505 gint ret = FALSE; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
506 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
507 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
508 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
509 case FILEVIEW_LIST: ret = vflist_set_path(vf, path); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
510 case FILEVIEW_ICON: ret = vficon_set_path(vf, path); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
511 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
512 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
513 return ret; |
| 572 | 514 } |
| 515 | |
| 516 static void vf_destroy_cb(GtkWidget *widget, gpointer data) | |
| 517 { | |
| 518 ViewFile *vf = data; | |
| 519 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
520 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
521 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
522 case FILEVIEW_LIST: vflist_destroy_cb(widget, data); break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
523 case FILEVIEW_ICON: vficon_destroy_cb(widget, data); break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
524 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
525 |
| 572 | 526 if (vf->popup) |
| 527 { | |
| 528 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA, | |
| 529 0, 0, 0, NULL, vf); | |
| 530 gtk_widget_destroy(vf->popup); | |
| 531 } | |
| 532 | |
| 533 g_free(vf->path); | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
534 g_free(vf->info); |
| 572 | 535 g_free(vf); |
| 536 } | |
| 537 | |
| 538 ViewFile *vf_new(FileViewType type, const gchar *path) | |
| 539 { | |
| 540 ViewFile *vf; | |
| 541 | |
| 542 vf = g_new0(ViewFile, 1); | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
543 vf->type = type; |
| 572 | 544 |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
545 vf->info = NULL; |
| 572 | 546 vf->path = NULL; |
| 547 vf->list = NULL; | |
| 548 | |
| 549 vf->sort_method = SORT_NAME; | |
| 550 vf->sort_ascend = TRUE; | |
| 551 | |
| 552 vf->thumbs_running = FALSE; | |
| 553 vf->thumbs_count = 0; | |
| 554 vf->thumbs_loader = NULL; | |
| 555 vf->thumbs_filedata = NULL; | |
| 556 | |
| 557 vf->popup = NULL; | |
| 558 | |
| 559 vf->widget = gtk_scrolled_window_new(NULL, NULL); | |
| 560 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->widget), GTK_SHADOW_IN); | |
| 561 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vf->widget), | |
| 562 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
563 |
| 572 | 564 g_signal_connect(G_OBJECT(vf->widget), "destroy", |
| 565 G_CALLBACK(vf_destroy_cb), vf); | |
| 566 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
567 switch(type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
568 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
569 case FILEVIEW_LIST: vf = vflist_new(vf, path); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
570 case FILEVIEW_ICON: vf = vficon_new(vf, path); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
571 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
572 |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
573 vf_dnd_init(vf); |
|
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
574 |
| 572 | 575 g_signal_connect(G_OBJECT(vf->listview), "key_press_event", |
| 576 G_CALLBACK(vf_press_key_cb), vf); | |
| 577 g_signal_connect(G_OBJECT(vf->listview), "button_press_event", | |
| 578 G_CALLBACK(vf_press_cb), vf); | |
| 579 g_signal_connect(G_OBJECT(vf->listview), "button_release_event", | |
| 580 G_CALLBACK(vf_release_cb), vf); | |
| 581 | |
| 582 gtk_container_add(GTK_CONTAINER(vf->widget), vf->listview); | |
| 583 gtk_widget_show(vf->listview); | |
| 584 | |
| 585 if (path) vf_set_path(vf, path); | |
| 586 | |
| 587 return vf; | |
| 588 } | |
| 589 | |
| 590 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data) | |
| 591 { | |
| 592 vf->func_status = func; | |
| 593 vf->data_status = data; | |
| 594 } | |
| 595 | |
| 596 void vf_set_thumb_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gdouble val, const gchar *text, gpointer data), gpointer data) | |
| 597 { | |
| 598 vf->func_thumb_status = func; | |
| 599 vf->data_thumb_status = data; | |
| 600 } | |
| 601 | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
602 void vf_thumb_set(ViewFile *vf, gint enable) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
603 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
604 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
605 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
606 case FILEVIEW_LIST: vflist_thumb_set(vf, enable); break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
607 case FILEVIEW_ICON: /*vficon_thumb_set(vf, enable);*/ break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
608 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
609 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
610 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
611 void vf_marks_set(ViewFile *vf, gint enable) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
612 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
613 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
614 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
615 case FILEVIEW_LIST: vflist_marks_set(vf, enable); break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
616 case FILEVIEW_ICON: /*vficon_marks_set(vf, enable);*/ break; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
617 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
618 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
619 |
| 572 | 620 void vf_set_layout(ViewFile *vf, LayoutWindow *layout) |
| 621 { | |
| 622 vf->layout = layout; | |
| 623 } | |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
624 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
625 /* |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
626 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
627 * maintenance (for rename, move, remove) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
628 *----------------------------------------------------------------------------- |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
629 */ |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
630 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
631 gint vf_maint_renamed(ViewFile *vf, FileData *fd) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
632 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
633 gint ret = FALSE; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
634 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
635 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
636 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
637 case FILEVIEW_LIST: ret = vflist_maint_renamed(vf, fd); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
638 case FILEVIEW_ICON: ret = vficon_maint_renamed(vf, fd); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
639 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
640 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
641 return ret; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
642 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
643 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
644 gint vf_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
645 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
646 gint ret = FALSE; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
647 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
648 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
649 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
650 case FILEVIEW_LIST: ret = vflist_maint_removed(vf, fd, ignore_list); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
651 case FILEVIEW_ICON: ret = vficon_maint_removed(vf, fd, ignore_list); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
652 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
653 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
654 return ret; |
|
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 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
657 gint vf_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
658 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
659 gint ret = FALSE; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
660 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
661 switch(vf->type) |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
662 { |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
663 case FILEVIEW_LIST: ret = vflist_maint_moved(vf, fd, ignore_list); break; |
|
574
3da75054d4e1
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
zas_
parents:
573
diff
changeset
|
664 case FILEVIEW_ICON: ret = vficon_maint_moved(vf, fd, ignore_list); break; |
|
573
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
665 } |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
666 |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
667 return ret; |
|
2996f1bbc305
Drop ViewFileList, use ViewFile and ViewFileInfoList instead.
zas_
parents:
572
diff
changeset
|
668 } |
