[nautilus] files-view: Allow opening current location with other apps
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] files-view: Allow opening current location with other apps
- Date: Sat, 12 Feb 2022 17:52:32 +0000 (UTC)
commit f96c14189c280e438d36114b40c8dd8fbb36d815
Author: yash10019coder <yashverma10019 gmail com>
Date: Sat Feb 12 13:48:56 2022 +0530
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
src/nautilus-files-view.c | 28 ++++++++++++++++++++++
.../ui/nautilus-files-view-context-menus.ui | 6 +++++
2 files changed, 34 insertions(+)
---
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
@@ -1486,6 +1486,27 @@ action_open_with_other_application (GSimpleAction *action,
open_with_other_program (NAUTILUS_FILES_VIEW (user_data));
}
+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)
{
@@ -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},
@@ -7727,6 +7749,12 @@ real_update_actions_state (NautilusFilesView *view)
priv->scripts_menu != NULL);
/* 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);
diff --git a/src/resources/ui/nautilus-files-view-context-menus.ui
b/src/resources/ui/nautilus-files-view-context-menus.ui
index 3c529a270..b15970366 100644
--- a/src/resources/ui/nautilus-files-view-context-menus.ui
+++ b/src/resources/ui/nautilus-files-view-context-menus.ui
@@ -15,6 +15,12 @@
<attribute name="label" translatable="yes">Add to _Bookmarks</attribute>
<attribute name="action">win.bookmark-current-location</attribute>
</item>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Open With Other Application</attribute>
+ <attribute name="action">view.open-current-directory-with-other-application</attribute>
+ </item>
+ </section>
<section>
<item>
<attribute name="label" translatable="yes">Create _Link</attribute>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]