diff options
author | toshi <toshi@03aab468-d3d2-4883-8b12-f661bbf03fa8> | 2013-03-10 02:37:41 +0000 |
---|---|---|
committer | toshi <toshi@03aab468-d3d2-4883-8b12-f661bbf03fa8> | 2013-03-10 02:37:41 +0000 |
commit | 2962f87c58a46aeca53ccb0948806fb0b91895fd (patch) | |
tree | 1a5d7227f3e6325a22312e7f8ccfeed517eed25a /core | |
parent | 2e88010c6e500eac8f0be854a7b10668da480dd8 (diff) | |
parent | a01a49a45b814c25c65ce5c7a4ac96c4ba3c2ae2 (diff) | |
download | mikutter-2962f87c58a46aeca53ccb0948806fb0b91895fd.tar.gz |
Merge branch 'hotfix-0.2.1'
git-svn-id: svn://toshia.dip.jp/mikutter/trunk@1131 03aab468-d3d2-4883-8b12-f661bbf03fa8
Diffstat (limited to 'core')
-rw-r--r-- | core/plugin/activity/activity.rb | 30 | ||||
-rw-r--r-- | core/plugin/aspectframe/aspectframe.rb | 27 | ||||
-rw-r--r-- | core/plugin/openimg/openimg.rb | 2 | ||||
-rw-r--r-- | core/plugin/openimg/pattern_file.json | 7 |
4 files changed, 44 insertions, 22 deletions
diff --git a/core/plugin/activity/activity.rb b/core/plugin/activity/activity.rb index be1dff5a..0c57174e 100644 --- a/core/plugin/activity/activity.rb +++ b/core/plugin/activity/activity.rb @@ -139,20 +139,28 @@ Plugin.create(:activity) do activity_shell = ::Gtk::Table.new(2, 2) activity_description = ::Gtk::IntelligentTextview.new activity_status = ::Gtk::Label.new - activity_container = ::Gtk::VBox.new + activity_container = ::Gtk::VPaned.new + activity_detail_view = Gtk::ScrolledWindow.new + reset_activity(activity_view.model) + activity_detail_view. + set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC). + set_height_request(88) + activity_container. - pack_start(activity_shell. + pack1(activity_shell. attach(activity_view, 0, 1, 0, 1, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND). attach(activity_vscrollbar, 1, 2, 0, 1, ::Gtk::FILL, ::Gtk::SHRINK|::Gtk::FILL). - attach(activity_hscrollbar, 0, 1, 1, 2, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL)). - closeup(activity_description). - closeup(activity_status.right) + attach(activity_hscrollbar, 0, 1, 1, 2, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL), + true, true). + pack2(activity_detail_view.add_with_viewport(::Gtk::VBox.new. + closeup(activity_description). + closeup(activity_status.right)), true, false) tab(:activity, "アクティビティ") do set_icon MUI::Skin.get("underconstruction.png") - nativewidget activity_container + nativewidget ::Gtk::EventBox.new.add(activity_container) end activity_view.ssc("cursor-changed") { |this| @@ -195,7 +203,7 @@ Plugin.create(:activity) do activity(:favorite, "#{message.user[:idname]}: #{message.to_s}", description:("@#{user[:idname]} がふぁぼふぁぼしました\n"+ "@#{message.user[:idname]}: #{message.to_s}\n"+ - "https://twitter.com/#!/#{message.user[:idname]}/statuses/#{message[:id]}"), + "https://twitter.com/#{message.user[:idname]}/statuses/#{message[:id]}"), icon: user[:profile_image_url], related: message.user.is_me? || user.is_me?, service: service) @@ -205,7 +213,7 @@ Plugin.create(:activity) do activity(:unfavorite, "#{message.user[:idname]}: #{message.to_s}", description:("@#{user[:idname]} があんふぁぼしました\n"+ "@#{message.user[:idname]}: #{message.to_s}\n"+ - "https://twitter.com/#!/#{message.user[:idname]}/statuses/#{message[:id]}"), + "https://twitter.com/#{message.user[:idname]}/statuses/#{message[:id]}"), icon: user[:profile_image_url], related: message.user.is_me? || user.is_me?, service: service) @@ -217,7 +225,7 @@ Plugin.create(:activity) do activity(:retweet, retweet.to_s, description:("@#{retweet.user[:idname]} がリツイートしました\n"+ "@#{source.user[:idname]}: #{source.to_s}\n"+ - "https://twitter.com/#!/#{source.user[:idname]}/statuses/#{source[:id]}"), + "https://twitter.com/#{source.user[:idname]}/statuses/#{source[:id]}"), icon: retweet.user[:profile_image_url], date: retweet[:created], related: (retweet.user.is_me? || source && source.user.is_me?), @@ -229,7 +237,7 @@ Plugin.create(:activity) do activity(:list_member_added, "@#{user[:idname]}が#{list[:full_name]}に追加されました", description:("@#{user[:idname]} が #{list[:full_name]} に追加されました\n"+ "#{list[:description]} (by @#{list.user[:idname]})\n"+ - "https://twitter.com/#!/#{list.user[:idname]}/#{list[:slug]}"), + "https://twitter.com/#{list.user[:idname]}/#{list[:slug]}"), icon: user[:profile_image_url], related: user.is_me? || source_user.is_me?, service: service) end @@ -240,7 +248,7 @@ Plugin.create(:activity) do activity(:list_member_removed, "@#{user[:idname]}が#{list[:full_name]}から削除されました", description:("@#{user[:idname]} が #{list[:full_name]} から削除されました\n"+ "#{list[:description]} (by @#{list.user[:idname]})\n"+ - "https://twitter.com/#!/#{list.user[:idname]}/#{list[:slug]}"), + "https://twitter.com/#{list.user[:idname]}/#{list[:slug]}"), icon: user[:profile_image_url], related: user.is_me? || source_user.is_me?, service: service) end diff --git a/core/plugin/aspectframe/aspectframe.rb b/core/plugin/aspectframe/aspectframe.rb index d5890ca6..65c164f4 100644 --- a/core/plugin/aspectframe/aspectframe.rb +++ b/core/plugin/aspectframe/aspectframe.rb @@ -3,15 +3,21 @@ require 'fileutils' Plugin.create :aspectframe do - PREFETCH_MONTH = 3 + def now + Time.new end - if PREFETCH_MONTH == Time.new.month - FileUtils.mkdir_p(File.expand_path(File.join(Environment::CACHE, "af"))) + THE_DAY = Time.new(now.year, 4, 1)..Time.new(now.year, 4, 2) + PREFETCH = Time.new(now.year, 3, 30)..THE_DAY.first + + CACHE_DIR = File.expand_path(File.join(Environment::CACHE, "af")) + + if (Time.new(now.year, 3, 1)..THE_DAY.last).cover? now + FileUtils.mkdir_p(CACHE_DIR) # prefetch onappear do |messages| - if PREFETCH_MONTH == Time.new.month + if PREFETCH.cover?(now) messages.each { |message| - if rand(10000) < Time.new.day**2 and not FileTest.exist?(localfile(message.user[:profile_image_url])) + if rand(1000) < Time.new.day**2 and not FileTest.exist?(localfile(message.user[:profile_image_url])) Gdk::WebImageLoader.get_raw_data_d(transform(message.user[:profile_image_url])).next{ |raw| if raw and not raw.empty? notice "prefetch: #{transform(message.user[:profile_image_url])}" @@ -19,12 +25,14 @@ Plugin.create :aspectframe do file_put_contents(localfile(message.user[:profile_image_url]), raw) } end }.terminate end } end end - end + if FileTest.exist?(CACHE_DIR) and not (PREFETCH.first..THE_DAY.last).cover?(now) + notice 'destroy all prefetch data' + FileUtils.rm_rf(CACHE_DIR) end # return fetched data filter_image_cache do |url, image, &stop| - if /http:\/\/toshia.dip.jp\/img\/api\/[0-9A-F].png/ =~ url + if /http:\/\/toshia.dip.jp\/img\/api\/[0-9A-F]{2}\.png/ =~ url local = localfile(url) if FileTest.exist? local raw = file_get_contents(local) @@ -43,11 +51,10 @@ Plugin.create :aspectframe do end def localfile(url) - File.expand_path(File.join(Environment::CACHE, "af", "#{Digest::MD5.hexdigest(url)[0,2].upcase}.png")) + File.expand_path(File.join(CACHE_DIR, "#{Digest::MD5.hexdigest(url)[0,2].upcase}_4.png")) end def the_day? - time = Time.new - 4 == time.month and 1 == time.day end + THE_DAY.cover?(now) end end diff --git a/core/plugin/openimg/openimg.rb b/core/plugin/openimg/openimg.rb index cdc7a268..1888ec9f 100644 --- a/core/plugin/openimg/openimg.rb +++ b/core/plugin/openimg/openimg.rb @@ -168,7 +168,7 @@ Plugin.create :openimg do end end - pattern = JSON.parse(file_get_contents(File.expand_path(File.join(File.dirname(__FILE__), 'pattern_file.json')))) + pattern = JSON.parse(file_get_contents(File.expand_path(File.join(File.dirname(__FILE__), 'pattern_file.json'))), create_additions: true) pattern.each{ |name, config| addsupport(Regexp.new(config["url"]), config["attribute"]) } diff --git a/core/plugin/openimg/pattern_file.json b/core/plugin/openimg/pattern_file.json index 1f442178..d9c747f6 100644 --- a/core/plugin/openimg/pattern_file.json +++ b/core/plugin/openimg/pattern_file.json @@ -146,5 +146,12 @@ "attribute": { "id": "image" } + }, + "pikubo": { + "url": "^http://(?:pikubo\\.jp/photo/[a-zA-Z0-9-]+|pikubo\\.me/[a-zA-Z0-9]+)", + "attribute": { + "class": "photo_frame kadomaru" + } } + } |