diff options
author | Pascal Terjan <pterjan@linuxfr.org> | 2007-10-25 06:01:57 (GMT) |
---|---|---|
committer | Pascal Terjan <pterjan@src.gnome.org> | 2007-10-25 06:01:57 (GMT) |
commit | 74fd0c3667f1e2cf5f59b2f0da3f4b31866ea79f (patch) | |
tree | 31e7e6c3ccb80ec0295c33f3845f352339142ade | |
parent | c67978e8a6f6027a787ccb3f1b6391245339de62 (diff) |
Let GnomeVFS check the URL, this allow more URL (like mailto:), and report
2007-10-25 Pascal Terjan <pterjan@linuxfr.org>
* shell/ev-window.c: (launch_external_uri):
Let GnomeVFS check the URL, this allow more URL (like mailto:),
and report error if the URL is not supported (#489910).
svn path=/trunk/; revision=2718
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | shell/ev-window.c | 40 |
2 files changed, 25 insertions, 22 deletions
@@ -1,3 +1,10 @@ +2007-10-25 Pascal Terjan <pterjan@linuxfr.org> + + * shell/ev-window.c: (launch_external_uri): + + Let GnomeVFS check the URL, this allow more URL (like mailto:), + and report error if the URL is not supported (#489910). + 2007-10-22 Carlos Garcia Campos <carlosgc@gnome.org> * backend/pdf/ev-poppler.cc: (pdf_document_file_exporter_begin): diff --git a/shell/ev-window.c b/shell/ev-window.c index cb09db4..8c0a19f 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -4728,45 +4728,41 @@ launch_action (EvWindow *window, EvLinkAction *action) allowing to launch executables is a good idea though. -- marco */ } -static gboolean -uri_is_valid (const gchar *uri) -{ - gchar *p = (gchar *) uri; - - if (!p || !g_ascii_isalpha (*p)) - return FALSE; - - p++; - while (g_ascii_isalnum (*p)) - p++; - - return (g_ascii_strncasecmp (p, "://", strlen ("://")) == 0); -} - static void launch_external_uri (EvWindow *window, EvLinkAction *action) { const gchar *uri = ev_link_action_get_uri (action); - - if (!uri_is_valid (uri)) { - GtkWidget *dialog; + GnomeVFSResult result = gnome_vfs_url_show (uri); + GtkWidget *dialog; + gchar* message = NULL; + switch(result) { + case GNOME_VFS_OK: + break; + case GNOME_VFS_ERROR_BAD_PARAMETERS: + message = _("Invalid URI: “%s”"); + break; + case GNOME_VFS_ERROR_NOT_SUPPORTED: + message = _("Unsupported URI: “%s”"); + break; + default: + message = _("Unknown error"); + } + if(message) { dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Unable to open external link")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - _("Invalid URI: “%s”"), uri); + message, uri); g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_widget_show (dialog); - return; } - - gnome_vfs_url_show (uri); + return; } static void |