Revision: 18388
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18388&view=rev
Author:   hofman
Date:     2012-01-10 11:26:16 +0000 (Tue, 10 Jan 2012)
Log Message:
-----------
only update error editor window title when window was loaded

Modified Paths:
--------------
    trunk/bibdesk/BDSKErrorEditor.m

Modified: trunk/bibdesk/BDSKErrorEditor.m
===================================================================
--- trunk/bibdesk/BDSKErrorEditor.m     2012-01-10 07:35:55 UTC (rev 18387)
+++ trunk/bibdesk/BDSKErrorEditor.m     2012-01-10 11:26:16 UTC (rev 18388)
@@ -101,7 +101,7 @@
     return @"BDSKErrorEditWindow";
 }
 
-- (void)awakeFromNib;
+- (void)windowDidLoad;
 {
     [self setWindowFrameAutosaveNameOrCascade:@"Edit Source Window"];
 
@@ -133,22 +133,23 @@
     [[self window] setRepresentedFilename:fileName];
        [[self window] setTitle:[NSString stringWithFormat:@"%@: %@", prefix, 
[manager displayName]]];
     
-       [[NSNotificationCenter defaultCenter] addObserver:self
-                                                                               
         selector:@selector(handleSelectionDidChangeNotification:)
-                                                                               
                 name:NSTextViewDidChangeSelectionNotification
-                                                                               
           object:textView];
-       [[NSNotificationCenter defaultCenter] addObserver:self
-                                                                               
         selector:@selector(handleUndoManagerChangeUndoneNotification:)
-                                                                               
                 name:NSUndoManagerDidUndoChangeNotification
-                                                                               
           object:[[self window] undoManager]];
-       [[NSNotificationCenter defaultCenter] addObserver:self
-                                                                               
         selector:@selector(handleUndoManagerChangeDoneNotification:)
-                                                                               
                 name:NSUndoManagerDidRedoChangeNotification
-                                                                               
           object:[[self window] undoManager]];
-       [[NSNotificationCenter defaultCenter] addObserver:self
-                                                                               
         selector:@selector(handleUndoManagerChangeDoneNotification:)
-                                                                               
                 name:NSUndoManagerWillCloseUndoGroupNotification
-                                                                               
           object:[[self window] undoManager]];
+    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+    [nc addObserver:self
+           selector:@selector(handleSelectionDidChangeNotification:)
+               name:NSTextViewDidChangeSelectionNotification
+             object:textView];
+    [nc addObserver:self
+           selector:@selector(handleUndoManagerChangeUndoneNotification:)
+               name:NSUndoManagerDidUndoChangeNotification
+             object:[[self window] undoManager]];
+    [nc addObserver:self
+           selector:@selector(handleUndoManagerChangeDoneNotification:)
+               name:NSUndoManagerDidRedoChangeNotification
+             object:[[self window] undoManager]];
+    [nc addObserver:self
+           selector:@selector(handleUndoManagerChangeDoneNotification:)
+               name:NSUndoManagerWillCloseUndoGroupNotification
+             object:[[self window] undoManager]];
 }
 
 - (void)windowWillClose:(NSNotification *)notification{
@@ -224,8 +225,10 @@
         if(object == manager && [keyPath isEqualToString:@"displayName"]){
             [self updateDisplayName];
             
-            NSString *prefix = (isPasteDrag) ? NSLocalizedString(@"Paste/Drag 
Data", @"Partial window title") : NSLocalizedString(@"Source Data", @"Partial 
window title");
-            [[self window] setTitle:[NSString stringWithFormat:@"%@: %@", 
prefix, [manager displayName]]];
+            if ([self isWindowLoaded]) {
+                NSString *prefix = (isPasteDrag) ? 
NSLocalizedString(@"Paste/Drag Data", @"Partial window title") : 
NSLocalizedString(@"Source Data", @"Partial window title");
+                [[self window] setTitle:[NSString stringWithFormat:@"%@: %@", 
prefix, [manager displayName]]];
+            }
         }
     } else {
         [super observeValueForKeyPath:keyPath ofObject:object change:change 
context:context];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to