aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/chat_input/chat_input_controller.vala4
-rw-r--r--main/src/ui/contact_details/dialog.vala3
-rw-r--r--main/src/ui/conversation_content_view/conversation_view.vala4
-rw-r--r--main/src/ui/conversation_view_controller.vala20
-rw-r--r--main/src/ui/notifications.vala5
-rw-r--r--main/src/ui/util/accounts_combo_box.vala3
-rw-r--r--main/src/ui/util/helper.vala2
-rw-r--r--main/src/ui/util/scaling_image.vala15
8 files changed, 25 insertions, 31 deletions
diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala
index bd38067d..eeaddaab 100644
--- a/main/src/ui/chat_input/chat_input_controller.vala
+++ b/main/src/ui/chat_input/chat_input_controller.vala
@@ -129,12 +129,12 @@ public class ChatInputController : Object {
}
return;
case "/nick":
- stream_interactor.get_module(MucManager.IDENTITY).change_nick(conversation, token[1]);
+ stream_interactor.get_module(MucManager.IDENTITY).change_nick.begin(conversation, token[1]);
return;
case "/ping":
Xmpp.XmppStream? stream = stream_interactor.get_stream(conversation.account);
try {
- stream.get_module(Xmpp.Xep.Ping.Module.IDENTITY).send_ping(stream, conversation.counterpart.with_resource(token[1]), null);
+ stream.get_module(Xmpp.Xep.Ping.Module.IDENTITY).send_ping.begin(stream, conversation.counterpart.with_resource(token[1]), null);
} catch (Xmpp.InvalidJidError e) {
warning("Could not ping invalid Jid: %s", e.message);
}
diff --git a/main/src/ui/contact_details/dialog.vala b/main/src/ui/contact_details/dialog.vala
index cf85e691..35647eee 100644
--- a/main/src/ui/contact_details/dialog.vala
+++ b/main/src/ui/contact_details/dialog.vala
@@ -36,7 +36,8 @@ public class Dialog : Gtk.Dialog {
title = conversation.type_ == Conversation.Type.GROUPCHAT ? _("Conference Details") : _("Contact Details");
if (Util.use_csd()) {
- (get_header_bar() as HeaderBar).set_subtitle(Util.get_conversation_display_name(stream_interactor, conversation));
+ // TODO get_header_bar directly returns a HeaderBar in vala > 0.48
+ ((HeaderBar) get_header_bar()).set_subtitle(Util.get_conversation_display_name(stream_interactor, conversation));
}
setup_top();
diff --git a/main/src/ui/conversation_content_view/conversation_view.vala b/main/src/ui/conversation_content_view/conversation_view.vala
index dd68cef0..0d61a0d1 100644
--- a/main/src/ui/conversation_content_view/conversation_view.vala
+++ b/main/src/ui/conversation_content_view/conversation_view.vala
@@ -444,7 +444,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
was_value = scrolled.vadjustment.value;
if (!reloading_mutex.trylock()) return;
if (content_items.size > 0) {
- Gee.List<ContentMetaItem> items = content_populator.populate_before(conversation, (content_items.first() as ContentMetaItem).content_item, 20);
+ Gee.List<ContentMetaItem> items = content_populator.populate_before(conversation, ((ContentMetaItem) content_items.first()).content_item, 20);
foreach (ContentMetaItem item in items) {
do_insert_item(item);
}
@@ -456,7 +456,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
private void load_later_messages() {
if (!reloading_mutex.trylock()) return;
if (content_items.size > 0 && !at_current_content) {
- Gee.List<ContentMetaItem> items = content_populator.populate_after(conversation, (content_items.last() as ContentMetaItem).content_item, 20);
+ Gee.List<ContentMetaItem> items = content_populator.populate_after(conversation, ((ContentMetaItem) content_items.last()).content_item, 20);
if (items.size == 0) {
at_current_content = true;
}
diff --git a/main/src/ui/conversation_view_controller.vala b/main/src/ui/conversation_view_controller.vala
index b2be8ed8..dcd3e1c7 100644
--- a/main/src/ui/conversation_view_controller.vala
+++ b/main/src/ui/conversation_view_controller.vala
@@ -176,10 +176,14 @@ public class ConversationViewController : Object {
if (clipboard.wait_is_image_available()) {
clipboard.request_image((_, pixbuf) => {
File file = File.new_for_path(Path.build_filename(FileManager.get_storage_dir(), Xmpp.random_uuid() + ".png"));
- DataOutputStream fos = new DataOutputStream(file.create(FileCreateFlags.REPLACE_DESTINATION));
- pixbuf.save_to_stream_async.begin(fos, "png", null, () => {
- open_send_file_overlay(file);
- });
+ try {
+ FileOutputStream fos = file.create(FileCreateFlags.REPLACE_DESTINATION);
+ pixbuf.save_to_stream_async.begin(fos, "png", null, () => {
+ open_send_file_overlay(file);
+ });
+ } catch (Error e) {
+ warning("Could not create file to store pasted image in %s, %s", file.get_path(), e.message);
+ }
});
}
}
@@ -191,8 +195,12 @@ public class ConversationViewController : Object {
string[] uris = selection_data.get_uris();
// For now we only process the first dragged file
if (uris.length >= 1) {
- string file_path = Filename.from_uri(uris[0]);
- open_send_file_overlay(File.new_for_path(file_path));
+ try {
+ string file_path = Filename.from_uri(uris[0]);
+ open_send_file_overlay(File.new_for_path(file_path));
+ } catch (ConvertError e) {
+ warning("Could not handle dragged file %s, %s", uris[0], e.message);
+ }
}
break;
default:
diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala
index ba6e5422..396a88ab 100644
--- a/main/src/ui/notifications.vala
+++ b/main/src/ui/notifications.vala
@@ -55,12 +55,11 @@ public class Notifications : Object {
string text = "";
switch (content_item.type_) {
case MessageItem.TYPE:
- Message message = (content_item as MessageItem).message;
+ Message message = ((MessageItem) content_item).message;
text = message.body;
break;
case FileItem.TYPE:
- FileItem file_item = content_item as FileItem;
- FileTransfer transfer = file_item.file_transfer;
+ FileTransfer transfer = ((FileItem) content_item).file_transfer;
bool file_is_image = transfer.mime_type != null && transfer.mime_type.has_prefix("image");
if (transfer.direction == Message.DIRECTION_SENT) {
diff --git a/main/src/ui/util/accounts_combo_box.vala b/main/src/ui/util/accounts_combo_box.vala
index 5fdd18e6..1c708eac 100644
--- a/main/src/ui/util/accounts_combo_box.vala
+++ b/main/src/ui/util/accounts_combo_box.vala
@@ -24,7 +24,8 @@ class AccountComboBox : ComboBox {
do {
Value val;
list_store.get_value(iter, 1, out val);
- if ((val as Account).equals(value)) {
+ Account? account = val as Account;
+ if (account != null && account.equals(value)) {
active = i;
break;
}
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala
index 888dc66e..de4896d9 100644
--- a/main/src/ui/util/helper.vala
+++ b/main/src/ui/util/helper.vala
@@ -441,7 +441,7 @@ public string summarize_whitespaces_to_space(string s) {
}
public bool use_csd() {
- return (GLib.Application.get_default() as Application).use_csd();
+ return ((Application) GLib.Application.get_default()).use_csd();
}
}
diff --git a/main/src/ui/util/scaling_image.vala b/main/src/ui/util/scaling_image.vala
index 7813ff9b..477432c5 100644
--- a/main/src/ui/util/scaling_image.vala
+++ b/main/src/ui/util/scaling_image.vala
@@ -148,21 +148,6 @@ class ScalingImage : Misc {
return buffer;
}
- private static Gdk.Pixbuf crop_corners(Gdk.Pixbuf pixbuf, double radius = 3) {
- Cairo.Context ctx = new Cairo.Context(new Cairo.ImageSurface(Cairo.Format.ARGB32, pixbuf.width, pixbuf.height));
- Gdk.cairo_set_source_pixbuf(ctx, pixbuf, 0, 0);
- double degrees = Math.PI / 180.0;
- ctx.new_sub_path();
- ctx.arc(pixbuf.width - radius, radius, radius, -90 * degrees, 0 * degrees);
- ctx.arc(pixbuf.width - radius, pixbuf.height - radius, radius, 0 * degrees, 90 * degrees);
- ctx.arc(radius, pixbuf.height - radius, radius, 90 * degrees, 180 * degrees);
- ctx.arc(radius, radius, radius, 180 * degrees, 270 * degrees);
- ctx.close_path();
- ctx.clip();
- ctx.paint();
- return Gdk.pixbuf_get_from_surface(ctx.get_target(), 0, 0, pixbuf.width, pixbuf.height);
- }
-
public override void get_preferred_width(out int minimum_width, out int natural_width) {
minimum_width = int.max(0, min_width);
double exact_width = -1, exact_height = -1;