diff options
author | Marek Kasik <mkasik@redhat.com> | 2008-09-30 08:45:01 +0000 |
---|---|---|
committer | Marek Kašík <mkasik@src.gnome.org> | 2008-09-30 08:45:01 +0000 |
commit | 1d7c1e13e86001104ffddd0b750247dc4dfc4e46 (patch) | |
tree | fb4600172bf533721ca9a4f5c186ea87368ed99d /gtk/gtkprintunixdialog.c | |
parent | 6a3a9c957c89a5896d3bd904dc5b59ff1ae40011 (diff) | |
download | gtk+-1d7c1e13e86001104ffddd0b750247dc4dfc4e46.tar.gz |
Bug 344522 – support non-local destination files (GtkPrint):
2008-09-30 Marek Kasik <mkasik@redhat.com>
Bug 344522 – support non-local destination files (GtkPrint):
* gtk/gtkprintunixdialog.c
* gtk/gtkprinteroptionwidget.c: Process URI instead of filename.
* modules/printbackends/file/gtkprintbackendfile.c: Add ability
to save files on non-local filesystems.
svn path=/trunk/; revision=21552
Diffstat (limited to 'gtk/gtkprintunixdialog.c')
-rw-r--r-- | gtk/gtkprintunixdialog.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index 3c7dc37b61..8751bfe975 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -333,7 +333,7 @@ error_dialogs (GtkPrintUnixDialog *print_dialog, GtkPrinter *printer = NULL; GtkWindow *toplevel = NULL; GtkWidget *dialog = NULL; - gchar *filename = NULL; + GFile *file = NULL; gchar *basename = NULL; gchar *dirname = NULL; int response; @@ -352,15 +352,15 @@ error_dialogs (GtkPrintUnixDialog *print_dialog, if (option != NULL && option->type == GTK_PRINTER_OPTION_TYPE_FILESAVE) { - filename = g_filename_from_uri (option->value, NULL, NULL); + file = g_file_new_for_uri (option->value); - if (filename != NULL && - g_file_test (filename, G_FILE_TEST_EXISTS)) + if (file != NULL && + g_file_query_exists (file, NULL)) { toplevel = get_toplevel (GTK_WIDGET (print_dialog)); - basename = g_path_get_basename (filename); - dirname = g_path_get_dirname (filename); + basename = g_file_get_basename (file); + dirname = g_file_get_parse_name (g_file_get_parent (file)); dialog = gtk_message_dialog_new (toplevel, GTK_DIALOG_MODAL | @@ -396,17 +396,18 @@ error_dialogs (GtkPrintUnixDialog *print_dialog, gtk_widget_destroy (dialog); + g_free (dirname); + g_free (basename); + if (response != GTK_RESPONSE_ACCEPT) { g_signal_stop_emission_by_name (print_dialog, "response"); + g_object_unref (file); return TRUE; } - - g_free (dirname); - g_free (basename); } - g_free (filename); + g_object_unref (file); } } } |