[dconf-editor] Clean callbacks syntax.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Clean callbacks syntax.
- Date: Mon, 1 Aug 2016 13:23:13 +0000 (UTC)
commit 9e863e6b12f95330989eb401a688db40e16c311b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Aug 1 15:23:03 2016 +0200
Clean callbacks syntax.
editor/bookmarks.vala | 14 +++++---------
editor/dconf-model.vala | 2 +-
editor/dconf-view.vala | 14 +++++++-------
editor/key-list-box-row.vala | 18 ++++++++----------
editor/registry-info.vala | 8 ++++----
editor/registry-view.vala | 8 ++++----
6 files changed, 29 insertions(+), 35 deletions(-)
---
diff --git a/editor/bookmarks.vala b/editor/bookmarks.vala
index 42db200..03b5e37 100644
--- a/editor/bookmarks.vala
+++ b/editor/bookmarks.vala
@@ -54,12 +54,8 @@ public class Bookmarks : MenuButton
update_bookmarks ();
bookmarked_switch.grab_focus ();
- destroy.connect (() => {
- settings.disconnect (bookmarks_changed_handler);
- });
- bookmarked_switch.destroy.connect (() => {
- bookmarked_switch.disconnect (switch_active_handler);
- });
+ destroy.connect (() => settings.disconnect (bookmarks_changed_handler));
+ bookmarked_switch.destroy.connect (() => bookmarked_switch.disconnect (switch_active_handler));
}
private void update_icon_and_switch ()
@@ -89,14 +85,14 @@ public class Bookmarks : MenuButton
private void update_bookmarks ()
{
- bookmarks_list_box.@foreach ((widget) => { widget.destroy (); });
+ bookmarks_list_box.@foreach ((widget) => widget.destroy ());
string [] bookmarks = settings.get_strv ("bookmarks");
foreach (string bookmark in bookmarks)
{
Bookmark bookmark_row = new Bookmark (bookmark);
- ulong destroy_button_clicked_handler = bookmark_row.destroy_button.clicked.connect (() => {
remove_bookmark (bookmark); });
- bookmark_row.destroy_button.destroy.connect (() => { bookmark_row.destroy_button.disconnect
(destroy_button_clicked_handler); });
+ ulong destroy_button_clicked_handler = bookmark_row.destroy_button.clicked.connect (() =>
remove_bookmark (bookmark));
+ bookmark_row.destroy_button.destroy.connect (() => bookmark_row.destroy_button.disconnect
(destroy_button_clicked_handler));
bookmark_row.show ();
bookmarks_list_box.add (bookmark_row);
}
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index db0b464..9430bb6 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -430,7 +430,7 @@ public class GSettingsKey : Key
range_content: range_content);
this.settings = settings;
- settings.changed [name].connect (() => { value_changed (); });
+ settings.changed [name].connect (() => value_changed ());
this.type_string = type_string;
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index 925c40c..2e8aa70 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -192,7 +192,7 @@ private class KeyEditorChildBool : Grid, KeyEditorChild // might be managed by a
button_true.active = initial_value;
button_true.bind_property ("active", button_false, "active",
BindingFlags.INVERT_BOOLEAN|BindingFlags.SYNC_CREATE|BindingFlags.BIDIRECTIONAL);
- button_true.toggled.connect (() => { value_has_changed (); });
+ button_true.toggled.connect (() => value_has_changed ());
}
public Variant get_variant ()
@@ -239,8 +239,8 @@ private class KeyEditorChildNumberDouble : SpinButton, KeyEditorChild
this.width_chars = 30;
EntryBuffer ref_buffer = buffer; // an EntryBuffer doesn't emit a "destroy" signal
- deleted_text_handler = ref_buffer.deleted_text.connect (() => { value_has_changed (); }); //
TODO test value for
- inserted_text_handler = ref_buffer.inserted_text.connect (() => { value_has_changed (); }); //
non-numeric chars
+ deleted_text_handler = ref_buffer.deleted_text.connect (() => value_has_changed ()); // TODO
test value for
+ inserted_text_handler = ref_buffer.inserted_text.connect (() => value_has_changed ()); //
non-numeric chars
ulong entry_activate_handler = activate.connect (() => { update (); child_activated (); });
destroy.connect (() => {
@@ -313,8 +313,8 @@ private class KeyEditorChildNumberInt : SpinButton, KeyEditorChild
this.width_chars = 30;
EntryBuffer ref_buffer = buffer; // an EntryBuffer doesn't emit a "destroy" signal
- deleted_text_handler = ref_buffer.deleted_text.connect (() => { value_has_changed (); });
- inserted_text_handler = ref_buffer.inserted_text.connect (() => { value_has_changed (); });
+ deleted_text_handler = ref_buffer.deleted_text.connect (() => value_has_changed ());
+ inserted_text_handler = ref_buffer.inserted_text.connect (() => value_has_changed ());
ulong entry_activate_handler = activate.connect (() => { update (); child_activated (); });
destroy.connect (() => {
@@ -416,8 +416,8 @@ private class KeyEditorChildDefault : Entry, KeyEditorChild
this.text = is_string ? initial_value.get_string () : initial_value.print (false);
EntryBuffer ref_buffer = buffer; // an EntryBuffer doesn't emit a "destroy" signal
- deleted_text_handler = ref_buffer.deleted_text.connect (() => { value_has_changed (test_value ());
});
- inserted_text_handler = ref_buffer.inserted_text.connect (() => { value_has_changed (test_value ());
});
+ deleted_text_handler = ref_buffer.deleted_text.connect (() => value_has_changed (test_value ()));
+ inserted_text_handler = ref_buffer.inserted_text.connect (() => value_has_changed (test_value ()));
ulong entry_activate_handler = activate.connect (() => { if (test_value ()) child_activated (); });
destroy.connect (() => {
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index a1ae346..4aa1d98 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -73,7 +73,7 @@ private abstract class ClickableListBoxRow : EventBox
return;
}
- ((!) nullable_popover).destroy.connect (() => { nullable_popover = null; });
+ ((!) nullable_popover).destroy.connect (() => nullable_popover = null);
((!) nullable_popover).set_relative_to (this);
((!) nullable_popover).position = PositionType.BOTTOM; // TODO better
@@ -106,7 +106,7 @@ private class FolderListBoxRow : ClickableListBoxRow
protected override bool generate_popover (ContextPopover popover, bool unused) // TODO better
{
- popover.new_action ("open", () => { on_row_clicked (); });
+ popover.new_action ("open", () => on_row_clicked ());
popover.new_copy_action (get_text ());
return true;
@@ -145,7 +145,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
update ();
destroy_popover ();
});
- destroy.connect (() => { key.disconnect (key_value_changed_handler); }); // TODO move to
KeyListBoxRow
+ destroy.connect (() => key.disconnect (key_value_changed_handler)); // TODO move to KeyListBoxRow
}
private void update ()
@@ -185,7 +185,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
return true;
}
- popover.new_action ("customize", () => { on_row_clicked (); });
+ popover.new_action ("customize", () => on_row_clicked ());
popover.new_copy_action (get_text ());
if (key.type_string == "b" || key.type_string == "mb")
@@ -255,7 +255,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
update ();
destroy_popover ();
});
- destroy.connect (() => { key.disconnect (key_value_changed_handler); }); // TODO move to
KeyListBoxRow
+ destroy.connect (() => key.disconnect (key_value_changed_handler)); // TODO move to KeyListBoxRow
}
protected override string get_text ()
@@ -265,7 +265,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
protected override bool generate_popover (ContextPopover popover, bool delayed_apply_menu)
{
- popover.new_action ("customize", () => { on_row_clicked (); });
+ popover.new_action ("customize", () => on_row_clicked ());
popover.new_copy_action (get_text ());
if (key.type_string == "b" || key.type_string == "<enum>" || key.type_string == "mb")
@@ -298,9 +298,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
popover.create_flags_list ((GSettingsKey) key);
- popover.value_changed.connect ((gvariant) => {
- set_key_value (gvariant);
- });
+ popover.value_changed.connect ((gvariant) => set_key_value (gvariant));
}
else if (key.planned_change)
{
@@ -374,7 +372,7 @@ private class ContextPopover : Popover
string group_dot_action = @"options.$action_action";
SimpleAction simple_action = new SimpleAction (action_action, null);
- simple_action.activate.connect (() => { action (); });
+ simple_action.activate.connect (() => action ());
current_group.add_action (simple_action);
switch (action_action)
diff --git a/editor/registry-info.vala b/editor/registry-info.vala
index 76831e5..08cede8 100644
--- a/editor/registry-info.vala
+++ b/editor/registry-info.vala
@@ -39,7 +39,7 @@ class RegistryInfo : Grid
disconnect_handler (erase_button, ref erase_button_handler);
disconnect_handler (revealer, ref revealer_reload_1_handler);
disconnect_handler (revealer, ref revealer_reload_2_handler);
- properties_list_box.@foreach ((widget) => { widget.destroy (); });
+ properties_list_box.@foreach ((widget) => widget.destroy ());
}
private void disconnect_handler (Widget widget, ref ulong handler)
@@ -71,7 +71,7 @@ class RegistryInfo : Grid
else
no_schema_warning.set_reveal_child (false);
- properties_list_box.@foreach ((widget) => { widget.destroy (); });
+ properties_list_box.@foreach ((widget) => widget.destroy ());
Variant dict = dict_container [0];
@@ -172,7 +172,7 @@ class RegistryInfo : Grid
custom_value_switch.set_active (gkey.is_default);
SignalHandler.unblock (custom_value_switch, switch_active_handler);
});
- custom_value_switch.destroy.connect (() => { custom_value_switch.disconnect
(switch_active_handler); });
+ custom_value_switch.destroy.connect (() => custom_value_switch.disconnect
(switch_active_handler));
}
else
{
@@ -182,7 +182,7 @@ class RegistryInfo : Grid
});
}
- ulong child_activated_handler = key_editor_child.child_activated.connect (() => {
revealer.apply_delayed_settings (); }); // TODO "only" used for string-based and spin widgets
+ ulong child_activated_handler = key_editor_child.child_activated.connect (() =>
revealer.apply_delayed_settings ()); // TODO "only" used for string-based and spin widgets
revealer_reload_2_handler = revealer.reload.connect (() => {
if (key is DConfKey && ((DConfKey) key).is_ghost)
return;
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 4b5af59..b89d4b3 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -47,7 +47,7 @@ class RegistryView : Grid
ulong revealer_reload_handler = revealer.reload.connect (invalidate_popovers);
EntryBuffer buffer = search_entry.get_buffer ();
- ulong search_entry_buffer_deleted_text_handler = buffer.deleted_text.connect (() => {
search_next_button.set_sensitive (true); });
+ ulong search_entry_buffer_deleted_text_handler = buffer.deleted_text.connect (() =>
search_next_button.set_sensitive (true));
search_bar.connect_entry (search_entry);
bind_property ("show-search-bar", search_bar, "search-mode-enabled", BindingFlags.BIDIRECTIONAL);
// TODO in UI file?
bind_property ("behaviour", revealer, "behaviour",
BindingFlags.BIDIRECTIONAL|BindingFlags.SYNC_CREATE);
@@ -240,10 +240,10 @@ class RegistryView : Grid
Key key = (Key) item;
KeyListBoxRow key_row = ((KeyListBoxRow) row);
ulong set_key_value_handler = key_row.set_key_value.connect ((variant) => { set_key_value (key,
variant); set_delayed_icon (row, key); });
- ulong change_dismissed_handler = key_row.change_dismissed.connect (() => {
revealer.dismiss_change (key); });
+ ulong change_dismissed_handler = key_row.change_dismissed.connect (() => revealer.dismiss_change
(key));
- ulong key_planned_change_handler = key.notify ["planned-change"].connect (() => {
set_delayed_icon (row, key); });
- ulong key_planned_value_handler = key.notify ["planned-value"].connect (() => { set_delayed_icon
(row, key); });
+ ulong key_planned_change_handler = key.notify ["planned-change"].connect (() => set_delayed_icon
(row, key));
+ ulong key_planned_value_handler = key.notify ["planned-value"].connect (() => set_delayed_icon
(row, key));
set_delayed_icon (row, key);
on_row_clicked_handler = row.on_row_clicked.connect (() => {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]