Index: capplets/theme-switcher/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/theme-switcher/ChangeLog,v
retrieving revision 1.70
diff -u -r1.70 ChangeLog
--- capplets/theme-switcher/ChangeLog	29 Dec 2002 02:24:34 -0000	1.70
+++ capplets/theme-switcher/ChangeLog	30 Dec 2002 13:26:58 -0000
@@ -1,3 +1,24 @@
+2002-12-30 Mark Finlay <sisob@eircom.net>
+
+	* gnome-theme-details.c: Change icon_install_button to use 
+	new gnome_icon_theme_installer_run
+	* gnome-theme-installer.c: duplicated all code to give support for installing into
+	~/.icons - not the best solution.
+
+	Install icon themes into ~/.icons instead of ~/.themes
+
 2002-12-28  Seth Nickell  <snickell@stanford.edu>
 
 	* gnome-theme-details.c: (path_to_theme_id), (load_theme_names),
Index: capplets/theme-switcher/gnome-theme-details.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/theme-switcher/gnome-theme-details.c,v
retrieving revision 1.5
diff -u -r1.5 gnome-theme-details.c
--- capplets/theme-switcher/gnome-theme-details.c	29 Dec 2002 02:24:34 -0000	1.5
+++ capplets/theme-switcher/gnome-theme-details.c	30 Dec 2002 13:27:00 -0000
@@ -283,9 +283,9 @@
 
   /* icon themes */
   widget = WID ("icon_install_button");
-  g_signal_connect_swapped (G_OBJECT (widget), "clicked", G_CALLBACK (gnome_theme_installer_run), parent);
+  g_signal_connect_swapped (G_OBJECT (widget), "clicked", G_CALLBACK (gnome_icon_theme_installer_run), parent);
   widget = WID ("icon_manage_button");
  g_signal_connect (G_OBJECT (widget), "clicked", G_CALLBACK (gnome_theme_manager_show_manage_themes), dialog);
 
 
   g_signal_connect (G_OBJECT (parent), "response", G_CALLBACK (cb_dialog_response), NULL);
Index: 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.2
diff -u -r1.2 gnome-theme-installer.c
--- capplets/theme-switcher/gnome-theme-installer.c	5 Nov 2002 20:49:44 -0000	1.2
+++ capplets/theme-switcher/gnome-theme-installer.c	30 Dec 2002 13:27:01 -0000
@@ -181,3 +184,141 @@
 	running_theme_install = FALSE;
 }
 
