[aquaskk-changes 150] CVS update: AquaSKK

Zurück zum Archiv-Index

Tomotaka SUWA t-suw****@users*****
2006年 2月 21日 (火) 23:58:51 JST


Index: AquaSKK/AquaSKKServer.mm
diff -u AquaSKK/AquaSKKServer.mm:1.1.2.2 AquaSKK/AquaSKKServer.mm:1.1.2.3
--- AquaSKK/AquaSKKServer.mm:1.1.2.2	Sun Feb 19 13:50:54 2006
+++ AquaSKK/AquaSKKServer.mm	Tue Feb 21 23:58:51 2006
@@ -1,5 +1,5 @@
 /* -*- objc -*-
-  $Id: AquaSKKServer.mm,v 1.1.2.2 2006/02/19 04:50:54 t-suwa Exp $
+  $Id: AquaSKKServer.mm,v 1.1.2.3 2006/02/21 14:58:51 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -54,8 +54,20 @@
 - (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
     NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
 
+    // Ž«‘‚Ì”z—ñ‚ðƒ[ƒh‚·‚é
+    NSString* error;
+    NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info];
+    NSData* plist = [NSData dataWithContentsOfFile:path];
+    NSArray* content = [NSPropertyListSerialization propertyListFromData:plist
+						    mutabilityOption:NSPropertyListImmutable
+						    format:nil errorDescription:&error];
+    if(!content) {
+	NSLog(@"loading plist[%@] failed: %@\n", path, error);
+	[error release];
+    }
+
     // Ž«‘ƒT[ƒo[‚ð‹N“®‚·‚é
-    DictionarySet::theInstance().initialize();
+    DictionarySet::theInstance().initialize((CFArrayRef)content);
 
     // ƒƒbƒZ[ƒWƒnƒ“ƒhƒ‰‚ð‹N“®‚·‚é
     ServerMessageReceiver::start(kAquaSKKServerRunLoopMode);
Index: AquaSKK/ChangeLog
diff -u AquaSKK/ChangeLog:1.20.2.8 AquaSKK/ChangeLog:1.20.2.9
--- AquaSKK/ChangeLog:1.20.2.8	Sun Feb 19 16:09:11 2006
+++ AquaSKK/ChangeLog	Tue Feb 21 23:58:51 2006
@@ -1,3 +1,14 @@
+2006-02-21  Tomotaka SUWA  <t.suw****@mac*****>
+
+	* PreferencesController.*: NSArrayController ‚Æ
+	NSUserDefaultsController ‚ðƒoƒCƒ“ƒh‚·‚é‚ƁAPanther ‚Å–â‘肪‚ ‚邱‚Æ
+	‚ª”»–¾‚µ‚½‚½‚߁AŽ«‘‚Ì”z—ñ‚ð“ÆŽ©‚Ì plist ‚É•Û‘¶/ƒ[ƒh‚·‚é‚悤‚ɏC
+	³B
+
+	* DictionarySet.*: Ž«‘‚Ì”z—ñ‚©‚珉Šú‰»‚·‚é‚悤‚ɏC³B
+
+	* AquaSKKServer.mm: Ž«‘‚Ì”z—ñ‚ð plist ‚©‚烍[ƒh‚·‚é‚悤‚ɏC³B
+
 2006-02-19  Tomotaka SUWA  <t.suw****@mac*****>
 
 	* Package/scripts/postflight: ƒCƒ“ƒXƒg[ƒ‹Œã‚ɁAplist ‚̈ڍs‚ðƒTƒ|[
Index: AquaSKK/DictionarySet.cpp
diff -u AquaSKK/DictionarySet.cpp:1.1.2.2 AquaSKK/DictionarySet.cpp:1.1.2.3
--- AquaSKK/DictionarySet.cpp:1.1.2.2	Sun Feb 19 13:50:54 2006
+++ AquaSKK/DictionarySet.cpp	Tue Feb 21 23:58:51 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: DictionarySet.cpp,v 1.1.2.2 2006/02/19 04:50:54 t-suwa Exp $
+  $Id: DictionarySet.cpp,v 1.1.2.3 2006/02/21 14:58:51 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -119,13 +119,7 @@
     return id.str();
 }
 
-void DictionarySet::load() {
-    CFArrayRef arrayRef = (CFArrayRef)CFPreferencesCopyAppValue(CFSTR("dictionary_info_array"),
-								kCFPreferencesCurrentApplication);
-    if(arrayRef == NULL) {
-	return;
-    }
-
+void DictionarySet::load(CFArrayRef arrayRef) {
     // ŒÃ‚¢î•ñ‚ðƒNƒŠƒA‚·‚é
     prefs_.clear();
 
@@ -175,7 +169,6 @@
 	}
 	CFRelease(dictRef);
     }
-    CFRelease(arrayRef);
 }
 
 DictionarySet::DictionarySet() {
@@ -193,9 +186,13 @@
     return obj;
 }
 
-void DictionarySet::initialize() {
+void DictionarySet::initialize(CFArrayRef arrayRef) {
     // Ž«‘‚ðƒ[ƒh‚·‚é
-    load();
+    if(arrayRef) {
+	CFRetain(arrayRef);
+	load(arrayRef);
+	CFRelease(arrayRef);
+    }
 }
 
 void DictionarySet::terminate() {
Index: AquaSKK/DictionarySet.h
diff -u AquaSKK/DictionarySet.h:1.1.2.1 AquaSKK/DictionarySet.h:1.1.2.2
--- AquaSKK/DictionarySet.h:1.1.2.1	Sat Feb 18 02:20:38 2006
+++ AquaSKK/DictionarySet.h	Tue Feb 21 23:58:51 2006
@@ -1,5 +1,5 @@
 /* -*- c++ -*-
-  $Id: DictionarySet.h,v 1.1.2.1 2006/02/17 17:20:38 t-suwa Exp $
+  $Id: DictionarySet.h,v 1.1.2.2 2006/02/21 14:58:51 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -60,7 +60,7 @@
 
     Dictionary* createDictionary(const DictionaryPref& pref) const;
     std::string generateID(const DictionaryPref& pref) const;
-    void load();
+    void load(CFArrayRef arrayRef);
 
     DictionarySet();
     ~DictionarySet();
@@ -68,7 +68,7 @@
 public:
     static DictionarySet& theInstance();
 
-    void initialize();
+    void initialize(CFArrayRef arrayRef);
     void terminate();
 
     CppCFString skkserv_style_search(const CppCFString& query);
Index: AquaSKK/PreferenceKeys.h
diff -u AquaSKK/PreferenceKeys.h:1.1.2.1 AquaSKK/PreferenceKeys.h:1.1.2.2
--- AquaSKK/PreferenceKeys.h:1.1.2.1	Sun Feb 19 13:50:54 2006
+++ AquaSKK/PreferenceKeys.h	Tue Feb 21 23:58:51 2006
@@ -1,5 +1,5 @@
 /* -*- objc -*-
-  $Id: PreferenceKeys.h,v 1.1.2.1 2006/02/19 04:50:54 t-suwa Exp $
+  $Id: PreferenceKeys.h,v 1.1.2.2 2006/02/21 14:58:51 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -36,10 +36,11 @@
 extern NSString* KEY_candidates_window_alpha;
 extern NSString* KEY_candidates_window_show_after_nth_cand;
 
-extern NSString* KEY_dictionary_info_array;
-
 extern NSString* KEY_skkserv_enabled;
 extern NSString* KEY_skkserv_port;
 extern NSString* KEY_skkserv_localonly;
 
+// ŒŸõŽ«‘‚Ì”z—ñ‚ð’è‹`‚·‚é plist ƒtƒ@ƒCƒ‹(ƒz[ƒ€ƒfƒBƒŒƒNƒgƒŠ‚©‚ç‚Ì‘Š‘΃pƒX)
+extern NSString* PLIST_dictionary_info;
+
 #endif
Index: AquaSKK/PreferencesController.h
diff -u AquaSKK/PreferencesController.h:1.6.2.5 AquaSKK/PreferencesController.h:1.6.2.6
--- AquaSKK/PreferencesController.h:1.6.2.5	Sun Feb 19 13:50:54 2006
+++ AquaSKK/PreferencesController.h	Tue Feb 21 23:58:51 2006
@@ -1,5 +1,5 @@
 /* -*- objc -*-
-  $Id: PreferencesController.h,v 1.6.2.5 2006/02/19 04:50:54 t-suwa Exp $
+  $Id: PreferencesController.h,v 1.6.2.6 2006/02/21 14:58:51 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -21,9 +21,12 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#include "DictArrayController.h"
+
 @interface PreferencesController : NSWindowController {
     IBOutlet NSPopUpButton* kbdLayoutPopUp;
     IBOutlet NSButton* fontButton;
+    IBOutlet DictArrayController* dictArray;
 
     NSFont* font;
     NSFontPanel* fontPanel;
Index: AquaSKK/PreferencesController.mm
diff -u AquaSKK/PreferencesController.mm:1.6.2.7 AquaSKK/PreferencesController.mm:1.6.2.8
--- AquaSKK/PreferencesController.mm:1.6.2.7	Sun Feb 19 13:50:54 2006
+++ AquaSKK/PreferencesController.mm	Tue Feb 21 23:58:51 2006
@@ -1,5 +1,5 @@
 /*  -*- objc -*-
-  $Id: PreferencesController.mm,v 1.6.2.7 2006/02/19 04:50:54 t-suwa Exp $
+  $Id: PreferencesController.mm,v 1.6.2.8 2006/02/21 14:58:51 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -43,12 +43,13 @@
 NSString* KEY_candidates_window_alpha = @"candidates_window_alpha";
 NSString* KEY_candidates_window_show_after_nth_cand = @"candidates_window_show_after_nth_cand";
 
-NSString* KEY_dictionary_info_array = @"dictionary_info_array";
-
 NSString* KEY_skkserv_enabled = @"skkserv_enabled";
 NSString* KEY_skkserv_port = @"skkserv_port";
 NSString* KEY_skkserv_localonly = @"skkserv_localonly";
 
+// ŒŸõŽ«‘‚Ì”z—ñ‚ð’è‹`‚·‚é plist ƒtƒ@ƒCƒ‹(ƒz[ƒ€ƒfƒBƒŒƒNƒgƒŠ‚©‚ç‚Ì‘Š‘΃pƒX)
+NSString* PLIST_dictionary_info = @"/Library/AquaSKK/DictionarySet.plist";
+
 // ƒL[ƒ{[ƒhƒŒƒCƒAƒEƒg—p
 const NSString* KbdIdKey = @"Identifier";
 const NSString* KbdNameKey = @"LocalizedName";
@@ -145,6 +146,20 @@
 		    size:[defaults floatForKey:KEY_candidates_font_size]] retain];
     [self setFontButtonTitle:font];
 
+    // Ž«‘‚Ì”z—ñ‚ðƒ[ƒh‚·‚é
+    NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info];
+    NSString* error;
+    NSData* plist = [NSData dataWithContentsOfFile:path];
+    NSMutableArray* content = [NSPropertyListSerialization propertyListFromData:plist
+							   mutabilityOption:NSPropertyListMutableContainersAndLeaves
+							   format:nil errorDescription:&error];
+    if(content) {
+	[dictArray setContent:content];
+    } else {
+	NSLog(@"loading plist failed: %@\n", error);
+	[error release];
+    }
+
     return self;
 }
 
@@ -162,11 +177,23 @@
     [defaults synchronize];
     [fontPanel close];
 
+    // Ž«‘‚Ì”z—ñ‚ð XML Œ`Ž®‚Å•Û‘¶‚·‚é
+    NSString* error;
+    NSData* plist = [NSPropertyListSerialization dataFromPropertyList:[dictArray content]
+						 format:NSPropertyListXMLFormat_v1_0 errorDescription:&error];
+    if(plist) {
+	NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info];
+	[plist writeToFile:path atomically:YES];
+    } else {
+	NSLog(@"saving plist failed: %@\n", error);
+	[error release];
+    }
+
     // ƒNƒ‰ƒCƒ“ƒg‚ɕύX‚ð’Ê’m‚·‚é
     ClientConnectionFactory::theInstance().newConnection().send(kSKKClientConfigurationModified, CppCFData());
 
     // Ä“xAŽ«‘ƒT[ƒo[‚ð‰Šú‰»‚·‚é
-    DictionarySet::theInstance().initialize();
+    DictionarySet::theInstance().initialize((CFArrayRef)[dictArray content]);
 
     // skkserv ƒGƒ~ƒ…ƒŒ[ƒVƒ‡ƒ“‚̍ċN“®
     skkserv& skkserv = skkserv::theInstance();


aquaskk-changes メーリングリストの案内
Zurück zum Archiv-Index