[dconf-editor] Move all key.planned_* accesses to mods. handler



commit b1238623020b5171c30d85a5bac6e4281bcaa484
Author: Davi da Silva Böger <dsboger gmail com>
Date:   Tue Dec 5 23:57:27 2017 -0200

    Move all key.planned_* accesses to mods. handler

 editor/dconf-view.vala            |   22 +++++-----
 editor/key-list-box-row.vala      |   75 ++++++++++++++++++++-----------------
 editor/modifications-handler.vala |   20 ++++++++++
 editor/registry-info.vala         |   35 +++++++++--------
 editor/registry-search.vala       |    9 +++-
 editor/registry-view.vala         |    9 +++-
 6 files changed, 104 insertions(+), 66 deletions(-)
---
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index 7063d18..f52cc9e 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -51,7 +51,7 @@ private class KeyEditorChildEnum : MenuButton, KeyEditorChild
     private Variant variant;
     private GLib.Action action;
 
-    public KeyEditorChildEnum (Key key)
+    public KeyEditorChildEnum (Key key, Variant initial_value, ModificationsHandler modifications_handler)
         requires (key.type_string == "<enum>")
     {
         this.visible = true;
@@ -61,7 +61,7 @@ private class KeyEditorChildEnum : MenuButton, KeyEditorChild
         this.width_request = 100;
 
         ContextPopover popover = new ContextPopover ();
-        action = popover.create_buttons_list (key, false, false);
+        action = popover.create_buttons_list (key, false, modifications_handler);
         popover.set_relative_to (this);
 
         popover.value_changed.connect ((gvariant) => {
@@ -72,7 +72,7 @@ private class KeyEditorChildEnum : MenuButton, KeyEditorChild
 
                 value_has_changed ();
             });
-        reload (key.planned_change && (key.planned_value != null) ? (!) key.planned_value : key.value);
+        reload (initial_value);
         this.set_popover ((Popover) popover);
     }
 
@@ -95,7 +95,7 @@ private class KeyEditorChildFlags : Grid, KeyEditorChild
     private Variant variant;
     private Label label = new Label ("");
 
-    public KeyEditorChildFlags (GSettingsKey key)
+    public KeyEditorChildFlags (GSettingsKey key, Variant initial_value, ModificationsHandler 
modifications_handler)
         requires (key.type_string == "<flags>")
     {
         this.visible = true;
@@ -116,7 +116,7 @@ private class KeyEditorChildFlags : Grid, KeyEditorChild
         this.add (label);
 
         ContextPopover popover = new ContextPopover ();
-        popover.create_flags_list (key);
+        popover.create_flags_list (key, modifications_handler);
         popover.set_relative_to (button);
         popover.value_changed.connect ((gvariant) => {
                 if (gvariant == null)   // TODO better (2/3)
@@ -124,7 +124,7 @@ private class KeyEditorChildFlags : Grid, KeyEditorChild
                 reload ((!) gvariant);
                 value_has_changed ();
             });
-        reload (key.planned_change && (key.planned_value != null) ? (!) key.planned_value : key.value);
+        reload (initial_value);
         button.set_popover ((Popover) popover);
     }
 
@@ -146,7 +146,7 @@ private class KeyEditorChildNullableBool : MenuButton, KeyEditorChild
     private Variant? maybe_variant;
     private GLib.Action action;
 
-    public KeyEditorChildNullableBool (Key key)
+    public KeyEditorChildNullableBool (Key key, Variant initial_value, ModificationsHandler 
modifications_handler)
         requires (key.type_string == "mb")
     {
         this.visible = true;
@@ -156,7 +156,7 @@ private class KeyEditorChildNullableBool : MenuButton, KeyEditorChild
         this.width_request = 100;
 
         ContextPopover popover = new ContextPopover ();
-        action = popover.create_buttons_list (key, false, false);
+        action = popover.create_buttons_list (key, false, modifications_handler);
         popover.set_relative_to (this);
 
         popover.value_changed.connect ((gvariant) => {
@@ -167,7 +167,7 @@ private class KeyEditorChildNullableBool : MenuButton, KeyEditorChild
 
                 value_has_changed ();
             });
-        reload (key.planned_change && (key.planned_value != null) ? (!) key.planned_value : key.value);
+        reload (initial_value);
         this.set_popover ((Popover) popover);
     }
 
@@ -329,7 +329,7 @@ private class KeyEditorChildNumberInt : SpinButton, KeyEditorChild
     private ulong deleted_text_handler = 0;
     private ulong inserted_text_handler = 0;
 
