[evince] previewer: handle opening files from URI



commit 71767dbf67636d083f40ca27326eee60221cb01f
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon May 23 14:03:24 2016 +0200

    previewer: handle opening files from URI
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766531

 previewer/ev-previewer.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/previewer/ev-previewer.c b/previewer/ev-previewer.c
index dd73b87..9fcd115 100644
--- a/previewer/ev-previewer.c
+++ b/previewer/ev-previewer.c
@@ -139,6 +139,7 @@ main (gint argc, gchar **argv)
         GtkApplication  *application;
        GOptionContext  *context;
        GError          *error = NULL;
+       gchar           *path;
         int              status = 1;
 
 #ifdef G_OS_WIN32
@@ -194,10 +195,12 @@ main (gint argc, gchar **argv)
                 return 1;
         }
 
-       if (!g_file_test (argv[1], G_FILE_TEST_IS_REGULAR)) {
+       path = g_filename_from_uri (argv[1], NULL, NULL);
+       if (!g_file_test (argv[1], G_FILE_TEST_IS_REGULAR) && !g_file_test (path, G_FILE_TEST_IS_REGULAR)) {
                g_printerr ("Filename \"%s\" does not exist or is not a regular file\n", argv[1]);
                 return 1;
        }
+        g_free (path);
 
        if (!ev_init ())
                 return 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]