mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
Patch from Gaute Lindkvist <lindkvis@stud.ntnu.no> that adds the script
* src/file-manager/fm-directory-view.c: (add_script_to_script_menus), (add_submenu_to_script_menus), (update_directory_in_scripts_menu): * src/file-manager/nautilus-directory-view-ui.xml: Patch from Gaute Lindkvist <lindkvis@stud.ntnu.no> that adds the script menu to the background right-click menu, not just the one you get when you click on an object.
This commit is contained in:
parent
4b257ed5a8
commit
75a2ddae16
3 changed files with 45 additions and 9 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2002-03-01 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* src/file-manager/fm-directory-view.c:
|
||||
(add_script_to_script_menus), (add_submenu_to_script_menus),
|
||||
(update_directory_in_scripts_menu):
|
||||
* src/file-manager/nautilus-directory-view-ui.xml:
|
||||
Patch from Gaute Lindkvist <lindkvis@stud.ntnu.no> that adds
|
||||
the script menu to the background right-click menu, not just the one
|
||||
you get when you click on an object.
|
||||
|
||||
2002-03-01 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* libnautilus-private/nautilus-link-historical.c:
|
||||
|
|
|
@ -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"
|
||||
|
@ -3638,10 +3640,11 @@ run_script_callback (BonoboUIComponent *component, gpointer callback_data, const
|
|||
|
||||
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;
|
||||
|
@ -3677,6 +3680,15 @@ add_script_to_script_menus (FMDirectoryView *directory_view,
|
|||
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);
|
||||
|
@ -3687,7 +3699,8 @@ static void
|
|||
add_submenu_to_script_menus (FMDirectoryView *directory_view,
|
||||
NautilusFile *file,
|
||||
const char *menu_path,
|
||||
const char *popup_path)
|
||||
const char *popup_path,
|
||||
const char *popup_bg_path)
|
||||
{
|
||||
char *name;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
@ -3697,6 +3710,7 @@ add_submenu_to_script_menus (FMDirectoryView *directory_view,
|
|||
(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);
|
||||
}
|
||||
|
@ -3728,14 +3742,14 @@ directory_belongs_in_scripts_menu (const char *uri)
|
|||
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,
|
||||
|
@ -3743,6 +3757,9 @@ update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *dire
|
|||
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);
|
||||
|
@ -3757,7 +3774,7 @@ update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *dire
|
|||
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);
|
||||
|
@ -3766,7 +3783,7 @@ update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *dire
|
|||
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;
|
||||
}
|
||||
|
@ -3777,6 +3794,7 @@ update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *dire
|
|||
nautilus_file_list_free (file_list);
|
||||
|
||||
g_free (popup_path);
|
||||
g_free (popup_bg_path);
|
||||
g_free (menu_path);
|
||||
|
||||
return any_scripts;
|
||||
|
|
|
@ -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"/>
|
||||
|
|
Loading…
Reference in a new issue