[Nautilus-list] [PATCH] Add script menu to background-popup
- From: Gaute Lindkvist <lindkvis stud ntnu no>
- To: <nautilus-list lists eazel com>
- Subject: [Nautilus-list] [PATCH] Add script menu to background-popup
- Date: Thu, 28 Feb 2002 20:31:09 +0100 (CET)
Since there are now several scripts that operate on the current working
directory instead of a file in that directory, having to right click on a
directory item to run the script seems counter intuitive.
This patch adds the script menu to the background-popup as well, and makes
calling "Terminal Here" so much easier.
I'm not sure you guys really want this behaviour, so I'll just submit it
and let you decide. I'll probably use it myself, so my small effort
doesn't seem wasted anyway. :)
Gaute Lindkvist
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.507
diff -u -r1.507 fm-directory-view.c
--- src/file-manager/fm-directory-view.c 2002/02/22 18:54:18 1.507
+++ src/file-manager/fm-directory-view.c 2002/02/28 20:14:37
@@ -142,6 +142,8 @@
#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND "/popups/background"
#define FM_DIRECTORY_VIEW_POPUP_PATH_SELECTION "/popups/selection"
+#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS_PLACEHOLDER "/popups/background/Before Zoom Items/Scripts/Scripts Placeholder"
+
#define FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_PLACEHOLDER "/popups/selection/Open Placeholder/Open With/Applications Placeholder"
#define FM_DIRECTORY_VIEW_POPUP_PATH_VIEWERS_PLACEHOLDER "/popups/selection/Open Placeholder/Open With/Viewers Placeholder"
#define FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS_PLACEHOLDER "/popups/selection/Open Placeholder/Scripts/Scripts Placeholder"
@@ -3634,10 +3636,11 @@
static void
add_script_to_script_menus (FMDirectoryView *directory_view,
- NautilusFile *file,
- int index,
- const char *menu_path,
- const char *popup_path)
+ NautilusFile *file,
+ int index,
+ const char *menu_path,
+ const char *popup_path,
+ const char *popup_bg_path)
{
ScriptLaunchParameters *launch_parameters;
char *tip;
@@ -3673,6 +3676,15 @@
run_script_callback,
launch_parameters,
NULL);
+ add_numbered_menu_item (directory_view->details->ui,
+ popup_bg_path,
+ name,
+ tip,
+ index,
+ pixbuf,
+ run_script_callback,
+ launch_parameters,
+ NULL);
g_object_unref (pixbuf);
g_free (name);
@@ -3681,9 +3693,10 @@
static void
add_submenu_to_script_menus (FMDirectoryView *directory_view,
- NautilusFile *file,
- const char *menu_path,
- const char *popup_path)
+ NautilusFile *file,
+ const char *menu_path,
+ const char *popup_path,
+ const char *popup_bg_path)
{
char *name;
GdkPixbuf *pixbuf;
@@ -3693,6 +3706,7 @@
(file, NULL, NAUTILUS_ICON_SIZE_FOR_MENUS);
add_submenu (directory_view->details->ui, menu_path, name, pixbuf);
add_submenu (directory_view->details->ui, popup_path, name, pixbuf);
+ add_submenu (directory_view->details->ui, popup_bg_path, name, pixbuf);
g_object_unref (pixbuf);
g_free (name);
}
@@ -3724,14 +3738,14 @@
static gboolean
update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *directory)
{
- char *menu_path, *popup_path;
+ char *menu_path, *popup_path, *popup_bg_path;
GList *file_list, *filtered, *node;
gboolean any_scripts;
NautilusFile *file;
NautilusDirectory *dir;
char *uri;
int i;
-
+
uri = nautilus_directory_get_uri (directory);
menu_path = g_strconcat (FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS_PLACEHOLDER,
uri + scripts_directory_uri_length,
@@ -3739,6 +3753,9 @@
popup_path = g_strconcat (FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS_PLACEHOLDER,
uri + scripts_directory_uri_length,
NULL);
+ popup_bg_path = g_strconcat (FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS_PLACEHOLDER,
+ uri + scripts_directory_uri_length,
+ NULL);
g_free (uri);
file_list = nautilus_directory_get_file_list (directory);
@@ -3753,7 +3770,7 @@
file = node->data;
if (file_is_launchable (file)) {
- add_script_to_script_menus (view, file, i++, menu_path, popup_path);
+ add_script_to_script_menus (view, file, i++, menu_path, popup_path, popup_bg_path);
any_scripts = TRUE;
} else if (nautilus_file_is_directory (file)) {
uri = nautilus_file_get_uri (file);
@@ -3762,7 +3779,7 @@
add_directory_to_scripts_directory_list (view, dir);
nautilus_directory_unref (dir);
- add_submenu_to_script_menus (view, file, menu_path, popup_path);
+ add_submenu_to_script_menus (view, file, menu_path, popup_path, popup_bg_path);
any_scripts = TRUE;
}
@@ -3773,6 +3790,7 @@
nautilus_file_list_free (file_list);
g_free (popup_path);
+ g_free (popup_bg_path);
g_free (menu_path);
return any_scripts;
Index: src/file-manager/nautilus-directory-view-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/nautilus-directory-view-ui.xml,v
retrieving revision 1.32
diff -u -r1.32 nautilus-directory-view-ui.xml
--- src/file-manager/nautilus-directory-view-ui.xml 2001/05/23 00:03:03 1.32
+++ src/file-manager/nautilus-directory-view-ui.xml 2002/02/28 20:14:37
@@ -184,6 +184,14 @@
<placeholder name="New Items">
<menuitem name="New Folder" verb="New Folder"/>
</placeholder>
+ <submenu name="Scripts"
+ _label="Scripts"
+ _tip="Run or manage scripts from ~/Nautilus/scripts"
+ tearoff="0">
+ <placeholder name="Scripts Placeholder" delimit="none"/>
+ <separator name="After Scripts"/>
+ <menuitem name="Open Scripts Folder" verb="Open Scripts Folder"/>
+ </submenu>
<placeholder name="View Items" delimit="top"/>
<placeholder name="File Clipboard Actions" delimit="top">
<menuitem name="Cut Files" verb="Cut Files"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]