[fractal] room_menu: Use menu model



commit 1f5970fa33f2e2551a4fdf498d98d004dfc4c099
Author: Christopher Davis <brainblasted disroot org>
Date:   Sat Oct 31 17:15:35 2020 -0700

    room_menu: Use menu model
    
    This menu is simple enough that we can use
    a menu model instead of a manual popover menu.
    Since MenuModels are private in GTK4, this is
    the recommended way to create menus.

 fractal-gtk/res/ui/main_window.ui |  2 +-
 fractal-gtk/res/ui/room_menu.ui   | 91 ++++++++-------------------------------
 2 files changed, 19 insertions(+), 74 deletions(-)
---
diff --git a/fractal-gtk/res/ui/main_window.ui b/fractal-gtk/res/ui/main_window.ui
index 4c74f785..6ab5c9e9 100644
--- a/fractal-gtk/res/ui/main_window.ui
+++ b/fractal-gtk/res/ui/main_window.ui
@@ -267,7 +267,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
-                                <property name="popover">room_popover</property>
+                                <property name="menu_model">room_menu</property>
                                 <child>
                                   <object class="GtkImage">
                                     <property name="visible">True</property>
diff --git a/fractal-gtk/res/ui/room_menu.ui b/fractal-gtk/res/ui/room_menu.ui
index 6126d91b..5d629159 100644
--- a/fractal-gtk/res/ui/room_menu.ui
+++ b/fractal-gtk/res/ui/room_menu.ui
@@ -2,77 +2,22 @@
 <!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.20"/>
-  <object class="GtkPopoverMenu" id="room_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_start">6</property>
-        <property name="margin_end">6</property>
-        <property name="margin_top">6</property>
-        <property name="margin_bottom">6</property>
-        <property name="orientation">vertical</property>
-        <child>
-          <object class="GtkModelButton" id="room_menu">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="action_name">app.open-room-settings</property>
-            <property name="text" translatable="yes">Room Details</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkModelButton" id="room_invite">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="action_name">app.room_invite</property>
-            <property name="text" translatable="yes">Invite to This Room</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkSeparator">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="margin_top">3</property>
-            <property name="margin_bottom">3</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkModelButton" id="leave_room_menu">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
-            <property name="action_name">app.leave_room</property>
-            <property name="text" translatable="yes">Leave Room</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">3</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="submenu">main</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-  </object>
+  <menu id="room_menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Room Details</attribute>
+        <attribute name="action">app.open-room-settings</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Invite to This Room</attribute>
+        <attribute name="action">app.room_invite</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Leave Room</attribute>
+        <attribute name="action">app.leave_room</attribute>
+      </item>
+    </section>
+  </menu>
 </interface>


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