[dconf-editor] Make on_delete_call() a function.



commit c0a1f1207c2068133e54dddc315c02158e87262a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Feb 8 06:23:24 2018 +0100

    Make on_delete_call() a function.

 editor/key-list-box-row.vala      |    7 +++++--
 editor/modifications-handler.vala |   17 -----------------
 editor/registry-search.vala       |    2 --
 editor/registry-view.vala         |    2 --
 4 files changed, 5 insertions(+), 23 deletions(-)
---
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 5c5b8d6..462f829 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -199,8 +199,6 @@ private class FolderListBoxRow : ClickableListBoxRow
 [GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/key-list-box-row.ui")]
 private abstract class KeyListBoxRow : ClickableListBoxRow
 {
-    public signal void on_delete_call ();
-
     [GtkChild] private Grid key_name_and_value_grid;
     [GtkChild] private Label key_name_label;
     [GtkChild] protected Label key_value_label;
@@ -287,6 +285,11 @@ private abstract class KeyListBoxRow : ClickableListBoxRow
         }
     }
 
+    public void on_delete_call ()
+    {
+        set_key_value ((abstract_key is GSettingsKey), null);
+    }
+
     protected void set_key_value (bool has_schema, Variant? new_value)
     {
         ModelButton actionable = new ModelButton ();
diff --git a/editor/modifications-handler.vala b/editor/modifications-handler.vala
index 3c2fb0b..3e8aa13 100644
--- a/editor/modifications-handler.vala
+++ b/editor/modifications-handler.vala
@@ -166,23 +166,6 @@ class ModificationsHandler : Object
         return planned_change ? planned_value == null : model.is_key_default (key);
     }
 
-    public void set_key_value (Key key, Variant? new_value)
-    {
-        if (get_current_delay_mode ())
-            add_delayed_setting (key.full_name, new_value);
-        else if (new_value != null)
-            model.set_key_value (key, (!) new_value);
-        else if (key is GSettingsKey)
-            model.set_key_to_default (((GSettingsKey) key).full_name, ((GSettingsKey) key).schema_id);
-        else if (behaviour != Behaviour.UNSAFE)
-        {
-            mode = ModificationsMode.DELAYED;   // call only once delayed_changes_changed()
-            add_delayed_setting (key.full_name, null);
-        }
-        else
-            model.erase_key (((DConfKey) key).full_name);
-    }
-
     public void set_dconf_key_value (string full_name, Variant key_value)
     {
         model.set_dconf_key_value (full_name, key_value);
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index 172afbc..ce22757 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -136,7 +136,6 @@ class RegistrySearch : Grid, BrowsableView
             KeyListBoxRow key_row = (KeyListBoxRow) row;
             key_row.small_keys_list_rows = _small_keys_list_rows;
 
-            ulong on_delete_call_handler = key_row.on_delete_call.connect (() => 
modifications_handler.set_key_value (key, null));
             ulong change_dismissed_handler = key_row.change_dismissed.connect (() => 
modifications_handler.dismiss_change (key.full_name));
 
             ulong delayed_modifications_changed_handler =
@@ -145,7 +144,6 @@ class RegistrySearch : Grid, BrowsableView
 
             row.destroy.connect (() => {
                     modifications_handler.disconnect (delayed_modifications_changed_handler);
-                    key_row.disconnect (on_delete_call_handler);
                     key_row.disconnect (change_dismissed_handler);
                 });
         }
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index eb7344f..315565d 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -183,7 +183,6 @@ class RegistryView : Grid, BrowsableView
             KeyListBoxRow key_row = (KeyListBoxRow) row;
             key_row.small_keys_list_rows = _small_keys_list_rows;
 
-            ulong on_delete_call_handler = key_row.on_delete_call.connect (() => 
modifications_handler.set_key_value (key, null));
             ulong change_dismissed_handler = key_row.change_dismissed.connect (() => 
modifications_handler.dismiss_change (key.full_name));
 
             ulong delayed_modifications_changed_handler =
@@ -192,7 +191,6 @@ class RegistryView : Grid, BrowsableView
 
             row.destroy.connect (() => {
                     modifications_handler.disconnect (delayed_modifications_changed_handler);
-                    key_row.disconnect (on_delete_call_handler);
                     key_row.disconnect (change_dismissed_handler);
                 });
         }


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