? gtk2-gtkicontheme-autoupdate.patch ================================================================================ --- gtk/gtkicontheme.c +++ gtk/gtkicontheme.c @@ -230,6 +230,9 @@ static GHashTable *icon_theme_builtin_icons; +static int update_themes_callback_id; +static GSList *update_themes_list; + /* also used in gtkiconfactory.c */ GtkIconCache *_builtin_cache = NULL; static GList *builtin_dirs = NULL; @@ -255,6 +258,23 @@ return g_object_new (GTK_TYPE_ICON_THEME, NULL); } +static gboolean +update_themes_callback (gpointer user_data) +{ + GSList *iterator; + for (iterator = update_themes_list; iterator; iterator = iterator->next) + { + GtkIconTheme *icon_theme = iterator->data; + GtkIconThemePrivate *priv = icon_theme->priv; + + if (priv->themes_valid) + { + gtk_icon_theme_rescan_if_needed (icon_theme); + } + } + return TRUE; +} + /** * gtk_icon_theme_get_default: * @@ -569,6 +589,11 @@ priv->unthemed_icons = NULL; priv->pixbuf_supports_svg = pixbuf_supports_svg (); + + update_themes_list = g_slist_prepend (update_themes_list, icon_theme); + if (update_themes_callback_id == 0) { + update_themes_callback_id = g_timeout_add (30 * 1000, update_themes_callback, NULL); + } } static void @@ -652,6 +677,13 @@ icon_theme = GTK_ICON_THEME (object); priv = icon_theme->priv; + update_themes_list = g_slist_remove (update_themes_list, icon_theme); + if (update_themes_list == NULL) + { + g_source_remove (update_themes_callback_id); + update_themes_callback_id = 0; + } + if (priv->reset_styles_idle) { g_source_remove (priv->reset_styles_idle);