Commit 6b835878 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Fix so that the encoding of the filename is handled properly in the case

Thu Jun 13 12:24:09 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkfilesel.c (gtk_file_selection_set_filename):
        Fix so that the encoding of the filename is handled
        properly in the case of non-UTF-8 filesystems;
        document the encoding. (#83386, Sebastian Ritau)

        * gtk/gtkfilesel.c (filenames_drag_get): Remove
        debug printf. Fix UTF-8 / filename encoding
        confusion
parent 88ed8a8c
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename):
Fix so that the encoding of the filename is handled
properly in the case of non-UTF-8 filesystems;
document the encoding. (#83386, Sebastian Ritau)
* gtk/gtkfilesel.c (filenames_drag_get): Remove
debug printf. Fix UTF-8 / filename encoding
confusion.
2002-06-13 Christian Rose <menthos@menthos.com>
* Makefile.am (EXTRA_DIST): Remove po/README.tools, po/desk.pl
......
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename):
Fix so that the encoding of the filename is handled
properly in the case of non-UTF-8 filesystems;
document the encoding. (#83386, Sebastian Ritau)
* gtk/gtkfilesel.c (filenames_drag_get): Remove
debug printf. Fix UTF-8 / filename encoding
confusion.
2002-06-13 Christian Rose <menthos@menthos.com>
* Makefile.am (EXTRA_DIST): Remove po/README.tools, po/desk.pl
......
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename):
Fix so that the encoding of the filename is handled
properly in the case of non-UTF-8 filesystems;
document the encoding. (#83386, Sebastian Ritau)
* gtk/gtkfilesel.c (filenames_drag_get): Remove
debug printf. Fix UTF-8 / filename encoding
confusion.
2002-06-13 Christian Rose <menthos@menthos.com>
* Makefile.am (EXTRA_DIST): Remove po/README.tools, po/desk.pl
......
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename):
Fix so that the encoding of the filename is handled
properly in the case of non-UTF-8 filesystems;
document the encoding. (#83386, Sebastian Ritau)
* gtk/gtkfilesel.c (filenames_drag_get): Remove
debug printf. Fix UTF-8 / filename encoding
confusion.
2002-06-13 Christian Rose <menthos@menthos.com>
* Makefile.am (EXTRA_DIST): Remove po/README.tools, po/desk.pl
......
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename):
Fix so that the encoding of the filename is handled
properly in the case of non-UTF-8 filesystems;
document the encoding. (#83386, Sebastian Ritau)
* gtk/gtkfilesel.c (filenames_drag_get): Remove
debug printf. Fix UTF-8 / filename encoding
confusion.
2002-06-13 Christian Rose <menthos@menthos.com>
* Makefile.am (EXTRA_DIST): Remove po/README.tools, po/desk.pl
......
Thu Jun 13 12:24:09 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_set_filename):
Fix so that the encoding of the filename is handled
properly in the case of non-UTF-8 filesystems;
document the encoding. (#83386, Sebastian Ritau)
* gtk/gtkfilesel.c (filenames_drag_get): Remove
debug printf. Fix UTF-8 / filename encoding
confusion.
2002-06-13 Christian Rose <menthos@menthos.com>
* Makefile.am (EXTRA_DIST): Remove po/README.tools, po/desk.pl
......
......@@ -938,13 +938,21 @@ filenames_dropped (GtkWidget *widget,
else
{
GtkWidget *dialog;
gchar *filename_utf8;
/* Conversion back to UTF-8 should always succeed for the result
* of g_filename_from_uri()
*/
filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
g_assert (filename_utf8);
dialog = gtk_message_dialog_new (GTK_WINDOW (widget),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
_("The file \"%s\" resides on another machine (called %s) and may not be available to this program.\n"
"Are you sure that you want to select it?"), filename, hostname);
"Are you sure that you want to select it?"), filename_utf8, hostname);
g_free (filename_utf8);
g_object_set_data_full (G_OBJECT (dialog), "gtk-fs-dnd-filename", g_strdup (filename), g_free);
......@@ -1008,8 +1016,10 @@ filenames_drag_get (GtkWidget *widget,
}
else
{
g_print ("Setting text: '%s'\n", file);
gtk_selection_data_set_text (selection_data, file, -1);
gchar *filename_utf8 = g_filename_to_utf8 (file, -1, NULL, NULL, NULL);
g_assert (filename_utf8);
gtk_selection_data_set_text (selection_data, filename_utf8, -1);
g_free (filename_utf8);
}
}
}
......@@ -1134,16 +1144,32 @@ gtk_file_selection_hide_fileop_buttons (GtkFileSelection *filesel)
/**
* gtk_file_selection_set_filename:
* @filesel: a #GtkFileSelection.
* @filename: a string to set as the default file name.
*
* Sets a default path for the file requestor. If @filename includes a
* directory path, then the requestor will open with that path as its
* current working directory.
*
* The encoding of @filename is the on-disk encoding, which
* may not be UTF-8. See g_filename_from_utf8().
**/
void
gtk_file_selection_set_filename (GtkFileSelection *filesel,
const gchar *filename)
{
gchar *buf;
const char *name, *last_slash;
char *filename_utf8;
g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
g_return_if_fail (filename != NULL);
filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
g_return_if_fail (filename_utf8 == NULL);
last_slash = strrchr (filename, G_DIR_SEPARATOR);
if (!last_slash)
......@@ -1164,6 +1190,8 @@ gtk_file_selection_set_filename (GtkFileSelection *filesel,
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), name);
g_free (buf);
g_object_notify (G_OBJECT (filesel), "filename");
g_free (filename_utf8);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment