[dconf-editor] Move apply/dismiss-delayed-settings in ui.



commit 4304d1c16b900847745da68fb489f032860ab517
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Jan 16 14:11:51 2018 +0100

    Move apply/dismiss-delayed-settings in ui.

 editor/dconf-window.vala           |   21 ++++++++++++++++-----
 editor/modifications-revealer.ui   |    4 ++--
 editor/modifications-revealer.vala |   31 +------------------------------
 3 files changed, 19 insertions(+), 37 deletions(-)
---
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 62db822..3ee1bd5 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -49,7 +49,6 @@ class DConfWindow : ApplicationWindow
     [GtkChild] private Label notification_label;
 
     private ulong behaviour_changed_handler = 0;
-    private ulong modifications_handler_leave_delay_mode_handler = 0;
 
     public DConfWindow (bool disable_warning, string? schema, string? path, string? key_name)
     {
@@ -58,7 +57,6 @@ class DConfWindow : ApplicationWindow
         modifications_handler = new ModificationsHandler (model);
         revealer.modifications_handler = modifications_handler;
         browser_view.modifications_handler = modifications_handler;
-        modifications_handler_leave_delay_mode_handler = modifications_handler.leave_delay_mode.connect 
(invalidate_popovers);
 
         behaviour_changed_handler = settings.changed ["behaviour"].connect_after (invalidate_popovers);
         settings.bind ("behaviour", modifications_handler, "behaviour", 
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
@@ -317,8 +315,6 @@ class DConfWindow : ApplicationWindow
     {
         ((ConfigurationEditor) get_application ()).clean_copy_notification ();
 
-        modifications_handler.disconnect (modifications_handler_leave_delay_mode_handler);
-
         settings.disconnect (behaviour_changed_handler);
         settings.disconnect (small_keys_list_rows_handler);
         settings.disconnect (small_bookmarks_rows_handler);
@@ -353,7 +349,10 @@ class DConfWindow : ApplicationWindow
 
         { "reset-recursive", reset_recursively, "s" },
         { "reset-visible", reset_visible, "s" },
-        { "enter-delay-mode", enter_delay_mode }
+
+        { "enter-delay-mode", enter_delay_mode },
+        { "apply-delayed-settings", apply_delayed_settings },
+        { "dismiss-delayed-settings", dismiss_delayed_settings }
     };
 
     private void open_folder (SimpleAction action, Variant? path_variant)
@@ -410,6 +409,18 @@ class DConfWindow : ApplicationWindow
         invalidate_popovers ();
     }
 
+    private void apply_delayed_settings ()
+    {
+        modifications_handler.apply_delayed_settings ();
+        invalidate_popovers ();
+    }
+
+    private void dismiss_delayed_settings ()
+    {
+        modifications_handler.dismiss_delayed_settings ();
+        invalidate_popovers ();
+    }
+
     /*\
     * * Directories tree
     \*/
diff --git a/editor/modifications-revealer.ui b/editor/modifications-revealer.ui
index bee5e05..70e403d 100644
--- a/editor/modifications-revealer.ui
+++ b/editor/modifications-revealer.ui
@@ -17,7 +17,7 @@
         <child>
           <object class="GtkButton" id="dismiss-button">
             <property name="visible">True</property>
-            <property name="action-name">mod.dismiss-delayed-settings</property>
+            <property name="action-name">ui.dismiss-delayed-settings</property>
             <style>
               <class name="flat"/>
               <class name="image-button"/>
@@ -49,7 +49,7 @@
             <property name="text" translatable="yes">Apply</property>
             <property name="centered">True</property>
             <property name="iconic">True</property>
-            <property name="action-name">mod.apply-delayed-settings</property>
+            <property name="action-name">ui.apply-delayed-settings</property>
             <style>
               <class name="suggested-action"/>
             </style>
diff --git a/editor/modifications-revealer.vala b/editor/modifications-revealer.vala
index b902297..7ae5824 100644
--- a/editor/modifications-revealer.vala
+++ b/editor/modifications-revealer.vala
@@ -27,9 +27,7 @@ class ModificationsRevealer : Revealer
         set
         {
             _modifications_handler = value;
-            _modifications_handler.delayed_changes_changed.connect (() => {
-                    update ();
-                });
+            _modifications_handler.delayed_changes_changed.connect (update);
         }
     }
 
@@ -61,33 +59,6 @@ class ModificationsRevealer : Revealer
     }
 
     /*\
-    * * Action entries
-    \*/
-
-    construct
-    {
-        SimpleActionGroup action_group = new SimpleActionGroup ();
-        action_group.add_action_entries (action_entries, this);
-        insert_action_group ("mod", action_group);
-    }
-
-    private const GLib.ActionEntry [] action_entries =
-    {
-        { "apply-delayed-settings", apply_delayed_settings },
-        { "dismiss-delayed-settings", dismiss_delayed_settings }
-    };
-
-    private void apply_delayed_settings ()
-    {
-        modifications_handler.apply_delayed_settings ();
-    }
-
-    private void dismiss_delayed_settings ()
-    {
-        modifications_handler.dismiss_delayed_settings ();
-    }
-
-    /*\
     * * Reseting objects
     \*/
 


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