aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorToshiaki Asai <toshi.alternative@gmail.com>2013-04-06 02:11:33 +0900
committerToshiaki Asai <toshi.alternative@gmail.com>2013-04-06 02:11:33 +0900
commitc60d10515f028f07e07bfabb9f31d8e6eb7c51a7 (patch)
tree9bc60cd42e281c15375c0b7a09a3af706fd13de4 /core
parent6f80ba6a6335b2106b12b0fd1b602dae58c56b6a (diff)
downloadmikutter-c60d10515f028f07e07bfabb9f31d8e6eb7c51a7.tar.gz
Twitter APIからふぁぼ・RT数を取得して表示できるようにしてみた
Diffstat (limited to 'core')
-rw-r--r--core/mui/cairo_sub_parts_favorite.rb4
-rw-r--r--core/mui/cairo_sub_parts_retweet.rb4
-rw-r--r--core/mui/cairo_sub_parts_voter.rb10
3 files changed, 15 insertions, 3 deletions
diff --git a/core/mui/cairo_sub_parts_favorite.rb b/core/mui/cairo_sub_parts_favorite.rb
index 67672aa3..e9d7fd23 100644
--- a/core/mui/cairo_sub_parts_favorite.rb
+++ b/core/mui/cairo_sub_parts_favorite.rb
@@ -8,6 +8,10 @@ require 'cairo'
class Gdk::SubPartsFavorite < Gdk::SubPartsVoter
regist
+ def get_vote_count
+ [helper.message[:favorite_count] || 0, super].max
+ end
+
def get_default_votes
helper.message.favorited_by
end
diff --git a/core/mui/cairo_sub_parts_retweet.rb b/core/mui/cairo_sub_parts_retweet.rb
index a9fff4b9..5ea6544a 100644
--- a/core/mui/cairo_sub_parts_retweet.rb
+++ b/core/mui/cairo_sub_parts_retweet.rb
@@ -8,6 +8,10 @@ require 'cairo'
class Gdk::SubPartsRetweet < Gdk::SubPartsVoter
regist
+ def get_vote_count
+ [helper.message[:retweet_count] || 0, super].max
+ end
+
def get_default_votes
helper.message.retweeted_by
end
diff --git a/core/mui/cairo_sub_parts_voter.rb b/core/mui/cairo_sub_parts_voter.rb
index d34a88cb..ae53e07a 100644
--- a/core/mui/cairo_sub_parts_voter.rb
+++ b/core/mui/cairo_sub_parts_voter.rb
@@ -64,7 +64,7 @@ class ::Gdk::SubPartsVoter < Gdk::SubParts
@votes[index] end end end
def render(context)
- if(not @votes.empty?)
+ if get_vote_count != 0
context.save{
context.translate(@margin, 0)
put_title_icon(context)
@@ -73,7 +73,7 @@ class ::Gdk::SubPartsVoter < Gdk::SubParts
@last_height = height end
def height
- if @votes.empty?
+ if get_vote_count == 0
0
else
icon_height end end
@@ -154,8 +154,12 @@ class ::Gdk::SubPartsVoter < Gdk::SubParts
layout = context.create_pango_layout
layout.wrap = Pango::WRAP_CHAR
layout.font_description = Pango::FontDescription.new(UserConfig[:mumble_basic_font])
- layout.text = "#{votes.size}"
+ layout.text = "#{get_vote_count}"
layout
end
+ def get_vote_count
+ votes.size
+ end
+
end