[dconf-editor] key-list-box-row.vala: Make --enable-experimental-non-null happier.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] key-list-box-row.vala: Make --enable-experimental-non-null happier.
- Date: Fri, 19 Aug 2016 19:29:11 +0000 (UTC)
commit 7d68419e51271a14d255c0204f380d475763d404
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Aug 19 21:04:40 2016 +0200
key-list-box-row.vala: Make --enable-experimental-non-null happier.
editor/key-list-box-row.vala | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/editor/key-list-box-row.vala b/editor/key-list-box-row.vala
index f207646..7d5901c 100644
--- a/editor/key-list-box-row.vala
+++ b/editor/key-list-box-row.vala
@@ -78,7 +78,7 @@ private abstract class ClickableListBoxRow : EventBox
((!) nullable_popover).set_relative_to (this);
((!) nullable_popover).position = PositionType.BOTTOM; // TODO better
}
- else if ((!) nullable_popover.visible)
+ else if (((!) nullable_popover).visible)
warning ("show_right_click_popover() called but popover is visible"); // TODO is called on
multi-right-click or long Menu key press
Gdk.Rectangle rect = { x:event_x, y:get_allocated_height (), width:0, height:0 };
@@ -472,7 +472,7 @@ private class ContextPopover : Popover
});
key.notify ["planned-value"].connect (() => {
- active_flags = key.planned_value != null ? key.planned_value.get_strv () :
key.value.get_strv ();
+ active_flags = key.planned_value != null ? ((!) key.planned_value).get_strv () :
key.value.get_strv ();
bool active = flag in active_flags;
if (active != simple_action.get_state ())
simple_action.set_state (new Variant.boolean (active));
@@ -502,10 +502,16 @@ private class ContextPopover : Popover
value_variant = key.planned_change && (key.planned_value != null) ? key.planned_value :
key.value;
else if (key.planned_change)
value_variant = key.planned_value;
+ else if (key is GSettingsKey && ((GSettingsKey) key).is_default)
+ value_variant = null;
else
- value_variant = key is GSettingsKey && ((GSettingsKey) key).is_default ? null : key.value;
+ value_variant = 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);
+ Variant nullable_variant;
+ if (delayed_apply_menu && !key.planned_change)
+ nullable_variant = new Variant.maybe (nullable_type, null);
+ else
+ nullable_variant = new Variant.maybe (nullable_type, variant);
GLib.Action action = (GLib.Action) new SimpleAction.stateful (ACTION_NAME, nullable_nullable_type,
nullable_variant);
current_group.add_action (action);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]