From 930245a60b32dd86142d0e183834b21fb0c7f6ac Mon Sep 17 00:00:00 2001 From: Thomas Wood Date: Sun, 29 Jul 2007 11:03:05 +0000 Subject: [PATCH] - Fix theme installation (free called before last last use of a string) - 2007-07-29 Thomas Wood * theme-installer.c: (file_theme_type), (gnome_theme_install_real): - Fix theme installation (free called before last last use of a string) - Update icon cache when installing icon themes (closes bug 355486) svn path=/trunk/; revision=7919 --- capplets/appearance/ChangeLog | 6 ++++++ capplets/appearance/theme-installer.c | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/capplets/appearance/ChangeLog b/capplets/appearance/ChangeLog index 92d59b903..54a20ba6a 100644 --- a/capplets/appearance/ChangeLog +++ b/capplets/appearance/ChangeLog @@ -1,3 +1,9 @@ +2007-07-29 Thomas Wood + + * theme-installer.c: (file_theme_type), (gnome_theme_install_real): + - Fix theme installation (free called before last last use of a string) + - Update icon cache when installing icon themes (closes bug 355486) + 2007-07-29 Thomas Wood * data/appearance.glade: Fix mnemonics and Customize Theme window title. diff --git a/capplets/appearance/theme-installer.c b/capplets/appearance/theme-installer.c index 34734f251..8a982005f 100644 --- a/capplets/appearance/theme-installer.c +++ b/capplets/appearance/theme-installer.c @@ -74,7 +74,6 @@ file_theme_type (const gchar *dir) filename = g_build_filename (dir, "index.theme", NULL); src_uri = gnome_vfs_uri_new (filename); - g_free (filename); exists = gnome_vfs_uri_exists (src_uri); gnome_vfs_uri_unref (src_uri); @@ -103,6 +102,7 @@ file_theme_type (const gchar *dir) if (match) return THEME_GNOME; } + g_free (filename); filename = g_build_filename (dir, "gtk-2.0", "gtkrc", NULL); src_uri = gnome_vfs_uri_new (filename); @@ -271,15 +271,21 @@ gnome_theme_install_real (gint filetype, const gchar *tmp_dir, const gchar *them if (g_file_test (path, G_FILE_TEST_IS_DIR) && (file_theme_type (path) == THEME_ICON)) { - gchar *new_path; + gchar *new_path, *update_icon_cache; new_path = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".icons", theme_name, NULL); + update_icon_cache = g_strdup_printf ("gtk-update-icon-cache %s", new_path); /* XXX: make some noise if we couldn't install it? */ gnome_vfs_move (path, new_path, FALSE); + + /* update icon cache - shouldn't really matter if this fails */ + g_spawn_command_line_async (update_icon_cache, NULL); + g_free (new_path); + g_free (update_icon_cache); } g_free (path); } @@ -305,6 +311,16 @@ gnome_theme_install_real (gint filetype, const gchar *tmp_dir, const gchar *them gtk_widget_destroy (dialog); success = FALSE; } else { + if (theme_type == THEME_ICON) + { + gchar *update_icon_cache; + + /* update icon cache - shouldn't really matter if this fails */ + update_icon_cache = g_strdup_printf ("gtk-update-icon-cache %s", target_dir); + g_spawn_command_line_async (update_icon_cache, NULL); + + g_free (update_icon_cache); + } /* Ask to apply theme (if we can) */ if (theme_type == THEME_GTK || theme_type == THEME_METACITY || theme_type == THEME_ICON) {