From f24fdfa8e831b9ba9a85bbb5074413760f499a93 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 5 Dec 2003 04:35:15 +0000 Subject: [PATCH] Fix for bug #116224, infinite loop when installing themes from ~/.themes. --- capplets/theme-switcher/ChangeLog | 5 ++++ .../theme-switcher/gnome-theme-installer.c | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/capplets/theme-switcher/ChangeLog b/capplets/theme-switcher/ChangeLog index 7f27107dc..9339c4a1f 100644 --- a/capplets/theme-switcher/ChangeLog +++ b/capplets/theme-switcher/ChangeLog @@ -1,3 +1,8 @@ +2003-12-05 Srinivasa Ragavan + + * gnome-theme-installer.c (install_dialog_response): Fix for infinite + loop, when trying to install themes from ~/.themes , #116224 + 2003-10-28 Jody Goldberg * Release 2.5.0 diff --git a/capplets/theme-switcher/gnome-theme-installer.c b/capplets/theme-switcher/gnome-theme-installer.c index 7f3b58615..a8feef181 100644 --- a/capplets/theme-switcher/gnome-theme-installer.c +++ b/capplets/theme-switcher/gnome-theme-installer.c @@ -105,6 +105,7 @@ install_dialog_response (GtkWidget *widget, int response_id, gpointer data) GnomeVFSURI *src_uri; const gchar *raw; gboolean icon_theme; + gchar *temppath; if (response_id == GTK_RESPONSE_HELP) { capplet_help (GTK_WINDOW (widget), @@ -133,6 +134,33 @@ install_dialog_response (GtkWidget *widget, int response_id, gpointer data) path = g_build_filename (g_get_home_dir (), ".icons", base, NULL); else path = g_build_filename (g_get_home_dir (), ".themes", base, NULL); + + /* To avoid the copy of /root/.themes to /root/.themes/.themes + * which causes an infinite loop. The user asks to transfer the all + * contents of a folder, to a folder under itseld. So ignore the + * situation. + */ + temppath = g_build_filename (filename, ".themes", NULL); + if (!strcmp(temppath, path)) { + GtkWidget *dialog; + + dialog = gtk_message_dialog_new (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("%s is the path where the theme files will be installed. This can not be selected as the source location"), filename); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + g_free (base); + g_free (filename); + g_free(temppath); + return; + } + g_free(temppath); + + + target = g_list_append (NULL, gnome_vfs_uri_new (path)); dlg = file_transfer_dialog_new ();