[dconf-editor] Move hide_notification in NotificationsRevealer.



commit 1422521ca5a2dd3952c59ac57dd3d034e1a7c2ca
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Nov 30 05:34:16 2018 +0100

    Move hide_notification in NotificationsRevealer.

 editor/dconf-window.vala           |  6 ------
 editor/notifications-revealer.ui   |  2 +-
 editor/notifications-revealer.vala | 35 ++++++++++++++++++++++++++++++-----
 3 files changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 7b9923a..8bce241 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -496,7 +496,6 @@ private class DConfWindow : AdaptativeWindow, AdaptativeWidget
         { "dismiss-change", dismiss_change, "s" },  // here because needs to be accessed from 
DelayedSettingView rows
         { "erase", erase_dconf_key, "s" },          // here because needs a reload_view as we enter 
delay_mode
 
-        { "hide-notification", hide_notification },
         { "about", about_cb }
     };
 
@@ -803,11 +802,6 @@ private class DConfWindow : AdaptativeWindow, AdaptativeWidget
         invalidate_popovers_with_ui_reload ();
     }
 
-    private void hide_notification (/* SimpleAction action, Variant? variant */)
-    {
-        notifications_revealer.hide_notification ();
-    }
-
     private void about_cb ()    // register as "win.about"?
     {
         if (!AdaptativeWidget.WindowSize.is_phone_size (window_size)
diff --git a/editor/notifications-revealer.ui b/editor/notifications-revealer.ui
index 2e6bf26..ef70916 100644
--- a/editor/notifications-revealer.ui
+++ b/editor/notifications-revealer.ui
@@ -25,7 +25,7 @@
                 <property name="visible">True</property>
                 <property name="focus-on-click">False</property>
                 <property name="relief">none</property>
-                <property name="action-name">ui.hide-notification</property>
+                <property name="action-name">notification.hide</property>
                 <style>
                   <class name="image-button"/>
                 </style>
diff --git a/editor/notifications-revealer.vala b/editor/notifications-revealer.vala
index 78b7e79..9b837b9 100644
--- a/editor/notifications-revealer.vala
+++ b/editor/notifications-revealer.vala
@@ -22,15 +22,19 @@ private class NotificationsRevealer : Revealer, AdaptativeWidget
 {
     [GtkChild] private Label notification_label;
 
-    internal void show_notification (string notification)
+    construct
     {
-        notification_label.set_text (notification);
-        set_reveal_child (true);
+        install_action_entries ();
     }
 
-    internal void hide_notification ()
+    /*\
+    * * internal calls
+    \*/
+
+    internal void show_notification (string notification)
     {
-        set_reveal_child (false);
+        notification_label.set_text (notification);
+        set_reveal_child (true);
     }
 
     private bool is_thin = false;
@@ -52,4 +56,25 @@ private class NotificationsRevealer : Revealer, AdaptativeWidget
             halign = Align.CENTER;
         }
     }
+
+    /*\
+    * * action entries
+    \*/
+
+    private void install_action_entries ()
+    {
+        SimpleActionGroup action_group = new SimpleActionGroup ();
+        action_group.add_action_entries (action_entries, this);
+        insert_action_group ("notification", action_group);
+    }
+
+    private const GLib.ActionEntry [] action_entries =
+    {
+        { "hide", hide_notification }
+    };
+
+    private void hide_notification (/* SimpleAction action, Variant? variant */)
+    {
+        set_reveal_child (false);
+    }
 }


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