diff gtk/gtkprefs.c @ 14354:01daacf7b771

[gaim-migrate @ 17060] Make gaim_url_fetch() cancelable and change Yahoo! to take advantage of the changes. Other stuff can be changed later, the important thing is that the API is there. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 27 Aug 2006 21:13:30 +0000
parents ab8a105eff62
children 333989477bcd
line wrap: on
line diff
--- a/gtk/gtkprefs.c	Sun Aug 27 19:47:41 2006 +0000
+++ b/gtk/gtkprefs.c	Sun Aug 27 21:13:30 2006 +0000
@@ -526,26 +526,29 @@
 }
 
 static void
-theme_got_url(void *data, const char *themedata, size_t len)
+theme_got_url(GaimUtilFetchUrlData *url_data, gpointer user_data,
+		const gchar *themedata, size_t len, const gchar *error_message)
 {
 	FILE *f;
 	gchar *path;
 
-	if (len == 0)
+	if ((error_message != NULL) || (len == 0))
 		return;
 
 	f = gaim_mkstemp(&path, TRUE);
 	fwrite(themedata, len, 1, f);
 	fclose(f);
 
-	theme_install_theme(path, data);
+	theme_install_theme(path, user_data);
 
 	g_unlink(path);
 	g_free(path);
 }
 
-static void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd,
-				guint info, guint t, gpointer data) {
+static void
+theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
+		GtkSelectionData *sd, guint info, guint t, gpointer data)
+{
 	gchar *name = (gchar *)sd->data;
 
 	if ((sd->length >= 0) && (sd->format == 8)) {
@@ -568,9 +571,9 @@
 		} else if (!g_ascii_strncasecmp(name, "http://", 7)) {
 			/* Oo, a web drag and drop. This is where things
 			 * will start to get interesting */
-			gaim_url_fetch(name, TRUE, NULL, FALSE, theme_got_url, ".tgz");
+			gaim_util_fetch_url(name, TRUE, NULL, FALSE, theme_got_url, ".tgz");
 		} else if (!g_ascii_strncasecmp(name, "https://", 8)) {
-			/* gaim_url_fetch() doesn't support HTTPS, but we want users
+			/* gaim_util_fetch_url() doesn't support HTTPS, but we want users
 			 * to be able to drag and drop links from the SF trackers, so
 			 * we'll try it as an HTTP URL. */
 			char *tmp = g_strdup(name + 1);
@@ -578,7 +581,7 @@
 			tmp[1] = 't';
 			tmp[2] = 't';
 			tmp[3] = 'p';
-			gaim_url_fetch(tmp, TRUE, NULL, FALSE, theme_got_url, ".tgz");
+			gaim_util_fetch_url(tmp, TRUE, NULL, FALSE, theme_got_url, ".tgz");
 			g_free(tmp);
 		}