mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
34 lines
939 B
Objective-C
34 lines
939 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 setEnabled: [[self target] validateToolbarItem: self]];
|
|
|
|
if ([menuItem isEnabled]) {
|
|
NSMenu *servicesMenu = [[NSMenu alloc] initWithTitle: @""];
|
|
for (NSMenuItem * item in [[ShareTorrentFileHelper sharedHelper] menuItems])
|
|
{
|
|
[servicesMenu addItem:item];
|
|
}
|
|
|
|
[menuItem setSubmenu:servicesMenu];
|
|
[servicesMenu release]; // can't believe we're not using ARC yet!
|
|
}
|
|
|
|
return menuItem;
|
|
}
|
|
|
|
@end
|