-    public KeyEditorChildNumberInt (Key key)
+    public KeyEditorChildNumberInt (Key key, Variant initial_value)
         requires (key.type_string == "y" || key.type_string == "n" || key.type_string == "q" || 
key.type_string == "i" || key.type_string == "u" || key.type_string == "h")     // TODO key.type_string == 
"x" || key.type_string == "t" ||
     {
         this.key_type = key.type_string;
@@ -347,7 +347,7 @@ private class KeyEditorChildNumberInt : SpinButton, KeyEditorChild
         else
             get_min_and_max_double (out min, out max, key.type_string);
 
-        Adjustment adjustment = new Adjustment (get_variant_as_double (key.planned_change && 
(key.planned_value != null) ? (!) key.planned_value : key.value), min, max, 1.0, 5.0, 0.0);
+        Adjustment adjustment = new Adjustment (get_variant_as_double (initial_value), min, max, 1.0, 5.0, 
0.0);
         this.configure (adjustment, 1.0, 0);
 
         this.update_policy = SpinButtonUpdatePolicy.IF_VALID;
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 797b351..d2575a9 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -99,7 +99,7 @@ private abstract class ClickableListBoxRow : EventBox
     \*/
 
     private ContextPopover? nullable_popover = null;
-    protected virtual bool generate_popover (ContextPopover popover, bool delayed_apply_menu) { return 
false; }      // no popover should be created
+    protected virtual bool generate_popover (ContextPopover popover, ModificationsHandler 
modifications_handler) { return false; }      // no popover should be created
 
     public void destroy_popover ()
     {
@@ -113,12 +113,12 @@ private abstract class ClickableListBoxRow : EventBox
             ((!) nullable_popover).popdown ();
     }
 
-    public void show_right_click_popover (bool delayed_apply_menu, int event_x = (int) (get_allocated_width 
() / 2.0))
+    public void show_right_click_popover (ModificationsHandler modifications_handler, int event_x = (int) 
(get_allocated_width () / 2.0))
     {
         if (nullable_popover == null)
         {
             nullable_popover = new ContextPopover ();
-            if (!generate_popover ((!) nullable_popover, delayed_apply_menu))
+            if (!generate_popover ((!) nullable_popover, modifications_handler))
             {
                 ((!) nullable_popover).destroy ();  // TODO better, again
                 nullable_popover = null;
@@ -157,7 +157,7 @@ private class FolderListBoxRow : ClickableListBoxRow
         return full_name;
     }
 
-    protected override bool generate_popover (ContextPopover popover, bool unused)  // TODO better
+    protected override bool generate_popover (ContextPopover popover, ModificationsHandler 
modifications_handler)  // TODO better
     {
         if (search_result_mode)
         {
@@ -230,17 +230,11 @@ private abstract class KeyListBoxRow : ClickableListBoxRow
         update ();
         key_name_label.set_label (search_result_mode ? abstract_key.full_name : abstract_key.name);
 
-        ulong key_planned_change_handler = abstract_key.notify ["planned-change"].connect (() => 
set_delayed_icon ());
-        ulong key_planned_value_handler = abstract_key.notify ["planned-value"].connect (() => 
set_delayed_icon ());
-        set_delayed_icon ();
-
         ulong key_value_changed_handler = abstract_key.value_changed.connect (() => {
                 update ();
                 destroy_popover ();
             });
         destroy.connect (() => {
-                abstract_key.disconnect (key_planned_change_handler);
-                abstract_key.disconnect (key_planned_value_handler);
                 abstract_key.disconnect (key_value_changed_handler);
             });
     }
@@ -254,16 +248,16 @@ private abstract class KeyListBoxRow : ClickableListBoxRow
         ((!) boolean_switch).set_active (!((!) boolean_switch).get_active ());
     }
 
-    private void set_delayed_icon ()
+    public void set_delayed_icon (ModificationsHandler modifications_handler)
     {
         Key key = abstract_key;
         StyleContext context = get_style_context ();
-        if (key.planned_change)
+        if (modifications_handler.key_has_planned_change (key))
         {
             context.add_class ("delayed");
             if (key is DConfKey)
             {
-                if (key.planned_value == null)
+                if (modifications_handler.get_key_planned_value (key) == null)
                     context.add_class ("erase");
                 else
                     context.remove_class ("erase");
@@ -332,7 +326,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
         return key.is_ghost ? _("%s (key erased)").printf (key.full_name) : key.descriptor + " " + 
key.value.print (false);
     }
 
-    protected override bool generate_popover (ContextPopover popover, bool delayed_apply_menu)
+    protected override bool generate_popover (ContextPopover popover, ModificationsHandler 
modifications_handler)
     {
         if (key.is_ghost)
         {
@@ -349,10 +343,11 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
         popover.new_action ("customize", () => on_row_clicked ());
         popover.new_copy_action (get_text ());
 
+
         if (key.type_string == "b" || key.type_string == "mb")
         {
             popover.new_section ();
-            GLib.Action action = popover.create_buttons_list (key, true, delayed_apply_menu);
+            GLib.Action action = popover.create_buttons_list (key, true, modifications_handler);
 
             popover.change_dismissed.connect (() => {
                     destroy_popover ();
@@ -364,6 +359,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
                     set_key_value (gvariant);
                 });
 
+            bool delayed_apply_menu = modifications_handler.get_current_delay_mode ();
             if (!delayed_apply_menu)
             {
                 popover.new_section ();
@@ -375,16 +371,17 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
         }
         else
         {
-            if (key.planned_change)
+            bool planned_change = modifications_handler.key_has_planned_change (key);
+            Variant? planned_value = modifications_handler.get_key_planned_value (key);
+            if (planned_change)
             {
                 popover.new_section ();
-                popover.new_action (key.planned_value == null ? "unerase" : "dismiss", () => {
+                popover.new_action (planned_value == null ? "unerase" : "dismiss", () => {
                         destroy_popover ();
                         change_dismissed ();
                     });
             }
-
-            if (!key.planned_change || key.planned_value != null)
+            else if (planned_value != null)
             {
                 popover.new_section ();
                 popover.new_action ("erase", () => {
@@ -460,7 +457,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
         return key.descriptor + " " + key.value.print (false);
     }
 
-    protected override bool generate_popover (ContextPopover popover, bool delayed_apply_menu)
+    protected override bool generate_popover (ContextPopover popover, ModificationsHandler 
modifications_handler)
     {
         if (search_result_mode)
         {
@@ -468,6 +465,10 @@ private class KeyListBoxRowEditable : KeyListBoxRow
             popover.new_section ();
         }
 
+        bool delayed_apply_menu = modifications_handler.get_current_delay_mode ();
+        bool planned_change = modifications_handler.key_has_planned_change (key);
+        Variant? planned_value = modifications_handler.get_key_planned_value (key);
+
         popover.new_action ("customize", () => on_row_clicked ());
         popover.new_copy_action (get_text ());
 
@@ -484,7 +485,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
                ))
         {
             popover.new_section ();
-            GLib.Action action = popover.create_buttons_list (key, true, delayed_apply_menu);
+            GLib.Action action = popover.create_buttons_list (key, true, modifications_handler);
 
             popover.change_dismissed.connect (() => {
                     destroy_popover ();
@@ -496,7 +497,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
                     set_key_value (gvariant);
                 });
         }
-        else if (!delayed_apply_menu && !key.planned_change && key.type_string == "<flags>")
+        else if (!delayed_apply_menu && !planned_change && key.type_string == "<flags>")
         {
             popover.new_section ();
 
@@ -507,18 +508,18 @@ private class KeyListBoxRowEditable : KeyListBoxRow
                     });
             popover.set_group ("flags");    // ensures a flag called "customize" or "default2" won't cause 
problems
 
-            popover.create_flags_list ((GSettingsKey) key);
+            popover.create_flags_list ((GSettingsKey) key, modifications_handler);
 
             popover.value_changed.connect ((gvariant) => set_key_value (gvariant));
         }
-        else if (key.planned_change)
+        else if (planned_change)
         {
             popover.new_section ();
             popover.new_action ("dismiss", () => {
                     destroy_popover ();
                     change_dismissed ();
                 });
-            if (key.planned_value != null)
+            if (planned_value != null)
                 popover.new_action ("default1", () => {
                         destroy_popover ();
                         set_key_value (null);
@@ -644,7 +645,7 @@ private class ContextPopover : Popover
     * * Flags
     \*/
 
-    public void create_flags_list (GSettingsKey key)
+    public void create_flags_list (GSettingsKey key, ModificationsHandler modifications_handler)
     {
         set_group ("flags");
         string group_dot = "flags.";
@@ -673,12 +674,14 @@ private class ContextPopover : Popover
                     value_changed (variant);
                 });
 
-            key.notify ["planned-value"].connect (() => {
-                    active_flags = key.planned_value != null ? ((!) key.planned_value).get_strv () : 
key.value.get_strv ();
+            ulong delayed_modifications_changed_handler = 
modifications_handler.delayed_changes_changed.connect (() => {
+                    active_flags = modifications_handler.get_key_custom_value (key).get_strv ();
                     bool active = flag in active_flags;
                     if (active != simple_action.get_state ())
                         simple_action.set_state (new Variant.boolean (active));
                 });
+
+            destroy.connect (() => modifications_handler.disconnect (delayed_modifications_changed_handler));
         }
 
         finalize_menu ();
@@ -688,7 +691,7 @@ private class ContextPopover : Popover
     * * Choices
     \*/
 
-    public GLib.Action create_buttons_list (Key key, bool has_default_value, bool delayed_apply_menu)
+    public GLib.Action create_buttons_list (Key key, bool has_default_value, ModificationsHandler 
modifications_handler)
     {
         set_group ("enum");
         const string ACTION_NAME = "choice";
@@ -699,18 +702,22 @@ private class ContextPopover : Popover
         VariantType nullable_nullable_type = new VariantType.maybe (nullable_type);
         string type_string = original_type.dup_string ();
 
+        bool delayed_apply_menu = modifications_handler.get_current_delay_mode ();
+        bool planned_change = modifications_handler.key_has_planned_change (key);
+        Variant? planned_value = modifications_handler.get_key_planned_value (key);
+
         Variant? value_variant;
         if (!has_default_value) // TODO report bug: if using ?: inside ?:, there's a "g_variant_ref: 
assertion 'value->ref_count > 0' failed"
-            value_variant = key.planned_change && (key.planned_value != null) ? key.planned_value : 
key.value;
-        else if (key.planned_change)
-            value_variant = key.planned_value;
+            value_variant = modifications_handler.get_key_custom_value (key);
+        else if (planned_change)
+            value_variant = planned_value;
         else if (key is GSettingsKey && ((GSettingsKey) key).is_default)
             value_variant = null;
         else
             value_variant = key.value;
         Variant variant = new Variant.maybe (original_type, value_variant);
         Variant nullable_variant;
-        if (delayed_apply_menu && !key.planned_change)
+        if (delayed_apply_menu && !planned_change)
             nullable_variant = new Variant.maybe (nullable_type, null);
         else
             nullable_variant = new Variant.maybe (nullable_type, variant);
@@ -720,7 +727,7 @@ private class ContextPopover : Popover
 
         if (has_default_value)
         {
-            bool complete_menu = delayed_apply_menu || key.planned_change;
+            bool complete_menu = delayed_apply_menu || planned_change;
 
             if (complete_menu)
                 /* Translators: "no change" option in the right-click menu on a key when on delayed mode */
diff --git a/editor/modifications-handler.vala b/editor/modifications-handler.vala
index a7bf30c..6a9f18e 100644
--- a/editor/modifications-handler.vala
+++ b/editor/modifications-handler.vala
@@ -189,6 +189,16 @@ class ModificationsHandler : Object
         reload ();
     }
 
+    public Variant get_key_custom_value (Key key)
+    {
+        return key.planned_change && (key.planned_value != null) ? (!) key.planned_value : key.value;
+    }
+
+    public bool key_value_is_default (GSettingsKey key) // doesn't make sense for DConfKey?
+    {
+        return key.planned_change ? key.planned_value == null : key.is_default;
+    }
+
     public void set_key_value (Key key, Variant? new_value)
     {
         if (get_current_delay_mode ())
@@ -206,4 +216,14 @@ class ModificationsHandler : Object
             ((DConfKey) key).erase ();
     }
 
+    public bool key_has_planned_change (Key key)
+    {
+        return key.planned_change;
+    }
+
+    public Variant? get_key_planned_value (Key key)
+    {
+        return key.planned_value;
+    }
+
 }
diff --git a/editor/registry-info.vala b/editor/registry-info.vala
index babb4ba..173ea3f 100644
--- a/editor/registry-info.vala
+++ b/editor/registry-info.vala
@@ -28,7 +28,7 @@ class RegistryInfo : Grid, BrowsableView
     [GtkChild] private ListBox properties_list_box;
     [GtkChild] private Button erase_button;
 
-    public ModificationsHandler modifications_handler { get; set; }
+    public ModificationsHandler modifications_handler { private get; set; }
 
     /*\
     * * Cleaning
@@ -148,7 +148,7 @@ class RegistryInfo : Grid, BrowsableView
             custom_value_switch.bind_property ("active", key_editor_child, "sensitive", 
BindingFlags.SYNC_CREATE | BindingFlags.INVERT_BOOLEAN);
 
             GSettingsKey gkey = (GSettingsKey) key;
-            custom_value_switch.set_active (key.planned_change ? key.planned_value == null : 
gkey.is_default);
+            custom_value_switch.set_active (modifications_handler.key_value_is_default (gkey));
             ulong switch_active_handler = custom_value_switch.notify ["active"].connect (() => {
                     if (modifications_handler.should_delay_apply (tmp_string))
                     {
@@ -156,7 +156,7 @@ class RegistryInfo : Grid, BrowsableView
                             modifications_handler.add_delayed_setting (key, null);
                         else
                         {
-                            Variant tmp_variant = key.planned_change && (key.planned_value != null) ? (!) 
key.planned_value : key.value;
+                            Variant tmp_variant = modifications_handler.get_key_custom_value (key);
                             modifications_handler.add_delayed_setting (key, tmp_variant);
                             key_editor_child.reload (tmp_variant);
                         }
@@ -168,8 +168,8 @@ class RegistryInfo : Grid, BrowsableView
                             ((GSettingsKey) key).set_to_default ();
                             SignalHandler.block (key_editor_child, value_has_changed_handler);
                             key_editor_child.reload (key.value);
-                            if (tmp_string == "<flags>")
-                                key.planned_value = key.value;
+                            //if (tmp_string == "<flags>")                      let's try to live without 
this...
+                            //    key.planned_value = key.value;
                             SignalHandler.unblock (key_editor_child, value_has_changed_handler);
                         }
                         else
@@ -197,8 +197,8 @@ class RegistryInfo : Grid, BrowsableView
                     return;
                 SignalHandler.block (key_editor_child, value_has_changed_handler);
                 key_editor_child.reload (key.value);
-                if (tmp_string == "<flags>")
-                    key.planned_value = key.value;
+                //if (tmp_string == "<flags>")                      let's try to live without this...
+                //    key.planned_value = key.value;
                 SignalHandler.unblock (key_editor_child, value_has_changed_handler);
             });
         add_row_from_widget (_("Custom value"), key_editor_child, tmp_string);
@@ -210,8 +210,9 @@ class RegistryInfo : Grid, BrowsableView
             });
     }
 
-    private static KeyEditorChild create_child (Key key, bool has_schema)
+    private KeyEditorChild create_child (Key key, bool has_schema)
     {
+        Variant initial_value = modifications_handler.get_key_custom_value (key);
         switch (key.type_string)
         {
             case "<enum>":
@@ -219,12 +220,12 @@ class RegistryInfo : Grid, BrowsableView
                 {
                     case 0:  assert_not_reached ();
                     case 1:  return (KeyEditorChild) new KeyEditorChildSingle (key.value, 
key.value.get_string ());
-                    default: return (KeyEditorChild) new KeyEditorChildEnum (key);
+                    default: return (KeyEditorChild) new KeyEditorChildEnum (key, initial_value, 
modifications_handler);
                 }
             case "<flags>":
-                return (KeyEditorChild) new KeyEditorChildFlags ((GSettingsKey) key);
+                return (KeyEditorChild) new KeyEditorChildFlags ((GSettingsKey) key, initial_value, 
modifications_handler);
             case "b":
-                return (KeyEditorChild) new KeyEditorChildBool (key.planned_change && (key.planned_value != 
null) ? ((!) key.planned_value).get_boolean () : key.value.get_boolean ());
+                return (KeyEditorChild) new KeyEditorChildBool (initial_value.get_boolean ());
             case "n":
             case "i":
             case "h":
@@ -235,7 +236,7 @@ class RegistryInfo : Grid, BrowsableView
                     if (Key.get_variant_as_int64 (range.get_child_value (0)) == Key.get_variant_as_int64 
(range.get_child_value (1)))
                         return (KeyEditorChild) new KeyEditorChildSingle (key.value, key.value.print 
(false));
                 }
-                return (KeyEditorChild) new KeyEditorChildNumberInt (key);
+                return (KeyEditorChild) new KeyEditorChildNumberInt (key, initial_value);
             case "y":
             case "q":
             case "u":
@@ -246,16 +247,16 @@ class RegistryInfo : Grid, BrowsableView
                     if (Key.get_variant_as_uint64 (range.get_child_value (0)) == Key.get_variant_as_uint64 
(range.get_child_value (1)))
                         return (KeyEditorChild) new KeyEditorChildSingle (key.value, key.value.print 
(false));
                 }
-                return (KeyEditorChild) new KeyEditorChildNumberInt (key);
+                return (KeyEditorChild) new KeyEditorChildNumberInt (key, initial_value);
             case "d":
-                return (KeyEditorChild) new KeyEditorChildNumberDouble (key.value);
+                return (KeyEditorChild) new KeyEditorChildNumberDouble (initial_value);
             case "mb":
-                return (KeyEditorChild) new KeyEditorChildNullableBool (key);
+                return (KeyEditorChild) new KeyEditorChildNullableBool (key, initial_value, 
modifications_handler);
             default:
                 if ("a" in key.type_string)
-                    return (KeyEditorChild) new KeyEditorChildArray (key.type_string, key.planned_change && 
(key.planned_value != null) ? (!) key.planned_value : key.value);
+                    return (KeyEditorChild) new KeyEditorChildArray (key.type_string, initial_value);
                 else
-                    return (KeyEditorChild) new KeyEditorChildDefault (key.type_string, key.planned_change 
&& (key.planned_value != null) ? (!) key.planned_value : key.value);
+                    return (KeyEditorChild) new KeyEditorChildDefault (key.type_string, initial_value);
         }
     }
 
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index 5264db9..3a4ef19 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -164,7 +164,12 @@ class RegistrySearch : Grid, PathElement, BrowsableView
             ulong set_key_value_handler = key_row.set_key_value.connect ((variant) => { 
modifications_handler.set_key_value (key, variant); });
             ulong change_dismissed_handler = key_row.change_dismissed.connect (() => 
modifications_handler.dismiss_change (key));
 
+            ulong delayed_modifications_changed_handler =
+                    modifications_handler.delayed_changes_changed.connect (() => key_row.set_delayed_icon 
(modifications_handler));
+            key_row.set_delayed_icon (modifications_handler);
+
             row.destroy.connect (() => {
+                    modifications_handler.disconnect (delayed_modifications_changed_handler);
                     key_row.disconnect (set_key_value_handler);
                     key_row.disconnect (change_dismissed_handler);
                 });
@@ -212,7 +217,7 @@ class RegistrySearch : Grid, PathElement, BrowsableView
                 event_x += widget_x;
             }
 
-            row.show_right_click_popover (modifications_handler.get_current_delay_mode (), event_x);
+            row.show_right_click_popover (modifications_handler, event_x);
             rows_possibly_with_popover.append (row);
         }
 
@@ -299,7 +304,7 @@ class RegistrySearch : Grid, PathElement, BrowsableView
             return false;
 
         ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
-        row.show_right_click_popover (modifications_handler.get_current_delay_mode ());
+        row.show_right_click_popover (modifications_handler);
         rows_possibly_with_popover.append (row);
         return true;
     }
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 229803e..4c0bee9 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -157,7 +157,12 @@ class RegistryView : Grid, PathElement, BrowsableView
             ulong set_key_value_handler = key_row.set_key_value.connect ((variant) => { 
modifications_handler.set_key_value (key, variant); });
             ulong change_dismissed_handler = key_row.change_dismissed.connect (() => 
modifications_handler.dismiss_change (key));
 
+            ulong delayed_modifications_changed_handler =
+                    modifications_handler.delayed_changes_changed.connect (() => key_row.set_delayed_icon 
(modifications_handler));
+            key_row.set_delayed_icon (modifications_handler);
+
             row.destroy.connect (() => {
+                    modifications_handler.disconnect (delayed_modifications_changed_handler);
                     key_row.disconnect (set_key_value_handler);
                     key_row.disconnect (change_dismissed_handler);
                 });
@@ -201,7 +206,7 @@ class RegistryView : Grid, PathElement, BrowsableView
                 event_x += widget_x;
             }
 
-            row.show_right_click_popover (modifications_handler.get_current_delay_mode (), event_x);
+            row.show_right_click_popover (modifications_handler, event_x);
             rows_possibly_with_popover.append (row);
         }
 
@@ -280,7 +285,7 @@ class RegistryView : Grid, PathElement, BrowsableView
             return false;
 
         ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
-        row.show_right_click_popover (modifications_handler.get_current_delay_mode ());
+        row.show_right_click_popover (modifications_handler);
         rows_possibly_with_popover.append (row);
         return true;
     }


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