diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 7e2f8ed42b..f47a95622a 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -315,8 +315,9 @@ typedef struct typedef struct { gchar *dir; - time_t mtime; /* 0 == not existing or not a dir */ + time_t mtime; GtkIconCache *cache; + gboolean exists; } IconThemeDirMtime; static void gtk_icon_theme_finalize (GObject *object); @@ -1133,10 +1134,13 @@ insert_theme (GtkIconTheme *icon_theme, dir_mtime = g_slice_new (IconThemeDirMtime); dir_mtime->cache = NULL; dir_mtime->dir = path; - if (g_stat (path, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode)) + if (g_stat (path, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode)) { dir_mtime->mtime = stat_buf.st_mtime; - else + dir_mtime->exists = TRUE; + } else { dir_mtime->mtime = 0; + dir_mtime->exists = FALSE; + } priv->dir_mtimes = g_list_prepend (priv->dir_mtimes, dir_mtime); } @@ -1370,11 +1374,13 @@ load_themes (GtkIconTheme *icon_theme) dir_mtime->dir = g_strdup (dir); dir_mtime->mtime = 0; + dir_mtime->exists = FALSE; dir_mtime->cache = NULL; if (g_stat (dir, &stat_buf) != 0 || !S_ISDIR (stat_buf.st_mode)) continue; dir_mtime->mtime = stat_buf.st_mtime; + dir_mtime->exists = TRUE; dir_mtime->cache = _gtk_icon_cache_new_for_path (dir); if (dir_mtime->cache != NULL) @@ -2714,12 +2720,12 @@ rescan_themes (GtkIconTheme *icon_theme) stat_res = g_stat (dir_mtime->dir, &stat_buf); /* dir mtime didn't change */ - if (stat_res == 0 && + if (stat_res == 0 && dir_mtime->exists && S_ISDIR (stat_buf.st_mode) && dir_mtime->mtime == stat_buf.st_mtime) continue; /* didn't exist before, and still doesn't */ - if (dir_mtime->mtime == 0 && + if (!dir_mtime->exists && (stat_res != 0 || !S_ISDIR (stat_buf.st_mode))) continue; @@ -3314,7 +3320,7 @@ theme_subdir_load (GtkIconTheme *icon_theme, { dir_mtime = (IconThemeDirMtime *)d->data; - if (dir_mtime->mtime == 0) + if (!dir_mtime->exists) continue; /* directory doesn't exist */ full_dir = g_build_filename (dir_mtime->dir, subdir, NULL);