[dconf-editor] Correct a popover value update bug.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Correct a popover value update bug.
- Date: Mon, 20 Jun 2016 03:29:10 +0000 (UTC)
commit b3306d49a4070c22dc6ee20c50259fb612b06ca9
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Jun 20 05:28:55 2016 +0200
Correct a popover value update bug.
editor/key-list-box-row.vala | 18 +++++++++++-------
editor/registry-view.vala | 4 ++--
2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index 72050a9..9030f5d 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -418,10 +418,14 @@ private class ContextPopover : Popover
VariantType original_type = key.value.get_type ();
VariantType nullable_type = new VariantType.maybe (original_type);
VariantType nullable_nullable_type = new VariantType.maybe (nullable_type);
- string nullable_nullable_type_string = nullable_nullable_type.dup_string ();
+ string type_string = original_type.dup_string ();
- Variant value_variant = key.planned_change ? key.planned_value : key.value;
- Variant variant = new Variant.maybe (original_type, key.has_schema && ((GSettingsKey)
key).is_default ? null : value_variant);
+ Variant? value_variant;
+ if (key.planned_change) // TODO report bug: if using ?: inside ?:, there's a "g_variant_ref:
assertion 'value->ref_count > 0' failed"
+ value_variant = key.planned_value;
+ else
+ value_variant = key.has_schema && ((GSettingsKey) key).is_default ? null : key.value;
+ Variant variant = new Variant.maybe (original_type, value_variant);
Variant nullable_variant = new Variant.maybe (nullable_type, delayed_apply_menu &&
!key.planned_change ? null : variant);
current_group.add_action (new SimpleAction.stateful (ACTION_NAME, nullable_nullable_type,
nullable_variant));
@@ -431,13 +435,13 @@ private class ContextPopover : Popover
if (complete_menu)
/* Translators: "no change" option in the right-click menu on a key when on delayed mode */
- current_section.append (_("No change"), group_dot_action + "(@" +
nullable_nullable_type_string + " nothing)");
+ current_section.append (_("No change"), group_dot_action + "(@mm" + type_string + "
nothing)");
if (key.has_schema)
- new_multi_default_action (group_dot_action + "(@" + nullable_nullable_type_string + " just
nothing)");
+ new_multi_default_action (group_dot_action + "(@mm" + type_string + " just nothing)");
else if (complete_menu)
/* Translators: "erase key" option in the right-click menu on a key without schema when on
delayed mode */
- current_section.append (_("Erase key"), group_dot_action + "(@" +
nullable_nullable_type_string + " just nothing)");
+ current_section.append (_("Erase key"), group_dot_action + "(@mm" + type_string + " just
nothing)");
}
switch (key.type_string)
@@ -464,7 +468,7 @@ private class ContextPopover : Popover
((GLib.ActionGroup) current_group).action_state_changed [ACTION_NAME].connect ((unknown_string,
tmp_variant) => {
Variant? change_variant = tmp_variant.get_maybe ();
if (change_variant != null)
- value_changed (change_variant.get_maybe ());
+ value_changed (((!) change_variant).get_maybe ());
else
change_dismissed ();
});
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index e497e23..a7c1f22 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -315,7 +315,7 @@ class RegistryView : Grid
if (delayed_apply_menu || key.planned_change)
revealer.add_delayed_dconf_settings (key, new_value);
else if (new_value != null)
- key.value = new_value;
+ key.value = (!) new_value;
else
assert_not_reached ();
}
@@ -325,7 +325,7 @@ class RegistryView : Grid
if (delayed_apply_menu || key.planned_change)
revealer.add_delayed_glib_settings (key, new_value);
else if (new_value != null)
- key.value = new_value;
+ key.value = (!) new_value;
else
key.set_to_default ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]