pidgin: 7f73fdcd: A patch to clean up authorization reques...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Dec 6 00:20:37 EST 2008


-----------------------------------------------------------------
Revision: 7f73fdcdd190c7a6dc1372ddc2887ad216db3c28
Ancestor: 4a3731f468487751f392e59106f3554b1e70bd9d
Author: paul at aurich.com
Date: 2008-12-06T04:42:13
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/7f73fdcdd190c7a6dc1372ddc2887ad216db3c28

Modified files:
        finch/gntaccount.c pidgin/gtkaccount.c

ChangeLog: 

A patch to clean up authorization request related stuff.  Fixes #7695.

-------------- next part --------------
============================================================
--- finch/gntaccount.c	cd924432949361235b338e462fa0fa9f89df885e
+++ finch/gntaccount.c	bdba07c90eb585df16faa9be58dc27697ebff94d
@@ -1069,6 +1069,8 @@ finch_request_authorize(PurpleAccount *a
 			_("Authorize"), auth_cb,
 			_("Deny"), deny_cb);
 	}
+	g_signal_connect(G_OBJECT(uihandle), "destroy",
+		G_CALLBACK(purple_account_request_close), NULL);
 	g_free(buffer);
 	return uihandle;
 }
============================================================
--- pidgin/gtkaccount.c	709e4183da9c294f23966669153b00d070f6c1eb
+++ pidgin/gtkaccount.c	c5319c2c102c6848b66bfbc4bda82afef4af10c2
@@ -2425,25 +2425,25 @@ static void
 };
 
 static void
+free_auth_and_add(struct auth_and_add *aa)
+{
+	g_free(aa->username);
+	g_free(aa->alias);
+	g_free(aa);
+}
+
+static void
 authorize_and_add_cb(struct auth_and_add *aa)
 {
 	aa->auth_cb(aa->data);
 	purple_blist_request_add_buddy(aa->account, aa->username,
 	 	                    NULL, aa->alias);
-
-	g_free(aa->username);
-	g_free(aa->alias);
-	g_free(aa);
 }
 
 static void
 deny_no_add_cb(struct auth_and_add *aa)
 {
 	aa->deny_cb(aa->data);
-
-	g_free(aa->username);
-	g_free(aa->alias);
-	g_free(aa);
 }
 
 static void *
@@ -2492,7 +2492,7 @@ pidgin_accounts_request_authorization(Pu
 						  _("Authorize"), authorize_and_add_cb,
 						  _("Deny"), deny_no_add_cb,
 						  NULL);
-		g_object_set_data(G_OBJECT(alert), "auth_and_add", aa);
+		g_signal_connect_swapped(G_OBJECT(alert), "destroy", G_CALLBACK(free_auth_and_add), aa);
 	} else {
 		alert = pidgin_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION,
 						  _("Authorize buddy?"), buffer, user_data,
@@ -2501,6 +2501,8 @@ pidgin_accounts_request_authorization(Pu
 						  NULL);
 	}
 	pidgin_blist_add_alert(alert);
+	g_signal_connect(G_OBJECT(alert), "destroy",
+		G_CALLBACK(purple_account_request_close), NULL);
 
 	g_free(buffer);
 
@@ -2510,13 +2512,6 @@ pidgin_accounts_request_close(void *ui_h
 static void
 pidgin_accounts_request_close(void *ui_handle)
 {
-	/* This is super ugly, but without API changes, this is how it works */
-	struct auth_and_add *aa = g_object_get_data(G_OBJECT(ui_handle), "auth_and_add");
-	if (aa != NULL) {
-		g_free(aa->username);
-		g_free(aa->alias);
-		g_free(aa);
-	}
 	gtk_widget_destroy(GTK_WIDGET(ui_handle));
 }
 


More information about the Commits mailing list