diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2007-05-14 15:35:37 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@src.gnome.org> | 2007-05-14 15:35:37 +0000 |
commit | 2e098756c1717e9e0e735ee7ea77cbaeba463550 (patch) | |
tree | 4d7eebaeb90c52738a2ff9a246da9bfdb99aff04 /gtk | |
parent | 59120d8bfd7ec9d6d254065f3de3c9729e3c9a1d (diff) | |
download | gdk-pixbuf-2e098756c1717e9e0e735ee7ea77cbaeba463550.tar.gz |
Add check for GNU extensions to ftw()/nftw().
2007-05-14 Emmanuele Bassi <ebassi@gnome.org>
* configure.in: Add check for GNU extensions to ftw()/nftw().
* gtk/gtksearchenginesimple.c: Fix compilation on systems with
only POSIX-compliant ftw(). (#435797, based on a patch by
Richard Hult)
svn path=/trunk/; revision=17844
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtksearchenginesimple.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/gtk/gtksearchenginesimple.c b/gtk/gtksearchenginesimple.c index 26768488e..ede5e8521 100644 --- a/gtk/gtksearchenginesimple.c +++ b/gtk/gtksearchenginesimple.c @@ -20,10 +20,17 @@ * Based on nautilus-search-engine-simple.c */ +#include <config.h> + +#ifdef HAVE_GNU_FTW #define _XOPEN_SOURCE 500 #define _GNU_SOURCE +#endif + +#ifdef HAVE_FTW_H +#include <ftw.h> +#endif -#include <config.h> #include "gtksearchenginesimple.h" #define XDG_PREFIX _gtk_xdg @@ -31,10 +38,6 @@ #include <string.h> -#ifdef HAVE_FTW_H -#include <ftw.h> -#endif - #include <glib/gstrfuncs.h> #define BATCH_SIZE 500 @@ -205,9 +208,13 @@ search_visit_func (const char *fpath, gboolean is_hidden; data = (SearchThreadData*)g_static_private_get (&search_thread_data); - + if (data->cancelled) +#ifdef HAVE_GNU_FTW return FTW_STOP; +#else + return 1; +#endif /* HAVE_GNU_FTW */ name = strrchr (fpath, '/'); if (name) @@ -262,10 +269,14 @@ search_visit_func (const char *fpath, if (data->n_processed_files > BATCH_SIZE) send_batch (data); +#ifdef HAVE_GNU_FTW if (is_hidden) return FTW_SKIP_SUBTREE; else return FTW_CONTINUE; +#else + return 0; +#endif /* HAVE_GNU_FTW */ } #endif /* HAVE_FTW_H */ @@ -279,12 +290,16 @@ search_thread_func (gpointer user_data) g_static_private_set (&search_thread_data, data, NULL); - nftw (data->path, search_visit_func, 20, FTW_ACTIONRETVAL | FTW_PHYS); + nftw (data->path, search_visit_func, 20, +#ifdef HAVE_GNU_FTW + FTW_ACTIONRETVAL | +#endif + FTW_PHYS); send_batch (data); g_idle_add (search_thread_done_idle, data); -#endif +#endif /* HAVE_FTW_H */ return NULL; } |