1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-30 19:46:56 +00:00
transmission/macosx/ShareToolbarItem.mm
Mike Gelfand b7ba261359
Port macOS client to C++ (#1830)
* Rename all .m (Obj-C) files to .mm (Obj-C++)

* Fix build in Obj-C++ mode

* Fix Xcode build
2021-09-24 07:56:57 -05:00

34 lines
825 B
Text

//
// ShareToolbarItem.m
// Transmission
//
// Created by Mitchell Livingston on 1/8/14.
// Copyright (c) 2014 The Transmission Project. All rights reserved.
//
#import "ShareToolbarItem.h"
#import "ShareTorrentFileHelper.h"
#import "NSApplicationAdditions.h"
@implementation ShareToolbarItem
- (NSMenuItem*)menuFormRepresentation
{
NSMenuItem* menuItem = [[NSMenuItem alloc] initWithTitle:self.label action:nil keyEquivalent:@""];
menuItem.enabled = [self.target validateToolbarItem:self];
if (menuItem.enabled)
{
NSMenu* servicesMenu = [[NSMenu alloc] initWithTitle:@""];
for (NSMenuItem* item in ShareTorrentFileHelper.sharedHelper.menuItems)
{
[servicesMenu addItem:item];
}
menuItem.submenu = servicesMenu;
}
return menuItem;
}
@end