[sound-juicer: 2/4] main: Migrate app menu to popover menu in main window




commit 946430d2226db34fccf416393ad0d888405eaa80
Author: David Meikle <david meikle io>
Date:   Sun Aug 30 07:29:07 2020 +0100

    main: Migrate app menu to popover menu in main window
    
    Following the retirement of the app menus concept in GNOME,
    sound-juicer's main menu has been inaccessible.
    
    Moved current menu definition into the main interface file and
    added pop-over menu using that definition in the main window.
    
    Removed the old menu file as it is no longer needed following
    the move.

 data/sound-juicer-menu.ui       | 58 ----------------------------
 data/sound-juicer.gresource.xml |  1 -
 data/sound-juicer.ui            | 84 ++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 83 insertions(+), 60 deletions(-)
---
diff --git a/data/sound-juicer.gresource.xml b/data/sound-juicer.gresource.xml
index 5b12cbce..62baf674 100644
--- a/data/sound-juicer.gresource.xml
+++ b/data/sound-juicer.gresource.xml
@@ -3,7 +3,6 @@
   <gresource prefix="/org/gnome/sound-juicer">
     <file preprocess="xml-stripblanks">sj-album-chooser-dialog.ui</file>
     <file preprocess="xml-stripblanks">sound-juicer.ui</file>
-    <file alias="gtk/menus.ui" preprocess="xml-stripblanks">sound-juicer-menu.ui</file>
     <file alias="gtk/help-overlay.ui" preprocess="xml-stripblanks">sound-juicer-shortcuts.ui</file>
  </gresource>
 </gresources>
diff --git a/data/sound-juicer.ui b/data/sound-juicer.ui
index 214772ce..d64a066e 100644
--- a/data/sound-juicer.ui
+++ b/data/sound-juicer.ui
@@ -4,8 +4,34 @@
   <object class="GtkApplicationWindow" id="main_window">
     <property name="width_request">500</property>
     <property name="height_request">420</property>
-    <property name="title" translatable="yes">Sound Juicer</property>
     <signal name="delete_event" handler="on_delete_event"/>
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="headerbar">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="show_close_button">True</property>
+        <property name="title" translatable="yes">Sound Juicer</property>
+        <child>
+          <object class="GtkMenuButton" id="menu_button">
+            <property name="visible">True</property>
+            <property name="direction">none</property>
+            <property name="use-popover">True</property>
+            <property name="menu-model">popover-menu</property>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon_name">open-menu-symbolic</property>
+                <property name="icon_size">1</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
     <child>
       <object class="GtkBox" id="vbox1">
         <property name="visible">True</property>
@@ -800,4 +826,60 @@ audio-volume-medium</property>
       </object>
     </child>
   </object>
+  <menu id="popover-menu">
+    <section>
+      <submenu>
+        <attribute name="label" translatable="yes">Disc</attribute>
+        <section>
+          <item>
+            <attribute name="label" translatable="yes">Re-read</attribute>
+            <attribute name="action">app.re-read</attribute>
+            <attribute name="accel">&lt;Primary&gt;r</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">Duplicate</attribute>
+            <attribute name="action">app.duplicate</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">Eject</attribute>
+            <attribute name="action">app.eject</attribute>
+            <attribute name="accel">&lt;Primary&gt;j</attribute>
+          </item>
+        </section>
+      </submenu>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Open MusicBrainz</attribute>
+        <attribute name="action">app.submit-tracks</attribute>
+        <attribute name="accel">&lt;Primary&gt;s</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Shortcuts</attribute>
+        <attribute name="action">win.show-help-overlay</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Help</attribute>
+        <attribute name="action">app.help</attribute>
+        <attribute name="accel">F1</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">About Sound Juicer</attribute>
+        <attribute name="action">app.about</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Quit</attribute>
+        <attribute name="action">app.quit</attribute>
+        <attribute name="accel">&lt;Primary&gt;q</attribute>
+      </item>
+    </section>
+  </menu>
 </interface>


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