diff options
author | Hans Breuer <hans@breuer.org> | 2001-11-18 15:37:13 +0000 |
---|---|---|
committer | Hans Breuer <hans@src.gnome.org> | 2001-11-18 15:37:13 +0000 |
commit | d9eb9ba9d6b1967c8243aecbd043cebe52198819 (patch) | |
tree | 9c1d2439f9cdc7867831afef13162db5282cbcbe /gtk/gtkfilesel.c | |
parent | cdc4f6a476940f20d5989c61016a15e13995bd15 (diff) | |
download | gdk-pixbuf-d9eb9ba9d6b1967c8243aecbd043cebe52198819.tar.gz |
make it compile with msvc: !HAVE_UNISTD_H; no label without op, even if
2001-11-18 Hans Breuer <hans@breuer.org>
* gtk/gdkaccelmap.c : make it compile with msvc: !HAVE_UNISTD_H;
no label without op, even if it's a no-op.
* gtk/gtk.def :
* gtk/makefile.msc.in : reflect marshaler split, some clean-up
* config.h.win32.in : remove definition of HAVE_DIRENT_H
* gtk/gtkfilesel.c : due to GDir (new in glib) DIR isn't
required anymore, replace it.
* gtk/queryimmodules.c : DIR -> GDir replacement, also
getcwd() -> g_get_current_dir()
* gdk/win32/gdkgeometry-win32.c : adapt to refactored gdkgeometry-x11.c
Even 'noisy laugh' scolling appears to work, though I still can't
claim to have fully understood what it is supposed to do ...
Diffstat (limited to 'gtk/gtkfilesel.c')
-rw-r--r-- | gtk/gtkfilesel.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index fc8bab725..19fb7ab9e 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -32,9 +32,6 @@ #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif -#ifdef HAVE_DIRENT_H -#include <dirent.h> -#endif #include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -2592,8 +2589,9 @@ open_new_dir (gchar *dir_name, gboolean stat_subdirs) { CompletionDirSent *sent; - DIR *directory; - struct dirent *dirent_ptr; + GDir *directory; + char *dirent; + GError *error; gint entry_count = 0; gint n_entries = 0; gint i; @@ -2615,38 +2613,38 @@ open_new_dir (gchar *dir_name, return NULL; } - directory = opendir (sys_dir_name); + directory = g_dir_open (sys_dir_name, 0, &error); if (!directory) { - cmpl_errno = errno; + cmpl_errno = error->code; /* ??? */ g_free (sys_dir_name); return NULL; } - while ((dirent_ptr = readdir (directory)) != NULL) + while ((dirent = g_dir_read_name (directory)) != NULL) entry_count++; sent->entries = g_new (CompletionDirEntry, entry_count); sent->entry_count = entry_count; - rewinddir (directory); + g_dir_rewind (directory); for (i = 0; i < entry_count; i += 1) { - dirent_ptr = readdir (directory); + dirent = g_dir_read_name (directory); - if (!dirent_ptr) + if (!dirent) { - cmpl_errno = errno; - closedir (directory); + g_warning ("Failure reading directory '%s'", sys_dir_name); + g_dir_close (directory); g_free (sys_dir_name); return NULL; } - sent->entries[n_entries].entry_name = g_filename_to_utf8 (dirent_ptr->d_name, -1, NULL, NULL, NULL); + sent->entries[n_entries].entry_name = g_filename_to_utf8 (dirent, -1, NULL, NULL, NULL); if (!g_utf8_validate (sent->entries[n_entries].entry_name, -1, NULL)) { - g_warning (_("The filename %s couldn't be converted to UTF-8. Try setting the environment variable G_BROKEN_FILENAMES."), dirent_ptr->d_name); + g_warning (_("The filename %s couldn't be converted to UTF-8. Try setting the environment variable G_BROKEN_FILENAMES."), dirent); continue; } @@ -2655,7 +2653,7 @@ open_new_dir (gchar *dir_name, { g_string_append_c (path, G_DIR_SEPARATOR); } - g_string_append (path, dirent_ptr->d_name); + g_string_append (path, dirent); if (stat_subdirs) { @@ -2678,7 +2676,7 @@ open_new_dir (gchar *dir_name, g_string_free (path, TRUE); qsort (sent->entries, sent->entry_count, sizeof (CompletionDirEntry), compare_cmpl_dir); - closedir (directory); + g_dir_close (directory); return sent; } |