2014-01-08 22:27:43 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2011 William Hua, Ryan Lortie
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the licence, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Author: William Hua <william@attente.ca>
|
|
|
|
* Ryan Lortie <desrt@desrt.ca>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gtkapplicationprivate.h"
|
2019-06-10 03:10:13 +00:00
|
|
|
#include "gtkmenutrackerprivate.h"
|
2014-01-08 22:27:43 +00:00
|
|
|
#include "gtkicontheme.h"
|
|
|
|
#include "gtkquartz.h"
|
2021-05-24 21:37:55 +00:00
|
|
|
#include "gtkprivate.h"
|
2014-01-08 22:27:43 +00:00
|
|
|
|
2020-10-10 03:08:23 +00:00
|
|
|
#include <gdk/macos/gdkmacos.h>
|
|
|
|
#include <gdk/macos/gdkmacoskeymap-private.h>
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
|
|
#define ICON_SIZE 16
|
|
|
|
|
|
|
|
#define BLACK "#000000"
|
|
|
|
#define TANGO_CHAMELEON_3 "#4e9a06"
|
|
|
|
#define TANGO_ORANGE_2 "#f57900"
|
|
|
|
#define TANGO_SCARLET_RED_2 "#cc0000"
|
|
|
|
|
|
|
|
@interface GNSMenu : NSMenu
|
|
|
|
{
|
|
|
|
GtkMenuTracker *tracker;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithTitle:(NSString *)title model:(GMenuModel *)model observable:(GtkActionObservable *)observable;
|
|
|
|
|
|
|
|
- (id)initWithTitle:(NSString *)title trackerItem:(GtkMenuTrackerItem *)trackerItem;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NSMenuItem (GtkMenuTrackerItem)
|
|
|
|
|
|
|
|
+ (id)menuItemForTrackerItem:(GtkMenuTrackerItem *)trackerItem;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GNSMenuItem : NSMenuItem
|
|
|
|
{
|
|
|
|
GtkMenuTrackerItem *trackerItem;
|
|
|
|
gulong trackerItemChangedHandler;
|
|
|
|
GCancellable *cancellable;
|
2013-12-16 16:05:17 +00:00
|
|
|
BOOL isSpecial;
|
2014-01-08 22:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithTrackerItem:(GtkMenuTrackerItem *)aTrackerItem;
|
|
|
|
|
|
|
|
- (void)didChangeLabel;
|
|
|
|
- (void)didChangeIcon;
|
|
|
|
- (void)didChangeVisible;
|
|
|
|
- (void)didChangeToggled;
|
|
|
|
- (void)didChangeAccel;
|
|
|
|
|
|
|
|
- (void)didSelectItem:(id)sender;
|
2014-01-15 05:26:58 +00:00
|
|
|
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem;
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
static void
|
|
|
|
tracker_item_changed (GObject *object,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GNSMenuItem *item = user_data;
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *name = g_param_spec_get_name (pspec);
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
if (name != NULL)
|
|
|
|
{
|
|
|
|
if (g_str_equal (name, "label"))
|
|
|
|
[item didChangeLabel];
|
|
|
|
else if (g_str_equal (name, "icon"))
|
|
|
|
[item didChangeIcon];
|
2014-08-20 19:42:42 +00:00
|
|
|
else if (g_str_equal (name, "is-visible"))
|
2014-01-08 22:27:43 +00:00
|
|
|
[item didChangeVisible];
|
|
|
|
else if (g_str_equal (name, "toggled"))
|
|
|
|
[item didChangeToggled];
|
|
|
|
else if (g_str_equal (name, "accel"))
|
|
|
|
[item didChangeAccel];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-10 03:08:23 +00:00
|
|
|
#if 0
|
2014-01-08 22:27:43 +00:00
|
|
|
static void
|
|
|
|
icon_loaded (GObject *object,
|
|
|
|
GAsyncResult *result,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2020-10-10 03:08:23 +00:00
|
|
|
GtkIconPaintable *icon = GTK_ICON_PAINTABLE (object);
|
2014-01-08 22:27:43 +00:00
|
|
|
GNSMenuItem *item = user_data;
|
|
|
|
GError *error = NULL;
|
|
|
|
GdkPixbuf *pixbuf;
|
2020-07-24 13:54:49 +00:00
|
|
|
int scale = 1;
|
2015-07-24 13:28:27 +00:00
|
|
|
|
|
|
|
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
|
|
|
|
/* we need a run-time check for the backingScaleFactor selector because we
|
|
|
|
* may be compiling on a 10.7 framework, but targeting a 10.6 one
|
|
|
|
*/
|
|
|
|
if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])
|
|
|
|
scale = roundf ([[NSScreen mainScreen] backingScaleFactor]);
|
|
|
|
#endif
|
2014-01-08 22:27:43 +00:00
|
|
|
|
2020-01-30 09:52:09 +00:00
|
|
|
pixbuf = gtk_icon_load_symbolic_finish (icon, result, NULL, &error);
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
if (pixbuf != NULL)
|
|
|
|
{
|
2015-07-24 13:28:27 +00:00
|
|
|
cairo_t *cr;
|
|
|
|
cairo_surface_t *surface;
|
|
|
|
NSImage *image;
|
|
|
|
|
|
|
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
|
|
|
gdk_pixbuf_get_width (pixbuf),
|
|
|
|
gdk_pixbuf_get_height (pixbuf));
|
|
|
|
|
|
|
|
cr = cairo_create (surface);
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
|
|
|
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
|
|
|
cairo_paint (cr);
|
|
|
|
cairo_destroy (cr);
|
2014-01-08 22:27:43 +00:00
|
|
|
g_object_unref (pixbuf);
|
2015-07-24 13:28:27 +00:00
|
|
|
|
|
|
|
cairo_surface_set_device_scale (surface, scale, scale);
|
|
|
|
image = _gtk_quartz_create_image_from_surface (surface);
|
|
|
|
cairo_surface_destroy (surface);
|
|
|
|
|
|
|
|
if (image != NULL)
|
|
|
|
[item setImage:image];
|
|
|
|
else
|
|
|
|
[item setImage:nil];
|
2014-01-08 22:27:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* on failure to load, clear the old icon */
|
|
|
|
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
|
|
|
[item setImage:nil];
|
|
|
|
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
|
|
|
}
|
2020-10-10 03:08:23 +00:00
|
|
|
#endif
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
@implementation GNSMenuItem
|
|
|
|
|
2014-01-15 05:26:58 +00:00
|
|
|
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
|
|
|
|
{
|
|
|
|
return gtk_menu_tracker_item_get_sensitive (trackerItem) ? YES : NO;
|
|
|
|
}
|
|
|
|
|
2014-01-08 22:27:43 +00:00
|
|
|
- (id)initWithTrackerItem:(GtkMenuTrackerItem *)aTrackerItem
|
|
|
|
{
|
|
|
|
self = [super initWithTitle:@""
|
|
|
|
action:@selector(didSelectItem:)
|
|
|
|
keyEquivalent:@""];
|
|
|
|
|
|
|
|
if (self != nil)
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *special = gtk_menu_tracker_item_get_special (aTrackerItem);
|
2014-01-15 05:30:12 +00:00
|
|
|
|
|
|
|
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];
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
trackerItem = g_object_ref (aTrackerItem);
|
|
|
|
trackerItemChangedHandler = g_signal_connect (trackerItem, "notify", G_CALLBACK (tracker_item_changed), self);
|
2013-12-16 16:05:17 +00:00
|
|
|
isSpecial = (special != NULL);
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
[self didChangeLabel];
|
|
|
|
[self didChangeIcon];
|
|
|
|
[self didChangeVisible];
|
|
|
|
[self didChangeToggled];
|
|
|
|
[self didChangeAccel];
|
|
|
|
|
2014-06-23 23:04:56 +00:00
|
|
|
if (gtk_menu_tracker_item_get_has_link (trackerItem, G_MENU_LINK_SUBMENU))
|
2014-01-08 22:27:43 +00:00
|
|
|
[self setSubmenu:[[[GNSMenu alloc] initWithTitle:[self title] trackerItem:trackerItem] autorelease]];
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
if (cancellable != NULL)
|
|
|
|
{
|
|
|
|
g_cancellable_cancel (cancellable);
|
|
|
|
g_clear_object (&cancellable);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_signal_handler_disconnect (trackerItem, trackerItemChangedHandler);
|
|
|
|
g_object_unref (trackerItem);
|
|
|
|
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didChangeLabel
|
|
|
|
{
|
2021-05-24 21:37:55 +00:00
|
|
|
char *label = _gtk_elide_underscores (gtk_menu_tracker_item_get_label (trackerItem));
|
2014-01-08 22:27:43 +00:00
|
|
|
|
2013-12-16 16:05:17 +00:00
|
|
|
NSString *title = [NSString stringWithUTF8String:label ? : ""];
|
|
|
|
|
|
|
|
if (isSpecial)
|
|
|
|
{
|
|
|
|
NSRange range = [title rangeOfString:@"%s"];
|
|
|
|
|
|
|
|
if (range.location != NSNotFound)
|
|
|
|
{
|
|
|
|
NSBundle *bundle = [NSBundle mainBundle];
|
|
|
|
NSString *name = [[bundle localizedInfoDictionary] objectForKey:@"CFBundleName"];
|
|
|
|
|
|
|
|
if (name == nil)
|
|
|
|
name = [[bundle infoDictionary] objectForKey:@"CFBundleName"];
|
|
|
|
|
|
|
|
if (name == nil)
|
|
|
|
name = [[NSProcessInfo processInfo] processName];
|
|
|
|
|
|
|
|
if (name != nil)
|
|
|
|
title = [title stringByReplacingCharactersInRange:range withString:name];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[self setTitle:title];
|
2021-05-24 21:37:55 +00:00
|
|
|
|
|
|
|
g_free (label);
|
2014-01-08 22:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didChangeIcon
|
|
|
|
{
|
2020-10-10 03:08:23 +00:00
|
|
|
#if 0
|
2014-01-08 22:27:43 +00:00
|
|
|
GIcon *icon = gtk_menu_tracker_item_get_icon (trackerItem);
|
|
|
|
|
|
|
|
if (cancellable != NULL)
|
|
|
|
{
|
|
|
|
g_cancellable_cancel (cancellable);
|
|
|
|
g_clear_object (&cancellable);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (icon != NULL)
|
|
|
|
{
|
|
|
|
static gboolean parsed;
|
|
|
|
|
|
|
|
static GdkRGBA foreground;
|
|
|
|
static GdkRGBA success;
|
|
|
|
static GdkRGBA warning;
|
|
|
|
static GdkRGBA error;
|
|
|
|
|
|
|
|
GtkIconTheme *theme;
|
2020-02-04 16:19:22 +00:00
|
|
|
GtkIconPaintable *icon;
|
2020-07-24 13:54:49 +00:00
|
|
|
int scale = 1;
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
if (!parsed)
|
|
|
|
{
|
|
|
|
gdk_rgba_parse (&foreground, BLACK);
|
|
|
|
gdk_rgba_parse (&success, TANGO_CHAMELEON_3);
|
|
|
|
gdk_rgba_parse (&warning, TANGO_ORANGE_2);
|
|
|
|
gdk_rgba_parse (&error, TANGO_SCARLET_RED_2);
|
|
|
|
|
|
|
|
parsed = TRUE;
|
|
|
|
}
|
|
|
|
|
2020-02-01 22:38:49 +00:00
|
|
|
theme = gtk_icon_theme_get_for_display (gdk_display_get_default ());
|
2014-08-23 08:59:29 +00:00
|
|
|
|
|
|
|
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
|
|
|
|
/* we need a run-time check for the backingScaleFactor selector because we
|
|
|
|
* may be compiling on a 10.7 framework, but targeting a 10.6 one
|
|
|
|
*/
|
|
|
|
if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])
|
|
|
|
scale = roundf ([[NSScreen mainScreen] backingScaleFactor]);
|
|
|
|
#endif
|
2020-02-01 23:35:42 +00:00
|
|
|
icon = gtk_icon_theme_lookup_by_gicon (theme, icon, ICON_SIZE, scale, 0);
|
2014-01-08 22:27:43 +00:00
|
|
|
|
2020-01-30 09:52:09 +00:00
|
|
|
if (icon != NULL)
|
2014-01-08 22:27:43 +00:00
|
|
|
{
|
|
|
|
cancellable = g_cancellable_new ();
|
2020-01-30 09:52:09 +00:00
|
|
|
gtk_icon_load_symbolic_async (icon, &foreground, &success, &warning, &error,
|
2020-01-30 11:27:15 +00:00
|
|
|
cancellable, icon_loaded, self);
|
2020-01-30 09:52:09 +00:00
|
|
|
g_object_unref (icon);
|
2014-01-08 22:27:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-10-10 03:08:23 +00:00
|
|
|
#endif
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
[self setImage:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didChangeVisible
|
|
|
|
{
|
2014-06-23 23:04:56 +00:00
|
|
|
[self setHidden:gtk_menu_tracker_item_get_is_visible (trackerItem) ? NO : YES];
|
2014-01-08 22:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didChangeToggled
|
|
|
|
{
|
2021-01-06 00:20:46 +00:00
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
[self setState:gtk_menu_tracker_item_get_toggled (trackerItem) ? NSOnState : NSOffState];
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2014-01-08 22:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didChangeAccel
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *accel = gtk_menu_tracker_item_get_accel (trackerItem);
|
2014-01-08 22:27:43 +00:00
|
|
|
|
|
|
|
if (accel != NULL)
|
|
|
|
{
|
|
|
|
guint key;
|
|
|
|
GdkModifierType mask;
|
|
|
|
unichar character;
|
|
|
|
NSUInteger modifiers;
|
|
|
|
|
|
|
|
gtk_accelerator_parse (accel, &key, &mask);
|
|
|
|
|
2020-10-10 03:08:23 +00:00
|
|
|
character = _gdk_macos_keymap_get_equivalent (key);
|
2014-01-08 22:27:43 +00:00
|
|
|
[self setKeyEquivalent:[NSString stringWithCharacters:&character length:1]];
|
|
|
|
|
|
|
|
modifiers = 0;
|
|
|
|
if (mask & GDK_SHIFT_MASK)
|
2020-10-10 03:08:23 +00:00
|
|
|
modifiers |= NSEventModifierFlagShift;
|
2014-01-08 22:27:43 +00:00
|
|
|
if (mask & GDK_CONTROL_MASK)
|
2020-10-10 03:08:23 +00:00
|
|
|
modifiers |= NSEventModifierFlagControl;
|
2020-04-05 13:39:03 +00:00
|
|
|
if (mask & GDK_ALT_MASK)
|
2020-10-10 03:08:23 +00:00
|
|
|
modifiers |= NSEventModifierFlagOption;
|
2014-01-08 22:27:43 +00:00
|
|
|
if (mask & GDK_META_MASK)
|
2020-10-10 03:08:23 +00:00
|
|
|
modifiers |= NSEventModifierFlagCommand;
|
2014-01-08 22:27:43 +00:00
|
|
|
[self setKeyEquivalentModifierMask:modifiers];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[self setKeyEquivalent:@""];
|
|
|
|
[self setKeyEquivalentModifierMask:0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didSelectItem:(id)sender
|
|
|
|
{
|
|
|
|
gtk_menu_tracker_item_activated (trackerItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NSMenuItem (GtkMenuTrackerItem)
|
|
|
|
|
|
|
|
+ (id)menuItemForTrackerItem:(GtkMenuTrackerItem *)trackerItem
|
|
|
|
{
|
|
|
|
if (gtk_menu_tracker_item_get_is_separator (trackerItem))
|
|
|
|
return [NSMenuItem separatorItem];
|
|
|
|
|
|
|
|
return [[[GNSMenuItem alloc] initWithTrackerItem:trackerItem] autorelease];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
static void
|
|
|
|
menu_item_inserted (GtkMenuTrackerItem *item,
|
2020-07-24 13:54:49 +00:00
|
|
|
int position,
|
2014-01-08 22:27:43 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GNSMenu *menu = user_data;
|
|
|
|
|
|
|
|
[menu insertItem:[NSMenuItem menuItemForTrackerItem:item] atIndex:position];
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-07-24 13:54:49 +00:00
|
|
|
menu_item_removed (int position,
|
2014-01-08 22:27:43 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GNSMenu *menu = user_data;
|
|
|
|
|
|
|
|
[menu removeItemAtIndex:position];
|
|
|
|
}
|
|
|
|
|
|
|
|
@implementation GNSMenu
|
|
|
|
|
|
|
|
- (id)initWithTitle:(NSString *)title model:(GMenuModel *)model observable:(GtkActionObservable *)observable
|
|
|
|
{
|
|
|
|
self = [super initWithTitle:title];
|
|
|
|
|
|
|
|
if (self != nil)
|
|
|
|
{
|
|
|
|
tracker = gtk_menu_tracker_new (observable,
|
|
|
|
model,
|
2014-06-23 23:04:56 +00:00
|
|
|
NO,
|
|
|
|
YES,
|
2014-12-16 17:14:23 +00:00
|
|
|
YES,
|
2014-01-08 22:27:43 +00:00
|
|
|
NULL,
|
|
|
|
menu_item_inserted,
|
|
|
|
menu_item_removed,
|
|
|
|
self);
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)initWithTitle:(NSString *)title trackerItem:(GtkMenuTrackerItem *)trackerItem
|
|
|
|
{
|
|
|
|
self = [super initWithTitle:title];
|
|
|
|
|
|
|
|
if (self != nil)
|
|
|
|
{
|
2014-06-23 23:04:56 +00:00
|
|
|
tracker = gtk_menu_tracker_new_for_item_link (trackerItem,
|
|
|
|
G_MENU_LINK_SUBMENU,
|
|
|
|
YES,
|
2014-12-16 17:14:23 +00:00
|
|
|
YES,
|
2014-01-08 22:27:43 +00:00
|
|
|
menu_item_inserted,
|
|
|
|
menu_item_removed,
|
|
|
|
self);
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
gtk_menu_tracker_free (tracker);
|
|
|
|
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_application_impl_quartz_setup_menu (GMenuModel *model,
|
|
|
|
GtkActionMuxer *muxer)
|
|
|
|
{
|
|
|
|
NSMenu *menu;
|
|
|
|
|
|
|
|
if (model != NULL)
|
|
|
|
menu = [[GNSMenu alloc] initWithTitle:@"Main Menu" model:model observable:GTK_ACTION_OBSERVABLE (muxer)];
|
|
|
|
else
|
|
|
|
menu = [[NSMenu alloc] init];
|
|
|
|
|
|
|
|
[NSApp setMainMenu:menu];
|
|
|
|
[menu release];
|
|
|
|
}
|