diff options
author | Daniel Boles <dboles@src.gnome.org> | 2016-12-24 14:58:38 +0000 |
---|---|---|
committer | djb <db0451@gmail.com> | 2016-12-26 16:04:10 +0000 |
commit | f9db4fab71a5a93ada9e04117e311ab9d9ba83f3 (patch) | |
tree | a9d5e05d1045524efe21de7eca21aca94ab9cdc6 | |
parent | 73ec1aa8e64a6cf316dbf4c3f4d8c5c1b52157c7 (diff) | |
download | glibmm-f9db4fab71a5a93ada9e04117e311ab9d9ba83f3.tar.gz |
Gio::ActionMap: Fix add_action_with_parameter()
It was not registering the parameter type for the action on create, so
when activating the action later and passing a parameter, an assertion
failed about the expected and passed parameter types/counts not matching
and the parameter was not usable.
https://bugzilla.gnome.org/show_bug.cgi?id=774444
-rw-r--r-- | gio/src/actionmap.ccg | 4 | ||||
-rw-r--r-- | gio/src/actionmap.hg | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/gio/src/actionmap.ccg b/gio/src/actionmap.ccg index da803bb8..054eee3a 100644 --- a/gio/src/actionmap.ccg +++ b/gio/src/actionmap.ccg @@ -33,9 +33,9 @@ ActionMap::add_action(const Glib::ustring& name) Glib::RefPtr<SimpleAction> ActionMap::add_action_with_parameter( - const Glib::ustring& name, const ActivateWithParameterSlot& slot) + const Glib::ustring& name, const ActivateWithParameterSlot& slot, const Glib::VariantType& parameter_type) { - auto action = add_action(name); + auto action = SimpleAction::create(name, parameter_type); action->signal_activate().connect(slot); return action; } diff --git a/gio/src/actionmap.hg b/gio/src/actionmap.hg index b5f885d4..81280376 100644 --- a/gio/src/actionmap.hg +++ b/gio/src/actionmap.hg @@ -74,7 +74,7 @@ public: * @param slot The callback method to be called when the action is activated. * @return The Action. */ - Glib::RefPtr<SimpleAction> add_action_with_parameter(const Glib::ustring& name, const ActivateWithParameterSlot& slot); + Glib::RefPtr<SimpleAction> add_action_with_parameter(const Glib::ustring& name, const ActivateWithParameterSlot& slot, const Glib::VariantType& parameter_type); _IGNORE(g_action_map_add_action_entries) /** A Slot to be called when an action has been activated, @@ -91,6 +91,7 @@ public: * * @param name The name of the Action. * @param slot The callback method to be called when the action is activated. + * @parameter_type The type of parameter to be passed to the slot. * @return The Action. */ Glib::RefPtr<SimpleAction> add_action(const Glib::ustring& name, const ActivateSlot& slot); |