[lightsoff/arnaudb/wip/gtk4: 17/28] MenuButton is not subclassable anymore.




commit 955f98e1ba9837f9c5ddfa752ae0e7f870581c25
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Nov 27 16:44:18 2020 +0100

    MenuButton is not subclassable anymore.

 data/game-button.ui       | 12 ++++++++----
 src/lightsoff-window.vala |  8 +++++++-
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/data/game-button.ui b/data/game-button.ui
index 02d56a7..1182231 100644
--- a/data/game-button.ui
+++ b/data/game-button.ui
@@ -10,10 +10,14 @@
     </section>
   </menu>
 
-  <requires lib="gtk+" version="3.12"/>
-  <template class="GameButton" parent="GtkMenuButton">
+  <requires lib="gtk+" version="3.99"/>
+  <template class="GameButton" parent="GtkWidget">
     <property name="valign">center</property>
-    <property name="label" translatable="no">0</property>
-    <property name="menu-model">restart-menu</property>
+    <child>
+      <object class="GtkMenuButton" id="menu_button">
+        <property name="label" translatable="no">0</property>
+        <property name="menu-model">restart-menu</property>
+      </object>
+    </child>
   </template>
 </interface>
diff --git a/src/lightsoff-window.vala b/src/lightsoff-window.vala
index d8ce4fb..ecf064f 100644
--- a/src/lightsoff-window.vala
+++ b/src/lightsoff-window.vala
@@ -197,6 +197,12 @@ private class LightsoffWindow : ManagedWindow
 }
 
 [GtkTemplate (ui = "/org/gnome/LightsOff/ui/game-button.ui")]
-private class GameButton : MenuButton
+private class GameButton : Widget
 {
+    private MenuButton menu_button;
+
+    internal void set_label (string new_label)
+    {
+        menu_button.set_label (new_label);
+    }
 }


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