Rename open_url to open_uri

This commit is contained in:
bleakgrey 2018-06-07 14:43:55 +03:00
parent e9d83e13b2
commit 1fa6780180
6 changed files with 16 additions and 16 deletions

View File

@ -1,8 +1,14 @@
public class Tootle.Desktop {
// Open a URI in the user's default browser
public static void open_url (string url) {
Gtk.show_uri (null, url, Gdk.CURRENT_TIME);
// Open URI in the user's default application associated with it
public static void open_uri (string uri) {
try {
Gtk.show_uri (null, uri, Gdk.CURRENT_TIME);
}
catch (GLib.Error e){
warning ("Can't open %s: %s", uri, e.message);
app.error (_("Error"), e.message);
}
}
// Copy a string to the clipboard

View File

@ -146,14 +146,8 @@ public class Tootle.NewAccountDialog : Gtk.Dialog {
pars += "&redirect_uri=urn:ietf:wg:oauth:2.0:oob";
pars += "&client_id=" + client_id;
try {
info ("Requesting auth token");
AppInfo.launch_default_for_uri ("%s/oauth/authorize%s".printf (instance, pars), null);
}
catch (GLib.Error e){
warning (e.message);
app.error (_("Error"), e.message);
}
info ("Requesting auth token");
Desktop.open_uri ("%s/oauth/authorize%s".printf (instance, pars));
}
private void try_auth (string code){

View File

@ -26,7 +26,7 @@ public class Tootle.AccountWidget : StatusWidget {
});
var item_open_link = new Gtk.MenuItem.with_label (_("Open in Browser"));
item_open_link.activate.connect (() => Desktop.open_url (status.url));
item_open_link.activate.connect (() => Desktop.open_uri (status.url));
var item_copy_link = new Gtk.MenuItem.with_label (_("Copy Link"));
item_copy_link.activate.connect (() => Desktop.copy (status.url));
menu.add (item_open_link);

View File

@ -104,7 +104,7 @@ public class Tootle.AttachmentWidget : Gtk.EventBox {
if (ev.button == 3)
return open_menu (ev.button, ev.time);
Desktop.open_url (attachment.url);
Desktop.open_uri (attachment.url);
return true;
}
@ -123,7 +123,7 @@ public class Tootle.AttachmentWidget : Gtk.EventBox {
}
var item_open_link = new Gtk.MenuItem.with_label (_("Open in Browser"));
item_open_link.activate.connect (() => Desktop.open_url (attachment.url));
item_open_link.activate.connect (() => Desktop.open_uri (attachment.url));
var item_copy_link = new Gtk.MenuItem.with_label (_("Copy Link"));
item_copy_link.activate.connect (() => Desktop.copy (attachment.url));
var item_download = new Gtk.MenuItem.with_label (_("Download"));

View File

@ -65,7 +65,7 @@ public class Tootle.RichLabel : Gtk.Label {
return true;
}
Desktop.open_url (url);
Desktop.open_uri (url);
return true;
}

View File

@ -271,7 +271,7 @@ public class Tootle.StatusWidget : Gtk.EventBox {
var item_delete = new Gtk.MenuItem.with_label (_("Delete"));
item_delete.activate.connect (() => status.poof ());
var item_open_link = new Gtk.MenuItem.with_label (_("Open in Browser"));
item_open_link.activate.connect (() => Desktop.open_url (status.url));
item_open_link.activate.connect (() => Desktop.open_uri (status.url));
var item_copy_link = new Gtk.MenuItem.with_label (_("Copy Link"));
item_copy_link.activate.connect (() => Desktop.copy (status.url));
var item_copy = new Gtk.MenuItem.with_label (_("Copy Text"));