summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-06-13 16:32:45 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-06-13 16:32:45 +0000
commit610a91de25153713f61fee62aa44090a751a9569 (patch)
tree031a866b51da495bca937f2724908e2bfec06c21
parent138d13b2a4ff182ddff858606a3939123de9d3c1 (diff)
downloadgdk-pixbuf-610a91de25153713f61fee62aa44090a751a9569.tar.gz
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.
-rw-r--r--ChangeLog11
-rw-r--r--ChangeLog.pre-2-1011
-rw-r--r--ChangeLog.pre-2-211
-rw-r--r--ChangeLog.pre-2-411
-rw-r--r--ChangeLog.pre-2-611
-rw-r--r--ChangeLog.pre-2-811
-rw-r--r--docs/reference/gtk/tmpl/gtkfilesel.sgml6
-rw-r--r--gtk/gtkfilesel.c38
8 files changed, 101 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index d4f8e0e05..0b5929625 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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.
+
Thu Jun 13 12:01:36 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_drag_motion): Don't return
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index d4f8e0e05..0b5929625 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,14 @@
+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.
+
Thu Jun 13 12:01:36 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_drag_motion): Don't return
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index d4f8e0e05..0b5929625 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,14 @@
+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.
+
Thu Jun 13 12:01:36 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_drag_motion): Don't return
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index d4f8e0e05..0b5929625 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,14 @@
+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.
+
Thu Jun 13 12:01:36 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_drag_motion): Don't return
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index d4f8e0e05..0b5929625 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,14 @@
+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.
+
Thu Jun 13 12:01:36 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_drag_motion): Don't return
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index d4f8e0e05..0b5929625 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,14 @@
+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.
+
Thu Jun 13 12:01:36 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_drag_motion): Don't return
diff --git a/docs/reference/gtk/tmpl/gtkfilesel.sgml b/docs/reference/gtk/tmpl/gtkfilesel.sgml
index 43671d1bf..6c32bc223 100644
--- a/docs/reference/gtk/tmpl/gtkfilesel.sgml
+++ b/docs/reference/gtk/tmpl/gtkfilesel.sgml
@@ -133,12 +133,10 @@ Creates a new file selection dialog box. By default it will contain a #GtkCList
<!-- ##### FUNCTION gtk_file_selection_set_filename ##### -->
<para>
-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.
-
</para>
-@filesel: a #GtkFileSelection.
-@filename: a string to set as the default file name.
+@filesel:
+@filename:
<!-- ##### FUNCTION gtk_file_selection_get_filename ##### -->
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index 9de3daa87..4cbae7cec 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -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,14 +1190,16 @@ 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);
}
/**
* gtk_file_selection_get_filename:
* @filesel: a #GtkFileSelection
*
- * This function returns the selected filename in encoding of
- * g_filename_from_utf8(), which may or may not be the same as that
+ * This function returns the selected filename in the on-disk encoding
+ * (see g_filename_from_utf8()), which may or may not be the same as that
* used by GTK+ (UTF-8). To convert to UTF-8, call g_filename_to_utf8().
* The returned string points to a statically allocated buffer and
* should be copied if you plan to keep it around.