[nautilus/wip/antoniof/menu-reorganization: 27/29] pathbar: Redesign current location menu




commit 065a0598b20eb7dab4bf12961a88a14952862cf1
Author: António Fernandes <antoniof gnome org>
Date:   Tue Aug 2 20:21:41 2022 +0100

    pathbar: Redesign current location menu
    
    It's been identical to background context menu so far because
    the later was inaccessible in list view if scrolling.
    
    But in the new list view, background context menu is allways
    accessible. so we can deviate now.
    
    Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2355

 src/nautilus-pathbar.c                            | 11 +-----
 src/resources/ui/nautilus-pathbar-context-menu.ui | 48 +++++++++++++++++++++++
 2 files changed, 50 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index f31cae62b..efff5fc9f 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -282,15 +282,8 @@ nautilus_path_bar_init (NautilusPathBar *self)
     gtk_popover_set_has_arrow (GTK_POPOVER (self->button_menu_popover), FALSE);
     gtk_widget_set_halign (self->button_menu_popover, GTK_ALIGN_START);
 
-    /* Add current location menu, which matches the view's background context menu */
-    gtk_builder_add_from_resource (builder,
-                                   "/org/gnome/nautilus/ui/nautilus-files-view-context-menus.ui",
-                                   &error);
-    if (error != NULL)
-    {
-        g_error ("failed to add files-view-context-menus.ui: %s", error->message);
-    }
-    self->current_view_menu = g_object_ref_sink (G_MENU (gtk_builder_get_object (builder, 
"background-menu")));
+    /* Add current location menu, which shares features with the view's background context menu */
+    self->current_view_menu = g_object_ref_sink (G_MENU (gtk_builder_get_object (builder, 
"current-view-menu")));
     self->extensions_section = g_object_ref (G_MENU (gtk_builder_get_object (builder, 
"background-extensions-section")));
     self->templates_submenu = g_object_ref (G_MENU (gtk_builder_get_object (builder, "templates-submenu")));
     self->current_view_menu_popover = g_object_ref_sink (GTK_POPOVER_MENU (gtk_popover_menu_new_from_model 
(NULL)));
diff --git a/src/resources/ui/nautilus-pathbar-context-menu.ui 
b/src/resources/ui/nautilus-pathbar-context-menu.ui
index 5abbcce61..fea4f2cf9 100644
--- a/src/resources/ui/nautilus-pathbar-context-menu.ui
+++ b/src/resources/ui/nautilus-pathbar-context-menu.ui
@@ -15,4 +15,52 @@
       <attribute name="action">pathbar.properties</attribute>
     </item>
   </menu>
+  <menu id="current-view-menu">
+    <item>
+      <attribute name="label" translatable="yes">New _Folder…</attribute>
+      <attribute name="action">view.new-folder</attribute>
+    </item>
+    <item>
+      <attribute name="label" translatable="yes">New _Document</attribute>
+      <attribute name="nautilus-menu-item">templates-submenu</attribute>
+      <link name="submenu" id="templates-submenu"/>
+    </item>
+    <item>
+      <attribute name="label" translatable="yes">Open _With…</attribute>
+      <attribute name="action">view.open-current-directory-with-other-application</attribute>
+    </item>
+    <item>
+      <attribute name="label" translatable="yes">Open in Consol_e</attribute>
+      <attribute name="action">view.current-directory-console</attribute>
+      <attribute name="hidden-when">action-disabled</attribute>
+    </item>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">R_eload</attribute>
+        <attribute name="action">win.reload</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">St_op</attribute>
+        <attribute name="action">win.stop</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Add to _Bookmarks</attribute>
+        <attribute name="action">win.bookmark-current-location</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Copy Location</attribute>
+        <attribute name="action">view.copy-current-location</attribute>
+      </item>
+    </section>
+    <section id="background-extensions-section"/>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">P_roperties</attribute>
+        <attribute name="action">view.current-directory-properties</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+    </section>
+  </menu>
 </interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]