Include <ftw.h> and use nftw() and all the symbols defined in <ftw.h>

2007-05-13  Emmanuele Bassi  <ebassi@gnome.org>

	* gtk/gtksearchenginesimple.c: Include <ftw.h> and use nftw() and
	all the symbols defined in <ftw.h> conditionally.

svn path=/trunk/; revision=17836
This commit is contained in:
Emmanuele Bassi 2007-05-13 21:21:39 +00:00 committed by Emmanuele Bassi
parent 50af49319a
commit 12a3162dd5
2 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2007-05-13 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtksearchenginesimple.c: Include <ftw.h> and use nftw() and
all the symbols defined in <ftw.h> conditionally.
2007-05-13 Cody Russell <bratsche@gnome.org>
* gdk/win32/gdkevents-win32.c: Only do the configure event context

View File

@ -30,7 +30,11 @@
#include "xdgmime/xdgmime.h"
#include <string.h>
#ifdef HAVE_FTW_H
#include <ftw.h>
#endif
#include <glib/gstrfuncs.h>
#define BATCH_SIZE 500
@ -184,6 +188,7 @@ send_batch (SearchThreadData *data)
static GStaticPrivate search_thread_data = G_STATIC_PRIVATE_INIT;
#ifdef HAVE_FTW_H
static int
search_visit_func (const char *fpath,
const struct stat *sb,
@ -256,16 +261,18 @@ search_visit_func (const char *fpath,
if (data->n_processed_files > BATCH_SIZE)
send_batch (data);
if (is_hidden)
return FTW_SKIP_SUBTREE;
else
return FTW_CONTINUE;
}
#endif /* HAVE_FTW_H */
static gpointer
search_thread_func (gpointer user_data)
{
#ifdef HAVE_FTW_H
SearchThreadData *data;
data = user_data;
@ -277,6 +284,7 @@ search_thread_func (gpointer user_data)
send_batch (data);
g_idle_add (search_thread_done_idle, data);
#endif
return NULL;
}
@ -366,9 +374,9 @@ _gtk_search_engine_simple_init (GtkSearchEngineSimple *engine)
GtkSearchEngine *
_gtk_search_engine_simple_new (void)
{
GtkSearchEngine *engine;
engine = g_object_new (GTK_TYPE_SEARCH_ENGINE_SIMPLE, NULL);
return engine;
#ifdef HAVE_FTW_H
return g_object_new (GTK_TYPE_SEARCH_ENGINE_SIMPLE, NULL);
#else
return NULL;
#endif
}