diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/mui/cairo_sub_parts_favorite.rb | 4 | ||||
-rw-r--r-- | core/mui/cairo_sub_parts_retweet.rb | 4 | ||||
-rw-r--r-- | core/mui/cairo_sub_parts_voter.rb | 10 |
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 |