[lightsoff/arnaudb/wip/gtk4: 19/28] Revealer is not subclassable anymore.




commit 1aac5b770e52da2b673bbc9c09def357cc0f0c5c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Nov 28 13:02:42 2020 +0100

    Revealer is not subclassable anymore.

 data/notifications-revealer.ui  | 66 ++++++++++++++++++-----------------------
 src/notifications-revealer.vala |  9 +++---
 2 files changed, 34 insertions(+), 41 deletions(-)
---
diff --git a/data/notifications-revealer.ui b/data/notifications-revealer.ui
index b4ad275..f658fb5 100644
--- a/data/notifications-revealer.ui
+++ b/data/notifications-revealer.ui
@@ -16,48 +16,40 @@
   along with LightsOff.  If not, see <https://www.gnu.org/licenses/>.
 -->
 <interface>
-  <requires lib="gtk+" version="3.12"/>
-  <template class="NotificationsRevealer" parent="GtkRevealer">
-    <property name="halign">center</property>
-    <property name="valign">start</property>
+  <requires lib="gtk+" version="3.99"/>
+  <template class="NotificationsRevealer" parent="GtkWidget">
     <child>
-      <object class="GtkFrame">
-        <property name="visible">True</property>
-        <style>
-          <class name="app-notification"/>
-        </style>
+      <object class="GtkRevealer" id="revealer">
+        <property name="halign">center</property>
+        <property name="valign">start</property>
         <child>
-          <object class="GtkGrid">
-            <property name="visible">True</property>
-            <property name="column-spacing">6</property>
+          <object class="GtkFrame">
+            <style>
+              <class name="app-notification"/>
+            </style>
             <child>
-              <object class="GtkLabel" id="notification_label">
-                <property name="visible">True</property>
-                <property name="hexpand">True</property>
-                <property name="xalign">0</property>
-                <property name="wrap">True</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkSeparator">
-                <property name="visible">True</property>
-              </object>
-            </child>
-            <child>
-              <object class="GtkButton">
-                <property name="visible">True</property>
-                <property name="valign">center</property>
-                <property name="focus-on-click">False</property>
-                <property name="relief">none</property>
-                <property name="action-name">notification.hide</property>
-                <style>
-                  <class name="image-button"/>
-                </style>
+              <object class="GtkGrid">
+                <property name="column-spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="notification_label">
+                    <property name="hexpand">True</property>
+                    <property name="xalign">0</property>
+                    <property name="wrap">True</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkSeparator"/>
+                </child>
                 <child>
-                  <object class="GtkImage">
-                    <property name="visible">True</property>
+                  <object class="GtkButton">
+                    <property name="valign">center</property>
+                    <property name="focus-on-click">False</property>
+                    <property name="action-name">notification.hide</property>
                     <property name="icon-name">window-close-symbolic</property>
-                    <property name="icon-size">1</property>
+                    <style>
+                      <class name="flat"/>
+                      <class name="image-button"/>
+                    </style>
                   </object>
                 </child>
               </object>
diff --git a/src/notifications-revealer.vala b/src/notifications-revealer.vala
index 305eea0..316fb86 100644
--- a/src/notifications-revealer.vala
+++ b/src/notifications-revealer.vala
@@ -18,9 +18,10 @@
 using Gtk;
 
 [GtkTemplate (ui = "/org/gnome/LightsOff/ui/notifications-revealer.ui")]
-private class NotificationsRevealer : Revealer
+private class NotificationsRevealer : Widget
 {
-    [GtkChild] private Label notification_label;
+    [GtkChild] private Revealer revealer;
+    [GtkChild] private Label    notification_label;
 
     construct
     {
@@ -34,7 +35,7 @@ private class NotificationsRevealer : Revealer
     internal void show_notification (string notification)
     {
         notification_label.set_text (notification);
-        set_reveal_child (true);
+        revealer.set_reveal_child (true);
     }
 
     private bool thin_window_size = false;
@@ -76,6 +77,6 @@ private class NotificationsRevealer : Revealer
 
     internal void hide_notification (/* SimpleAction action, Variant? variant */)
     {
-        set_reveal_child (false);
+        revealer.set_reveal_child (false);
     }
 }


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