From 9cbae0171595e4afbd6109098b89f1922c623827 Mon Sep 17 00:00:00 2001 From: mltownsend Date: Tue, 11 Aug 2009 20:45:28 +0000 Subject: Fix some MainMenu references by index. --- Source/SPUserManager.m | 9 ++++----- Source/TableDocument.m | 15 ++++++++++++--- Source/TablesList.m | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index 8fddb2aa..000880ee 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -67,10 +67,6 @@ @"Replication_slave_priv",@"Repl_slave_priv", @"Replication_client_priv",@"Repl_client_priv",nil] retain]; - if (!outlineView) { - [NSBundle loadNibNamed:@"UserManagerView" owner:self]; - } - return self; } @@ -292,7 +288,10 @@ - (void)show { -// [NSThread detachNewThreadSelector:@selector(_initializeUsers) toTarget:self withObject:nil]; +// [NSThread detachNewThreadSelector:@selector(_initializeUsers) toTarget:self withObject:nil]; + if (!outlineView) { + [NSBundle loadNibNamed:@"UserManagerView" owner:self]; + } [window makeKeyAndOrderFront:nil]; } diff --git a/Source/TableDocument.m b/Source/TableDocument.m index ee314b65..523031cd 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -194,6 +194,14 @@ [tableDataInstance setConnection:mySQLConnection]; [extendedTableInfoInstance setConnection:mySQLConnection]; [databaseDataInstance setConnection:mySQLConnection]; + if (userManagerInstance == nil) + { + userManagerInstance = [[SPUserManager alloc] initWithConnection:mySQLConnection]; + } + else + { + [userManagerInstance setConnection:mySQLConnection]; + } // Set the cutom query editor's MySQL version [customQueryInstance setMySQLversion:mySQLVersion]; @@ -679,7 +687,7 @@ // Get the menu item for showing and hiding the console. This is isn't the best way to get it as any // changes to the menu structure will result in the wrong item being selected. - NSMenuItem *menuItem = [[[[NSApp mainMenu] itemAtIndex:3] submenu] itemAtIndex:5]; + NSMenuItem *menuItem = [[[[NSApp mainMenu] itemWithTitle:@"View"] submenu] itemAtIndex:5]; // Only update the menu item title if its the menu item and not the toolbar [menuItem setTitle:(!isConsoleVisible) ? NSLocalizedString(@"Hide Console", @"Hide Console") : NSLocalizedString(@"Show Console", @"Show Console")]; @@ -2551,6 +2559,7 @@ if (mySQLVersion) [mySQLVersion release]; [allDatabases release]; if(queryEditorInitString) [queryEditorInitString release]; + if(userManagerInstance) [userManagerInstance release]; [super dealloc]; } @@ -2559,9 +2568,9 @@ if (userManagerInstance == nil) { userManagerInstance = [[SPUserManager alloc] initWithConnection:mySQLConnection]; - } else { - [userManagerInstance show]; } + + [userManagerInstance show]; } @end diff --git a/Source/TablesList.m b/Source/TablesList.m index 4f852f9b..8be7a505 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -1090,7 +1090,7 @@ // Set gear menu items Remove/Duplicate table/view and mainMenu > Table items // according to the table types - NSMenu *tableSubMenu = [[[NSApp mainMenu] itemAtIndex:5] submenu]; + NSMenu *tableSubMenu = [[[NSApp mainMenu] itemWithTitle:@"Table"] submenu]; if(selectedTableType == SP_TABLETYPE_VIEW) { -- cgit v1.2.3