[glibmm] Gio::ActionMap: Fix add_action_with_parameter()



commit f9db4fab71a5a93ada9e04117e311ab9d9ba83f3
Author: Daniel Boles <dboles src gnome org>
Date:   Sat Dec 24 14:58:38 2016 +0000

    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

 gio/src/actionmap.ccg |    4 ++--
 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 da803bb..054eee3 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 b5f885d..8128037 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]