[dconf-editor] Make ModsHandler a property of ClicakbleListBoxRow
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Make ModsHandler a property of ClicakbleListBoxRow
- Date: Sun, 17 Dec 2017 01:46:05 +0000 (UTC)
commit 617a965eb33bcddf64cfade46064e39c147b7271
Author: Davi da Silva Böger <dsboger gmail com>
Date: Tue Dec 12 18:46:27 2017 -0200
Make ModsHandler a property of ClicakbleListBoxRow
editor/key-list-box-row.vala | 24 +++++++++++++-----------
editor/registry-search.vala | 12 ++++++------
editor/registry-view.vala | 12 ++++++------
3 files changed, 25 insertions(+), 23 deletions(-)
---
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index c2f7d1d..ee6691b 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -87,6 +87,8 @@ private abstract class ClickableListBoxRow : EventBox
public bool search_result_mode { protected get; construct; default=false; }
+ public ModificationsHandler modifications_handler { protected get; construct; }
+
/*\
* * Dismiss popover on window resize
\*/
@@ -111,7 +113,7 @@ private abstract class ClickableListBoxRow : EventBox
\*/
private ContextPopover? nullable_popover = null;
- protected virtual bool generate_popover (ContextPopover popover, ModificationsHandler
modifications_handler) { return false; } // no popover should be created
+ protected virtual bool generate_popover (ContextPopover popover) { return false; } // no popover
should be created
public void destroy_popover ()
{
@@ -130,12 +132,12 @@ private abstract class ClickableListBoxRow : EventBox
return (nullable_popover != null) && (((!) nullable_popover).visible);
}
- public void show_right_click_popover (ModificationsHandler modifications_handler, int event_x = (int)
(get_allocated_width () / 2.0))
+ public void show_right_click_popover (int event_x = (int) (get_allocated_width () / 2.0))
{
if (nullable_popover == null)
{
nullable_popover = new ContextPopover ();
- if (!generate_popover ((!) nullable_popover, modifications_handler))
+ if (!generate_popover ((!) nullable_popover))
{
((!) nullable_popover).destroy (); // TODO better, again
nullable_popover = null;
@@ -178,7 +180,7 @@ private class FolderListBoxRow : ClickableListBoxRow
return full_name;
}
- protected override bool generate_popover (ContextPopover popover, ModificationsHandler
modifications_handler) // TODO better
+ protected override bool generate_popover (ContextPopover popover) // TODO better
{
if (search_result_mode)
{
@@ -263,7 +265,7 @@ private abstract class KeyListBoxRow : ClickableListBoxRow
((!) boolean_switch).set_active (!((!) boolean_switch).get_active ());
}
- public void set_delayed_icon (ModificationsHandler modifications_handler)
+ public void set_delayed_icon ()
{
Key key = abstract_key;
StyleContext context = get_style_context ();
@@ -305,9 +307,9 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
key_info_label.set_label (_("No Schema Found"));
}
- public KeyListBoxRowEditableNoSchema (DConfKey _key, bool search_result_mode = false)
+ public KeyListBoxRowEditableNoSchema (DConfKey _key, ModificationsHandler modifications_handler, bool
search_result_mode=false)
{
- Object (key: _key, search_result_mode: search_result_mode);
+ Object (key: _key, modifications_handler: modifications_handler, search_result_mode :
search_result_mode);
}
protected override void update ()
@@ -338,7 +340,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
return key.get_copy_text ();
}
- protected override bool generate_popover (ContextPopover popover, ModificationsHandler
modifications_handler)
+ protected override bool generate_popover (ContextPopover popover)
{
if (key.is_ghost)
{
@@ -434,9 +436,9 @@ private class KeyListBoxRowEditable : KeyListBoxRow
}
}
- public KeyListBoxRowEditable (GSettingsKey _key, bool search_result_mode = false)
+ public KeyListBoxRowEditable (GSettingsKey _key, ModificationsHandler modifications_handler, bool
search_result_mode=false)
{
- Object (key: _key, search_result_mode: search_result_mode);
+ Object (key: _key, modifications_handler: modifications_handler, search_result_mode :
search_result_mode);
}
protected override void update ()
@@ -471,7 +473,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
return key.get_copy_text ();
}
- protected override bool generate_popover (ContextPopover popover, ModificationsHandler
modifications_handler)
+ protected override bool generate_popover (ContextPopover popover)
{
if (search_result_mode)
{
diff --git a/editor/registry-search.vala b/editor/registry-search.vala
index 67ac599..5754168 100644
--- a/editor/registry-search.vala
+++ b/editor/registry-search.vala
@@ -152,9 +152,9 @@ class RegistrySearch : Grid, PathElement, BrowsableView
else
{
if (setting_object is GSettingsKey)
- row = new KeyListBoxRowEditable ((GSettingsKey) setting_object, !is_local_result);
+ row = new KeyListBoxRowEditable ((GSettingsKey) setting_object, modifications_handler,
!is_local_result);
else
- row = new KeyListBoxRowEditableNoSchema ((DConfKey) setting_object, !is_local_result);
+ row = new KeyListBoxRowEditableNoSchema ((DConfKey) setting_object, modifications_handler,
!is_local_result);
Key key = (Key) setting_object;
KeyListBoxRow key_row = (KeyListBoxRow) row;
@@ -165,8 +165,8 @@ class RegistrySearch : Grid, PathElement, BrowsableView
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);
+ 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);
@@ -217,7 +217,7 @@ class RegistrySearch : Grid, PathElement, BrowsableView
event_x += widget_x;
}
- row.show_right_click_popover (modifications_handler, event_x);
+ row.show_right_click_popover (event_x);
if (row.on_popover_disappear_handler == 0)
row.on_popover_disappear_handler = row.on_popover_disappear.connect
(window.select_search_entry);
rows_possibly_with_popover.append (row);
@@ -315,7 +315,7 @@ class RegistrySearch : Grid, PathElement, BrowsableView
return false;
ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
- row.show_right_click_popover (modifications_handler);
+ row.show_right_click_popover ();
if (row.on_popover_disappear_handler == 0)
row.on_popover_disappear_handler = row.on_popover_disappear.connect (window.select_search_entry);
rows_possibly_with_popover.append (row);
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 04b4883..dc95ddd 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -150,9 +150,9 @@ class RegistryView : Grid, PathElement, BrowsableView
else
{
if (setting_object is GSettingsKey)
- row = new KeyListBoxRowEditable ((GSettingsKey) setting_object);
+ row = new KeyListBoxRowEditable ((GSettingsKey) setting_object, modifications_handler);
else
- row = new KeyListBoxRowEditableNoSchema ((DConfKey) setting_object);
+ row = new KeyListBoxRowEditableNoSchema ((DConfKey) setting_object, modifications_handler);
Key key = (Key) setting_object;
KeyListBoxRow key_row = (KeyListBoxRow) row;
@@ -163,8 +163,8 @@ class RegistryView : Grid, PathElement, BrowsableView
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);
+ 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);
@@ -211,7 +211,7 @@ class RegistryView : Grid, PathElement, BrowsableView
event_x += widget_x;
}
- row.show_right_click_popover (modifications_handler, event_x);
+ row.show_right_click_popover (event_x);
rows_possibly_with_popover.append (row);
}
@@ -294,7 +294,7 @@ class RegistryView : Grid, PathElement, BrowsableView
return false;
ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
- row.show_right_click_popover (modifications_handler);
+ row.show_right_click_popover ();
rows_possibly_with_popover.append (row);
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]