[pitivi/1.0] menu: Use GtkPopoverMenu instead of GtkMenu for primary menu



commit 5c1d0e9fe3f034d6682974063b74efb2f9755c88
Author: Christopher Davis <brainblasted disroot org>
Date:   Thu Dec 6 16:16:04 2018 -0500

    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.

 data/ui/mainmenubutton.ui | 262 +++++++++++++++++++++++-----------------------
 pitivi/mainwindow.py      |   2 +-
 2 files changed, 133 insertions(+), 131 deletions(-)
---
diff --git a/data/ui/mainmenubutton.ui b/data/ui/mainmenubutton.ui
index c42905ef..60366236 100644
--- a/data/ui/mainmenubutton.ui
+++ b/data/ui/mainmenubutton.ui
@@ -1,145 +1,147 @@
 <?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_new">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="action_name">win.new-project</property>
-        <property name="label" translatable="yes">New project</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="menu_open">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="action_name">win.open-project</property>
-        <property name="label" translatable="yes">Open project...</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkSeparatorMenuItem" id="menu_sep1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-      </object>
-    </child>
-    <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">win.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">
+      <object class="GtkBox" id="menu_box">
         <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">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">About</property>
-        <property name="use_underline">True</property>
-        <signal name="activate" handler="_aboutCb" swapped="no"/>
-      </object>
+        <property name="margin">6</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkModelButton" id="menu_new">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="action_name">win.new-project</property>
+            <property name="text" translatable="yes">New project</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton" id="menu_open">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="action_name">win.open-project</property>
+            <property name="text" translatable="yes">Open project...</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator" id="menu_sep1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+        </child>
+        <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">win.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="text" translatable="yes">About Pitivi</property>
+            <signal name="activate" handler="_aboutCb" swapped="no"/>
+          </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>
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 80a19cab..51b762ff 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -408,7 +408,7 @@ class MainWindow(Gtk.ApplicationWindow, Loggable):
         self._menubutton = 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
 
         self._headerbar.pack_end(self._menubutton)


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