mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-13 04:51:15 +00:00
pathbar: Build menu using Glade
So we allow easy tweaking.
This commit is contained in:
parent
fbe7cac0a0
commit
ee7bd9bd15
|
@ -103,10 +103,6 @@ typedef struct
|
|||
unsigned int drag_slider_timeout;
|
||||
gboolean drag_slider_timeout_for_up_button;
|
||||
|
||||
GActionGroup *action_group;
|
||||
|
||||
GMenu *context_menu;
|
||||
|
||||
GtkPopover *current_view_menu;
|
||||
} NautilusPathBarPrivate;
|
||||
|
||||
|
@ -232,17 +228,12 @@ nautilus_path_bar_init (NautilusPathBar *self)
|
|||
{
|
||||
NautilusPathBarPrivate *priv;
|
||||
GtkBuilder *builder;
|
||||
GMenu *menu;
|
||||
GMenu *section_1;
|
||||
GMenu *section_2;
|
||||
GMenu *section_3;
|
||||
GMenu *section_4;
|
||||
|
||||
priv = nautilus_path_bar_get_instance_private (self);
|
||||
|
||||
/* Context menu */
|
||||
builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-pathbar-context-menu.ui");
|
||||
priv->context_menu = g_object_ref (G_MENU (gtk_builder_get_object (builder, "pathbar-menu")));
|
||||
priv->current_view_menu = g_object_ref (GTK_POPOVER (gtk_builder_get_object (builder, "menu_popover"))),
|
||||
g_object_unref (builder);
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
|
||||
|
@ -291,26 +282,6 @@ nautilus_path_bar_init (NautilusPathBar *self)
|
|||
GTK_STYLE_CLASS_LINKED);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
|
||||
"path-bar");
|
||||
|
||||
menu = g_menu_new ();
|
||||
section_1 = g_menu_new ();
|
||||
section_2 = g_menu_new ();
|
||||
section_3 = g_menu_new ();
|
||||
section_4 = g_menu_new ();
|
||||
g_menu_insert (section_1, 0, _("New Folder…"), "view.new-folder");
|
||||
g_menu_insert (section_2, 0, _("Add to Bookmarks"), "view.bookmark");
|
||||
g_menu_insert (section_2, 1, _("Star"), "view.star");
|
||||
g_menu_insert (section_3, 0, _("Paste"), "view.paste");
|
||||
g_menu_insert (section_3, 1, _("Select All"), "view.select-all");
|
||||
g_menu_insert (section_4, 0, _("Properties"), "view.properties");
|
||||
|
||||
g_menu_insert_section (menu, 0, NULL, G_MENU_MODEL (section_1));
|
||||
g_menu_insert_section (menu, 1, NULL, G_MENU_MODEL (section_2));
|
||||
g_menu_insert_section (menu, 2, NULL, G_MENU_MODEL (section_3));
|
||||
g_menu_insert_section (menu, 3, NULL, G_MENU_MODEL (section_4));
|
||||
|
||||
priv->current_view_menu = GTK_POPOVER (gtk_popover_new_from_model (GTK_WIDGET (self),
|
||||
G_MENU_MODEL (menu)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1,23 +1,128 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<menu id="pathbar-menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Open In New _Tab</attribute>
|
||||
<attribute name="action">pathbar.open-item-new-tab</attribute>
|
||||
<attribute name="hidden-when">action-disabled</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Open In New _Window</attribute>
|
||||
<attribute name="action">pathbar.open-item-new-window</attribute>
|
||||
<attribute name="hidden-when">action-disabled</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">P_roperties</attribute>
|
||||
<attribute name="action">pathbar.properties</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkPopoverMenu" id="menu_popover">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">10</property>
|
||||
<property name="margin_right">10</property>
|
||||
<property name="margin_top">10</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="action_name">view.new-folder</property>
|
||||
<property name="text" translatable="yes">New Folder…</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="action_name">view.bookmark</property>
|
||||
<property name="text" translatable="yes">Add to Bookmarks</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="action_name">view.star</property>
|
||||
<property name="text" translatable="yes">Star</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="action_name">view.paste</property>
|
||||
<property name="text" translatable="yes">Paste</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="action_name">view.select-all</property>
|
||||
<property name="text" translatable="yes">Select All</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="action_name">view.properties</property>
|
||||
<property name="text" translatable="yes">Properties</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="submenu">main</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
Loading…
Reference in a new issue