summaryrefslogtreecommitdiff
path: root/gtk/gtkfilesel.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-12-13 23:28:56 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-12-13 23:28:56 +0000
commit137ad5b9ae32c00114743ff07684dcd46a5cc9f7 (patch)
tree1469d57084a8c0b2dafc689473b485cbdcef3b95 /gtk/gtkfilesel.c
parent73b15ba391b3a533786e2a2f4f80274b80866822 (diff)
downloadgtk+-137ad5b9ae32c00114743ff07684dcd46a5cc9f7.tar.gz
Use g_utf8_collate_key() to sort in human-friendly order. (#94473)
Fri Dec 13 18:22:21 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c (compare_cmpl_dir): Use g_utf8_collate_key() to sort in human-friendly order. (#94473)
Diffstat (limited to 'gtk/gtkfilesel.c')
-rw-r--r--gtk/gtkfilesel.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index 061a0f476a..cbe031ac31 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -182,6 +182,7 @@ struct _CompletionDirEntry
{
gboolean is_dir;
gchar *entry_name;
+ gchar *sort_key;
};
struct _CompletionUserDir
@@ -2688,7 +2689,10 @@ free_dir_sent (CompletionDirSent* sent)
{
gint i;
for (i = 0; i < sent->entry_count; i++)
- g_free (sent->entries[i].entry_name);
+ {
+ g_free (sent->entries[i].entry_name);
+ g_free (sent->entries[i].sort_key);
+ }
g_free (sent->entries);
g_free (sent);
}
@@ -3080,6 +3084,8 @@ open_new_dir (gchar *dir_name,
}
g_clear_error (&error);
+ sent->entries[n_entries].sort_key = g_utf8_collate_key (sent->entries[n_entries].entry_name, -1);
+
g_string_assign (path, sys_dir_name);
if (path->str[path->len-1] != G_DIR_SEPARATOR)
{
@@ -3924,8 +3930,9 @@ static gint
compare_cmpl_dir (const void *a,
const void *b)
{
- return compare_filenames ((((CompletionDirEntry*)a))->entry_name,
- (((CompletionDirEntry*)b))->entry_name);
+
+ return strcmp (((CompletionDirEntry*)a)->sort_key,
+ (((CompletionDirEntry*)b))->sort_key);
}
static gint