diff --git a/core/mui/cairo_miracle_painter.rb b/core/mui/cairo_miracle_painter.rb index bd9e1eb..d7bb533 100644 --- a/core/mui/cairo_miracle_painter.rb +++ b/core/mui/cairo_miracle_painter.rb @@ -237,15 +237,15 @@ class Gdk::MiraclePainter < Gtk::Object textselector_unselect end def iob_icon_pixbuf - [ ["reply.png".freeze, message.user.verified? ? "verified.png" : "etc.png"], - [if message.user.protected?; then "protected.png".freeze else "retweet.png".freeze end, + [ ["reply.png".freeze, (message.respond_to?(:user) && message.user.verified?) ? "verified.png" : "etc.png"], + [if message.respond_to?(:user) && message.user.protected?; then "protected.png".freeze else "retweet.png".freeze end, message.favorite? ? "unfav.png".freeze : "fav.png".freeze] ] end def iob_icon_pixbuf_off world, = Plugin.filtering(:world_current, nil) [ [(UserConfig[:show_replied_icon] and message.mentioned_by_me? and "reply.png".freeze), - UserConfig[:show_verified_icon] && message.user.verified? && "verified.png"], - [ if UserConfig[:show_protected_icon] and message.user.protected? + UserConfig[:show_verified_icon] && message.respond_to?(:user) && message.user.verified? && "verified.png"], + [ if UserConfig[:show_protected_icon] and message.respond_to?(:user) and message.user.protected? "protected.png".freeze elsif Plugin[:miracle_painter].shared?(message, world) "retweet.png".freeze end, @@ -390,11 +390,15 @@ class Gdk::MiraclePainter < Gtk::Object layout end def header_left_markup - user = message.user - if user.respond_to?(:idname) - Pango.parse_markup("#{Pango.escape(user.idname)} #{Pango.escape(user.name || '')}") + if message.respond_to?(:user) + user = message.user + if user.respond_to?(:idname) + Pango.parse_markup("#{Pango.escape(user.idname)} #{Pango.escape(user.name || '')}") + else + Pango.parse_markup(Pango.escape(user.name || '')) + end else - Pango.parse_markup(Pango.escape(user.name || '')) + Pango.parse_markup(Pango.escape('')) end end @@ -434,7 +438,7 @@ class Gdk::MiraclePainter < Gtk::Object # アイコンのpixbufを返す def main_icon - @main_icon ||= message.user.icon.load_pixbuf(width: icon_width, height: icon_height){|pixbuf| + @main_icon ||= message.icon.load_pixbuf(width: icon_width, height: icon_height){|pixbuf| @main_icon = pixbuf on_modify } diff --git a/core/mui/cairo_sub_parts_message_base.rb b/core/mui/cairo_sub_parts_message_base.rb index 1e77ea0..24a80b1 100644 --- a/core/mui/cairo_sub_parts_message_base.rb +++ b/core/mui/cairo_sub_parts_message_base.rb @@ -40,11 +40,15 @@ class Gdk::SubPartsMessageBase < Gdk::SubParts # [Pango::FontDescription] フォント情報 # [Pango::Attribute] マークアップ情報 def header_left_content(message) - user = message.user - if message.user[:idname] - attr_list, text = Pango.parse_markup("#{Pango.escape(user.idname)} #{Pango.escape(user.name || '')}") + if message.respond_to?(:user) + user = message.user + if message.user[:idname] + attr_list, text = Pango.parse_markup("#{Pango.escape(user.idname)} #{Pango.escape(user.name || '')}") + else + attr_list, text = Pango.parse_markup(Pango.escape(user.name || '')) + end else - attr_list, text = Pango.parse_markup(Pango.escape(user.name || '')) + attr_list, text = Pango.parse_markup(Pango.escape('')) end return text, header_left_font(message), attr_list end @@ -445,7 +449,7 @@ class Gdk::SubPartsMessageBase < Gdk::SubParts context.paint end end def main_icon(message) - message.user.icon.load_pixbuf(width: icon_size.width, height: icon_size.width){ helper.on_modify } + message.icon.load_pixbuf(width: icon_size.width, height: icon_size.width){ helper.on_modify } end # 表示する際に本文に適用すべき装飾オブジェクトを作成する