diff options
author | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-05-13 02:19:09 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-05-13 02:19:09 +0800 |
commit | 784359c0caef5b4a29d75c2179037c1f1698823e (patch) | |
tree | 6d86b3383cc5f227b11bfb1d2bf6fdc25fbbac6f /e-util | |
parent | 5910f5e48d28ccfd55cc23f478cce1a40a87d791 (diff) | |
download | gsoc2013-evolution-784359c0caef5b4a29d75c2179037c1f1698823e.tar.gz gsoc2013-evolution-784359c0caef5b4a29d75c2179037c1f1698823e.tar.zst gsoc2013-evolution-784359c0caef5b4a29d75c2179037c1f1698823e.zip |
*** empty log message ***
svn path=/trunk/; revision=25886
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 5 | ||||
-rw-r--r-- | e-util/e-icon-factory.c | 31 |
2 files changed, 27 insertions, 9 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 96d6aa32e9..674ef62640 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,8 @@ +2004-05-12 Jeffrey Stedfast <fejj@novell.com> + + * e-icon-factory.c (e_icon_factory_shutdown): New function to + clean up the cached icons. + 2004-05-12 Not Zed <NotZed@Ximian.com> * e-error-tool.c: Tool to do i18n string extraction for error xml diff --git a/e-util/e-icon-factory.c b/e-util/e-icon-factory.c index f59d5dba55..715a18295d 100644 --- a/e-util/e-icon-factory.c +++ b/e-util/e-icon-factory.c @@ -74,10 +74,6 @@ icon_new (const char *name, GdkPixbuf **pixbufs) return icon; } -#if 0 - -/* (This is not currently used since we never prune icons out of the - cache.) */ static void icon_free (Icon *icon) { @@ -93,8 +89,6 @@ icon_free (Icon *icon) g_free (icon); } -#endif - /* Loading icons. */ static Icon * @@ -151,10 +145,8 @@ pixel_size_to_icon_size (int pixel_size) void e_icon_factory_init (void) { - if (name_to_icon != NULL) { - /* Already initialized. */ + if (name_to_icon != NULL) return; - } name_to_icon = g_hash_table_new (g_str_hash, g_str_equal); icon_theme = gnome_icon_theme_new (); @@ -162,6 +154,27 @@ e_icon_factory_init (void) } +static void +icon_foreach_free (gpointer key, gpointer value, gpointer user_data) +{ + icon_free (value); +} + + +void +e_icon_factory_shutdown (void) +{ + if (name_to_icon == NULL) + return; + + g_hash_table_foreach (name_to_icon, (GHFunc) icon_foreach_free, NULL); + g_hash_table_destroy (name_to_icon); + g_object_unref (empty_pixbuf); + g_object_unref (icon_theme); + name_to_icon = NULL; +} + + /** * e_icon_factory_get_icon_filename: * @icon_name: name of the icon |