Mercurial > geeqie.yaz
changeset 722:9a145206ec2c
tab_completion_do(): use g_build_filename(), G_DIR_SEPARATOR, G_DIR_SEPARATOR_S.
author | zas_ |
---|---|
date | Wed, 21 May 2008 10:11:56 +0000 |
parents | b736a2e3129b |
children | 7638e83fed2a |
files | src/ui_tabcomp.c |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ui_tabcomp.c Wed May 21 09:58:29 2008 +0000 +++ b/src/ui_tabcomp.c Wed May 21 10:11:56 2008 +0000 @@ -379,10 +379,11 @@ g_free(entry_dir); return home_exp; } + if (isdir(entry_dir) && strcmp(entry_file, ".") != 0 && strcmp(entry_file, "..") != 0) { ptr = entry_dir + strlen(entry_dir) - 1; - if (ptr[0] == '/') + if (ptr[0] == G_DIR_SEPARATOR) { if (home_exp) { @@ -398,11 +399,12 @@ const gchar *file; file = td->file_list->data; - buf = g_strconcat(entry_dir, file, NULL); + buf = g_build_filename(entry_dir, file, NULL); if (isdir(buf)) { + gchar *tmp = g_strconcat(buf, G_DIR_SEPARATOR_S, NULL); g_free(buf); - buf = g_strconcat(entry_dir, file, "/", NULL); + buf = tmp; } gtk_entry_set_text(GTK_ENTRY(td->entry), buf); gtk_editable_set_position(GTK_EDITABLE(td->entry), strlen(buf)); @@ -422,7 +424,7 @@ } else { - gchar *buf = g_strconcat(entry_dir, "/", NULL); + gchar *buf = g_strconcat(entry_dir, G_DIR_SEPARATOR_S, NULL); gtk_entry_set_text(GTK_ENTRY(td->entry), buf); gtk_editable_set_position(GTK_EDITABLE(td->entry), strlen(buf)); g_free(buf); @@ -438,7 +440,7 @@ if (strlen(entry_dir) == 0) { g_free(entry_dir); - entry_dir = g_strdup("/"); + entry_dir = g_strdup(G_DIR_SEPARATOR_S); /* FIXME: win32 */ } if (isdir(entry_dir)) @@ -452,7 +454,7 @@ tab_completion_read_dir(td, entry_dir); } - if (strcmp(entry_dir, "/") == 0) entry_dir[0] = '\0'; + if (strcmp(entry_dir, G_DIR_SEPARATOR_S) == 0) entry_dir[0] = '\0'; /* FIXME: win32 */ list = td->file_list; while (list) @@ -472,12 +474,13 @@ gchar *file = poss->data; gchar *buf; - buf = g_strconcat(entry_dir, "/", file, NULL); + buf = g_build_filename(entry_dir, file, NULL); if (isdir(buf)) { + gchar *tmp = g_strconcat(buf, G_DIR_SEPARATOR_S, NULL); g_free(buf); - buf = g_strconcat(entry_dir, "/", file, "/", NULL); + buf = tmp; } gtk_entry_set_text(GTK_ENTRY(td->entry), buf); gtk_editable_set_position(GTK_EDITABLE(td->entry), strlen(buf)); @@ -514,7 +517,7 @@ gchar *buf; file = g_strdup(test_file); file[c] = '\0'; - buf = g_strconcat(entry_dir, "/", file, NULL); + buf = g_build_filename(entry_dir, file, NULL); gtk_entry_set_text(GTK_ENTRY(td->entry), buf); gtk_editable_set_position(GTK_EDITABLE(td->entry), strlen(buf));