diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-06-20 15:00:16 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-06-20 15:01:31 +0200 |
commit | 5ee4ff2aaf98e2eaa1ec2dc9f7e659b3b01ba7bf (patch) | |
tree | 26104e4c159494401ed0bef31dbef8b88ca30a67 /glib | |
parent | a568248d3255407fcaa7368c4925c20e95619d20 (diff) |
[glib-demo] Allow using relative paths in demo application
Diffstat (limited to 'glib')
-rw-r--r-- | glib/demo/main.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/glib/demo/main.c b/glib/demo/main.c index cf5cb756..5973c8e7 100644 --- a/glib/demo/main.c +++ b/glib/demo/main.c @@ -146,6 +146,7 @@ gint main (gint argc, gchar **argv) GtkWidget *notebook; GtkWidget *treeview; GtkTreeSelection *selection; + GFile *file; gchar *uri; GTimer *timer; GError *error = NULL; @@ -161,18 +162,10 @@ gint main (gint argc, gchar **argv) gtk_init (&argc, &argv); - if (g_ascii_strncasecmp (argv[1], "file://", strlen ("file://")) == 0) { - uri = g_strdup (argv[1]); - } else { - uri = g_filename_to_uri (argv[1], NULL, &error); - if (error) { - g_print ("Error: %s\n", error->message); - g_error_free (error); - - return 1; - } - } - + file = g_file_new_for_commandline_arg (argv[1]); + uri = g_file_get_uri (file); + g_object_unref (file); + timer = g_timer_new (); document = poppler_document_new_from_file (uri, NULL, &error); g_timer_stop (timer); |