diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-04-26 14:15:01 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-04-28 14:14:43 -0400 |
commit | 038de025748c765a6e858d152ce9a20da84a36bf (patch) | |
tree | 5276b5e7e6ab8148d3d2b67342e91320450b126f /gtk/gtkmenutrackeritem.c | |
parent | 5137e491dc56b4f66b2330d3a33e70a57913c0c3 (diff) | |
download | gtk+-038de025748c765a6e858d152ce9a20da84a36bf.tar.gz |
GtkMenuTrackerItem: Add support for verb-icons
When rendering iconic sections, we want to use icons for verbs,
and we want to differentiate these in the menu model, to keep
the icon attribute reserved for nouns.
https://bugzilla.gnome.org/show_bug.cgi?id=727477
Diffstat (limited to 'gtk/gtkmenutrackeritem.c')
-rw-r--r-- | gtk/gtkmenutrackeritem.c | 28 |
1 files changed, 28 insertions, 0 deletions
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) { |