changeset 27082:f7ef790f3a44

merge of '43b8c66366c5dc03c717fa9d938446752df53293' and 'cd775ef3764162a2493ef7060750cd8c8ef544d4'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 08 Jun 2009 04:40:58 +0000
parents dda65a7151a2 (current diff) 22d73c75e546 (diff)
children 8671d9a37002
files pidgin/plugins/disco/gtkdisco.c
diffstat 1 files changed, 11 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/disco/gtkdisco.c	Mon Jun 08 03:59:16 2009 +0000
+++ b/pidgin/plugins/disco/gtkdisco.c	Mon Jun 08 04:40:58 2009 +0000
@@ -36,11 +36,6 @@
 
 GList *dialogs = NULL;
 
-struct _menu_cb_info {
-	PidginDiscoList *list;
-	XmppDiscoService *service;
-};
-
 enum {
 	PIXBUF_COLUMN = 0,
 	NAME_COLUMN,
@@ -124,9 +119,8 @@
 
 static void register_button_cb(GtkButton *button, PidginDiscoDialog *dialog)
 {
-	struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "disco-info");
-
-	xmpp_disco_service_register(info->service);
+	XmppDiscoService *service = g_object_get_data(G_OBJECT(button), "service");
+	xmpp_disco_service_register(service);
 }
 
 static void discolist_cancel_cb(PidginDiscoList *pdl, const char *server)
@@ -213,18 +207,18 @@
 	g_free(server);
 }
 
-static void add_room_to_blist_cb(GtkButton *button, PidginDiscoDialog *dialog)
+static void add_to_blist_cb(GtkButton *button, PidginDiscoDialog *dialog)
 {
-	struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "disco-info");
+	XmppDiscoService *service = g_object_get_data(G_OBJECT(button), "service");
 	PurpleAccount *account;
 	const char *jid;
 
-	g_return_if_fail(info != NULL);
+	g_return_if_fail(service != NULL);
 
-	account = purple_connection_get_account(info->list->pc);
-	jid = info->service->jid;
+	account = purple_connection_get_account(service->list->pc);
+	jid = service->jid;
 
-	if (info->service->type == XMPP_DISCO_SERVICE_TYPE_CHAT)
+	if (service->type == XMPP_DISCO_SERVICE_TYPE_CHAT)
 		purple_blist_request_add_chat(account, NULL, NULL, jid);
 	else
 		purple_blist_request_add_buddy(account, jid, NULL, NULL);
@@ -236,7 +230,6 @@
 	XmppDiscoService *service;
 	GtkTreeIter iter;
 	GValue val;
-	static struct _menu_cb_info *info;
 	PidginDiscoDialog *dialog = pdl->dialog;
 
 	if (gtk_tree_selection_get_selected(selection, NULL, &iter)) {
@@ -249,13 +242,8 @@
 			return;
 		}
 
-		info = g_new0(struct _menu_cb_info, 1);
-		info->list = dialog->discolist;
-		info->service = service;
-
-		g_object_set_data_full(G_OBJECT(dialog->add_button), "disco-info",
-		                       info, g_free);
-		g_object_set_data(G_OBJECT(dialog->register_button), "disco-info", info);
+		g_object_set_data(G_OBJECT(dialog->add_button), "service", service);
+		g_object_set_data(G_OBJECT(dialog->register_button), "service", service);
 
 		gtk_widget_set_sensitive(dialog->add_button, service->flags & XMPP_DISCO_ADD);
 		gtk_widget_set_sensitive(dialog->register_button, service->flags & XMPP_DISCO_REGISTER);
@@ -615,7 +603,7 @@
 	                                    PIDGIN_BUTTON_HORIZONTAL);
 	gtk_box_pack_start(GTK_BOX(bbox), dialog->add_button, FALSE, FALSE, 0);
 	g_signal_connect(G_OBJECT(dialog->add_button), "clicked",
-	                 G_CALLBACK(add_room_to_blist_cb), dialog);
+	                 G_CALLBACK(add_to_blist_cb), dialog);
 	gtk_widget_set_sensitive(dialog->add_button, FALSE);
 	gtk_widget_show(dialog->add_button);