aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_summary
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-10-29 15:15:28 +0100
committerfiaxh <git@mx.ax.lt>2017-10-31 15:41:45 +0100
commit0102abeec1d2055b19dccbb7edc7f06e527642b1 (patch)
tree4018e82224c19142c4a7a6eced67d9c2550b2dd8 /main/src/ui/conversation_summary
parentb9df78e4494879752e9e68dcc5d54e03fffe9467 (diff)
downloaddino-0102abeec1d2055b19dccbb7edc7f06e527642b1.tar.gz
dino-0102abeec1d2055b19dccbb7edc7f06e527642b1.zip
Fix warnings
Diffstat (limited to 'main/src/ui/conversation_summary')
-rw-r--r--main/src/ui/conversation_summary/chat_state_populator.vala3
-rw-r--r--main/src/ui/conversation_summary/default_message_display.vala2
-rw-r--r--main/src/ui/conversation_summary/file_populator.vala10
-rw-r--r--main/src/ui/conversation_summary/message_textview.vala1
-rw-r--r--main/src/ui/conversation_summary/slashme_message_display.vala3
5 files changed, 10 insertions, 9 deletions
diff --git a/main/src/ui/conversation_summary/chat_state_populator.vala b/main/src/ui/conversation_summary/chat_state_populator.vala
index 06d0cf87..e491fe44 100644
--- a/main/src/ui/conversation_summary/chat_state_populator.vala
+++ b/main/src/ui/conversation_summary/chat_state_populator.vala
@@ -53,7 +53,6 @@ class ChatStatePopulator : Plugins.ConversationItemPopulator, Object {
string? new_text = null;
if (state_ != null) {
if (state_ == Xep.ChatStateNotifications.STATE_COMPOSING || state_ == Xep.ChatStateNotifications.STATE_PAUSED) {
- string display_name = Util.get_display_name(stream_interactor, jid, account);
if (state_ == Xep.ChatStateNotifications.STATE_COMPOSING) {
new_text = _("is typing...");
} else if (state_ == Xep.ChatStateNotifications.STATE_PAUSED) {
@@ -95,7 +94,7 @@ public class MetaChatStateItem : Plugins.MetaConversationItem {
this.text = text;
}
- public override Object get_widget(Plugins.WidgetType widget_type) {
+ public override Object? get_widget(Plugins.WidgetType widget_type) {
label = new Label("") { xalign=0, vexpand=true, visible=true };
label.get_style_context().add_class("dim-label");
update_text();
diff --git a/main/src/ui/conversation_summary/default_message_display.vala b/main/src/ui/conversation_summary/default_message_display.vala
index 44040a3b..f843f116 100644
--- a/main/src/ui/conversation_summary/default_message_display.vala
+++ b/main/src/ui/conversation_summary/default_message_display.vala
@@ -44,7 +44,7 @@ public class MetaMessageItem : Plugins.MetaConversationItem {
public override bool requires_avatar { get; set; default=true; }
public override bool requires_header { get; set; default=true; }
- public override Object get_widget(Plugins.WidgetType widget_type) {
+ public override Object? get_widget(Plugins.WidgetType widget_type) {
MessageTextView text_view = new MessageTextView() { visible = true };
text_view.add_text(message.body);
return text_view;
diff --git a/main/src/ui/conversation_summary/file_populator.vala b/main/src/ui/conversation_summary/file_populator.vala
index 99185f6b..0edad19e 100644
--- a/main/src/ui/conversation_summary/file_populator.vala
+++ b/main/src/ui/conversation_summary/file_populator.vala
@@ -79,9 +79,14 @@ public class ImageItem : Plugins.MetaConversationItem {
});
}
- public override Object get_widget(Plugins.WidgetType widget_type) {
+ public override Object? get_widget(Plugins.WidgetType widget_type) {
Image image = new Image() { halign=Align.START, visible = true };
- Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.from_file(file_transfer.get_uri());
+ Gdk.Pixbuf pixbuf;
+ try {
+ pixbuf = new Gdk.Pixbuf.from_file(file_transfer.get_uri());
+ } catch (Error error) {
+ return null;
+ }
int max_scaled_height = MAX_HEIGHT * image.scale_factor;
if (pixbuf.height > max_scaled_height) {
@@ -104,7 +109,6 @@ public class ImageItem : Plugins.MetaConversationItem {
Util.force_color(url_label, "#eee");
file_transfer.notify["info"].connect_after(() => { update_info(url_label, file_transfer.info); });
update_info(url_label, file_transfer.info);
- Box url_box = builder.get_object("url_box") as Box;
Image copy_image = builder.get_object("copy_image") as Image;
Util.force_css(copy_image, "*:not(:hover) { color: #eee; }");
diff --git a/main/src/ui/conversation_summary/message_textview.vala b/main/src/ui/conversation_summary/message_textview.vala
index f2a4ca22..77b2d707 100644
--- a/main/src/ui/conversation_summary/message_textview.vala
+++ b/main/src/ui/conversation_summary/message_textview.vala
@@ -51,7 +51,6 @@ public class MessageTextView : TextView {
MatchInfo match_info;
url_regex.match(text, 0, out match_info);
for (; match_info.matches(); match_info.next()) {
- string? url = match_info.fetch(0);
int start;
int end;
match_info.fetch_pos(0, out start, out end);
diff --git a/main/src/ui/conversation_summary/slashme_message_display.vala b/main/src/ui/conversation_summary/slashme_message_display.vala
index cb3d5cd2..92596936 100644
--- a/main/src/ui/conversation_summary/slashme_message_display.vala
+++ b/main/src/ui/conversation_summary/slashme_message_display.vala
@@ -50,7 +50,7 @@ public class MetaSlashmeItem : Plugins.MetaConversationItem {
public override bool requires_avatar { get; set; default=true; }
public override bool requires_header { get; set; default=false; }
- public override Object get_widget(Plugins.WidgetType widget_type) {
+ public override Object? get_widget(Plugins.WidgetType widget_type) {
text_view = new MessageTextView() { valign=Align.CENTER, vexpand=true, visible = true };
string display_name = Util.get_message_display_name(stream_interactor, message, conversation.account);
@@ -67,7 +67,6 @@ public class MetaSlashmeItem : Plugins.MetaConversationItem {
}
private void update_style() {
- string display_name = Util.get_message_display_name(stream_interactor, message, conversation.account);
string color = Util.get_name_hex_color(stream_interactor, conversation.account, message.real_jid ?? message.from, Util.is_dark_theme(text_view));
nick_tag.foreground = "#" + color;
}