[gtk+/popover-menu-buttons: 5/8] GtkMenuTrackerItem: Add support for verb-icons
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/popover-menu-buttons: 5/8] GtkMenuTrackerItem: Add support for verb-icons
- Date: Sat, 26 Apr 2014 23:46:41 +0000 (UTC)
commit 1b07ed766cb98d1b30263f3cda85093798da8612
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.
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 9f6251a..ca3b944 100644
--- a/gtk/gtkmenutrackeritem.c
+++ b/gtk/gtkmenutrackeritem.c
@@ -110,6 +110,7 @@ enum {
PROP_HAS_SUBMENU,
PROP_LABEL,
PROP_ICON,
+ PROP_VERB_ICON,
PROP_SENSITIVE,
PROP_VISIBLE,
PROP_ROLE,
@@ -171,6 +172,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;
@@ -230,6 +234,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_VISIBLE] =
@@ -616,6 +622,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 3c62050..b97db84 100644
--- a/gtk/gtkmenutrackeritem.h
+++ b/gtk/gtkmenutrackeritem.h
@@ -62,6 +62,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);
gboolean gtk_menu_tracker_item_get_visible (GtkMenuTrackerItem *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]