diff options
author | Murray Cumming <murrayc@murrayc.com> | 2013-10-08 10:14:56 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2013-10-08 10:14:56 +0200 |
commit | f6849fb3462456a9890c65de8a97a60b08cc49d5 (patch) | |
tree | ee4a040ccff296fcc8630cf47e1c4b0dbc8ee467 | |
parent | 842f841182e51a66bd1ffc9a158a80b52438f71f (diff) | |
download | glibmm-f6849fb3462456a9890c65de8a97a60b08cc49d5.tar.gz |
Gio::MenuItem: Add set_action(), unset_target() and unset_action_and_target().
* gio/src/menuitem.[hg|ccg]: set_action() and unset_target()
replace set_action_and_target(action), which is now deprecated.
-rw-r--r-- | gio/src/menuitem.ccg | 18 | ||||
-rw-r--r-- | gio/src/menuitem.hg | 25 |
2 files changed, 41 insertions, 2 deletions
diff --git a/gio/src/menuitem.ccg b/gio/src/menuitem.ccg index ed4c6e35..de96ad38 100644 --- a/gio/src/menuitem.ccg +++ b/gio/src/menuitem.ccg @@ -50,6 +50,24 @@ void MenuItem::set_action_and_target(const Glib::ustring& action) g_menu_item_set_action_and_target_value(gobj(), action.c_str(), 0); } +void MenuItem::set_action(const Glib::ustring& action) +{ + g_menu_item_set_action_and_target_value(gobj(), action.c_str(), 0); +} + +void MenuItem::unset_target() +{ + const gchar *action_name = 0; + g_menu_item_get_attribute (gobj(), G_MENU_ATTRIBUTE_ACTION, "&s", &action_name); + + g_menu_item_set_action_and_target_value(gobj(), action_name, 0); +} + +void MenuItem::unset_action_and_target() +{ + g_menu_item_set_action_and_target_value(gobj(), 0, 0); +} + void MenuItem::unset_icon() { g_menu_item_set_icon(gobj(), 0); diff --git a/gio/src/menuitem.hg b/gio/src/menuitem.hg index e7eb6c32..31eeae02 100644 --- a/gio/src/menuitem.hg +++ b/gio/src/menuitem.hg @@ -124,12 +124,33 @@ GMenuItem * g_menu_item_new_section (const Glib::ustring& label, // Ignore varargs function. _IGNORE(g_menu_item_get_attribute) - //TODO: Rename this to unset_action_target() and deprecate this one. +_DEPRECATE_IFDEF_START /** Unsets the target for the specified @a action. + * @deprecate Use set_action() or unset_target() instead. */ void set_action_and_target(const Glib::ustring& action); +_DEPRECATE_IFDEF_END - //TODO: Add unset_action_and_target(). + /** Sets the action for the menu item. + * See set_action_and_target(). + * + * @newin{2,38} + */ + void set_action(const Glib::ustring& action); + + /** Unsets the target for the menu item. + * See set_action_and_target(). + * + * @newin{2,38} + */ + void unset_target(); + + /** Unsets the action and target for the menu item. + * See set_action_and_target(). + * + * @newin{2,38}. + */ + void unset_action_and_target(); _WRAP_METHOD(void set_action_and_target(const Glib::ustring& action, const Glib::VariantBase& target_value), g_menu_item_set_action_and_target_value) _IGNORE(g_menu_item_set_action_and_target) |