Don't keep the caches for unthemed directories in a separate list, instead

2005-07-13  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkicontheme.c (load_themes): Don't keep the caches
	for unthemed directories in a separate list, instead append
	them at the end of the dir_mtimes list, so that we can check
	them for staleness like the other caches.  (#310221, Mark
	McLoughlin)
This commit is contained in:
Matthias Clasen 2005-07-13 14:07:10 +00:00 committed by Matthias Clasen
parent 7db082d5da
commit c251818ca0
4 changed files with 31 additions and 32 deletions

View File

@ -1,5 +1,11 @@
2005-07-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkicontheme.c (load_themes): Don't keep the caches
for unthemed directories in a separate list, instead append
them at the end of the dir_mtimes list, so that we can check
them for staleness like the other caches. (#310221, Mark
McLoughlin)
* configure.in: Check that we have a new enough Cairo.
2005-07-13 Robert Ögren <gtk@roboros.com>

View File

@ -1,5 +1,11 @@
2005-07-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkicontheme.c (load_themes): Don't keep the caches
for unthemed directories in a separate list, instead append
them at the end of the dir_mtimes list, so that we can check
them for staleness like the other caches. (#310221, Mark
McLoughlin)
* configure.in: Check that we have a new enough Cairo.
2005-07-13 Robert Ögren <gtk@roboros.com>

View File

@ -1,5 +1,11 @@
2005-07-13 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkicontheme.c (load_themes): Don't keep the caches
for unthemed directories in a separate list, instead append
them at the end of the dir_mtimes list, so that we can check
them for staleness like the other caches. (#310221, Mark
McLoughlin)
* configure.in: Check that we have a new enough Cairo.
2005-07-13 Robert Ögren <gtk@roboros.com>

View File

@ -81,7 +81,6 @@ struct _GtkIconThemePrivate
*/
GList *themes;
GHashTable *unthemed_icons;
GList *unthemed_icons_caches;
/* Note: The keys of this hashtable are owned by the
* themedir and unthemed hashtables.
@ -571,7 +570,6 @@ gtk_icon_theme_init (GtkIconTheme *icon_theme)
priv->themes_valid = FALSE;
priv->themes = NULL;
priv->unthemed_icons = NULL;
priv->unthemed_icons_caches = NULL;
priv->pixbuf_supports_svg = pixbuf_supports_svg ();
}
@ -604,16 +602,6 @@ do_theme_change (GtkIconTheme *icon_theme)
}
}
static void
free_cache (gpointer data,
gpointer user_data)
{
GtkIconCache *cache = (GtkIconCache *)data;
if (cache)
_gtk_icon_cache_unref (cache);
}
static void
blow_themes (GtkIconTheme *icon_theme)
{
@ -627,13 +615,9 @@ blow_themes (GtkIconTheme *icon_theme)
g_list_foreach (priv->dir_mtimes, (GFunc)free_dir_mtime, NULL);
g_list_free (priv->dir_mtimes);
g_hash_table_destroy (priv->unthemed_icons);
if (priv->unthemed_icons_caches)
g_list_foreach (priv->unthemed_icons_caches, free_cache, NULL);
g_list_free (priv->unthemed_icons_caches);
}
priv->themes = NULL;
priv->unthemed_icons = NULL;
priv->unthemed_icons_caches = NULL;
priv->dir_mtimes = NULL;
priv->all_icons = NULL;
priv->themes_valid = FALSE;
@ -1001,6 +985,8 @@ load_themes (GtkIconTheme *icon_theme)
UnthemedIcon *unthemed_icon;
IconSuffix old_suffix, new_suffix;
GTimeVal tv;
IconThemeDirMtime *dir_mtime;
struct stat stat_buf;
priv = icon_theme->priv;
@ -1018,18 +1004,21 @@ load_themes (GtkIconTheme *icon_theme)
for (base = 0; base < icon_theme->priv->search_path_len; base++)
{
GtkIconCache *cache;
dir = icon_theme->priv->search_path[base];
cache = _gtk_icon_cache_new_for_path (dir);
dir_mtime = g_new (IconThemeDirMtime, 1);
dir_mtime->cache = _gtk_icon_cache_new_for_path (dir);
dir_mtime->dir = g_strdup (dir);
if (g_stat (dir, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode))
dir_mtime->mtime = stat_buf.st_mtime;
else
dir_mtime->mtime = 0;
if (cache != NULL)
{
priv->unthemed_icons_caches = g_list_prepend (priv->unthemed_icons_caches, cache);
priv->dir_mtimes = g_list_append (priv->dir_mtimes, dir_mtime);
if (dir_mtime->cache != NULL)
continue;
continue;
}
gdir = g_dir_open (dir, 0, NULL);
if (gdir == NULL)
@ -1357,14 +1346,6 @@ gtk_icon_theme_has_icon (GtkIconTheme *icon_theme,
return TRUE;
}
for (l = priv->unthemed_icons_caches; l; l = l->next)
{
GtkIconCache *cache = (GtkIconCache *)l->data;
if (_gtk_icon_cache_has_icon (cache, icon_name))
return TRUE;
}
if (g_hash_table_lookup_extended (priv->all_icons,
icon_name, NULL, NULL))
return TRUE;