[glibmm] Gio::Action:: get_state_hint(): Correct a check.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Gio::Action:: get_state_hint(): Correct a check.
- Date: Fri, 9 Aug 2013 09:31:09 +0000 (UTC)
commit a294cb6adf243ae5934ff21d6becaa1a2ce95526
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Aug 9 11:29:54 2013 +0200
Gio::Action:: get_state_hint(): Correct a check.
gio/src/action.hg | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gio/src/action.hg b/gio/src/action.hg
index f627787..316631d 100644
--- a/gio/src/action.hg
+++ b/gio/src/action.hg
@@ -80,9 +80,14 @@ public:
_WRAP_METHOD(Glib::VariantType get_state_type() const, g_action_get_state_type)
//TODO: Docs
+ //TODO: Is there any specific type that can really be used with this? A std::list<>. We must test this.
+ // See also ActionGroup:::get_action_state_hint().
template <typename T_Value>
void get_state_hint(T_Value& value) const;
+ //TODO: When we can break ABI, Return a Glib::VariantContainerBase,
+ // as we already do for ActionGroup::get_action_state_hint(),
+ // because that is what this returns (to specify a range).
_WRAP_METHOD(Glib::VariantBase get_state_hint_variant() const, g_action_get_state_hint)
_WRAP_METHOD(bool get_enabled() const, g_action_get_enabled)
@@ -182,10 +187,12 @@ void Action::get_state_hint(T_Value& value) const
typedef Glib::Variant<T_Value> type_glib_variant;
+ const Glib::VariantBase variantBase = get_state_hint_variant();
+
+ // We can't check the type (a range) that will be returned before getting the range hint.
g_return_if_fail(
- g_variant_type_equal(g_action_get_state_type(const_cast<GAction*>(gobj())),
type_glib_variant::variant_type().gobj()));
+ variantBase.is_of_type(type_glib_variant::variant_type()) );
- const Glib::VariantBase variantBase = get_state_hint_variant();
const type_glib_variant variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
value = variantDerived.get();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]