Revision: 17938
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=17938&view=rev
Author:   hofman
Date:     2011-06-05 11:51:20 +0000 (Sun, 05 Jun 2011)

Log Message:
-----------
Only replace document setup from xattr for Save and Save As.

Modified Paths:
--------------
    trunk/bibdesk/BibDocument.h
    trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2011-06-05 06:36:50 UTC (rev 17937)
+++ trunk/bibdesk/BibDocument.h 2011-06-05 11:51:20 UTC (rev 17938)
@@ -272,7 +272,7 @@
  */
 - (id)init;
 
-- (void)saveWindowSetupInExtendedAttributesAtURL:(NSURL *)anURL 
forEncoding:(NSStringEncoding)encoding;
+- (NSDictionary *)saveWindowSetupInExtendedAttributesAtURL:(NSURL *)anURL 
forEncoding:(NSStringEncoding)encoding;
 - (NSDictionary *)mainWindowSetupDictionaryFromExtendedAttributes;
 - (BOOL)isMainDocument;
 - (BOOL)commitPendingEdits;

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2011-06-05 06:36:50 UTC (rev 17937)
+++ trunk/bibdesk/BibDocument.m 2011-06-05 11:51:20 UTC (rev 17938)
@@ -695,13 +695,15 @@
     return mainWindowSetupDictionary;
 }
 
-- (void)saveWindowSetupInExtendedAttributesAtURL:(NSURL *)anURL 
forEncoding:(NSStringEncoding)encoding {
+- (NSDictionary *)saveWindowSetupInExtendedAttributesAtURL:(NSURL *)anURL 
forEncoding:(NSStringEncoding)encoding {
     
     NSString *path = [anURL path];
+    NSMutableDictionary *dictionary = nil;
+    
     if (path && [[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKDisableDocumentExtendedAttributesKey] == NO) {
         
         // We could set each of these as a separate attribute name on the 
file, but then we'd need to muck around with prepending 
net.sourceforge.bibdesk. to each key, and that seems messy.
-        NSMutableDictionary *dictionary = [[self 
mainWindowSetupDictionaryFromExtendedAttributes] mutableCopy];
+        dictionary = [[self mainWindowSetupDictionaryFromExtendedAttributes] 
mutableCopy];
         
         [dictionary setObject:[[[tableView tableColumnIdentifiers] 
arrayByRemovingObject:BDSKImportOrderString] 
arrayByRemovingObject:BDSKRelevanceString] forKey:BDSKShownColsNamesKey];
         [dictionary setObject:[self currentTableColumnWidthsAndIdentifiers] 
forKey:BDSKColumnWidthsKey];
@@ -764,9 +766,6 @@
         }
         [dictionary setObject:groupsToExpand 
forKey:BDSKDocumentGroupsToExpandKey];
         
-        [mainWindowSetupDictionary release];
-        mainWindowSetupDictionary = [dictionary copy];
-        
         NSError *error;
         
         if ([[SKNExtendedAttributeManager sharedNoSplitManager] 
setExtendedAttributeNamed:BDSKMainWindowExtendedAttributeKey 
@@ -784,9 +783,9 @@
                 }
             }
         }
-        
-        [dictionary release];
-    } 
+    }
+    
+    return [dictionary autorelease];
 }
 
 #pragma mark -
@@ -1091,8 +1090,13 @@
         }
         
         // save our window setup if we save or export to BibTeX
-        if ([[self class] isNativeType:typeName] || [typeName 
isEqualToString:BDSKMinimalBibTeXDocumentType])
-            [self saveWindowSetupInExtendedAttributesAtURL:saveTargetURL 
forEncoding:encoding];
+        if ([[self class] isNativeType:typeName] || [typeName 
isEqualToString:BDSKMinimalBibTeXDocumentType]) {
+            NSDictionary *dictionary = [self 
saveWindowSetupInExtendedAttributesAtURL:saveTargetURL forEncoding:encoding];
+            if (dictionary && (docState.currentSaveOperationType == 
NSSaveOperation || docState.currentSaveOperationType == NSSaveAsOperation)) {
+                [mainWindowSetupDictionary release];
+                mainWindowSetupDictionary = [dictionary copy];
+            }
+        }
     }
     
     BDSKDESTROY(saveTargetURL);


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

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to