[gnome-maps/wip/cdavis/dark-style-preference: 1/2] main-window: Use manual popover




commit e4d74b1f02994423612923552af169b577da345e
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sat Sep 25 22:32:35 2021 -0700

    main-window: Use manual popover
    
    In GTK3 this is required to use custom widgets in popovers.

 data/ui/main-window.ui | 89 +++++++++++++++++++++++++++++++++++---------------
 1 file changed, 62 insertions(+), 27 deletions(-)
---
diff --git a/data/ui/main-window.ui b/data/ui/main-window.ui
index a21db6aa..99e17a11 100644
--- a/data/ui/main-window.ui
+++ b/data/ui/main-window.ui
@@ -1,32 +1,67 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <menu id="hamburgerMenu">
-    <section>
-      <item>
-        <attribute name="action">app.night-mode</attribute>
-        <attribute name="label" translatable="yes">Night Mode</attribute>
-      </item>
-      <item>
-        <attribute name="action">app.osm-account-setup</attribute>
-        <attribute name="label" translatable="yes">Set up OpenStreetMap Account</attribute>
-      </item>
-      <item>
-        <attribute name="action">win.export-as-image</attribute>
-        <attribute name="label" translatable="yes">Export as Image</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
-        <attribute name="action">win.show-help-overlay</attribute>
-      </item>
-      <item>
-        <attribute name="action">win.about</attribute>
-        <attribute name="label" translatable="yes">About Maps</attribute>
-      </item>
-    </section>
-  </menu>
+  <object class="GtkPopover" id="hamburgerMenuPopover">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Night Mode</property>
+            <property name="action-name">app.night-mode</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Set up OpenStreetMap Account</property>
+            <property name="action-name">app.osm-account-setup</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Export as Image</property>
+            <property name="action-name">win.export-as-image</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="visible">True</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="use-underline">True</property>
+            <property name="label" translatable="yes">_Keyboard Shortcuts</property>
+            <property name="action-name">win.show-help-overlay</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">About Maps</property>
+            <property name="action-name">win.about</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
   <template class="Gjs_MainWindow" parent="GtkApplicationWindow">
     <property name="width-request">300</property>
     <property name="height-request">500</property>
@@ -45,7 +80,7 @@
             <property name="visible">True</property>
             <property name="halign">end</property>
             <property name="valign">center</property>
-            <property name="menu-model">hamburgerMenu</property>
+            <property name="popover">hamburgerMenuPopover</property>
             <accelerator key="F10" signal="clicked"/>
             <child internal-child="accessible">
               <object class="AtkObject">


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