[evince] shell: better handle external links
- From: Jose Aliste <jaliste src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] shell: better handle external links
- Date: Thu, 7 Dec 2017 19:37:50 +0000 (UTC)
commit df38ffdc0a14be1e7870221e0de38056861e6e87
Author: José Aliste <jose aliste gmail com>
Date: Wed Dec 6 23:35:29 2017 -0300
shell: better handle external links
Currently we only handle uris with :// and mailto: uris.
Handle all uris that g_app_info actually can handle.
https://bugzilla.gnome.org/show_bug.cgi?id=791287
shell/ev-window.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 0fe49ba..03fbb4e 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -5972,21 +5972,25 @@ launch_external_uri (EvWindow *window, EvLinkAction *action)
gboolean ret;
GdkAppLaunchContext *context;
GdkScreen *screen;
+ GFile *file;
+ gchar *uri_scheme;
screen = gtk_window_get_screen (GTK_WINDOW (window));
context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
gdk_app_launch_context_set_screen (context, screen);
gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
+ file = g_file_new_for_uri (uri);
+ uri_scheme = g_file_get_uri_scheme (file);
+ g_object_unref (file);
- if (!g_strstr_len (uri, strlen (uri), "://") &&
- !g_str_has_prefix (uri, "mailto:")) {
+ if (uri_scheme == NULL) {
gchar *new_uri;
/* Not a valid uri, assume http if it starts with www */
if (g_str_has_prefix (uri, "www.")) {
new_uri = g_strdup_printf ("http://%s", uri);
} else {
- GFile *file, *parent;
+ GFile *parent;
file = g_file_new_for_uri (window->priv->uri);
parent = g_file_get_parent (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]