diff options
-rw-r--r-- | src/nautilus-pathbar.c | 33 | ||||
-rw-r--r-- | src/resources/ui/nautilus-pathbar-context-menu.ui | 32 |
2 files changed, 26 insertions, 39 deletions
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c index 5e1fa3021..58242fbb8 100644 --- a/src/nautilus-pathbar.c +++ b/src/nautilus-pathbar.c @@ -209,17 +209,36 @@ static void nautilus_path_bar_init (NautilusPathBar *self) { GtkBuilder *builder; + g_autoptr (GError) error = NULL; - /* Context menu */ - builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-pathbar-context-menu.ui"); - 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, "extensions-section"))); - self->templates_submenu = g_object_ref (G_MENU (gtk_builder_get_object (builder, "templates-submenu"))); + builder = gtk_builder_new(); + + /* Add context menu for pathbar buttons */ + gtk_builder_add_from_resource (builder, + "/org/gnome/nautilus/ui/nautilus-pathbar-context-menu.ui", + &error); + if (error != NULL) + { + g_error ("Failed to add pathbar-context-menu.ui: %s", error->message); + } self->button_menu = g_object_ref_sink (G_MENU (gtk_builder_get_object (builder, "button-menu"))); - self->current_view_menu_popover = g_object_ref_sink (GTK_POPOVER (gtk_popover_new_from_model (NULL, - G_MENU_MODEL (self->current_view_menu)))); self->button_menu_popover = g_object_ref_sink (GTK_POPOVER (gtk_popover_new_from_model (NULL, G_MENU_MODEL (self->button_menu)))); + + /* 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"))); + 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 (gtk_popover_new_from_model (NULL, + G_MENU_MODEL (self->current_view_menu)))); + g_object_unref (builder); gtk_widget_set_has_window (GTK_WIDGET (self), FALSE); diff --git a/src/resources/ui/nautilus-pathbar-context-menu.ui b/src/resources/ui/nautilus-pathbar-context-menu.ui index 2a253ba06..696921e3c 100644 --- a/src/resources/ui/nautilus-pathbar-context-menu.ui +++ b/src/resources/ui/nautilus-pathbar-context-menu.ui @@ -1,38 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Generated with glade 3.22.1 --> <interface> - <menu id="current-view-menu"> - <item> - <attribute name="label" translatable="yes">New _Folder…</attribute> - <attribute name="action">view.new-folder</attribute> - </item> - <submenu id="templates-submenu"> - <attribute name="label" translatable="yes">New _Document</attribute> - <attribute name="action">view.new-document</attribute> - <attribute name="hidden-when">action-disabled</attribute> - </submenu> - <item> - <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">_Paste</attribute> - <attribute name="action">view.paste</attribute> - </item> - <item> - <attribute name="label" translatable="yes">Select _All</attribute> - <attribute name="action">view.select-all</attribute> - </item> - <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> - <section id="extensions-section"> - </section> - </menu> <menu id="button-menu"> <item> <attribute name="label" translatable="yes">Open in New _Window</attribute> |