+2005-05-10 Marco Pesenti Gritti <mpg@redhat.com>
+
+ * shell/ev-window.c: (sanity_check_uri), (ev_window_open):
+
+ Check for uri correctness/existence
+
2005-05-09 Juerg Billeter <j@bitron.ch>
* shell/ev-window.c: (using_postscript_printer):
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
+#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomeprintui/gnome-print-dialog.h>
#include <gconf/gconf-client.h>
return FALSE;
}
+static gboolean
+sanity_check_uri (EvWindow *window, const char *uri)
+{
+ gboolean result = FALSE;
+ GnomeVFSURI *vfs_uri;
+ char *err;
+
+ vfs_uri = gnome_vfs_uri_new (uri);
+ if (vfs_uri) {
+ if (gnome_vfs_uri_exists (vfs_uri)) {
+ result = TRUE;
+ }
+ }
+
+ if (!result) {
+ err = g_strdup_printf (_("The file %s does not exist."), uri);
+ unable_to_load (window, err);
+ g_free (err);
+ }
+
+ return result;
+}
+
void
ev_window_open (EvWindow *ev_window, const char *uri)
{
GType document_type;
char *mime_type = NULL;
+ if (!sanity_check_uri (ev_window, uri)) {
+ return;
+ }
+
g_free (ev_window->priv->uri);
ev_window->priv->uri = g_strdup (uri);