summaryrefslogtreecommitdiff
path: root/gtk/gtkprinteroptionwidget.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2006-08-18 01:30:24 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2006-08-18 01:30:24 +0000
commit919cdba486e502c99386bf3dc8465a068f938345 (patch)
treed215a0f495604c4913a659bfb011e06a82e3442f /gtk/gtkprinteroptionwidget.c
parent3336c855fefd625b99076e43422fde0503530571 (diff)
downloadgtk+-919cdba486e502c99386bf3dc8465a068f938345.tar.gz
Handle filename encoding consistently. (#351812, Christian Persch)
2006-08-17 Matthias Clasen <mclasen@redhat.com> * gtk/gtkprinteroptionwidget.c (update_widgets): * modules/printbackends/file/gtkprintbackendfile.c (output_file_from_settings): Handle filename encoding consistently. (#351812, Christian Persch)
Diffstat (limited to 'gtk/gtkprinteroptionwidget.c')
-rw-r--r--gtk/gtkprinteroptionwidget.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c
index a5f95286d0..c7f7316661 100644
--- a/gtk/gtkprinteroptionwidget.c
+++ b/gtk/gtkprinteroptionwidget.c
@@ -841,14 +841,27 @@ update_widgets (GtkPrinterOptionWidget *widget)
break;
case GTK_PRINTER_OPTION_TYPE_FILESAVE:
{
- char *basename = g_path_get_basename (source->value);
- char *dirname = g_path_get_dirname (source->value);
- gtk_entry_set_text (GTK_ENTRY (priv->entry), basename);
- if (g_path_is_absolute (dirname))
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (priv->combo),
- dirname);
- g_free (basename);
- g_free (dirname);
+ gchar *filename = g_filename_from_uri (source->value, NULL, NULL);
+ if (filename != NULL)
+ {
+ gchar *basename, *dirname, *text;
+
+ basename = g_path_get_basename (filename);
+ dirname = g_path_get_dirname (filename);
+ text = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
+
+ if (text != NULL)
+ gtk_entry_set_text (GTK_ENTRY (priv->entry), basename);
+ if (g_path_is_absolute (dirname))
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (priv->combo),
+ dirname);
+ g_free (text);
+ g_free (basename);
+ g_free (dirname);
+ g_free (filename);
+ }
+ else
+ gtk_entry_set_text (GTK_ENTRY (priv->entry), source->value);
break;
}
default: