Permalink
Browse files

separated toolbar item identifiers from localized descriptions in pre…

…ferences window
  • Loading branch information...
1 parent 33f5ce7 commit 2f20a767fe9c2ee63c7dba2bcb27494fd0fbd7b5 Zachary Schneirov committed Feb 4, 2010
Showing with 12 additions and 18 deletions.
  1. +0 −1 AppController.m
  2. +0 −2 NotationPrefsViewController.m
  3. +0 −1 PrefsWindowController.h
  4. +12 −14 PrefsWindowController.m
View
@@ -66,7 +66,6 @@ - (void)awakeFromNib {
[toolbar setDelegate:self];
[window setToolbar:toolbar];
- //[[window standardWindowButton:NSWindowToolbarButton] setFrame:NSZeroRect];
[window setShowsToolbarButton:NO];
titleBarButton = [[TitlebarButton alloc] initWithFrame:NSMakeRect(0, 0, 17.0, 17.0) pullsDown:YES];
[titleBarButton addToWindow:window];
@@ -68,7 +68,6 @@ - (void)dealloc {
- (void)awakeFromNib {
didAwakeFromNib = YES;
-
[allowedExtensionsTable setDataSource:self];
[allowedTypesTable setDataSource:self];
[allowedExtensionsTable setDelegate:self];
@@ -402,7 +401,6 @@ - (void)cancelLoginVerifier {
- (void)startLoginVerifier {
if (!loginVerifier && [[syncAccountField stringValue] length] && [[syncPasswordField stringValue] length]) {
-
NSURL *loginURL = [SimplenoteSession servletURLWithPath:@"/api/login" parameters:nil];
loginVerifier = [[SyncResponseFetcher alloc] initWithURL:loginURL bodyStringAsUTF8B64:
[[NSDictionary dictionaryWithObjectsAndKeys: [syncAccountField stringValue], @"email", [syncPasswordField stringValue], @"password", nil]
@@ -31,7 +31,6 @@
IBOutlet NSWindow *window;
IBOutlet NSView *editingView, *generalView, *databaseView, *notationPrefsView;
- NSString *EditingPref, *GeneralPref, *NotesPref;
GlobalPrefs *prefsController;
}
@@ -14,10 +14,6 @@ - (id)init {
prefsController = [GlobalPrefs defaultPrefs];
fontPanelWasOpen = NO;
- EditingPref = NSLocalizedString(@"Editing", @"title of Editing preference pane");
- GeneralPref = NSLocalizedString(@"General", @"title of General preference pane");
- NotesPref = NSLocalizedString(@"Notes", @"title of Notes preference pane");
-
[prefsController registerForSettingChange:@selector(resolveNoteBodyFontFromNotationPrefsFromSender:) withTarget:self];
[prefsController registerForSettingChange:@selector(setCheckSpellingAsYouType:sender:) withTarget:self];
}
@@ -321,8 +317,10 @@ - (NSView*)databaseView {
- (void)addToolbarItemWithName:(NSString*)name {
NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:name];
- [item setPaletteLabel:name];
- [item setLabel:name];
+
+ NSString *localizedTitle = [[NSBundle mainBundle] localizedStringForKey:name value:@"" table:nil];
+ [item setPaletteLabel:localizedTitle];
+ [item setLabel:localizedTitle];
//[item setToolTip:@"General settings: appearance and behavior"];
[item setImage:[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:name ofType:@"tiff"]] autorelease]];
[item setTarget:self];
@@ -363,9 +361,9 @@ - (void)awakeFromNib {
items = [[NSMutableDictionary alloc] init];
- [self addToolbarItemWithName:GeneralPref];
- [self addToolbarItemWithName:NotesPref];
- [self addToolbarItemWithName:EditingPref];
+ [self addToolbarItemWithName:@"General"];
+ [self addToolbarItemWithName:@"Notes"];
+ [self addToolbarItemWithName:@"Editing"];
toolbar = [[NSToolbar alloc] initWithIdentifier:@"preferencePanes"];
[toolbar setDelegate:self];
@@ -374,7 +372,7 @@ - (void)awakeFromNib {
[window setToolbar:toolbar];
[toolbar release]; //setToolbar retains the toolbar we pass, so release the one we used.
- [[window standardWindowButton:NSWindowToolbarButton] setFrame:NSZeroRect];
+ [window setShowsToolbarButton:NO];
[self switchViews:nil]; //select last selected pane by default
@@ -390,7 +388,7 @@ - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)theToolbar {
}
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)theToolbar {
- return [NSArray arrayWithObjects:GeneralPref, NotesPref, EditingPref, nil];
+ return [NSArray arrayWithObjects:@"General", @"Notes", @"Editing", nil];
}
- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar {
@@ -413,11 +411,11 @@ - (void)switchViews:(NSToolbarItem *)item {
[window setTitle:sender];
- if ([sender isEqualToString:GeneralPref]){
+ if ([sender isEqualToString:@"General"]){
prefsView = generalView;
- } else if([sender isEqualToString:NotesPref]) {
+ } else if([sender isEqualToString:@"Notes"]) {
prefsView = [self databaseView];
- } else if([sender isEqualToString:EditingPref]) {
+ } else if([sender isEqualToString:@"Editing"]) {
prefsView = editingView;
}

0 comments on commit 2f20a76

Please sign in to comment.