From ceeef03004468a03ff9816493ca2f3a7fee287d9 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Wed, 15 Jan 2014 00:30:12 -0500 Subject: [PATCH] quartz menu: add special items Add support for the "Hide app", "Hide Others" and "Show All" special items and for the "Services" submenu. https://bugzilla.gnome.org/show_bug.cgi?id=720552 --- gtk/gtkapplication-quartz-menu.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/gtk/gtkapplication-quartz-menu.c b/gtk/gtkapplication-quartz-menu.c index 0282996aaf..60e13d0286 100644 --- a/gtk/gtkapplication-quartz-menu.c +++ b/gtk/gtkapplication-quartz-menu.c @@ -139,7 +139,31 @@ icon_loaded (GObject *object, if (self != nil) { - [self setTarget:self]; + const gchar *special = gtk_menu_tracker_item_get_special (aTrackerItem); + + if (special && g_str_equal (special, "hide-this")) + { + [self setAction:@selector(hide:)]; + [self setTarget:NSApp]; + } + else if (special && g_str_equal (special, "hide-others")) + { + [self setAction:@selector(hideOtherApplications:)]; + [self setTarget:NSApp]; + } + else if (special && g_str_equal (special, "show-all")) + { + [self setAction:@selector(unhideAllApplications:)]; + [self setTarget:NSApp]; + } + else if (special && g_str_equal (special, "services-submenu")) + { + [self setSubmenu:[[[NSMenu alloc] init] autorelease]]; + [NSApp setServicesMenu:[self submenu]]; + [self setTarget:self]; + } + else + [self setTarget:self]; trackerItem = g_object_ref (aTrackerItem); trackerItemChangedHandler = g_signal_connect (trackerItem, "notify", G_CALLBACK (tracker_item_changed), self);