+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):
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