annotate src/view_dir.c @ 388:5186f8e38cb8

Make directory view popup menu common and move it to view_dir.{c,h}.
author zas_
date Wed, 16 Apr 2008 20:36:10 +0000
parents 392dd6541d51
children b78077f65eff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
1 /*
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
2 * Geeqie
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
3 * (C) 2008 Vladimir Nadvornik
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
4 *
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
5 * Author: Laurent Monin
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
6 *
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
8 * Please read the included file COPYING for more information.
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
10 */
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
11
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
12 #include "main.h"
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
13 #include "view_dir.h"
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
14
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
15 #include "dupe.h"
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
16 #include "filelist.h"
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
17 #include "layout_image.h"
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
18 #include "layout_util.h"
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
19 #include "ui_fileops.h"
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
20 #include "ui_menu.h"
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
21 #include "utilops.h"
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
22 #include "view_dir_list.h"
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
23 #include "view_dir_tree.h"
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
24
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
25 GtkRadioActionEntry menu_view_dir_radio_entries[] = {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
26 { "FolderList", NULL, N_("List"), "<meta>L", NULL, DIRVIEW_LIST },
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
27 { "FolderTree", NULL, N_("Tr_ee"), "<control>T", NULL, DIRVIEW_TREE },
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
28 };
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
29
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
30 void vd_destroy_cb(GtkWidget *widget, gpointer data)
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
31 {
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
32 ViewDir *vd = data;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
33
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
34 if (vd->popup)
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
35 {
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
36 g_signal_handlers_disconnect_matched(G_OBJECT(vd->popup), G_SIGNAL_MATCH_DATA,
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
37 0, 0, 0, NULL, vd);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
38 gtk_widget_destroy(vd->popup);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
39 }
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
40
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
41 if (vd->widget_destroy_cb) vd->widget_destroy_cb(widget, data);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
42
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
43 if (vd->pf) folder_icons_free(vd->pf);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
44 if (vd->drop_list) filelist_free(vd->drop_list);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
45
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
46 if (vd->path) g_free(vd->path);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
47 if (vd->info) g_free(vd->info);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
48
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
49 g_free(vd);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
50 }
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
51
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
52 ViewDir *vd_new(DirViewType type, const gchar *path)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
53 {
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
54 ViewDir *vd = g_new0(ViewDir, 1);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
55
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
56 vd->path = NULL;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
57 vd->click_fd = NULL;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
58
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
59 vd->drop_fd = NULL;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
60 vd->drop_list = NULL;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
61 vd->drop_scroll_id = -1;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
62 vd->drop_list = NULL;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
63
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
64 vd->popup = NULL;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
65 vd->pf = NULL;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
66
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
67 vd->widget = gtk_scrolled_window_new(NULL, NULL);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
68 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vd->widget), GTK_SHADOW_IN);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
69 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vd->widget),
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
70 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
71
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
72 switch(type)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
73 {
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
74 case DIRVIEW_LIST: vd = vdlist_new(vd, path); break;
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
75 case DIRVIEW_TREE: vd = vdtree_new(vd, path); break;
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
76 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
77
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
78 g_signal_connect(G_OBJECT(vd->widget), "destroy",
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
79 G_CALLBACK(vd_destroy_cb), vd);
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
80
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
81 vd->pf = folder_icons_new();
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
82
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
83 return vd;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
84 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
85
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
86 void vd_set_select_func(ViewDir *vd,
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
87 void (*func)(ViewDir *vd, const gchar *path, gpointer data), gpointer data)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
88 {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
89 vd->select_func = func;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
90 vd->select_data = data;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
91 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
92
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
93 void vd_set_layout(ViewDir *vd, LayoutWindow *layout)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
94 {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
95 vd->layout = layout;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
96 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
97
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
98 gint vd_set_path(ViewDir *vd, const gchar *path)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
99 {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
100 gint ret = FALSE;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
101
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
102 switch(vd->type)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
103 {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
104 case DIRVIEW_LIST: ret = vdlist_set_path(vd, path); break;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
105 case DIRVIEW_TREE: ret = vdtree_set_path(vd, path); break;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
106 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
107
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
108 return ret;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
109 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
110
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
111 void vd_refresh(ViewDir *vd)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
112 {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
113 switch(vd->type)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
114 {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
115 case DIRVIEW_LIST: return vdlist_refresh(vd);
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
116 case DIRVIEW_TREE: return vdtree_refresh(vd);
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
117 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
118 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
119
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
120 const gchar *vd_row_get_path(ViewDir *vd, gint row)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
121 {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
122 const gchar *ret = NULL;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
123
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
124 switch(vd->type)
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
125 {
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
126 case DIRVIEW_LIST: ret = vdlist_row_get_path(vd, row); break;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
127 case DIRVIEW_TREE: ret = vdtree_row_get_path(vd, row); break;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
128 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
129
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
130 return ret;
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
131 }
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents:
diff changeset
132
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
133 void vd_color_set(ViewDir *vd, FileData *fd, gint color_set)
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
134 {
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
135 GtkTreeModel *store;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
136 GtkTreeIter iter;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
137
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
138 switch(vd->type)
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
139 {
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
140 case DIRVIEW_LIST:
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
141 {
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
142 if (vdlist_find_row(vd, fd, &iter) < 0) return;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
143 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
144 gtk_list_store_set(GTK_LIST_STORE(store), &iter, DIR_COLUMN_COLOR, color_set, -1);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
145 }
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
146 break;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
147 case DIRVIEW_TREE:
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
148 {
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
149 if (vdtree_find_row(vd, fd, &iter, NULL) < 0) return;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
150 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
151 gtk_tree_store_set(GTK_TREE_STORE(store), &iter, DIR_COLUMN_COLOR, color_set, -1);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
152 }
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
153 break;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
154 }
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
155 }
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
156
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
157 void vd_popup_destroy_cb(GtkWidget *widget, gpointer data)
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
158 {
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
159 ViewDir *vd = data;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
160
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
161 vd_color_set(vd, vd->click_fd, FALSE);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
162 vd->click_fd = NULL;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
163 vd->popup = NULL;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
164
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
165 vd_color_set(vd, vd->drop_fd, FALSE);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
166 filelist_free(vd->drop_list);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
167 vd->drop_list = NULL;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
168 vd->drop_fd = NULL;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
169 }
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
170
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
171 /*
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
172 *-----------------------------------------------------------------------------
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
173 * drop menu (from dnd)
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
174 *-----------------------------------------------------------------------------
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
175 */
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
176
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
177 static void vd_drop_menu_copy_cb(GtkWidget *widget, gpointer data)
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
178 {
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
179 ViewDir *vd = data;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
180 const gchar *path;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
181 GList *list;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
182
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
183 if (!vd->drop_fd) return;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
184
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
185 path = vd->drop_fd->path;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
186 list = vd->drop_list;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
187 vd->drop_list = NULL;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
188
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
189 file_util_copy_simple(list, path);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
190 }
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
191
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
192 static void vd_drop_menu_move_cb(GtkWidget *widget, gpointer data)
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
193 {
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
194 ViewDir *vd = data;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
195 const gchar *path;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
196 GList *list;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
197
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
198 if (!vd->drop_fd) return;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
199
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
200 path = vd->drop_fd->path;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
201 list = vd->drop_list;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
202
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
203 vd->drop_list = NULL;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
204
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
205 file_util_move_simple(list, path);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
206 }
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
207
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
208 GtkWidget *vd_drop_menu(ViewDir *vd, gint active)
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
209 {
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
210 GtkWidget *menu;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
211
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
212 menu = popup_menu_short_lived();
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
213 g_signal_connect(G_OBJECT(menu), "destroy",
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
214 G_CALLBACK(vd_popup_destroy_cb), vd);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
215
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
216 menu_item_add_stock_sensitive(menu, _("_Copy"), GTK_STOCK_COPY, active,
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
217 G_CALLBACK(vd_drop_menu_copy_cb), vd);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
218 menu_item_add_sensitive(menu, _("_Move"), active, G_CALLBACK(vd_drop_menu_move_cb), vd);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
219
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
220 menu_item_add_divider(menu);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
221 menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, NULL, vd);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
222
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
223 return menu;
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
224 }
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 380
diff changeset
225
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
226 /*
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
227 *-----------------------------------------------------------------------------
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
228 * pop-up menu
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
229 *-----------------------------------------------------------------------------
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
230 */
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
231
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
232 static void vd_pop_menu_up_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
233 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
234 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
235 gchar *path;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
236
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
237 if (!vd->path || strcmp(vd->path, "/") == 0) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
238 path = remove_level_from_path(vd->path);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
239
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
240 if (vd->select_func)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
241 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
242 vd->select_func(vd, path, vd->select_data);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
243 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
244
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
245 g_free(path);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
246 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
247
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
248 static void vd_pop_menu_slide_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
249 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
250 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
251 gchar *path;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
252
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
253 if (!vd->layout) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
254 if (!vd->click_fd) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
255
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
256 path = vd->click_fd->path;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
257
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
258 layout_set_path(vd->layout, path);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
259 layout_select_none(vd->layout);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
260 layout_image_slideshow_stop(vd->layout);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
261 layout_image_slideshow_start(vd->layout);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
262 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
263
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
264 static void vd_pop_menu_slide_rec_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
265 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
266 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
267 gchar *path;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
268 GList *list;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
269
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
270 if (!vd->layout) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
271 if (!vd->click_fd) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
272
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
273 path = vd->click_fd->path;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
274
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
275 list = filelist_recursive(path);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
276
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
277 layout_image_slideshow_stop(vd->layout);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
278 layout_image_slideshow_start_from_list(vd->layout, list);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
279 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
280
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
281 static void vd_pop_menu_dupe(ViewDir *vd, gint recursive)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
282 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
283 DupeWindow *dw;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
284 GList *list = NULL;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
285
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
286 if (!vd->click_fd) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
287
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
288 if (recursive)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
289 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
290 list = g_list_append(list, file_data_ref(vd->click_fd));
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
291 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
292 else
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
293 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
294 filelist_read(vd->click_fd->path, &list, NULL);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
295 list = filelist_filter(list, FALSE);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
296 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
297
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
298 dw = dupe_window_new(DUPE_MATCH_NAME);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
299 dupe_window_add_files(dw, list, recursive);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
300
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
301 filelist_free(list);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
302 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
303
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
304 static void vd_pop_menu_dupe_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
305 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
306 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
307 vd_pop_menu_dupe(vd, FALSE);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
308 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
309
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
310 static void vd_pop_menu_dupe_rec_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
311 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
312 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
313 vd_pop_menu_dupe(vd, TRUE);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
314 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
315
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
316 static void vd_pop_menu_delete_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
317 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
318 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
319
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
320 if (!vd->click_fd) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
321 file_util_delete_dir(vd->click_fd, vd->widget);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
322 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
323
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
324 static void vd_pop_menu_dir_view_as_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
325 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
326 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
327 DirViewType new_type = DIRVIEW_LIST;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
328
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
329 if (!vd->layout) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
330
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
331 switch(vd->type)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
332 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
333 case DIRVIEW_LIST: new_type = DIRVIEW_TREE; break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
334 case DIRVIEW_TREE: new_type = DIRVIEW_LIST; break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
335 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
336
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
337 layout_views_set(vd->layout, new_type, vd->layout->icon_view);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
338 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
339
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
340 static void vd_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
341 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
342 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
343
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
344 if (vd->layout) layout_refresh(vd->layout);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
345 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
346
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
347 static void vd_toggle_show_hidden_files_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
348 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
349 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
350
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
351 options->file_filter.show_hidden_files = !options->file_filter.show_hidden_files;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
352 if (vd->layout) layout_refresh(vd->layout);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
353 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
354
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
355 static void vd_pop_menu_new_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
356 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
357 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
358 const gchar *path = NULL;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
359 gchar *new_path;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
360 gchar *buf;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
361
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
362 switch(vd->type)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
363 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
364 case DIRVIEW_LIST:
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
365 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
366 if (!vd->path) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
367 path = vd->path;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
368 };
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
369 break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
370 case DIRVIEW_TREE:
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
371 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
372 if (!vd->click_fd) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
373 path = vd->click_fd->path;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
374 };
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
375 break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
376 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
377
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
378 buf = concat_dir_and_file(path, _("new_folder"));
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
379 new_path = unique_filename(buf, NULL, NULL, FALSE);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
380 g_free(buf);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
381 if (!new_path) return;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
382
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
383 if (!mkdir_utf8(new_path, 0755))
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
384 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
385 gchar *text;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
386
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
387 text = g_strdup_printf(_("Unable to create folder:\n%s"), new_path);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
388 file_util_warning_dialog(_("Error creating folder"), text, GTK_STOCK_DIALOG_ERROR, vd->view);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
389 g_free(text);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
390 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
391 else
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
392 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
393 switch(vd->type)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
394 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
395 case DIRVIEW_LIST:
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
396 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
397 FileData *fd;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
398
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
399 vd_refresh(vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
400 fd = vdlist_row_by_path(vd, new_path, NULL);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
401
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
402 vdlist_rename_by_row(vd, fd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
403 };
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
404 break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
405 case DIRVIEW_TREE:
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
406 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
407 FileData *fd;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
408
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
409 fd = vdtree_populate_path(vd, new_path, TRUE, TRUE);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
410 vdtree_rename_by_data(vd, fd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
411 };
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
412 break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
413 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
414 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
415
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
416 g_free(new_path);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
417 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
418
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
419 static void vd_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
420 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
421 ViewDir *vd = data;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
422
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
423 switch(vd->type)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
424 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
425 case DIRVIEW_LIST: vdlist_rename_by_row(vd, vd->click_fd); break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
426 case DIRVIEW_TREE: vdtree_rename_by_data(vd, vd->click_fd); break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
427 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
428 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
429
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
430 GtkWidget *vd_pop_menu(ViewDir *vd, FileData *fd)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
431 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
432 GtkWidget *menu;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
433 gint active;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
434 gint rename_delete_active = FALSE;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
435 gint new_folder_active = FALSE;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
436
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
437 active = (fd != NULL);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
438 if (fd)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
439 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
440 switch(vd->type)
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
441 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
442 case DIRVIEW_LIST:
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
443 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
444 /* check using . (always row 0) */
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
445 new_folder_active = (vd->path && access_file(vd->path , W_OK | X_OK));
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
446
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
447 /* ignore .. and . */
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
448 rename_delete_active = (new_folder_active &&
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
449 strcmp(fd->name, ".") != 0 &&
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
450 strcmp(fd->name, "..") != 0 &&
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
451 access_file(fd->path, W_OK | X_OK));
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
452 };
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
453 break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
454 case DIRVIEW_TREE:
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
455 {
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
456 gchar *parent;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
457
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
458 new_folder_active = (fd && access_file(fd->path, W_OK | X_OK));
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
459 parent = remove_level_from_path(fd->path);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
460 rename_delete_active = access_file(parent, W_OK | X_OK);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
461 g_free(parent);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
462 };
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
463 break;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
464 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
465
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
466 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
467 menu = popup_menu_short_lived();
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
468 g_signal_connect(G_OBJECT(menu), "destroy",
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
469 G_CALLBACK(vd_popup_destroy_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
470
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
471 menu_item_add_stock_sensitive(menu, _("_Up to parent"), GTK_STOCK_GO_UP,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
472 (vd->path && strcmp(vd->path, "/") != 0),
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
473 G_CALLBACK(vd_pop_menu_up_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
474
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
475 menu_item_add_divider(menu);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
476 menu_item_add_sensitive(menu, _("_Slideshow"), active,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
477 G_CALLBACK(vd_pop_menu_slide_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
478 menu_item_add_sensitive(menu, _("Slideshow recursive"), active,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
479 G_CALLBACK(vd_pop_menu_slide_rec_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
480
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
481 menu_item_add_divider(menu);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
482 menu_item_add_stock_sensitive(menu, _("Find _duplicates..."), GTK_STOCK_FIND, active,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
483 G_CALLBACK(vd_pop_menu_dupe_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
484 menu_item_add_stock_sensitive(menu, _("Find duplicates recursive..."), GTK_STOCK_FIND, active,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
485 G_CALLBACK(vd_pop_menu_dupe_rec_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
486
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
487 menu_item_add_divider(menu);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
488
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
489 menu_item_add_sensitive(menu, _("_New folder..."), new_folder_active,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
490 G_CALLBACK(vd_pop_menu_new_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
491
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
492 menu_item_add_sensitive(menu, _("_Rename..."), rename_delete_active,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
493 G_CALLBACK(vd_pop_menu_rename_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
494 menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, rename_delete_active,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
495 G_CALLBACK(vd_pop_menu_delete_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
496
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
497 menu_item_add_divider(menu);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
498 /* FIXME */
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
499 menu_item_add_check(menu, _("View as _tree"), vd->type,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
500 G_CALLBACK(vd_pop_menu_dir_view_as_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
501 menu_item_add_check(menu, _("Show _hidden files"), options->file_filter.show_hidden_files,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
502 G_CALLBACK(vd_toggle_show_hidden_files_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
503
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
504 menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH,
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
505 G_CALLBACK(vd_pop_menu_refresh_cb), vd);
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
506
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
507 return menu;
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
508 }
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 384
diff changeset
509