[gtk+/wip/desrt/popover-iconic: 6/10] GtkMenuTrackerItem: Add support for verb-icons
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/desrt/popover-iconic: 6/10] GtkMenuTrackerItem: Add support for verb-icons
- Date: Mon, 28 Apr 2014 16:16:00 +0000 (UTC)
commit 36c1f1941ff3823bfab56098655918c979b34159
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Apr 26 14:15:01 2014 -0400
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
gtk/gtkmenutrackeritem.c | 28 ++++++++++++++++++++++++++++
gtk/gtkmenutrackeritem.h | 2 ++
2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmenutrackeritem.c b/gtk/gtkmenutrackeritem.c
index 71ed0a8..ddf20dc 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 4164984..ca5a665 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]