[dconf-editor] Remove the GBytes hack.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Remove the GBytes hack.
- Date: Thu, 29 Oct 2015 11:25:31 +0000 (UTC)
commit 3a6522e812d751f5c1cd90b9640ed337e555f83a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Oct 29 12:25:16 2015 +0100
Remove the GBytes hack.
editor/dconf-view.vala | 25 ++++++++++---------------
editor/dconf-window.vala | 14 ++++++--------
2 files changed, 16 insertions(+), 23 deletions(-)
---
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index 45a705f..c8e39f4 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -333,9 +333,9 @@ private class KeyEditorChildEnum : MenuButton, KeyEditorChild
ContextPopover popover = new ContextPopover ();
popover.create_buttons_list (key, false);
popover.set_relative_to (this);
- popover.value_changed.connect ((bytes) => {
- variant = new Variant.from_bytes (key.value.get_type (), (!) bytes, true);
- this.label = variant.get_type () == VariantType.STRING ? variant.get_string () :
variant.print (false);
+ popover.value_changed.connect ((gvariant) => {
+ variant = gvariant;
+ this.label = gvariant.get_type () == VariantType.STRING ? gvariant.get_string () :
gvariant.print (false);
popover.closed ();
});
this.set_popover ((Popover) popover);
@@ -374,9 +374,9 @@ private class KeyEditorChildFlags : Grid, KeyEditorChild
ContextPopover popover = new ContextPopover ();
popover.create_flags_list (key);
popover.set_relative_to (button);
- popover.value_changed.connect ((bytes) => {
- variant = new Variant.from_bytes (VariantType.STRING_ARRAY, (!) bytes, true);
- label.label = variant.print (false);
+ popover.value_changed.connect ((gvariant) => {
+ variant = gvariant;
+ label.label = gvariant.print (false);
});
button.set_popover ((Popover) popover);
}
@@ -409,18 +409,13 @@ private class KeyEditorChildNullableBool : MenuButton, KeyEditorChild
ContextPopover popover = new ContextPopover ();
popover.create_buttons_list (key, false);
popover.set_relative_to (this);
- popover.value_changed.connect ((bytes) => {
- if (bytes == null)
- {
- variant = new Variant.maybe (VariantType.BOOLEAN, null);
+ popover.value_changed.connect ((gvariant) => {
+ variant = gvariant;
+ maybe_variant = gvariant.get_maybe ();
+ if (maybe_variant == null)
this.label = Key.cool_boolean_text_value (null);
- }
else
- {
- variant = new Variant.from_bytes (key.value.get_type (), (!) bytes, true);
- maybe_variant = variant.get_maybe ();
this.label = Key.cool_boolean_text_value (((!) maybe_variant).get_boolean ());
- }
popover.closed ();
});
this.set_popover ((Popover) popover);
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index a0cbd50..e7d221a 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -413,7 +413,7 @@ private class KeyListBoxRowEditableNoSchema : KeyListBoxRow
popover.new_section ();
popover.create_buttons_list (key, false);
- popover.value_changed.connect ((bytes) => { nullable_popover.destroy (); key.value = bytes ==
null ? new Variant.maybe (VariantType.BOOLEAN, null) : new Variant.from_bytes (key.value.get_type (), (!)
bytes, true); });
+ popover.value_changed.connect ((gvariant) => { nullable_popover.destroy (); key.value =
gvariant; });
}
return true;
}
@@ -454,7 +454,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
popover.create_buttons_list (key, true);
popover.set_to_default.connect (() => { nullable_popover.destroy (); key.set_to_default (); });
- popover.value_changed.connect ((bytes) => { nullable_popover.destroy (); key.value = bytes ==
null ? new Variant.maybe (VariantType.BOOLEAN, null) : new Variant.from_bytes (key.value.get_type (), (!)
bytes, true); });
+ popover.value_changed.connect ((gvariant) => { nullable_popover.destroy (); key.value =
gvariant; });
}
else if (key.type_string == "<flags>")
{
@@ -466,7 +466,7 @@ private class KeyListBoxRowEditable : KeyListBoxRow
}
popover.create_flags_list ((GSettingsKey) key);
- popover.value_changed.connect ((bytes) => { key.value = new Variant.from_bytes
(VariantType.STRING_ARRAY, (!) bytes, true); });
+ popover.value_changed.connect ((gvariant) => { key.value = gvariant; });
}
else if (!key.is_default)
{
@@ -496,7 +496,7 @@ private class ContextPopover : Popover
// public signals
public signal void set_to_default ();
- public signal void value_changed (Bytes? bytes);
+ public signal void value_changed (Variant gvariant);
public ContextPopover ()
{
@@ -573,7 +573,7 @@ private class ContextPopover : Popover
if (action.state.get_boolean ())
new_flags += action.name;
Variant variant = new Variant.strv (new_flags);
- value_changed (variant.get_data_as_bytes ());
+ value_changed (variant);
});
}
}
@@ -621,10 +621,8 @@ private class ContextPopover : Popover
Variant? new_variant = tmp_variant.get_maybe ();
if (new_variant == null)
set_to_default ();
- else if (((!) new_variant).get_data () == null) // TODO better
- value_changed (null);
else
- value_changed (((!) new_variant).get_data_as_bytes ());
+ value_changed ((!) new_variant);
});
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]