[dconf-editor] Make change_dismissed() a function.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Make change_dismissed() a function.
- Date: Thu, 8 Feb 2018 15:25:34 +0000 (UTC)
commit 95966517073ccde1a94433acff225f4641dbda7b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Feb 8 06:52:03 2018 +0100
Make change_dismissed() a function.
editor/key-list-box-row.vala | 14 ++++++++++++--
editor/registry-search.vala | 17 +++--------------
editor/registry-view.vala | 17 +++--------------
3 files changed, 18 insertions(+), 30 deletions(-)
---
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 462f829..dcb8e2b 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -222,8 +222,6 @@ private abstract class KeyListBoxRow : ClickableListBoxRow
}
}
- public signal void change_dismissed ();
-
public ModificationsHandler modifications_handler { protected get; construct; }
construct
@@ -285,6 +283,18 @@ private abstract class KeyListBoxRow : ClickableListBoxRow
}
}
+ protected void change_dismissed ()
+ {
+ ModelButton actionable = new ModelButton ();
+ actionable.visible = false;
+ Variant variant = new Variant.string (abstract_key.full_name);
+ actionable.set_detailed_action_name ("ui.dismiss-change(" + variant.print (false) + ")");
+ ((Container) get_child ()).add (actionable);
+ actionable.clicked ();
+ ((Container) get_child ()).remove (actionable);
+ actionable.destroy ();
+ }
+
public void on_delete_call ()
{
set_key_value ((abstract_key is GSettingsKey), null);
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index ce22757..cfa836c 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -132,27 +132,16 @@ class RegistrySearch : Grid, BrowsableView
else
row = new KeyListBoxRowEditableNoSchema ((DConfKey) setting_object, modifications_handler,
!is_local_result);
- Key key = (Key) setting_object;
KeyListBoxRow key_row = (KeyListBoxRow) row;
key_row.small_keys_list_rows = _small_keys_list_rows;
- ulong change_dismissed_handler = key_row.change_dismissed.connect (() =>
modifications_handler.dismiss_change (key.full_name));
-
- ulong delayed_modifications_changed_handler =
- modifications_handler.delayed_changes_changed.connect (() => key_row.set_delayed_icon
());
+ ulong delayed_modifications_changed_handler =
modifications_handler.delayed_changes_changed.connect (() => key_row.set_delayed_icon ());
key_row.set_delayed_icon ();
-
- row.destroy.connect (() => {
- modifications_handler.disconnect (delayed_modifications_changed_handler);
- key_row.disconnect (change_dismissed_handler);
- });
+ row.destroy.connect (() => modifications_handler.disconnect
(delayed_modifications_changed_handler));
}
ulong button_press_event_handler = row.button_press_event.connect (on_button_pressed);
-
- row.destroy.connect (() => {
- row.disconnect (button_press_event_handler);
- });
+ row.destroy.connect (() => row.disconnect (button_press_event_handler));
/* Wrapper ensures max width for rows */
ListBoxRowWrapper wrapper = new ListBoxRowWrapper ();
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 315565d..c2edb72 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -179,27 +179,16 @@ class RegistryView : Grid, BrowsableView
else
row = new KeyListBoxRowEditableNoSchema ((DConfKey) setting_object, modifications_handler);
- Key key = (Key) setting_object;
KeyListBoxRow key_row = (KeyListBoxRow) row;
key_row.small_keys_list_rows = _small_keys_list_rows;
- ulong change_dismissed_handler = key_row.change_dismissed.connect (() =>
modifications_handler.dismiss_change (key.full_name));
-
- ulong delayed_modifications_changed_handler =
- modifications_handler.delayed_changes_changed.connect (() => key_row.set_delayed_icon
());
+ ulong delayed_modifications_changed_handler =
modifications_handler.delayed_changes_changed.connect (() => key_row.set_delayed_icon ());
key_row.set_delayed_icon ();
-
- row.destroy.connect (() => {
- modifications_handler.disconnect (delayed_modifications_changed_handler);
- key_row.disconnect (change_dismissed_handler);
- });
+ row.destroy.connect (() => modifications_handler.disconnect
(delayed_modifications_changed_handler));
}
ulong button_press_event_handler = row.button_press_event.connect (on_button_pressed);
-
- row.destroy.connect (() => {
- row.disconnect (button_press_event_handler);
- });
+ row.destroy.connect (() => row.disconnect (button_press_event_handler));
/* Wrapper ensures max width for rows */
ListBoxRowWrapper wrapper = new ListBoxRowWrapper ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]