2014-01-09 16:23:54 +00:00
|
|
|
//
|
|
|
|
// ShareToolbarItem.m
|
|
|
|
// Transmission
|
|
|
|
//
|
|
|
|
// Created by Mitchell Livingston on 1/8/14.
|
|
|
|
// Copyright (c) 2014 The Transmission Project. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "ShareToolbarItem.h"
|
2014-01-10 17:50:05 +00:00
|
|
|
#import "ShareTorrentFileHelper.h"
|
2014-01-09 16:23:54 +00:00
|
|
|
#import "NSApplicationAdditions.h"
|
|
|
|
|
|
|
|
@implementation ShareToolbarItem
|
|
|
|
|
|
|
|
- (NSMenuItem *) menuFormRepresentation
|
|
|
|
{
|
|
|
|
NSMenuItem * menuItem = [[NSMenuItem alloc] initWithTitle: [self label] action: nil keyEquivalent: @""];
|
|
|
|
[menuItem setEnabled: [[self target] validateToolbarItem: self]];
|
2017-01-24 17:53:16 +00:00
|
|
|
|
2014-01-10 17:50:05 +00:00
|
|
|
if ([menuItem isEnabled]) {
|
2014-01-09 16:23:54 +00:00
|
|
|
NSMenu *servicesMenu = [[NSMenu alloc] initWithTitle: @""];
|
2014-01-10 17:50:05 +00:00
|
|
|
for (NSMenuItem * item in [[ShareTorrentFileHelper sharedHelper] menuItems])
|
2014-01-09 16:23:54 +00:00
|
|
|
{
|
|
|
|
[servicesMenu addItem:item];
|
|
|
|
}
|
2017-01-24 17:53:16 +00:00
|
|
|
|
2014-01-09 16:23:54 +00:00
|
|
|
[menuItem setSubmenu:servicesMenu];
|
|
|
|
[servicesMenu release]; // can't believe we're not using ARC yet!
|
|
|
|
}
|
2017-01-24 17:53:16 +00:00
|
|
|
|
2014-01-09 16:23:54 +00:00
|
|
|
return menuItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|