1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 21:45:49 +00:00
transmission/macosx/ShareToolbarItem.m
Dmitry Serov af3a4d4557
Modern Objective-C syntax (#509)
* Update enabled complier warnings

* Convert to Modern Objective-C syntax using Xcode's tool

* Convert to modern objc syntax manually, fix some PR issues

* Remove unnecessary parentheses

* Use property syntax for all custom properties

* Use property syntax for all system properties

* Fix erroneously autoreleased values

* Revert VDKQueue to old objc syntax

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
Co-authored-by: Mitch Livingston <livings124@mac.com>
2021-08-07 10:27:56 +03:00

33 lines
830 B
Objective-C

//
// 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