+/* Total duplicate of all the above code for use with icon themes
+FIXME: removed dupliate code and use if statements instead.
+		change icon_install_button singal in gnome-theme-details.c to suit.
+*/
+
+static gboolean
+transfer_icon_done_targz_idle_cb (gpointer data)
+{
+	int status;
+	gchar *command;
+	gchar *path = data;
+
+	/* this should be something more clever and nonblocking */
+	command = g_strdup_printf ("sh -c 'gzip -d -c < \"%s\" | tar xf - -C \"%s/.icons\"'",
+				   path, g_get_home_dir ());
+	if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0)
+		gnome_vfs_unlink (path);
+	g_free (command);
+	g_free (path);
+
+	return FALSE;
+}
+
+static gboolean
+transfer_icon_done_tarbz2_idle_cb (gpointer data)
+{
+	int status;
+	gchar *command;
+	gchar *path = data;
+
+	/* this should be something more clever and nonblocking */
+	command = g_strdup_printf ("sh -c 'bzip2 -d -c < \"%s\" | tar xf - -C \"%s/.icons\"'",
+				   path, g_get_home_dir ());
+	if (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0)
+		gnome_vfs_unlink (path);
+	g_free (command);
+	g_free (path);
+
+	return FALSE;
+}
+
+
+static void
+transfer_icon_done_cb (GtkWidget *dlg, gchar *path)
+{
+	int len = strlen (path);
+	if (path && len > 7 && !strcmp (path + len - 7, ".tar.gz"))
+		g_idle_add (transfer_icon_done_targz_idle_cb, path);
+	if (path && len > 8 && !strcmp (path + len - 8, ".tar.bz2"))
+		g_idle_add (transfer_icon_done_tarbz2_idle_cb, path);
+	gtk_widget_destroy (dlg);
+}
+
+static void
+install_icon_dialog_response (GtkWidget *widget, int response_id, gpointer data)
+{
+	GladeXML *dialog = data;
+	GtkWidget *dlg;
+	gchar *filename, *path, *base;
+	GList *src, *target;
+	GnomeVFSURI *src_uri;
+	const gchar *raw;
+	
+	if (response_id == GTK_RESPONSE_HELP) {
+		capplet_help (GTK_WINDOW (widget),
+			"wgoscustdesk.xml",
+			"goscustdesk-12");
+		return;
+	}
+
+	if (response_id == 0) {
+		raw = gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (WID ("install_theme_picker")))));
+		if (raw == NULL || strlen (raw) <= 0)
+			return;
+
+		if (strncmp (raw, "http://", 7) && strncmp (raw, "ftp://", 6) && *raw != '/')
+			filename = gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (WID ("install_theme_picker")), TRUE);
+		else
+			filename = g_strdup (raw);
+		if (filename == NULL)
+			return;
+
+		src_uri = gnome_vfs_uri_new (filename);
+		base = gnome_vfs_uri_extract_short_name (src_uri);
+		src = g_list_append (NULL, src_uri);
+		path = g_build_filename (g_get_home_dir (), ".icons",
+				         base, NULL);
+		target = g_list_append (NULL, gnome_vfs_uri_new (path));
+		
+		dlg = file_transfer_dialog_new ();
+		file_transfer_dialog_wrap_async_xfer (FILE_TRANSFER_DIALOG (dlg),
+						      src, target,
+						      GNOME_VFS_XFER_RECURSIVE,
+						      GNOME_VFS_XFER_ERROR_MODE_QUERY,
+						      GNOME_VFS_XFER_OVERWRITE_MODE_QUERY,
+						      GNOME_VFS_PRIORITY_DEFAULT);
+		gnome_vfs_uri_list_unref (src);
+		gnome_vfs_uri_list_unref (target);
+		g_free (base);
+		g_free (filename);
+		g_signal_connect (G_OBJECT (dlg), "cancel",
+				  G_CALLBACK (transfer_cancel_cb), path);
+		g_signal_connect (G_OBJECT (dlg), "done",
+				  G_CALLBACK (transfer_icon_done_cb), path);
+		gtk_widget_show (dlg);
+	}
+}
+
+void
+gnome_icon_theme_installer_run (GtkWidget *parent, gchar *filename)
+{
+	static gboolean running_theme_install = FALSE;
+	GladeXML *dialog;
+	GtkWidget *widget;
+	
+	if (running_theme_install)
+		return;
+
+	running_theme_install = TRUE;
+
+	dialog = glade_xml_new (GLADEDIR "/theme-install.glade", NULL, NULL);
+	widget = WID ("install_dialog");
+	
+	g_signal_connect (G_OBJECT (widget), "response",
+		G_CALLBACK (install_icon_dialog_response), dialog);
+	gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (parent));
+	gtk_window_set_position (GTK_WINDOW (widget), GTK_WIN_POS_CENTER_ON_PARENT);
+	if (filename)
+		gnome_file_entry_set_filename (GNOME_FILE_ENTRY (WID ("install_theme_picker")), filename);
+
+	while (gtk_dialog_run (GTK_DIALOG (widget)) == GTK_RESPONSE_HELP)
+		;
+
+	gtk_widget_destroy (widget);
+	g_object_unref (G_OBJECT (dialog));
+
+	running_theme_install = FALSE;
+}
Index: capplets/theme-switcher/gnome-theme-installer.h
===================================================================
RCS file: /cvs/gnome/gnome-control-center/capplets/theme-switcher/gnome-theme-installer.h,v
retrieving revision 1.1
diff -u -r1.1 gnome-theme-installer.h
--- capplets/theme-switcher/gnome-theme-installer.h	1 Nov 2002 16:09:43 -0000	1.1
+++ capplets/theme-switcher/gnome-theme-installer.h	30 Dec 2002 13:27:01 -0000
@@ -25,5 +25,6 @@
 #include <gtk/gtk.h>
 
 void gnome_theme_installer_run (GtkWidget *parent, gchar *filename);
+void gnome_icon_theme_installer_run (GtkWidget *parent, gchar *filename);
 
 #endif /* GNOME_THEME_INSTALLER_H */
Index: capplets/theme-switcher/gnome-theme-manager.c
