forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
5137e491dc
commit
038de02574
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user