diff options
author | Nick Dedekind <nicholas.dedekind@gmail.com> | 2013-07-30 18:59:20 +0100 |
---|---|---|
committer | Nick Dedekind <nicholas.dedekind@gmail.com> | 2013-07-30 18:59:20 +0100 |
commit | 56374f1cfdbe68658a139cfad9dac8936f6ae60e (patch) | |
tree | 4672b4caf55b5ea4d021e3d7752a2e623e0e39fc /libqmenumodel/src/gtk | |
parent | 559df4bb3201c14d408d3a2b7bdd5101b7d75a29 (diff) | |
download | qmenumodel-56374f1cfdbe68658a139cfad9dac8936f6ae60e.tar.gz qmenumodel-56374f1cfdbe68658a139cfad9dac8936f6ae60e.tar.bz2 qmenumodel-56374f1cfdbe68658a139cfad9dac8936f6ae60e.zip |
Added action name
Diffstat (limited to 'libqmenumodel/src/gtk')
-rw-r--r-- | libqmenumodel/src/gtk/gtkmenutrackeritem.c | 24 | ||||
-rw-r--r-- | libqmenumodel/src/gtk/gtkmenutrackeritem.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libqmenumodel/src/gtk/gtkmenutrackeritem.c b/libqmenumodel/src/gtk/gtkmenutrackeritem.c index fb856c9..c14bbb8 100644 --- a/libqmenumodel/src/gtk/gtkmenutrackeritem.c +++ b/libqmenumodel/src/gtk/gtkmenutrackeritem.c @@ -106,6 +106,7 @@ enum { PROP_TOGGLED, PROP_ACCEL, PROP_SUBMENU_SHOWN, + PROP_ACTION_NAME, PROP_ACTION_STATE, N_PROPS }; @@ -179,6 +180,8 @@ gtk_menu_tracker_item_get_property (GObject *object, case PROP_SUBMENU_SHOWN: g_value_set_boolean (value, gtk_menu_tracker_item_get_submenu_shown (self)); break; + case PROP_ACTION_NAME: + g_value_set_string (value, gtk_menu_tracker_item_get_action_name (self)); case PROP_ACTION_STATE: g_value_set_variant (value, self->action_state); break; @@ -239,12 +242,16 @@ gtk_menu_tracker_item_class_init (GtkMenuTrackerItemClass *class) g_param_spec_string ("accel", "", "", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); gtk_menu_tracker_item_pspecs[PROP_SUBMENU_SHOWN] = g_param_spec_boolean ("submenu-shown", "", "", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); + gtk_menu_tracker_item_pspecs[PROP_ACTION_NAME] = + g_param_spec_boolean ("action-name", "", "", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); gtk_menu_tracker_item_pspecs[PROP_ACTION_STATE] = g_param_spec_boolean ("action-state", "", "", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); g_object_class_install_properties (class, N_PROPS, gtk_menu_tracker_item_pspecs); } +#include <stdio.h> + static void gtk_menu_tracker_item_action_added (GtkActionObserver *observer, GtkActionObservable *observable, @@ -268,6 +275,7 @@ gtk_menu_tracker_item_action_added (GtkActionObserver *observer, g_variant_unref (action_target); return; } + printf("INDICATORS: activateable %p\n", action_target); self->sensitive = enabled; @@ -612,6 +620,22 @@ gtk_menu_tracker_item_get_submenu_shown (GtkMenuTrackerItem *self) return self->submenu_shown; } +/** + * gtk_menu_tracker_item_get_action_name: + * @self: A #GtkMenuTrackerItem instance + * + * Returns the action name + */ +const gchar * +gtk_menu_tracker_item_get_action_name (GtkMenuTrackerItem *self) +{ + const gchar *action_name = NULL; + + g_menu_item_get_attribute (self->item, G_MENU_ATTRIBUTE_ACTION, "&s", &action_name); + + return action_name; +} + GVariant * gtk_menu_tracker_item_get_action_state (GtkMenuTrackerItem *self) { diff --git a/libqmenumodel/src/gtk/gtkmenutrackeritem.h b/libqmenumodel/src/gtk/gtkmenutrackeritem.h index 16c4415..8b0afae 100644 --- a/libqmenumodel/src/gtk/gtkmenutrackeritem.h +++ b/libqmenumodel/src/gtk/gtkmenutrackeritem.h @@ -81,6 +81,8 @@ void gtk_menu_tracker_item_request_submenu_shown (GtkMenu gboolean gtk_menu_tracker_item_get_submenu_shown (GtkMenuTrackerItem *self); +const gchar * gtk_menu_tracker_item_get_action_name (GtkMenuTrackerItem *self); + GVariant * gtk_menu_tracker_item_get_action_state (GtkMenuTrackerItem *self); gboolean gtk_menu_tracker_item_get_attribute (GtkMenuTrackerItem *self, |