diff --git a/gtk/gtkmenutrackeritem.c b/gtk/gtkmenutrackeritem.c index 71ed0a8e1b..ddf20dc5b9 100644 --- a/gtk/gtkmenutrackeritem.c +++ b/gtk/gtkmenutrackeritem.c @@ -108,6 +108,7 @@ enum { PROP_IS_SEPARATOR, PROP_LABEL, PROP_ICON, + PROP_VERB_ICON, PROP_SENSITIVE, PROP_ROLE, PROP_TOGGLED, @@ -165,6 +166,9 @@ gtk_menu_tracker_item_get_property (GObject *object, case PROP_ICON: g_value_set_object (value, gtk_menu_tracker_item_get_icon (self)); break; + case PROP_VERB_ICON: + g_value_set_object (value, gtk_menu_tracker_item_get_verb_icon (self)); + break; case PROP_SENSITIVE: g_value_set_boolean (value, gtk_menu_tracker_item_get_sensitive (self)); break; @@ -221,6 +225,8 @@ gtk_menu_tracker_item_class_init (GtkMenuTrackerItemClass *class) g_param_spec_string ("label", "", "", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); gtk_menu_tracker_item_pspecs[PROP_ICON] = g_param_spec_object ("icon", "", "", G_TYPE_ICON, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); + gtk_menu_tracker_item_pspecs[PROP_VERB_ICON] = + g_param_spec_object ("verb-icon", "", "", G_TYPE_ICON, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); gtk_menu_tracker_item_pspecs[PROP_SENSITIVE] = g_param_spec_boolean ("sensitive", "", "", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE); gtk_menu_tracker_item_pspecs[PROP_ROLE] = @@ -601,6 +607,28 @@ gtk_menu_tracker_item_get_icon (GtkMenuTrackerItem *self) return icon; } +/*< private > + * gtk_menu_tracker_item_get_verb_icon: + * + * Returns: (transfer full): + */ +GIcon * +gtk_menu_tracker_item_get_verb_icon (GtkMenuTrackerItem *self) +{ + GVariant *icon_data; + GIcon *icon; + + icon_data = g_menu_item_get_attribute_value (self->item, "verb-icon", NULL); + + if (icon_data == NULL) + return NULL; + + icon = g_icon_deserialize (icon_data); + g_variant_unref (icon_data); + + return icon; +} + gboolean gtk_menu_tracker_item_get_sensitive (GtkMenuTrackerItem *self) { diff --git a/gtk/gtkmenutrackeritem.h b/gtk/gtkmenutrackeritem.h index 41649848ab..ca5a665a9c 100644 --- a/gtk/gtkmenutrackeritem.h +++ b/gtk/gtkmenutrackeritem.h @@ -61,6 +61,8 @@ const gchar * gtk_menu_tracker_item_get_label (GtkMenu GIcon * gtk_menu_tracker_item_get_icon (GtkMenuTrackerItem *self); +GIcon * gtk_menu_tracker_item_get_verb_icon (GtkMenuTrackerItem *self); + gboolean gtk_menu_tracker_item_get_sensitive (GtkMenuTrackerItem *self); GtkMenuTrackerItemRole gtk_menu_tracker_item_get_role (GtkMenuTrackerItem *self);