diff options
author | Tor Lillqvist <tml@iki.fi> | 2004-04-22 05:08:19 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2004-04-22 05:08:19 +0000 |
commit | 215cabd938150ecfa32d50ac48ac43d00819e596 (patch) | |
tree | 25e0315dfdf0c9fd1ee3e57b572ea878107bdc19 /gtk/gtkfilechooserentry.c | |
parent | 5a8701523c19fc66c2a05135aa80c16d2e9606a3 (diff) | |
download | gtk+-215cabd938150ecfa32d50ac48ac43d00819e596.tar.gz |
Fix the file chooser on Windows. I can't make it misbehave or crash any
2004-04-22 Tor Lillqvist <tml@iki.fi>
Fix the file chooser on Windows. I can't make it misbehave or
crash any more now. But presumably there are still corner cases
not handled. I haven't really checked behaviour of UNC paths, for
instance.
* gtk/gtkfilesystemwin32.c: Accept both backslash and slash in
several places. Use G_IS_DIR_SEPARATOR macro (which could be added
to GLib in 2.6).
(gtk_file_system_win32_get_parent): Like the Unix version, assert
filename is absolute, and avoid one unnecessary string allocation
and freeing.
(canonicalize_filename,gtk_file_system_win32_parse): Handle drive
letters more correctly.
(gtk_file_system_win32_render_icon): Assure correct syntax is used
for root folder of a drive. (#137962, Morten Welinder)
(filename_is_some_root): New function that accepts also root
without any drive specified.
(filename_is_drive_root): Rename from filename_is_root.
* gtk/gtkfilechooserentry.c (completion_match_func): Casefold on
Windows.
Diffstat (limited to 'gtk/gtkfilechooserentry.c')
-rw-r--r-- | gtk/gtkfilechooserentry.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 9c7380d5e2..6bc9d8a9a3 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -99,7 +99,6 @@ static char *maybe_append_separator_to_path (GtkFileChooserEntry *chooser_ent GtkFilePath *path, gchar *display_name); - static GObjectClass *parent_class; static GtkEditableClass *parent_editable_iface; @@ -317,6 +316,20 @@ completion_match_func (GtkEntryCompletion *comp, norm_file_part = g_utf8_normalize (chooser_entry->file_part, -1, G_NORMALIZE_ALL); norm_name = g_utf8_normalize (name, -1, G_NORMALIZE_ALL); +#ifdef G_PLATFORM_WIN32 + { + gchar *temp; + + temp = norm_file_part; + norm_file_part = g_utf8_casefold (norm_file_part, -1); + g_free (temp); + + temp = norm_name; + norm_name = g_utf8_casefold (norm_name, -1); + g_free (temp); + } +#endif + result = (strncmp (norm_file_part, norm_name, strlen (norm_file_part)) == 0); g_free (norm_file_part); @@ -326,10 +339,11 @@ completion_match_func (GtkEntryCompletion *comp, return result; } -/* This function will append a '/' character to paths to display_name iff the - * path associated with it is a directory. maybe_append_separator_to_path will - * g_free the display_name and return a new one if needed. Otherwise, it will - * return the old one. You should be safe calling +/* This function will append a directory separator to paths to + * display_name iff the path associated with it is a directory. + * maybe_append_separator_to_path will g_free the display_name and + * return a new one if needed. Otherwise, it will return the old one. + * You should be safe calling * * display_name = maybe_append_separator_to_path (entry, path, display_name); * ... @@ -352,7 +366,7 @@ maybe_append_separator_to_path (GtkFileChooserEntry *chooser_entry, if (gtk_file_info_get_is_folder (info)) { gchar *tmp = display_name; - display_name = g_strconcat (tmp, "/", NULL); + display_name = g_strconcat (tmp, G_DIR_SEPARATOR_S, NULL); g_free (tmp); } |