Changeset 3246
- Timestamp:
- 12/18/07 02:31:48 (13 months ago)
- Location:
- lang/objective-c/SafariHatenaBookmark
- Files:
-
- 2 added
- 1 removed
- 6 modified
-
Menu.nib/classes.nib (modified) (2 diffs)
-
Menu.nib/keyedobjects.nib (modified) (previous)
-
PluginLoader.h (modified) (1 diff)
-
PluginLoader.m (modified) (2 diffs)
-
SHBController.h (deleted)
-
SHBController.m (modified) (4 diffs)
-
SafariHatenaBookmark.xcodeproj/project.pbxproj (modified) (7 diffs)
-
shb_controller.rb (added)
-
shb_init.rb (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-c/SafariHatenaBookmark/Menu.nib/classes.nib
r3208 r3246 14 14 </dict> 15 15 <dict> 16 <key>ACTIONS</key>17 <dict>18 <key>bookmark</key>19 <string>id</string>20 <key>diary</key>21 <string>id</string>22 <key>haiku</key>23 <string>id</string>24 </dict>25 16 <key>CLASS</key> 26 17 <string>SHBController</string> … … 29 20 <key>OUTLETS</key> 30 21 <dict> 31 <key>top Menu</key>32 <string> NSMenu</string>22 <key>top_menu</key> 23 <string>id</string> 33 24 </dict> 34 25 <key>SUPERCLASS</key> -
lang/objective-c/SafariHatenaBookmark/PluginLoader.h
r3208 r3246 11 11 @interface PluginLoader : NSObject { 12 12 } 13 + (PluginLoader *) sharedInstance;14 13 15 14 @end -
lang/objective-c/SafariHatenaBookmark/PluginLoader.m
r3208 r3246 7 7 8 8 #import "PluginLoader.h" 9 #import "SHBController.h" 9 //#import "SHBController.h" 10 #import <RubyCocoa/RubyCocoa.h> 10 11 11 12 @implementation PluginLoader 12 /** 13 * A special method called by SIMBL once the application has started and all classes are initialized. 14 */ 15 + (void) load 13 14 + (void) install 16 15 { 17 16 // MySamplePlugin* plugin = [MySamplePlugin sharedInstance]; … … 19 18 20 19 NSLog(@"PluginLoader:load"); 21 [[SHBController alloc] init];} 22 23 /** 24 * @return the single static instance of the plugin object 25 */ 26 + (PluginLoader *) sharedInstance 27 { 28 static PluginLoader* plugin = nil; 29 30 if (plugin == nil) 31 plugin = [[PluginLoader alloc] init]; 32 33 return plugin; 20 //[[SHBController alloc] init]; 21 22 static int installed = 0; 23 if (! installed) { 24 if (RBBundleInit("shb_init.rb", self, nil)) 25 NSLog(@"PluginLoader.install: failed"); 26 else 27 installed = 1; 28 } 34 29 } 35 30 @end -
lang/objective-c/SafariHatenaBookmark/SHBController.m
r3211 r3246 48 48 - (void) progressStarted: (NSNotification*) n 49 49 { 50 WebView* webView = [n object];51 WebDataSource* source = [[webView mainFrame] provisionalDataSource];52 if (! source) {53 // source = [[webView mainFrame] provisionalDataSource];54 }55 NSURL* cur_url = [[source request] URL];50 WebView* webView = [n object]; 51 WebDataSource* source = [[webView mainFrame] provisionalDataSource]; 52 if (! source) { 53 // source = [[webView mainFrame] provisionalDataSource]; 54 } 55 NSURL* cur_url = [[source request] URL]; 56 56 57 NSLog(@"progressStarted: cur_url = %@", cur_url);57 NSLog(@"progressStarted: cur_url = %@", cur_url); 58 58 59 59 // construct request … … 80 80 - (void) progressFinished: (NSNotification*) n 81 81 { 82 WebView* webView = [n object];83 //NSURL* url = WebFrameRequestURL([webView mainFrame]);84 WebDataSource* source = [[webView mainFrame] provisionalDataSource];85 if (! source) {86 // source = [[webView mainFrame] provisionalDataSource];87 }88 NSURL* url = [[source request] URL];89 NSLog(@"progressFinished: url = %@", url);82 WebView* webView = [n object]; 83 //NSURL* url = WebFrameRequestURL([webView mainFrame]); 84 WebDataSource* source = [[webView mainFrame] provisionalDataSource]; 85 if (! source) { 86 // source = [[webView mainFrame] provisionalDataSource]; 87 } 88 NSURL* url = [[source request] URL]; 89 NSLog(@"progressFinished: url = %@", url); 90 90 } 91 91 … … 118 118 // callbacks 119 119 - (void) connection : (NSURLConnection *) connection 120 didReceiveResponse : (NSURLResponse *) response {120 didReceiveResponse : (NSURLResponse *) response { 121 121 NSDictionary *dicHead = [(NSHTTPURLResponse *)response allHeaderFields]; 122 122 NSLog(@"didReceiveResponse : %@", [dicHead objectForKey:@"Status"]); … … 125 125 126 126 - (void) connection : (NSURLConnection *) connection 127 didReceiveData : (NSData *) data {127 didReceiveData : (NSData *) data { 128 128 [receivedData appendData:data]; 129 129 } 130 130 131 - (void) connection : (NSURLConnection *) connection132 didFailWithError : (NSError *) error {133 NSLog(@"didFailWithError 1");134 // [connection release];135 [receivedData release];136 NSLog(@"didFailWithError 2");131 - (void) connection : (NSURLConnection *) connection 132 didFailWithError : (NSError *) error { 133 NSLog(@"didFailWithError 1"); 134 // [connection release]; 135 [receivedData release]; 136 NSLog(@"didFailWithError 2"); 137 137 } 138 138 139 139 - (void) connectionDidFinishLoading:(NSURLConnection *)connection { 140 NSLog(@"connectionDidFinishLoading: succeeded to load %d bytes", [receivedData length]);140 NSLog(@"connectionDidFinishLoading: succeeded to load %d bytes", [receivedData length]); 141 141 NSString *result = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding]; 142 142 NSLog(@"connectionDidFinishLoading: result=%@", result); 143 id json = [result JSONValue];144 NSLog(@"connectionDidFinishLoading: id=%@", json);145 146 // [connection release];147 [receivedData release];143 //id json = [result JSONValue]; 144 //NSLog(@"connectionDidFinishLoading: id=%@", json); 145 146 // [connection release]; 147 [receivedData release]; 148 148 } 149 149 150 151 150 @end -
lang/objective-c/SafariHatenaBookmark/SafariHatenaBookmark.xcodeproj/project.pbxproj
r3211 r3246 8 8 9 9 /* Begin PBXBuildFile section */ 10 868C20510D16E39E00CA07C9 /* shb_init.rb in Resources */ = {isa = PBXBuildFile; fileRef = 868C20500D16E39E00CA07C9 /* shb_init.rb */; }; 10 11 86A7D1C40D16634600D35D4C /* Info in Resources */ = {isa = PBXBuildFile; fileRef = 86A7D1C30D16634600D35D4C /* Info */; }; 11 12 86A7D1C80D16635D00D35D4C /* Menu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 86A7D1C70D16635D00D35D4C /* Menu.nib */; }; 12 86A7D1D10D16639600D35D4C /* SHBController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86A7D1CE0D16639600D35D4C /* SHBController.m */; };13 13 86A7D1D20D16639600D35D4C /* PluginLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 86A7D1D00D16639600D35D4C /* PluginLoader.m */; }; 14 86B04CD30D16DDD300EB7A83 /* RubyCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86B04CD20D16DDD300EB7A83 /* RubyCocoa.framework */; }; 15 86B04CE10D16DE6B00EB7A83 /* shb_controller.rb in Resources */ = {isa = PBXBuildFile; fileRef = 86B04CE00D16DE6B00EB7A83 /* shb_controller.rb */; }; 14 16 86C597AA0D166CC10000340D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C597A90D166CC10000340D /* WebKit.framework */; }; 15 86C597D00D1673140000340D /* JSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C597CF0D1673140000340D /* JSON.framework */; };16 17 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 17 18 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; … … 24 25 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 25 26 32DBCF630370AF2F00C91783 /* SafariHatenaBookmark_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SafariHatenaBookmark_Prefix.pch; sourceTree = "<group>"; }; 27 868C20500D16E39E00CA07C9 /* shb_init.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = shb_init.rb; sourceTree = "<group>"; }; 26 28 86A7D1C30D16634600D35D4C /* Info */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info; sourceTree = "<group>"; }; 27 29 86A7D1C70D16635D00D35D4C /* Menu.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = Menu.nib; sourceTree = "<group>"; }; 28 86A7D1CD0D16639600D35D4C /* SHBController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SHBController.h; sourceTree = "<group>"; };29 30 86A7D1CE0D16639600D35D4C /* SHBController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SHBController.m; sourceTree = "<group>"; }; 30 31 86A7D1CF0D16639600D35D4C /* PluginLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginLoader.h; sourceTree = "<group>"; }; 31 32 86A7D1D00D16639600D35D4C /* PluginLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginLoader.m; sourceTree = "<group>"; }; 33 86B04CD20D16DDD300EB7A83 /* RubyCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RubyCocoa.framework; path = /System/Library/Frameworks/RubyCocoa.framework; sourceTree = "<absolute>"; }; 34 86B04CE00D16DE6B00EB7A83 /* shb_controller.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = shb_controller.rb; sourceTree = "<group>"; }; 32 35 86C597A90D166CC10000340D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; }; 33 86C597CF0D1673140000340D /* JSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JSON.framework; sourceTree = "<group>"; };34 36 8D5B49B6048680CD000E48DA /* SafariHatenaBookmark.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SafariHatenaBookmark.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 35 37 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; … … 44 46 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */, 45 47 86C597AA0D166CC10000340D /* WebKit.framework in Frameworks */, 46 86 C597D00D1673140000340D /* JSON.framework in Frameworks */,48 86B04CD30D16DDD300EB7A83 /* RubyCocoa.framework in Frameworks */, 47 49 ); 48 50 runOnlyForDeploymentPostprocessing = 0; … … 66 68 isa = PBXGroup; 67 69 children = ( 70 86B04CD20D16DDD300EB7A83 /* RubyCocoa.framework */, 68 71 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, 69 72 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, … … 86 89 isa = PBXGroup; 87 90 children = ( 88 86A7D1CD0D16639600D35D4C /* SHBController.h */,89 91 86A7D1CE0D16639600D35D4C /* SHBController.m */, 90 86C597CF0D1673140000340D /* JSON.framework */,91 92 86C597A90D166CC10000340D /* WebKit.framework */, 92 93 86A7D1CF0D16639600D35D4C /* PluginLoader.h */, 93 94 86A7D1D00D16639600D35D4C /* PluginLoader.m */, 95 86B04CE00D16DE6B00EB7A83 /* shb_controller.rb */, 96 868C20500D16E39E00CA07C9 /* shb_init.rb */, 94 97 ); 95 98 name = Classes; … … 176 179 86A7D1C40D16634600D35D4C /* Info in Resources */, 177 180 86A7D1C80D16635D00D35D4C /* Menu.nib in Resources */, 181 86B04CE10D16DE6B00EB7A83 /* shb_controller.rb in Resources */, 182 868C20510D16E39E00CA07C9 /* shb_init.rb in Resources */, 178 183 ); 179 184 runOnlyForDeploymentPostprocessing = 0; … … 186 191 buildActionMask = 2147483647; 187 192 files = ( 188 86A7D1D10D16639600D35D4C /* SHBController.m in Sources */,189 193 86A7D1D20D16639600D35D4C /* PluginLoader.m in Sources */, 190 194 );
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)