1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

clean code up a little

This commit is contained in:
Mitchell Livingston 2007-08-18 01:56:10 +00:00
parent 5c2f4e5fd1
commit 41d5f3c8f5
2 changed files with 52 additions and 50 deletions

View file

@ -521,7 +521,6 @@ static int static_lastid = 0;
return fStat->ratio; return fStat->ratio;
} }
#warning make enum
- (int) ratioSetting - (int) ratioSetting
{ {
return fRatioSetting; return fRatioSetting;

View file

@ -352,9 +352,6 @@
BOOL create = [menu numberOfItems] <= 0, folder; BOOL create = [menu numberOfItems] <= 0, folder;
NSMenu * supermenu = [menu supermenu];
NSArray * items;
NSDictionary * folderDict;
#warning move to submethod #warning move to submethod
if (menu == fUploadMenu || menu == fDownloadMenu) if (menu == fUploadMenu || menu == fDownloadMenu)
{ {
@ -391,12 +388,16 @@
return; return;
} }
else if ((folderDict = [[supermenu itemAtIndex: [supermenu indexOfItemWithSubmenu: menu]] representedObject])) else if ([menu supermenu]) //assume the menu is part of the file list
items = [[[supermenu itemAtIndex: [supermenu indexOfItemWithSubmenu: menu]] representedObject] objectForKey: @"Children"]; {
NSMenu * supermenu = [menu supermenu];
NSArray * items;
NSDictionary * folderDict;
if ((folderDict = [[supermenu itemAtIndex: [supermenu indexOfItemWithSubmenu: menu]] representedObject]))
items = [folderDict objectForKey: @"Children"];
else else
items = [fMenuTorrent fileList]; items = [fMenuTorrent fileList];
#warning move rest to submethod
NSEnumerator * enumerator = [items objectEnumerator]; NSEnumerator * enumerator = [items objectEnumerator];
NSDictionary * dict; NSDictionary * dict;
NSMenuItem * item; NSMenuItem * item;
@ -446,12 +447,14 @@
[item setState: [fMenuTorrent checkForFiles: indexSet]]; [item setState: [fMenuTorrent checkForFiles: indexSet]];
[item setEnabled: [fMenuTorrent canChangeDownloadCheckForFiles: indexSet]]; [item setEnabled: [fMenuTorrent canChangeDownloadCheckForFiles: indexSet]];
} }
}
else;
} }
- (void) setQuickLimitMode: (id) sender - (void) setQuickLimitMode: (id) sender
{ {
int tag = [sender tag]; int tag = [sender tag];
int mode; tr_speedlimit_t mode;
if (tag == ACTION_MENU_UNLIMITED_TAG) if (tag == ACTION_MENU_UNLIMITED_TAG)
mode = TR_SPEEDLIMIT_UNLIMITED; mode = TR_SPEEDLIMIT_UNLIMITED;
else if (tag == ACTION_MENU_LIMIT_TAG) else if (tag == ACTION_MENU_LIMIT_TAG)