diff options
author | Murray Cumming <murrayc@murrayc.com> | 2013-08-07 10:40:42 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2013-08-07 11:05:24 +0200 |
commit | 76221ac3195ca4d654b3515dcf40a0fa4477de47 (patch) | |
tree | 3e3ae3bc34247fb7c3a572135bc54efa3bc8a4be /gio/src/actionmap.ccg | |
parent | 993631fddccd3fbf36e9bd77e951657ebf4ac7e2 (diff) | |
download | glibmm-76221ac3195ca4d654b3515dcf40a0fa4477de47.tar.gz |
Gio::SimpleAction: add_action() now takes a slot with no parameter.
* gio/src/actionmap.[hg|ccg]: Change ActionSlot to take no parameter,
hiding it via sigc::hide(), because in most cases the parameter
is useless and annoying.
Add add_action_with_parameter() which takes a slot with the
parameter. We cannot just have an add_action() method overload
because the compiler considers that ambiguous.
Diffstat (limited to 'gio/src/actionmap.ccg')
-rw-r--r-- | gio/src/actionmap.ccg | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gio/src/actionmap.ccg b/gio/src/actionmap.ccg index 38a4ccfe..306cf3db 100644 --- a/gio/src/actionmap.ccg +++ b/gio/src/actionmap.ccg @@ -30,13 +30,22 @@ Glib::RefPtr<SimpleAction> ActionMap::add_action(const Glib::ustring& name) return action; } -Glib::RefPtr<SimpleAction> ActionMap::add_action(const Glib::ustring& name, const ActivateSlot& slot) +Glib::RefPtr<SimpleAction> ActionMap::add_action_with_parameter(const Glib::ustring& name, const ActivateWithParameterSlot& slot) { Glib::RefPtr<SimpleAction> action = add_action(name); action->signal_activate().connect(slot); return action; } +Glib::RefPtr<SimpleAction> ActionMap::add_action(const Glib::ustring& name, const ActivateSlot& slot) +{ + Glib::RefPtr<SimpleAction> action = add_action(name); + action->signal_activate().connect( + sigc::hide(slot)); + return action; +} + + Glib::RefPtr<SimpleAction> ActionMap::add_action_bool(const Glib::ustring& name, bool state) { Glib::RefPtr<SimpleAction> action = SimpleAction::create_bool(name, state); @@ -44,13 +53,16 @@ Glib::RefPtr<SimpleAction> ActionMap::add_action_bool(const Glib::ustring& name, return action; } +//TODO: Use a slot that takes a bool? Glib::RefPtr<SimpleAction> ActionMap::add_action_bool(const Glib::ustring& name, const ActivateSlot& slot, bool state) { Glib::RefPtr<SimpleAction> action = add_action_bool(name, state); - action->signal_activate().connect(slot); + action->signal_activate().connect( + sigc::hide(slot)); return action; } +//TODO: Use a slot that takes a string? Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_string(const Glib::ustring& name, const Glib::ustring& state) { Glib::RefPtr<SimpleAction> action = SimpleAction::create_radio_string(name, state); @@ -58,13 +70,14 @@ Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_string(const Glib::ustrin return action; } -Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_string(const Glib::ustring& name, const ActivateSlot& slot, const Glib::ustring& state) +Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_string(const Glib::ustring& name, const ActivateWithParameterSlot& slot, const Glib::ustring& state) { Glib::RefPtr<SimpleAction> action = add_action_radio_string(name, state); action->signal_activate().connect(slot); return action; } +//TODO: Use a slot that takes an integer? Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_integer(const Glib::ustring& name, gint32 state) { Glib::RefPtr<SimpleAction> action = SimpleAction::create_radio_integer(name, state); @@ -72,7 +85,7 @@ Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_integer(const Glib::ustri return action; } -Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_integer(const Glib::ustring& name, const ActivateSlot& slot, gint32 state) +Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_integer(const Glib::ustring& name, const ActivateWithParameterSlot& slot, gint32 state) { Glib::RefPtr<SimpleAction> action = add_action_radio_integer(name, state); action->signal_activate().connect(slot); |