Remove old try/catch blocks
This commit is contained in:
parent
130f8e3e51
commit
58730814dc
|
@ -49,9 +49,7 @@ public class Tootle.Views.ExpandedStatus : Views.Abstract {
|
||||||
var url = "%s/api/v1/statuses/%lld/context".printf (accounts.formal.instance, root_status.id);
|
var url = "%s/api/v1/statuses/%lld/context".printf (accounts.formal.instance, root_status.id);
|
||||||
var msg = new Soup.Message ("GET", url);
|
var msg = new Soup.Message ("GET", url);
|
||||||
network.queue (msg, (sess, mess) => {
|
network.queue (msg, (sess, mess) => {
|
||||||
try{
|
|
||||||
var root = network.parse (mess);
|
var root = network.parse (mess);
|
||||||
|
|
||||||
var ancestors = root.get_array_member ("ancestors");
|
var ancestors = root.get_array_member ("ancestors");
|
||||||
ancestors.foreach_element ((array, i, node) => {
|
ancestors.foreach_element ((array, i, node) => {
|
||||||
var object = node.get_object ();
|
var object = node.get_object ();
|
||||||
|
@ -71,11 +69,6 @@ public class Tootle.Views.ExpandedStatus : Views.Abstract {
|
||||||
prepend (status);
|
prepend (status);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
catch (GLib.Error e) {
|
|
||||||
warning ("Can't get context for a status");
|
|
||||||
warning (e.message);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +78,6 @@ public class Tootle.Views.ExpandedStatus : Views.Abstract {
|
||||||
var msg = new Soup.Message ("GET", url);
|
var msg = new Soup.Message ("GET", url);
|
||||||
msg.priority = Soup.MessagePriority.HIGH;
|
msg.priority = Soup.MessagePriority.HIGH;
|
||||||
network.queue (msg, (sess, mess) => {
|
network.queue (msg, (sess, mess) => {
|
||||||
try {
|
|
||||||
var root = network.parse (mess);
|
var root = network.parse (mess);
|
||||||
var statuses = root.get_array_member ("statuses");
|
var statuses = root.get_array_member ("statuses");
|
||||||
var object = statuses.get_element (0).get_object ();
|
var object = statuses.get_element (0).get_object ();
|
||||||
|
@ -95,10 +87,6 @@ public class Tootle.Views.ExpandedStatus : Views.Abstract {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Desktop.open_uri (q);
|
Desktop.open_uri (q);
|
||||||
}
|
|
||||||
catch (GLib.Error e) {
|
|
||||||
warning (e.message);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,36 +242,11 @@ public class Tootle.Views.Profile : Views.Timeline {
|
||||||
var msg = new Soup.Message ("GET", url);
|
var msg = new Soup.Message ("GET", url);
|
||||||
msg.priority = Soup.MessagePriority.HIGH;
|
msg.priority = Soup.MessagePriority.HIGH;
|
||||||
network.queue (msg, (sess, mess) => {
|
network.queue (msg, (sess, mess) => {
|
||||||
try {
|
|
||||||
var root = network.parse (mess);
|
var root = network.parse (mess);
|
||||||
var acc = API.Account.parse (root);
|
var acc = API.Account.parse (root);
|
||||||
window.open_view (new Views.Profile (acc));
|
window.open_view (new Views.Profile (acc));
|
||||||
}
|
}, (status, reason) => {
|
||||||
catch (GLib.Error e) {
|
network.on_error (status, reason);
|
||||||
warning ("Can't find account");
|
|
||||||
warning (e.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void open_from_name (string name){
|
|
||||||
var url = "%s/api/v1/accounts/search?limit=1&q=%s".printf (accounts.formal.instance, name);
|
|
||||||
var msg = new Soup.Message("GET", url);
|
|
||||||
msg.priority = Soup.MessagePriority.HIGH;
|
|
||||||
network.queue (msg, (sess, mess) => {
|
|
||||||
try {
|
|
||||||
var node = network.parse_array (mess).get_element (0);
|
|
||||||
var object = node.get_object ();
|
|
||||||
if (object != null){
|
|
||||||
var acc = API.Account.parse (object);
|
|
||||||
window.open_view (new Views.Profile (acc));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
app.toast (_("User not found"));
|
|
||||||
}
|
|
||||||
catch (GLib.Error e) {
|
|
||||||
warning (e.message);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class Tootle.Widgets.RichLabel : Label {
|
||||||
|
|
||||||
if ("@" in url || "tags" in url) {
|
if ("@" in url || "tags" in url) {
|
||||||
var query = Soup.URI.encode (url, null);
|
var query = Soup.URI.encode (url, null);
|
||||||
var msg_url = "%s/api/v1/search?q=%s".printf (accounts.formal.instance, query);
|
var msg_url = "%s/api/v1/search?q=%s&resolve=true".printf (accounts.formal.instance, query);
|
||||||
var msg = new Soup.Message("GET", msg_url);
|
var msg = new Soup.Message("GET", msg_url);
|
||||||
msg.priority = Soup.MessagePriority.HIGH;
|
msg.priority = Soup.MessagePriority.HIGH;
|
||||||
network.inject (msg, Network.INJECT_TOKEN);
|
network.inject (msg, Network.INJECT_TOKEN);
|
||||||
|
|
Loading…
Reference in New Issue