Commit 1c3ff4f0 authored by Christopher Davis's avatar Christopher Davis Committed by Alexandru Băluț

menu: Use GtkPopoverMenu instead of GtkMenu for primary menu

Popovers are recommended for primary menus; In addition, the
migration from the app menu introduced new conventions like
using "About [App]" instead of "About", and grouping
Preferences with About, Help, and Keyboard Shortcuts.
parent 2f2a3bdc
Pipeline #46613 passed with stages
in 76 minutes and 43 seconds
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkMenu" id="menu">
<property name="visible">True</property>
<requires lib="gtk+" version="3.18"/>
<object class="GtkPopoverMenu" id="menu">
<property name="can_focus">False</property>
<property name="halign">end</property>
<child>
<object class="GtkMenuItem" id="menu_save_as">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Save the current project under a new name or a different location</property>
<property name="action_name">editor.save-as</property>
<property name="label" translatable="yes">Save As...</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menu_revert_to_saved">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Reload the current project</property>
<property name="label" translatable="yes">Revert to saved version</property>
<property name="use_underline">True</property>
<signal name="activate" handler="_revertToSavedProjectCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menu_export_tarball">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Export the current project and all its media in a .tar archive</property>
<property name="label" translatable="yes">Export as Archive...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="_exportProjectAsTarCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="menu_sep2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menu_save_frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Export the frame at the current playhead position as an image file.</property>
<property name="label" translatable="yes">Export current frame...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="_screenshotCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="menu_sep3">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menu_project_settings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Edit the project settings</property>
<property name="label" translatable="yes">Project Settings</property>
<property name="use_underline">True</property>
<signal name="activate" handler="_projectSettingsCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menu_preferences">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Preferences</property>
<property name="use_underline">True</property>
<signal name="activate" handler="_prefsCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="menu_sep4">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menu_shortcuts">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">app.shortcuts_window</property>
<property name="label" translatable="yes">Keyboard Shortcuts</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menu_help">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">win.help</property>
<property name="label" translatable="yes">User Manual</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menu_about">
<object class="GtkBox" id="menu_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">win.about</property>
<property name="label" translatable="yes">About</property>
<property name="use_underline">True</property>
<property name="margin">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton" id="menu_save_as">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Save the current project under a new name or a different location</property>
<property name="action_name">editor.save-as</property>
<property name="text" translatable="yes">Save As...</property>
</object>
</child>
<child>
<object class="GtkModelButton" id="menu_revert_to_saved">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Reload the current project</property>
<property name="text" translatable="yes">Revert to saved version</property>
<signal name="activate" handler="_revertToSavedProjectCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkModelButton" id="menu_export_tarball">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Export the current project and all its media in a .tar archive</property>
<property name="text" translatable="yes">Export as Archive...</property>
<signal name="activate" handler="_exportProjectAsTarCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparator" id="menu_sep2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkModelButton" id="menu_save_frame">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Export the frame at the current playhead position as an image file.</property>
<property name="text" translatable="yes">Export current frame...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="_screenshotCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparator" id="menu_sep3">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkModelButton" id="menu_project_settings">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Edit the project settings</property>
<property name="text" translatable="yes">Project Settings</property>
<property name="use_underline">True</property>
<signal name="activate" handler="_projectSettingsCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparator" id="menu_sep4">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkModelButton" id="menu_preferences">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">Preferences</property>
<signal name="activate" handler="_prefsCb" swapped="no"/>
</object>
</child>
<child>
<object class="GtkModelButton" id="menu_shortcuts">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="action_name">app.shortcuts_window</property>
<property name="text" translatable="yes">Keyboard Shortcuts</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkModelButton" id="menu_help">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="action_name">win.help</property>
<property name="text" translatable="yes">User Manual</property>
</object>
</child>
<child>
<object class="GtkModelButton" id="menu_about">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="action_name">win.about</property>
<property name="text" translatable="yes">About Pitivi</property>
</object>
</child>
</object>
<packing>
<property name="submenu">main</property>
<property name="position">1</property>
</packing>
</child>
</object>
<object class="GtkMenuButton" id="menubutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popup">menu</property>
<property name="popover">menu</property>
<child>
<object class="GtkImage" id="open_menu_image">
<property name="visible">True</property>
......
......@@ -319,7 +319,7 @@ class EditorPerspective(Perspective, Loggable):
self.menu_button = self.builder.get_object("menubutton")
self._menubutton_items = {}
for widget in self.builder.get_object("menu").get_children():
for widget in self.builder.get_object("menu_box").get_children():
self._menubutton_items[Gtk.Buildable.get_name(widget)] = widget
headerbar.pack_end(self.menu_button)
......
......@@ -294,7 +294,7 @@ class GreeterPerspective(Perspective):
menu_button = builder.get_object("menubutton")
# Menu options we want to display.
visible_options = ["menu_shortcuts", "menu_help", "menu_about"]
for widget in builder.get_object("menu").get_children():
for widget in builder.get_object("menu_box").get_children():
if Gtk.Buildable.get_name(widget) not in visible_options:
widget.hide()
else:
......
......@@ -179,8 +179,8 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
about_dialog.show()
def __menu_cb(self, unused_action, unused_param):
self.__perspective.menu_button.set_active(
not self.__perspective.menu_button.get_active())
active = not self.__perspective.menu_button.get_active()
self.__perspective.menu_button.set_active(active)
def __configure_cb(self, unused_widget, unused_event):
"""Saves the main window position and size."""
......
......@@ -172,14 +172,15 @@ class Console(GObject.GObject, Peas.Activatable):
def add_menu_item(self):
"""Inserts a menu item into the Pitivi menu."""
menu = self.app.gui.editor.builder.get_object("menu")
self.menu_item = Gtk.MenuItem.new_with_label(_("Developer Console"))
menu = self.app.gui.editor.builder.get_object("menu_box")
self.menu_item = Gtk.ModelButton.new()
self.menu_item.props.text = _("Developer Console")
self.menu_item.connect("activate", self.__menu_item_activate_cb)
menu.add(self.menu_item)
def remove_menu_item(self):
"""Removes a menu item from the Pitivi menu."""
menu = self.app.gui.editor.builder.get_object("menu")
menu = self.app.gui.editor.builder.get_object("menu_box")
menu.remove(self.menu_item)
self.menu_item = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment