[gtk+] quartz menu: add special items



commit ceeef03004468a03ff9816493ca2f3a7fee287d9
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Jan 15 00:30:12 2014 -0500

    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 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkapplication-quartz-menu.c b/gtk/gtkapplication-quartz-menu.c
index 0282996..60e13d0 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]