diff options
author | yash10019coder <yashverma10019@gmail.com> | 2022-02-12 13:48:56 +0530 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-02-12 17:45:44 +0000 |
commit | f96c14189c280e438d36114b40c8dd8fbb36d815 (patch) | |
tree | c7e5f898aa2f8144b3e2d126787a88293033cd7e /src/nautilus-files-view.c | |
parent | 1300f7198c13f3bc681306a875b924e9ac92c72c (diff) | |
download | nautilus-f96c14189c280e438d36114b40c8dd8fbb36d815.tar.gz |
files-view: Allow opening current location with other apps
Add a new menu item to the background context menu and the current folder menu in the pathbar.
Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1969
Diffstat (limited to 'src/nautilus-files-view.c')
-rw-r--r-- | src/nautilus-files-view.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index eb07d9f95..046dd5e28 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -1487,6 +1487,27 @@ action_open_with_other_application (GSimpleAction *action, } static void +action_open_current_directory_with_other_application (GSimpleAction *action, + GVariant *state, + gpointer user_data) +{ + NautilusFilesView *view; + NautilusFilesViewPrivate *priv; + GList *files; + + g_return_if_fail (NAUTILUS_IS_FILES_VIEW (user_data)); + + view = NAUTILUS_FILES_VIEW (user_data); + priv = nautilus_files_view_get_instance_private (view); + + if (priv->directory_as_file != NULL) + { + files = g_list_append (NULL, nautilus_file_ref (priv->directory_as_file)); + choose_program (view, files); + } +} + +static void trash_or_delete_selected_files (NautilusFilesView *view) { NautilusFilesViewPrivate *priv; @@ -7018,6 +7039,7 @@ const GActionEntry view_entries[] = { "open-item-location", action_open_item_location }, { "open-with-default-application", action_open_with_default_application }, { "open-with-other-application", action_open_with_other_application }, + { "open-current-directory-with-other-application", action_open_current_directory_with_other_application }, { "open-item-new-window", action_open_item_new_window }, { "open-item-new-tab", action_open_item_new_tab }, { "cut", action_cut}, @@ -7728,6 +7750,12 @@ real_update_actions_state (NautilusFilesView *view) /* Background menu actions */ action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), + "open-current-directory-with-other-application"); + g_simple_action_set_enabled (G_SIMPLE_ACTION (action), + !selection_contains_recent && + !selection_contains_search && + !selection_contains_starred); + action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), "new-folder"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), can_create_files); action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group), |