[PATCH] Fix for the defect 116224



Hi,

I have fixed the defect 116224. Patch is attached.
The fix stops the user from selecting the $HOME/.themes directory
and pops out a error message saying that this cannot be selected.

Please review this and respond incase of any corrections.

Thanks
Srini.

--PATCH--
Index:
gnome-control-center/capplets/theme-switcher//gnome-theme-installer.c
===================================================================
RCS file:
/cvs/gnome/gnome-control-center/capplets/theme-switcher/gnome-theme-installer.c,v
retrieving revision 1.3
diff -u -r1.3 gnome-theme-installer.c
---
gnome-control-center/capplets/theme-switcher//gnome-theme-installer.c       16 Jan 2003 07:40:29 -0000      1.3
+++
gnome-control-center/capplets/theme-switcher//gnome-theme-installer.c       19 Nov 2003 06:49:13 -0000
@@ -105,6 +105,7 @@
        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 @@
                        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 ();

Index: gnome-control-center/capplets/theme-switcher//gnome-theme-installer.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/theme-switcher/gnome-theme-installer.c,v
retrieving revision 1.3
diff -u -r1.3 gnome-theme-installer.c
--- gnome-control-center/capplets/theme-switcher//gnome-theme-installer.c	16 Jan 2003 07:40:29 -0000	1.3
+++ gnome-control-center/capplets/theme-switcher//gnome-theme-installer.c	19 Nov 2003 06:49:13 -0000
@@ -105,6 +105,7 @@
 	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 @@
 			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 ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]