Check the mtime of all directories, not just the toplevel, if ftw() is
2007-01-26 Matthias Clasen <mclasen@redhat.com> * gtk/updateiconcache.c: Check the mtime of all directories, not just the toplevel, if ftw() is available. (#331671, Behdad Esfahbod) * configure.in: Check for ftw.h. svn path=/trunk/; revision=17221
This commit is contained in:
parent
51a5dad07e
commit
84cb26f73f
@ -1,3 +1,11 @@
|
|||||||
|
2007-01-26 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/updateiconcache.c: Check the mtime of all directories,
|
||||||
|
not just the toplevel, if ftw() is available. (#331671, Behdad
|
||||||
|
Esfahbod)
|
||||||
|
|
||||||
|
* configure.in: Check for ftw.h.
|
||||||
|
|
||||||
2007-01-26 Michael Natterer <mitch@imendio.com>
|
2007-01-26 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_finalize):
|
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_finalize):
|
||||||
|
@ -62,7 +62,53 @@ static gchar *var_name = "-";
|
|||||||
#define ALIGN_VALUE(this, boundary) \
|
#define ALIGN_VALUE(this, boundary) \
|
||||||
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
|
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
|
||||||
|
|
||||||
static gboolean
|
#ifdef HAVE_FTW_H
|
||||||
|
|
||||||
|
#include <ftw.h>
|
||||||
|
|
||||||
|
static struct stat cache_stat;
|
||||||
|
static gboolean cache_up_to_date;
|
||||||
|
|
||||||
|
static int check_dir_mtime (const char *dir,
|
||||||
|
const struct stat *sb,
|
||||||
|
int tf)
|
||||||
|
{
|
||||||
|
if (tf != FTW_NS && sb->st_mtime > cache_stat.st_mtime)
|
||||||
|
{
|
||||||
|
cache_up_to_date = FALSE;
|
||||||
|
/* stop tree walk */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
is_cache_up_to_date (const gchar *path)
|
||||||
|
{
|
||||||
|
gchar *cache_path;
|
||||||
|
gint retval;
|
||||||
|
|
||||||
|
cache_path = g_build_filename (path, CACHE_NAME, NULL);
|
||||||
|
retval = g_stat (cache_path, &cache_stat);
|
||||||
|
g_free (cache_path);
|
||||||
|
|
||||||
|
if (retval < 0)
|
||||||
|
{
|
||||||
|
/* Cache file not found */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
cache_up_to_date = TRUE;
|
||||||
|
|
||||||
|
ftw (path, check_dir_mtime, 20);
|
||||||
|
|
||||||
|
return cache_up_to_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !HAVE_FTW_H */
|
||||||
|
|
||||||
|
gboolean
|
||||||
is_cache_up_to_date (const gchar *path)
|
is_cache_up_to_date (const gchar *path)
|
||||||
{
|
{
|
||||||
struct stat path_stat, cache_stat;
|
struct stat path_stat, cache_stat;
|
||||||
@ -92,6 +138,8 @@ is_cache_up_to_date (const gchar *path)
|
|||||||
return cache_stat.st_mtime >= path_stat.st_mtime;
|
return cache_stat.st_mtime >= path_stat.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !HAVE_FTW_H */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
has_theme_index (const gchar *path)
|
has_theme_index (const gchar *path)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user