GtkMenuTracker: add 'special' items

Allow the possibility for items to be marked with a special attribute and
expose this via GtkTrackerMenuItem.  For internal use only.

We will use this to implement the special 'Hide', 'Hide Others' and 'Show All'
items and the 'Services' submenu in the Mac OS application menu.

https://bugzilla.gnome.org/show_bug.cgi?id=720552
This commit is contained in:
Ryan Lortie 2013-12-14 21:56:26 -05:00
parent e70f506e83
commit ea0ede201e
2 changed files with 12 additions and 0 deletions

View File

@ -653,6 +653,16 @@ gtk_menu_tracker_item_get_accel (GtkMenuTrackerItem *self)
return gtk_action_muxer_get_primary_accel (GTK_ACTION_MUXER (self->observable), self->action_and_target); return gtk_action_muxer_get_primary_accel (GTK_ACTION_MUXER (self->observable), self->action_and_target);
} }
const gchar *
gtk_menu_tracker_item_get_special (GtkMenuTrackerItem *self)
{
const gchar *special = NULL;
g_menu_item_get_attribute (self->item, "x-gtk-private-special", "&s", &special);
return special;
}
GMenuModel * GMenuModel *
_gtk_menu_tracker_item_get_submenu (GtkMenuTrackerItem *self) _gtk_menu_tracker_item_get_submenu (GtkMenuTrackerItem *self)
{ {

View File

@ -48,6 +48,8 @@ GtkMenuTrackerItem * _gtk_menu_tracker_item_new (GtkActi
const gchar *action_namespace, const gchar *action_namespace,
gboolean is_separator); gboolean is_separator);
const gchar * gtk_menu_tracker_item_get_special (GtkMenuTrackerItem *self);
GtkActionObservable * _gtk_menu_tracker_item_get_observable (GtkMenuTrackerItem *self); GtkActionObservable * _gtk_menu_tracker_item_get_observable (GtkMenuTrackerItem *self);
gboolean gtk_menu_tracker_item_get_is_separator (GtkMenuTrackerItem *self); gboolean gtk_menu_tracker_item_get_is_separator (GtkMenuTrackerItem *self);