4 * ROX-Filer, filer for the ROX desktop project
5 * Copyright (C) 2000, Thomas Leonard, <tal197@ecs.soton.ac.uk>.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA 02111-1307 USA
22 /* menu.c - code for handling the popup menu */
28 #include <sys/types.h>
30 #include <sys/param.h>
44 #include "gui_support.h"
47 #include "gtksavebox.h"
49 #include "minibuffer.h"
52 #define C_ "<control>"
54 #define MENU_MARGIN 32
56 GtkAccelGroup
*filer_keys
;
57 GtkAccelGroup
*panel_keys
;
58 GtkAccelGroup
*pinboard_keys
;
60 static GtkWidget
*popup_menu
= NULL
; /* Currently open menu */
62 static gint updating_menu
= 0; /* Non-zero => ignore activations */
65 static GtkWidget
*xterm_here_entry
;
66 static char *xterm_here_value
;
68 /* TRUE if we selected an icon automatically when the menu was opened */
69 static gboolean pin_temp_item_selected
;
71 /* Static prototypes */
73 static void save_menus(void);
74 static void position_menu(GtkMenu
*menu
, gint
*x
, gint
*y
, gpointer data
);
75 static void pin_menu_closed(GtkWidget
*widget
);
76 static void menu_closed(GtkWidget
*widget
);
77 static void items_sensitive(gboolean state
);
78 static char *load_xterm_here(char *data
);
79 static void savebox_show(guchar
*title
, guchar
*path
, MaskedPixmap
*image
,
80 gboolean (*callback
)(guchar
*current
, guchar
*new));
81 static gint
save_to_file(GtkSavebox
*savebox
, guchar
*pathname
);
82 static GList
*list_paths(FilerWindow
*filer_window
);
83 static void free_paths(GList
*paths
);
85 /* Note that for most of these callbacks none of the arguments are used. */
86 static void large(gpointer data
, guint action
, GtkWidget
*widget
);
87 static void small(gpointer data
, guint action
, GtkWidget
*widget
);
89 /* (action used in these two - (DetailsType) */
90 static void large_with(gpointer data
, guint action
, GtkWidget
*widget
);
91 static void small_with(gpointer data
, guint action
, GtkWidget
*widget
);
93 static void sort_name(gpointer data
, guint action
, GtkWidget
*widget
);
94 static void sort_type(gpointer data
, guint action
, GtkWidget
*widget
);
95 static void sort_size(gpointer data
, guint action
, GtkWidget
*widget
);
96 static void sort_date(gpointer data
, guint action
, GtkWidget
*widget
);
98 static void hidden(gpointer data
, guint action
, GtkWidget
*widget
);
99 static void refresh(gpointer data
, guint action
, GtkWidget
*widget
);
101 static void copy_item(gpointer data
, guint action
, GtkWidget
*widget
);
102 static void rename_item(gpointer data
, guint action
, GtkWidget
*widget
);
103 static void link_item(gpointer data
, guint action
, GtkWidget
*widget
);
104 static void open_file(gpointer data
, guint action
, GtkWidget
*widget
);
105 static void help(gpointer data
, guint action
, GtkWidget
*widget
);
106 static void show_file_info(gpointer data
, guint action
, GtkWidget
*widget
);
107 static void mount(gpointer data
, guint action
, GtkWidget
*widget
);
108 static void delete(gpointer data
, guint action
, GtkWidget
*widget
);
109 static void remove_link(gpointer data
, guint action
, GtkWidget
*widget
);
110 static void usage(gpointer data
, guint action
, GtkWidget
*widget
);
111 static void chmod_items(gpointer data
, guint action
, GtkWidget
*widget
);
112 static void find(gpointer data
, guint action
, GtkWidget
*widget
);
114 static void open_vfs_rpm(gpointer data
, guint action
, GtkWidget
*widget
);
115 static void open_vfs_utar(gpointer data
, guint action
, GtkWidget
*widget
);
116 static void open_vfs_uzip(gpointer data
, guint action
, GtkWidget
*widget
);
118 static void select_all(gpointer data
, guint action
, GtkWidget
*widget
);
119 static void clear_selection(gpointer data
, guint action
, GtkWidget
*widget
);
120 static void show_options(gpointer data
, guint action
, GtkWidget
*widget
);
121 static void new_directory(gpointer data
, guint action
, GtkWidget
*widget
);
122 static void xterm_here(gpointer data
, guint action
, GtkWidget
*widget
);
124 static void open_parent_same(gpointer data
, guint action
, GtkWidget
*widget
);
125 static void open_parent(gpointer data
, guint action
, GtkWidget
*widget
);
126 static void new_window(gpointer data
, guint action
, GtkWidget
*widget
);
127 static void close_window(gpointer data
, guint action
, GtkWidget
*widget
);
128 static void enter_path(gpointer data
, guint action
, GtkWidget
*widget
);
129 static void shell_command(gpointer data
, guint action
, GtkWidget
*widget
);
130 static void run_action(gpointer data
, guint action
, GtkWidget
*widget
);
131 static void select_if(gpointer data
, guint action
, GtkWidget
*widget
);
132 static void rox_help(gpointer data
, guint action
, GtkWidget
*widget
);
134 static void open_as_dir(gpointer data
, guint action
, GtkWidget
*widget
);
135 static void close_panel(gpointer data
, guint action
, GtkWidget
*widget
);
137 static void pin_help(gpointer data
, guint action
, GtkWidget
*widget
);
138 static void pin_remove(gpointer data
, guint action
, GtkWidget
*widget
);
140 static void set_items_shaded(GtkWidget
*menu
, gboolean shaded
, int from
, int n
);
142 static GtkWidget
*create_options();
143 static void update_options();
144 static void set_options();
145 static void save_options();
147 static OptionsSection options
=
157 static GtkWidget
*filer_menu
; /* The popup filer menu */
158 static GtkWidget
*filer_file_item
; /* The File '' label */
159 static GtkWidget
*filer_file_menu
; /* The File '' menu */
160 static GtkWidget
*filer_vfs_menu
; /* The Open VFS menu */
161 static GtkWidget
*filer_hidden_menu
; /* The Show Hidden item */
162 static GtkWidget
*filer_new_window
; /* The New Window item */
163 static GtkWidget
*panel_menu
; /* The popup panel menu */
164 static GtkWidget
*panel_hidden_menu
; /* The Show Hidden item */
165 static GtkWidget
*pinboard_menu
; /* The popup pinboard menu */
167 /* Used for Copy, etc */
168 static GtkWidget
*savebox
= NULL
;
169 static guchar
*current_path
= NULL
;
170 static gboolean (*current_savebox_callback
)(guchar
*current
, guchar
*new);
175 static GtkItemFactoryEntry filer_menu_def
[] = {
176 {N_("Display"), NULL
, NULL
, 0, "<Branch>"},
177 {">" N_("Large Icons"), NULL
, large
, 0, NULL
},
178 {">" N_("Small Icons"), NULL
, small
, 0, NULL
},
179 {">" N_("Large, With..."), NULL
, NULL
, 0, "<Branch>"},
180 {">>" N_("Summary"), NULL
, large_with
, DETAILS_SUMMARY
, NULL
},
181 {">>" N_("Sizes"), NULL
, large_with
, DETAILS_SIZE
, NULL
},
182 {">>" N_("Size Bars"), NULL
, large_with
, DETAILS_SIZE_BARS
, NULL
},
183 {">" N_("Small, With..."), NULL
, NULL
, 0, "<Branch>"},
184 {">>" N_("Summary"), NULL
, small_with
, DETAILS_SUMMARY
, NULL
},
185 {">>" N_("Sizes"), NULL
, small_with
, DETAILS_SIZE
, NULL
},
186 {">>" N_("Size Bars"), NULL
, small_with
, DETAILS_SIZE_BARS
, NULL
},
187 {">", NULL
, NULL
, 0, "<Separator>"},
188 {">" N_("Sort by Name"), NULL
, sort_name
, 0, NULL
},
189 {">" N_("Sort by Type"), NULL
, sort_type
, 0, NULL
},
190 {">" N_("Sort by Date"), NULL
, sort_date
, 0, NULL
},
191 {">" N_("Sort by Size"), NULL
, sort_size
, 0, NULL
},
192 {">", NULL
, NULL
, 0, "<Separator>"},
193 {">" N_("Show Hidden"), NULL
, hidden
, 0, "<ToggleItem>"},
194 {">" N_("Refresh"), NULL
, refresh
, 0, NULL
},
195 {N_("File"), NULL
, NULL
, 0, "<Branch>"},
196 {">" N_("Copy..."), NULL
, copy_item
, 0, NULL
},
197 {">" N_("Rename..."), NULL
, rename_item
, 0, NULL
},
198 {">" N_("Link..."), NULL
, link_item
, 0, NULL
},
199 {">" N_("Shift Open"), NULL
, open_file
, 0, NULL
},
200 {">" N_("Help"), NULL
, help
, 0, NULL
},
201 {">" N_("Info"), NULL
, show_file_info
, 0, NULL
},
202 {">" N_("Open VFS"), NULL
, NULL
, 0, "<Branch>"},
203 {">>" N_("Unzip"), NULL
, open_vfs_uzip
, 0, NULL
},
204 {">>" N_("Untar"), NULL
, open_vfs_utar
, 0, NULL
},
205 {">>" N_("RPM"), NULL
, open_vfs_rpm
, 0, NULL
},
206 {">", NULL
, NULL
, 0, "<Separator>"},
207 {">" N_("Mount"), NULL
, mount
, 0, NULL
},
208 {">" N_("Delete"), NULL
, delete, 0, NULL
},
209 {">" N_("Disk Usage"), NULL
, usage
, 0, NULL
},
210 {">" N_("Permissions"), NULL
, chmod_items
, 0, NULL
},
211 {">" N_("Find"), NULL
, find
, 0, NULL
},
212 {N_("Select All"), NULL
, select_all
, 0, NULL
},
213 {N_("Clear Selection"), NULL
, clear_selection
, 0, NULL
},
214 {N_("Options..."), NULL
, show_options
, 0, NULL
},
215 {N_("New Directory..."), NULL
, new_directory
, 0, NULL
},
216 {N_("Xterm Here"), NULL
, xterm_here
, 0, NULL
},
217 {N_("Window"), NULL
, NULL
, 0, "<Branch>"},
218 {">" N_("Parent, New Window"), NULL
, open_parent
, 0, NULL
},
219 {">" N_("Parent, Same Window"), NULL
, open_parent_same
, 0, NULL
},
220 {">" N_("New Window"), NULL
, new_window
, 0, NULL
},
221 {">" N_("Close Window"), NULL
, close_window
, 0, NULL
},
222 {">", NULL
, NULL
, 0, "<Separator>"},
223 {">" N_("Enter Path..."), NULL
, enter_path
, 0, NULL
},
224 {">" N_("Shell Command..."), NULL
, shell_command
, 0, NULL
},
225 {">" N_("Set Run Action..."), NULL
, run_action
, 0, NULL
},
226 {">" N_("Select If..."), NULL
, select_if
, 0, NULL
},
227 {">", NULL
, NULL
, 0, "<Separator>"},
228 {">" N_("Show ROX-Filer Help"), NULL
, rox_help
, 0, NULL
},
231 static GtkItemFactoryEntry panel_menu_def
[] = {
232 {N_("Display"), NULL
, NULL
, 0, "<Branch>"},
233 {">" N_("Sort by Name"), NULL
, sort_name
, 0, NULL
},
234 {">" N_("Sort by Type"), NULL
, sort_type
, 0, NULL
},
235 {">" N_("Sort by Date"), NULL
, sort_date
, 0, NULL
},
236 {">" N_("Sort by Size"), NULL
, sort_size
, 0, NULL
},
237 {">", NULL
, NULL
, 0, "<Separator>"},
238 {">" N_("Show Hidden"), NULL
, hidden
, 0, "<ToggleItem>"},
239 {">" N_("Refresh"), NULL
, refresh
, 0, NULL
},
240 {N_("Open Panel as Directory"), NULL
, open_as_dir
, 0, NULL
},
241 {N_("Close Panel"), NULL
, close_panel
, 0, NULL
},
242 {"", NULL
, NULL
, 0, "<Separator>"},
243 {N_("ROX-Filer Help"), NULL
, rox_help
, 0, NULL
},
244 {N_("ROX-Filer Options..."), NULL
, show_options
, 0, NULL
},
245 {"", NULL
, NULL
, 0, "<Separator>"},
246 {N_("Show Help"), NULL
, help
, 0, NULL
},
247 {N_("Remove Item"), NULL
, remove_link
, 0, NULL
},
250 static GtkItemFactoryEntry pinboard_menu_def
[] = {
251 {N_("Show Help"), NULL
, pin_help
, 0, NULL
},
252 {N_("Remove Item(s)"), NULL
, pin_remove
, 0, NULL
},
253 {"", NULL
, NULL
, 0, "<Separator>"},
254 {N_("ROX-Filer Help"), NULL
, rox_help
, 0, NULL
},
255 {N_("ROX-Filer Options..."), NULL
, show_options
, 0, NULL
},
259 typedef struct _FileStatus FileStatus
;
261 /* This is for the 'file(1) says...' thing */
264 int fd
; /* FD to read from, -1 if closed */
265 int input
; /* Input watcher tag if fd valid */
266 GtkLabel
*label
; /* Widget to output to */
267 gboolean start
; /* No output yet */
270 #define GET_MENU_ITEM(var, menu) \
271 var = gtk_item_factory_get_widget(item_factory, "<" menu ">");
273 #define GET_SMENU_ITEM(var, menu, sub) \
275 tmp = g_strdup_printf("<" menu ">/%s", _(sub)); \
276 var = gtk_item_factory_get_widget(item_factory, tmp); \
280 #define GET_SSMENU_ITEM(var, menu, sub, subsub) \
282 tmp = g_strdup_printf("<" menu ">/%s/%s", _(sub), _(subsub)); \
283 var = gtk_item_factory_get_widget(item_factory, tmp); \
287 /* Creates menu <name> from the <name>_menu_def array.
288 * The accel group <name>_keys must also have been created.
289 * All menu items are translated. Sets 'item_factory'.
291 #define MAKE_MENU(name) \
293 GtkItemFactoryEntry *translated; \
296 item_factory = gtk_item_factory_new(GTK_TYPE_MENU, \
297 "<" #name ">", name ## _keys); \
299 n_entries = sizeof(name ## _menu_def) / sizeof(*name ## _menu_def); \
300 translated = translate_entries(name ## _menu_def, n_entries); \
301 gtk_item_factory_create_items (item_factory, n_entries, \
303 free_translated_entries(translated, n_entries); \
312 GtkItemFactory
*item_factory
; \
314 filer_keys
= gtk_accel_group_new();
317 GET_MENU_ITEM(filer_menu
, "filer");
318 GET_SMENU_ITEM(filer_file_menu
, "filer", "File");
319 GET_SSMENU_ITEM(filer_vfs_menu
, "filer", "File", "Open VFS");
320 GET_SSMENU_ITEM(filer_hidden_menu
, "filer", "Display", "Show Hidden");
322 items
= gtk_container_children(GTK_CONTAINER(filer_menu
));
323 filer_file_item
= GTK_BIN(g_list_nth(items
, 1)->data
)->child
;
326 GET_SSMENU_ITEM(item
, "filer", "Window", "New Window");
327 filer_new_window
= GTK_BIN(item
)->child
;
329 panel_keys
= gtk_accel_group_new();
332 GET_MENU_ITEM(panel_menu
, "panel");
333 GET_SSMENU_ITEM(panel_hidden_menu
, "panel", "Display", "Show Hidden");
335 menurc
= choices_find_path_load("menus", PROJECT
);
337 gtk_item_factory_parse_rc(menurc
);
339 gtk_accel_group_lock(panel_keys
);
341 pinboard_keys
= gtk_accel_group_new();
343 gtk_accel_group_lock(pinboard_keys
);
344 GET_MENU_ITEM(pinboard_menu
, "pinboard");
346 gtk_signal_connect(GTK_OBJECT(pinboard_menu
), "unmap_event",
347 GTK_SIGNAL_FUNC(pin_menu_closed
), NULL
);
348 gtk_signal_connect(GTK_OBJECT(filer_menu
), "unmap_event",
349 GTK_SIGNAL_FUNC(menu_closed
), NULL
);
350 gtk_signal_connect(GTK_OBJECT(panel_menu
), "unmap_event",
351 GTK_SIGNAL_FUNC(menu_closed
), NULL
);
352 gtk_signal_connect(GTK_OBJECT(filer_file_menu
), "unmap_event",
353 GTK_SIGNAL_FUNC(menu_closed
), NULL
);
355 options_sections
= g_slist_prepend(options_sections
, &options
);
356 xterm_here_value
= g_strdup("xterm");
357 option_register("xterm_here", load_xterm_here
);
359 savebox
= gtk_savebox_new();
360 gtk_signal_connect_object(GTK_OBJECT(savebox
), "save_to_file",
361 GTK_SIGNAL_FUNC(save_to_file
), NULL
);
362 gtk_signal_connect_object(GTK_OBJECT(savebox
), "save_done",
363 GTK_SIGNAL_FUNC(gtk_widget_hide
),
364 GTK_OBJECT(savebox
));
369 /* Build up some option widgets to go in the options dialog, but don't
372 static GtkWidget
*create_options()
374 GtkWidget
*table
, *label
;
376 table
= gtk_table_new(2, 2, FALSE
);
377 gtk_container_set_border_width(GTK_CONTAINER(table
), 4);
379 label
= gtk_label_new(
380 _("To set the keyboard short-cuts, simply open "
381 "the menu over a filer window, move the pointer over "
382 "the item you want to use and press a key. The key "
383 "will appear next to the menu item and you can just "
384 "press that key without opening the menu in future."));
385 gtk_label_set_line_wrap(GTK_LABEL(label
), TRUE
);
386 gtk_table_attach_defaults(GTK_TABLE(table
), label
, 0, 2, 0, 1);
388 label
= gtk_label_new(_("'Xterm here' program:"));
389 gtk_table_attach_defaults(GTK_TABLE(table
), label
, 0, 1, 1, 2);
390 xterm_here_entry
= gtk_entry_new();
391 gtk_table_attach_defaults(GTK_TABLE(table
), xterm_here_entry
,
397 static char *load_xterm_here(char *data
)
399 g_free(xterm_here_value
);
400 xterm_here_value
= g_strdup(data
);
404 static void update_options()
406 gtk_entry_set_text(GTK_ENTRY(xterm_here_entry
), xterm_here_value
);
409 static void set_options()
411 g_free(xterm_here_value
);
412 xterm_here_value
= g_strdup(gtk_entry_get_text(
413 GTK_ENTRY(xterm_here_entry
)));
416 static void save_options()
419 option_write("xterm_here", xterm_here_value
);
423 static void items_sensitive(gboolean state
)
428 items
= item
= gtk_container_children(GTK_CONTAINER(filer_file_menu
));
431 gtk_widget_set_sensitive(GTK_BIN(item
->data
)->child
, state
);
436 items
= item
= gtk_container_children(GTK_CONTAINER(filer_vfs_menu
));
439 gtk_widget_set_sensitive(GTK_BIN(item
->data
)->child
, state
);
445 static void position_menu(GtkMenu
*menu
, gint
*x
, gint
*y
, gpointer data
)
447 int *pos
= (int *) data
;
448 GtkRequisition requisition
;
450 gtk_widget_size_request(GTK_WIDGET(menu
), &requisition
);
453 *x
= screen_width
- MENU_MARGIN
- requisition
.width
;
454 else if (pos
[0] == -2)
457 *x
= pos
[0] - (requisition
.width
>> 2);
460 *y
= screen_height
- MENU_MARGIN
- requisition
.height
;
461 else if (pos
[1] == -2)
464 *y
= pos
[1] - (requisition
.height
>> 2);
466 *x
= CLAMP(*x
, 0, screen_width
- requisition
.width
);
467 *y
= CLAMP(*y
, 0, screen_height
- requisition
.height
);
470 /* Display the pinboard menu. Set icon to NULL if no particular icon
473 void show_pinboard_menu(GdkEventButton
*event
, PinIcon
*icon
)
480 if (pinboard_is_selected(icon
))
481 pin_temp_item_selected
= FALSE
;
484 pinboard_select_only(icon
);
485 pin_temp_item_selected
= TRUE
;
489 icons
= pinboard_get_selected();
491 pos
[0] = event
->x_root
;
492 pos
[1] = event
->y_root
;
496 set_items_shaded(pinboard_menu
,
497 icons
->next
? TRUE
: FALSE
, 0, 1);
499 set_items_shaded(pinboard_menu
, FALSE
, 1, 1);
502 set_items_shaded(pinboard_menu
, TRUE
, 0, 2);
504 gtk_menu_popup(GTK_MENU(pinboard_menu
), NULL
, NULL
, position_menu
,
505 (gpointer
) pos
, event
->button
, event
->time
);
508 void show_filer_menu(FilerWindow
*filer_window
, GdkEventButton
*event
,
516 pos
[0] = event
->x_root
;
517 pos
[1] = event
->y_root
;
519 window_with_focus
= filer_window
;
521 switch (filer_window
->panel_type
)
533 if (filer_window
->panel_type
)
534 collection_clear_selection(filer_window
->collection
); /* ??? */
536 if (filer_window
->collection
->number_selected
== 0 && item
>= 0)
538 collection_select_item(filer_window
->collection
, item
);
539 filer_window
->temp_item_selected
= TRUE
;
542 filer_window
->temp_item_selected
= FALSE
;
544 if (filer_window
->panel_type
)
546 gtk_check_menu_item_set_active(
547 GTK_CHECK_MENU_ITEM(panel_hidden_menu
),
548 filer_window
->show_hidden
);
552 GtkWidget
*file_label
, *file_menu
;
553 Collection
*collection
= filer_window
->collection
;
556 file_label
= filer_file_item
;
557 file_menu
= filer_file_menu
;
558 gtk_check_menu_item_set_active(
559 GTK_CHECK_MENU_ITEM(filer_hidden_menu
),
560 filer_window
->show_hidden
);
561 buffer
= g_string_new(NULL
);
562 switch (collection
->number_selected
)
565 g_string_assign(buffer
, _("Next Click"));
566 items_sensitive(TRUE
);
569 items_sensitive(TRUE
);
570 file_item
= selected_item(
571 filer_window
->collection
);
572 g_string_sprintf(buffer
, "%s '%s'",
573 basetype_name(file_item
),
574 file_item
->leafname
);
577 items_sensitive(FALSE
);
578 g_string_sprintf(buffer
, _("%d items"),
579 collection
->number_selected
);
582 gtk_label_set_text(GTK_LABEL(file_label
), buffer
->str
);
583 g_string_free(buffer
, TRUE
);
587 gtk_widget_set_sensitive(filer_new_window
, !o_unique_filer_windows
);
589 if (filer_window
->panel_type
)
590 popup_menu
= panel_menu
;
592 popup_menu
= (event
->state
& GDK_CONTROL_MASK
)
598 gtk_menu_popup(GTK_MENU(popup_menu
), NULL
, NULL
, position_menu
,
599 (gpointer
) pos
, event
->button
, event
->time
);
602 static void pin_menu_closed(GtkWidget
*widget
)
604 if (pin_temp_item_selected
)
605 pinboard_clear_selection();
608 static void menu_closed(GtkWidget
*widget
)
610 if (window_with_focus
== NULL
|| widget
!= popup_menu
)
611 return; /* Close panel item chosen? */
613 if (window_with_focus
->temp_item_selected
)
615 collection_clear_selection(window_with_focus
->collection
);
616 window_with_focus
->temp_item_selected
= FALSE
;
620 void target_callback(Collection
*collection
, gint item
, gpointer real_fn
)
622 g_return_if_fail(window_with_focus
!= NULL
);
623 g_return_if_fail(window_with_focus
->collection
== collection
);
624 g_return_if_fail(real_fn
!= NULL
);
626 collection_wink_item(collection
, item
);
627 collection_clear_selection(collection
);
628 collection_select_item(collection
, item
);
629 ((CollectionTargetFunc
)real_fn
)(NULL
, 0, collection
);
630 if (item
< collection
->number_of_items
)
631 collection_unselect_item(collection
, item
);
636 static void large(gpointer data
, guint action
, GtkWidget
*widget
)
638 g_return_if_fail(window_with_focus
!= NULL
);
640 display_style_set(window_with_focus
, LARGE_ICONS
);
643 static void small(gpointer data
, guint action
, GtkWidget
*widget
)
645 g_return_if_fail(window_with_focus
!= NULL
);
647 display_style_set(window_with_focus
, SMALL_ICONS
);
650 static void large_with(gpointer data
, guint action
, GtkWidget
*widget
)
652 g_return_if_fail(window_with_focus
!= NULL
);
654 display_style_set(window_with_focus
, LARGE_FULL_INFO
);
655 display_details_set(window_with_focus
, (DetailsType
) action
);
658 static void small_with(gpointer data
, guint action
, GtkWidget
*widget
)
660 g_return_if_fail(window_with_focus
!= NULL
);
662 display_style_set(window_with_focus
, SMALL_FULL_INFO
);
663 display_details_set(window_with_focus
, (DetailsType
) action
);
666 static void sort_name(gpointer data
, guint action
, GtkWidget
*widget
)
668 g_return_if_fail(window_with_focus
!= NULL
);
670 display_set_sort_fn(window_with_focus
, sort_by_name
);
673 static void sort_type(gpointer data
, guint action
, GtkWidget
*widget
)
675 g_return_if_fail(window_with_focus
!= NULL
);
677 display_set_sort_fn(window_with_focus
, sort_by_type
);
680 static void sort_date(gpointer data
, guint action
, GtkWidget
*widget
)
682 g_return_if_fail(window_with_focus
!= NULL
);
684 display_set_sort_fn(window_with_focus
, sort_by_date
);
687 static void sort_size(gpointer data
, guint action
, GtkWidget
*widget
)
689 g_return_if_fail(window_with_focus
!= NULL
);
691 display_set_sort_fn(window_with_focus
, sort_by_size
);
694 static void hidden(gpointer data
, guint action
, GtkWidget
*widget
)
699 g_return_if_fail(window_with_focus
!= NULL
);
701 display_set_hidden(window_with_focus
, !window_with_focus
->show_hidden
);
704 static void refresh(gpointer data
, guint action
, GtkWidget
*widget
)
706 g_return_if_fail(window_with_focus
!= NULL
);
709 filer_update_dir(window_with_focus
, TRUE
);
712 static void mount(gpointer data
, guint action
, GtkWidget
*widget
)
714 g_return_if_fail(window_with_focus
!= NULL
);
716 if (window_with_focus
->collection
->number_selected
== 0)
717 collection_target(window_with_focus
->collection
,
718 target_callback
, mount
);
723 paths
= list_paths(window_with_focus
);
729 static void delete(gpointer data
, guint action
, GtkWidget
*widget
)
731 g_return_if_fail(window_with_focus
!= NULL
);
733 if (window_with_focus
->collection
->number_selected
== 0)
734 collection_target(window_with_focus
->collection
,
735 target_callback
, delete);
737 action_delete(window_with_focus
);
740 static void remove_link(gpointer data
, guint action
, GtkWidget
*widget
)
742 g_return_if_fail(window_with_focus
!= NULL
);
744 if (window_with_focus
->collection
->number_selected
> 1)
746 report_error(PROJECT
,
747 _("You can only remove one link at a time"));
750 else if (window_with_focus
->collection
->number_selected
== 0)
751 collection_target(window_with_focus
->collection
,
752 target_callback
, remove_link
);
759 item
= selected_item(window_with_focus
->collection
);
761 path
= make_path(window_with_focus
->path
, item
->leafname
)->str
;
762 if (lstat(path
, &info
))
763 report_error(PROJECT
, g_strerror(errno
));
764 else if (!S_ISLNK(info
.st_mode
))
765 report_error(PROJECT
,
766 _("You can only remove symbolic links this way - "
767 "try the 'Open Panel as Directory' item."));
768 else if (unlink(path
))
769 report_error(PROJECT
, g_strerror(errno
));
771 filer_update_dir(window_with_focus
, TRUE
);
775 static void usage(gpointer data
, guint action
, GtkWidget
*widget
)
777 g_return_if_fail(window_with_focus
!= NULL
);
779 if (window_with_focus
->collection
->number_selected
== 0)
780 collection_target(window_with_focus
->collection
,
781 target_callback
, usage
);
783 action_usage(window_with_focus
);
786 static void chmod_items(gpointer data
, guint action
, GtkWidget
*widget
)
788 g_return_if_fail(window_with_focus
!= NULL
);
790 if (window_with_focus
->collection
->number_selected
== 0)
791 collection_target(window_with_focus
->collection
,
792 target_callback
, chmod_items
);
794 action_chmod(window_with_focus
);
797 static void find(gpointer data
, guint action
, GtkWidget
*widget
)
799 g_return_if_fail(window_with_focus
!= NULL
);
801 if (window_with_focus
->collection
->number_selected
== 0)
802 collection_target(window_with_focus
->collection
,
803 target_callback
, find
);
805 action_find(window_with_focus
);
808 /* This pops up our savebox widget, cancelling any currently open one,
809 * and allows the user to pick a new path for it.
810 * Once the new path has been picked, the callback will be called with
811 * both the current and new paths.
813 static void savebox_show(guchar
*title
, guchar
*path
, MaskedPixmap
*image
,
814 gboolean (*callback
)(guchar
*current
, guchar
*new))
816 if (GTK_WIDGET_VISIBLE(savebox
))
817 gtk_widget_hide(savebox
);
820 g_free(current_path
);
821 current_path
= g_strdup(path
);
822 current_savebox_callback
= callback
;
824 gtk_window_set_title(GTK_WINDOW(savebox
), title
);
825 gtk_savebox_set_pathname(GTK_SAVEBOX(savebox
), current_path
);
826 gtk_savebox_set_icon(GTK_SAVEBOX(savebox
), image
->pixmap
, image
->mask
);
828 gtk_widget_grab_focus(GTK_SAVEBOX(savebox
)->entry
);
829 gtk_widget_show(savebox
);
832 static gint
save_to_file(GtkSavebox
*savebox
, guchar
*pathname
)
834 g_return_val_if_fail(current_savebox_callback
!= NULL
,
837 return current_savebox_callback(current_path
, pathname
)
838 ? GTK_XDS_SAVED
: GTK_XDS_SAVE_ERROR
;
841 static gboolean
copy_cb(guchar
*current
, guchar
*new)
843 char *new_dir
, *leaf
;
848 report_error(PROJECT
, _("New pathname is not absolute"));
852 if (new[strlen(new) - 1] == '/')
854 new_dir
= g_strdup(new);
861 slash
= strrchr(new, '/');
862 new_dir
= g_strndup(new, slash
- new);
866 local_paths
= g_slist_append(NULL
, current
);
867 action_copy(local_paths
, new_dir
, leaf
);
868 g_slist_free(local_paths
);
875 #define SHOW_SAVEBOX(title, callback) \
879 item = selected_item(collection); \
880 path = make_path(window_with_focus->path, item->leafname)->str; \
881 savebox_show(title, path, item->image, callback); \
884 static void copy_item(gpointer data
, guint action
, GtkWidget
*widget
)
886 Collection
*collection
;
888 g_return_if_fail(window_with_focus
!= NULL
);
890 collection
= window_with_focus
->collection
;
891 if (collection
->number_selected
> 1)
893 report_error(PROJECT
, _("You cannot do this to more than "
894 "one item at a time"));
897 else if (collection
->number_selected
!= 1)
898 collection_target(collection
, target_callback
, copy_item
);
900 SHOW_SAVEBOX(_("Copy"), copy_cb
);
903 static gboolean
rename_cb(guchar
*current
, guchar
*new)
905 if (rename(current
, new))
907 report_error("ROX-Filer: rename()", g_strerror(errno
));
913 static void rename_item(gpointer data
, guint action
, GtkWidget
*widget
)
915 Collection
*collection
;
917 g_return_if_fail(window_with_focus
!= NULL
);
919 collection
= window_with_focus
->collection
;
920 if (collection
->number_selected
> 1)
922 report_error(PROJECT
, _("You cannot do this to more than "
923 "one item at a time"));
926 else if (collection
->number_selected
!= 1)
927 collection_target(collection
, target_callback
, rename_item
);
929 SHOW_SAVEBOX(_("Rename"), rename_cb
);
932 static gboolean
link_cb(guchar
*initial
, guchar
*path
)
934 if (symlink(initial
, path
))
936 report_error("ROX-Filer: symlink()", g_strerror(errno
));
942 static void link_item(gpointer data
, guint action
, GtkWidget
*widget
)
944 Collection
*collection
;
946 g_return_if_fail(window_with_focus
!= NULL
);
948 collection
= window_with_focus
->collection
;
949 if (collection
->number_selected
> 1)
951 report_error(PROJECT
, _("You cannot do this to more than "
952 "one item at a time"));
955 else if (collection
->number_selected
!= 1)
956 collection_target(collection
, target_callback
, link_item
);
958 SHOW_SAVEBOX(_("Symlink"), link_cb
);
961 static void open_file(gpointer data
, guint action
, GtkWidget
*widget
)
963 Collection
*collection
;
965 g_return_if_fail(window_with_focus
!= NULL
);
967 collection
= window_with_focus
->collection
;
968 if (collection
->number_selected
> 1)
970 report_error(PROJECT
, _("You cannot do this to more than "
971 "one item at a time"));
974 else if (collection
->number_selected
!= 1)
975 collection_target(collection
, target_callback
, open_file
);
977 filer_openitem(window_with_focus
,
978 selected_item_number(collection
),
979 OPEN_SAME_WINDOW
| OPEN_SHIFT
);
982 /* Got some data from file(1) - stick it in the window. */
983 static void add_file_output(FileStatus
*fs
,
984 gint source
, GdkInputCondition condition
)
990 got
= read(source
, buffer
, sizeof(buffer
) - 1);
994 gtk_input_remove(fs
->input
);
998 delayed_error(_("ROX-Filer: file(1) says..."),
1010 gtk_label_get(fs
->label
, &str
);
1012 str
= g_strconcat(str
, buffer
, NULL
);
1013 gtk_label_set_text(fs
->label
, str
);
1017 static void file_info_destroyed(GtkWidget
*widget
, FileStatus
*fs
)
1021 gtk_input_remove(fs
->input
);
1028 /* g_free() the result */
1029 guchar
*pretty_type(DirItem
*file
, guchar
*path
)
1031 if (file
->flags
& ITEM_FLAG_SYMLINK
)
1033 char p
[MAXPATHLEN
+ 1];
1035 got
= readlink(path
, p
, MAXPATHLEN
);
1036 if (got
> 0 && got
<= MAXPATHLEN
)
1039 return g_strconcat(_("Symbolic link to "), p
, NULL
);
1042 return g_strdup(_("Symbolic link"));
1045 if (file
->flags
& ITEM_FLAG_EXEC_FILE
)
1046 return g_strdup(_("Executable file"));
1048 if (file
->flags
& ITEM_FLAG_APPDIR
)
1049 return g_strdup(_("ROX application"));
1051 if (file
->flags
& ITEM_FLAG_MOUNT_POINT
)
1054 if ((file
->flags
& ITEM_FLAG_MOUNTED
) &&
1055 (mp
= g_hash_table_lookup(mtab_mounts
, path
)))
1056 return g_strconcat(_("Mount point for "),
1059 return g_strdup(_("Mount point"));
1062 if (file
->mime_type
)
1063 return g_strconcat(file
->mime_type
->media_type
, "/",
1064 file
->mime_type
->subtype
, NULL
);
1066 return g_strdup("-");
1069 #define LABEL(text, row) \
1070 label = gtk_label_new(text); \
1071 gtk_misc_set_alignment(GTK_MISC(label), 1, .5); \
1072 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); \
1073 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, row, row + 1);
1075 #define VALUE(label, row) \
1076 gtk_misc_set_alignment(GTK_MISC(label), 0, .5); \
1077 gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, row, row + 1);
1079 static void show_file_info(gpointer data
, guint action
, GtkWidget
*widget
)
1081 GtkWidget
*window
, *table
, *label
, *button
, *frame
, *value
;
1082 GtkWidget
*file_label
;
1086 char *argv
[] = {"file", "-b", NULL
, NULL
};
1087 Collection
*collection
;
1090 FileStatus
*fs
= NULL
;
1093 g_return_if_fail(window_with_focus
!= NULL
);
1095 collection
= window_with_focus
->collection
;
1096 if (collection
->number_selected
> 1)
1098 report_error(PROJECT
, _("You cannot do this to more than "
1099 "one item at a time"));
1102 else if (collection
->number_selected
!= 1)
1104 collection_target(collection
, target_callback
, show_file_info
);
1107 file
= selected_item(collection
);
1108 path
= make_path(window_with_focus
->path
,
1109 file
->leafname
)->str
;
1110 if (lstat(path
, &info
))
1112 delayed_error(PROJECT
, g_strerror(errno
));
1116 gstring
= g_string_new(NULL
);
1118 window
= gtk_window_new(GTK_WINDOW_DIALOG
);
1119 gtk_window_set_position(GTK_WINDOW(window
), GTK_WIN_POS_MOUSE
);
1120 gtk_container_set_border_width(GTK_CONTAINER(window
), 4);
1121 gtk_window_set_title(GTK_WINDOW(window
), path
);
1123 table
= gtk_table_new(10, 2, FALSE
);
1124 gtk_container_add(GTK_CONTAINER(window
), table
);
1125 gtk_table_set_row_spacings(GTK_TABLE(table
), 8);
1126 gtk_table_set_col_spacings(GTK_TABLE(table
), 4);
1128 value
= gtk_label_new(file
->leafname
);
1129 LABEL(_("Name:"), 0);
1132 g_string_sprintf(gstring
, "%s, %s", user_name(info
.st_uid
),
1133 group_name(info
.st_gid
));
1134 value
= gtk_label_new(gstring
->str
);
1135 LABEL(_("Owner, Group:"), 1);
1138 if (info
.st_size
>= PRETTY_SIZE_LIMIT
)
1140 g_string_sprintf(gstring
, "%s (%ld %s)",
1141 format_size((unsigned long) info
.st_size
),
1142 (unsigned long) info
.st_size
, _("bytes"));
1146 g_string_assign(gstring
,
1147 format_size((unsigned long) info
.st_size
));
1149 value
= gtk_label_new(gstring
->str
);
1150 LABEL(_("Size:"), 2);
1153 value
= gtk_label_new(pretty_time(&info
.st_ctime
));
1154 LABEL(_("Change time:"), 3);
1157 value
= gtk_label_new(pretty_time(&info
.st_mtime
));
1158 LABEL(_("Modify time:"), 4);
1161 value
= gtk_label_new(pretty_time(&info
.st_atime
));
1162 LABEL(_("Access time:"), 5);
1165 value
= gtk_label_new(pretty_permissions(info
.st_mode
));
1166 perm
= applicable(info
.st_uid
, info
.st_gid
);
1167 gtk_label_set_pattern(GTK_LABEL(value
),
1168 perm
== 0 ? "___ " :
1169 perm
== 1 ? " ___ " :
1171 gtk_widget_set_style(value
, fixed_style
);
1172 LABEL(_("Permissions:"), 6);
1175 tmp
= pretty_type(file
, path
);
1176 value
= gtk_label_new(tmp
);
1178 LABEL(_("Type:"), 7);
1181 frame
= gtk_frame_new(_("file(1) says..."));
1182 gtk_table_attach_defaults(GTK_TABLE(table
), frame
, 0, 2, 8, 9);
1183 file_label
= gtk_label_new(_("<nothing yet>"));
1184 gtk_misc_set_padding(GTK_MISC(file_label
), 4, 4);
1185 gtk_label_set_line_wrap(GTK_LABEL(file_label
), TRUE
);
1186 gtk_container_add(GTK_CONTAINER(frame
), file_label
);
1188 button
= gtk_button_new_with_label(_("OK"));
1189 gtk_window_set_focus(GTK_WINDOW(window
), button
);
1190 gtk_table_attach(GTK_TABLE(table
), button
, 0, 2, 10, 11,
1191 GTK_EXPAND
| GTK_FILL
| GTK_SHRINK
, 0, 40, 4);
1192 gtk_signal_connect_object(GTK_OBJECT(button
), "clicked",
1193 gtk_widget_destroy
, GTK_OBJECT(window
));
1195 gtk_widget_show_all(window
);
1198 if (pipe(file_data
))
1200 g_string_sprintf(gstring
, "pipe(): %s", g_strerror(errno
));
1201 g_string_free(gstring
, TRUE
);
1207 g_string_sprintf(gstring
, "fork(): %s",
1209 gtk_label_set_text(GTK_LABEL(file_label
), gstring
->str
);
1210 g_string_free(gstring
, TRUE
);
1211 close(file_data
[0]);
1212 close(file_data
[1]);
1215 /* We are the child */
1216 close(file_data
[0]);
1217 dup2(file_data
[1], STDOUT_FILENO
);
1218 dup2(file_data
[1], STDERR_FILENO
);
1222 argv
[1] = file
->leafname
;
1223 chdir(window_with_focus
->path
);
1225 if (execvp(argv
[0], argv
))
1226 fprintf(stderr
, "execvp() error: %s\n",
1230 /* We are the parent */
1231 close(file_data
[1]);
1232 fs
= g_new(FileStatus
, 1);
1233 fs
->label
= GTK_LABEL(file_label
);
1234 fs
->fd
= file_data
[0];
1236 fs
->input
= gdk_input_add(fs
->fd
, GDK_INPUT_READ
,
1237 (GdkInputFunction
) add_file_output
, fs
);
1238 gtk_signal_connect(GTK_OBJECT(window
), "destroy",
1239 GTK_SIGNAL_FUNC(file_info_destroyed
), fs
);
1240 g_string_free(gstring
, TRUE
);
1245 static void help(gpointer data
, guint action
, GtkWidget
*widget
)
1247 Collection
*collection
;
1250 g_return_if_fail(window_with_focus
!= NULL
);
1252 collection
= window_with_focus
->collection
;
1253 if (collection
->number_selected
> 1)
1255 report_error(PROJECT
, _("You cannot do this to more than "
1256 "one item at a time"));
1259 else if (collection
->number_selected
!= 1)
1261 collection_target(collection
, target_callback
, help
);
1264 item
= selected_item(collection
);
1266 show_item_help(make_path(window_with_focus
->path
, item
->leafname
)->str
,
1270 #define OPEN_VFS(fs) \
1271 static void open_vfs_ ## fs (gpointer data, guint action, GtkWidget *widget) \
1273 Collection *collection; \
1275 g_return_if_fail(window_with_focus != NULL); \
1277 collection = window_with_focus->collection; \
1278 if (collection->number_selected < 1) \
1279 collection_target(collection, target_callback, \
1282 real_vfs_open(#fs); \
1285 static void real_vfs_open(char *fs
)
1290 if (window_with_focus
->collection
->number_selected
!= 1)
1292 report_error(PROJECT
, _("You must select a single file "
1293 "to open as a Virtual File System"));
1297 item
= selected_item(window_with_focus
->collection
);
1299 path
= g_strconcat(window_with_focus
->path
,
1304 filer_change_to(window_with_focus
, path
, NULL
);
1312 static void select_all(gpointer data
, guint action
, GtkWidget
*widget
)
1314 g_return_if_fail(window_with_focus
!= NULL
);
1316 collection_select_all(window_with_focus
->collection
);
1317 window_with_focus
->temp_item_selected
= FALSE
;
1320 static void clear_selection(gpointer data
, guint action
, GtkWidget
*widget
)
1322 g_return_if_fail(window_with_focus
!= NULL
);
1324 collection_clear_selection(window_with_focus
->collection
);
1325 window_with_focus
->temp_item_selected
= FALSE
;
1328 static void show_options(gpointer data
, guint action
, GtkWidget
*widget
)
1333 static gboolean
new_directory_cb(guchar
*initial
, guchar
*path
)
1335 if (mkdir(path
, S_IRWXU
| S_IRWXG
| S_IRWXO
))
1337 report_error("mkdir", g_strerror(errno
));
1341 dir_check_this(path
);
1345 static void new_directory(gpointer data
, guint action
, GtkWidget
*widget
)
1347 g_return_if_fail(window_with_focus
!= NULL
);
1349 savebox_show(_("New Directory"),
1350 make_path(window_with_focus
->path
, _("NewDir"))->str
,
1351 type_to_icon(&special_directory
),
1355 static void xterm_here(gpointer data
, guint action
, GtkWidget
*widget
)
1357 char *argv
[] = {NULL
, NULL
};
1359 argv
[0] = xterm_here_value
;
1361 g_return_if_fail(window_with_focus
!= NULL
);
1363 if (!spawn_full(argv
, window_with_focus
->path
))
1364 report_error(PROJECT
, "Failed to fork() child "
1368 static void open_parent(gpointer data
, guint action
, GtkWidget
*widget
)
1370 g_return_if_fail(window_with_focus
!= NULL
);
1372 filer_open_parent(window_with_focus
);
1375 static void open_parent_same(gpointer data
, guint action
, GtkWidget
*widget
)
1377 g_return_if_fail(window_with_focus
!= NULL
);
1379 change_to_parent(window_with_focus
);
1382 static void new_window(gpointer data
, guint action
, GtkWidget
*widget
)
1384 g_return_if_fail(window_with_focus
!= NULL
);
1386 if (o_unique_filer_windows
)
1387 report_error(PROJECT
, _("You can't open a second view onto "
1388 "this directory because the `Unique Windows' option "
1389 "is turned on in the Options window."));
1391 filer_opendir(window_with_focus
->path
, PANEL_NO
);
1394 static void close_window(gpointer data
, guint action
, GtkWidget
*widget
)
1396 g_return_if_fail(window_with_focus
!= NULL
);
1398 gtk_widget_destroy(window_with_focus
->window
);
1401 static void enter_path(gpointer data
, guint action
, GtkWidget
*widget
)
1403 g_return_if_fail(window_with_focus
!= NULL
);
1405 minibuffer_show(window_with_focus
, MINI_PATH
);
1408 static void shell_command(gpointer data
, guint action
, GtkWidget
*widget
)
1410 g_return_if_fail(window_with_focus
!= NULL
);
1412 minibuffer_show(window_with_focus
, MINI_SHELL
);
1415 static void run_action(gpointer data
, guint action
, GtkWidget
*widget
)
1417 g_return_if_fail(window_with_focus
!= NULL
);
1419 minibuffer_show(window_with_focus
, MINI_RUN_ACTION
);
1422 static void select_if(gpointer data
, guint action
, GtkWidget
*widget
)
1424 g_return_if_fail(window_with_focus
!= NULL
);
1426 minibuffer_show(window_with_focus
, MINI_SELECT_IF
);
1429 void rox_help(gpointer data
, guint action
, GtkWidget
*widget
)
1431 filer_opendir(make_path(getenv("APP_DIR"), "Help")->str
, PANEL_NO
);
1434 static void open_as_dir(gpointer data
, guint action
, GtkWidget
*widget
)
1436 g_return_if_fail(window_with_focus
!= NULL
);
1438 filer_opendir(window_with_focus
->path
, PANEL_NO
);
1441 static void close_panel(gpointer data
, guint action
, GtkWidget
*widget
)
1443 g_return_if_fail(window_with_focus
!= NULL
);
1445 gtk_widget_destroy(window_with_focus
->window
);
1448 /* Return a list of full paths of all the selected items */
1449 static GList
*list_paths(FilerWindow
*filer_window
)
1451 Collection
*collection
= filer_window
->collection
;
1452 GList
*paths
= NULL
;
1455 for (i
= 0; i
< collection
->number_of_items
; i
++)
1457 CollectionItem
*colitem
= &collection
->items
[i
];
1459 if (colitem
->selected
)
1461 DirItem
*item
= (DirItem
*) colitem
->data
;
1463 paths
= g_list_prepend(paths
,
1464 g_strdup(make_path(filer_window
->path
,
1465 item
->leafname
)->str
));
1472 static void free_paths(GList
*paths
)
1479 for (next
= paths
; next
; next
= next
->next
)
1485 static void pin_help(gpointer data
, guint action
, GtkWidget
*widget
)
1489 icon
= pinboard_selected_icon();
1492 pinboard_show_help(icon
);
1494 delayed_error(PROJECT
,
1495 _("You must first select a single pinned icon to get "
1499 static void pin_remove(gpointer data
, guint action
, GtkWidget
*widget
)
1501 pinboard_unpin_selection();
1504 /* Set n items from position 'from' in 'menu' to the 'shaded' state */
1505 static void set_items_shaded(GtkWidget
*menu
, gboolean shaded
, int from
, int n
)
1507 GList
*items
, *item
;
1509 items
= gtk_container_children(GTK_CONTAINER(menu
));
1511 item
= g_list_nth(items
, from
);
1514 gtk_widget_set_sensitive(GTK_BIN(item
->data
)->child
, !shaded
);
1520 static void save_menus(void)
1524 menurc
= choices_find_path_save("menus", PROJECT
, TRUE
);
1526 gtk_item_factory_dump_rc(menurc
, NULL
, TRUE
);