[dconf-editor] Unduplicate _get_parent.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Unduplicate _get_parent.
- Date: Fri, 19 Aug 2016 19:34:33 +0000 (UTC)
commit e9fccfb8d70570af1740b4d8bfac924343b12c6b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Aug 19 21:33:07 2016 +0200
Unduplicate _get_parent.
editor/dconf-window.vala | 8 ++++++++
editor/registry-info.vala | 9 +--------
editor/registry-view.vala | 9 +--------
3 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index d172744..fbb1449 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -109,6 +109,14 @@ class DConfWindow : ApplicationWindow
return path.slice (0, path.last_index_of_char ('/') + 1);
}
+ public static Widget _get_parent (Widget widget)
+ {
+ Widget? parent = widget.get_parent ();
+ if (parent == null)
+ assert_not_reached ();
+ return (!) parent;
+ }
+
/*\
* * Window management callbacks
\*/
diff --git a/editor/registry-info.vala b/editor/registry-info.vala
index d67939e..d22e0bf 100644
--- a/editor/registry-info.vala
+++ b/editor/registry-info.vala
@@ -92,7 +92,7 @@ class RegistryInfo : Grid
Label label = new Label (get_current_value_text (has_schema && ((GSettingsKey) key).is_default,
key));
ulong key_value_changed_handler = key.value_changed.connect (() => {
if (!has_schema && ((DConfKey) key).is_ghost)
- ((RegistryView) _get_parent (_get_parent (this))).request_path (parent_path);
+ ((RegistryView) DConfWindow._get_parent (DConfWindow._get_parent (this))).request_path
(parent_path);
else
label.set_text (get_current_value_text (has_schema && ((GSettingsKey) key).is_default,
key));
});
@@ -197,13 +197,6 @@ class RegistryInfo : Grid
key_editor_child.disconnect (child_activated_handler);
});
}
- private Widget _get_parent (Widget widget)
- {
- Widget? parent = widget.get_parent ();
- if (parent == null)
- assert_not_reached ();
- return (!) parent;
- }
private static KeyEditorChild create_child (Key key)
{
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index d30123f..792143d 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -251,14 +251,7 @@ class RegistryView : Grid, PathElement
private DConfWindow get_dconf_window ()
{
- return (DConfWindow) _get_parent (_get_parent (this));
- }
- private Widget _get_parent (Widget widget)
- {
- Widget? parent = widget.get_parent ();
- if (parent == null)
- assert_not_reached ();
- return (!) parent;
+ return (DConfWindow) DConfWindow._get_parent (DConfWindow._get_parent (this));
}
/*\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]