Fixed teardown sequence.
[raktpdf.git] / src / rakt-window.c
index 1ada22c1534c51fbe0c9b31c1079253625c70ae6..5e7b3ab0e020c06e5ab4c3c271fad184a1a6050a 100644 (file)
@@ -159,20 +159,14 @@ render_page (RaktWindow *window)
 }
 
 static void
-open_document (RaktWindow *window, gchar *file)
+open_document (RaktWindow *window, gchar *uri)
 {
        RaktWindowPriv *priv;
        GError *error = NULL;
-       gchar real[PATH_MAX], buf[16 + PATH_MAX];
 
        priv = GET_PRIV (window);
 
-       realpath (file, real);
-
-       g_strlcpy (buf, "file://", sizeof (buf));
-       g_strlcat (buf, real, sizeof (buf));
-
-       priv->document = poppler_document_new_from_file (buf, NULL, &error);
+       priv->document = poppler_document_new_from_file (uri, NULL, &error);
 
        priv->page_no = 0;
        render_page (window);
@@ -226,7 +220,7 @@ on_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 {
        gtk_main_quit ();
 
-       return FALSE;
+       return TRUE;
 }
 
 static void
@@ -308,10 +302,11 @@ on_action_open (GtkAction *action, RaktWindow *window)
        n = gtk_dialog_run (GTK_DIALOG (dialog));
 
        if (n == GTK_RESPONSE_ACCEPT) {
-               gchar *file;
+               gchar *uri;
 
-               file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-               open_document (window, file);
+               uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
+               open_document (window, uri);
+               g_free (uri);
        }
 
        gtk_widget_destroy (dialog);