Changeset 3250 for lang/objective-c

Show
Ignore:
Timestamp:
12/18/07 03:23:34 (6 years ago)
Author:
mootoh
Message:

lang/objective-c/SafariHatenaBookmark: fetch HatenaBookmark? via Ruby methods.

Location:
lang/objective-c/SafariHatenaBookmark
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/objective-c/SafariHatenaBookmark/SafariHatenaBookmark.xcodeproj/project.pbxproj

    r3246 r3250  
    1010                868C20510D16E39E00CA07C9 /* shb_init.rb in Resources */ = {isa = PBXBuildFile; fileRef = 868C20500D16E39E00CA07C9 /* shb_init.rb */; }; 
    1111                86A7D1C40D16634600D35D4C /* Info in Resources */ = {isa = PBXBuildFile; fileRef = 86A7D1C30D16634600D35D4C /* Info */; }; 
    12                 86A7D1C80D16635D00D35D4C /* Menu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 86A7D1C70D16635D00D35D4C /* Menu.nib */; }; 
    1312                86A7D1D20D16639600D35D4C /* PluginLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 86A7D1D00D16639600D35D4C /* PluginLoader.m */; }; 
    1413                86B04CD30D16DDD300EB7A83 /* RubyCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86B04CD20D16DDD300EB7A83 /* RubyCocoa.framework */; }; 
     
    178177                                8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */, 
    179178                                86A7D1C40D16634600D35D4C /* Info in Resources */, 
    180                                 86A7D1C80D16635D00D35D4C /* Menu.nib in Resources */, 
    181179                                86B04CE10D16DE6B00EB7A83 /* shb_controller.rb in Resources */, 
    182180                                868C20510D16E39E00CA07C9 /* shb_init.rb in Resources */, 
  • lang/objective-c/SafariHatenaBookmark/shb_controller.rb

    r3249 r3250  
    88 
    99require 'osx/cocoa' 
     10require 'rubygems' 
     11require 'json' 
    1012OSX.require_framework "WebKit" 
    1113 
     
    8284 
    8385    @logger.info("progressStarted: cur_url = " + cur_url.to_s) 
    84   end 
    8586 
    86   def progressFinished(n) 
    87     @logger.info('progressFinished begin') 
    88   end 
     87    # construct request 
     88    url_string = 'http://b.hatena.ne.jp/entry/json/' + cur_url.to_s 
     89    @logger.info("progressStarted: url = " + url_string) 
     90 
     91    # XXX: block here 
     92    require 'open-uri' 
     93    ret = open(url_string).read 
     94    @logger.info(JSON.parse(ret).to_s) 
    8995 
    9096=begin 
    91     // construct request 
    92     NSString *urlString = [NSString stringWithFormat: 
    93       @"http://b.hatena.ne.jp/entry/json/%@", cur_url]; 
    94  
    95     NSLog(@"progressStarted: url = %@", urlString);  
    9697    NSURL *url = [NSURL URLWithString:urlString]; 
    9798    NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:url]; 
     
    109110    } 
    110111  } 
     112=end 
     113  end 
     114 
     115  def progressFinished(n) 
     116    @logger.info('progressFinished begin') 
     117  end 
     118=begin 
    111119 
    112120- (void) progressFinished: (NSNotification*) n