# HG changeset patch # User Elliott Sales de Andrade # Date 1244436058 0 # Node ID f7ef790f3a4451930d49fed9d27f2169d5b7e52d # Parent dda65a7151a218cd9e0fdf3a4b73c1a225a3178d# Parent 22d73c75e54669836b6f73102383f0c10393b8a9 merge of '43b8c66366c5dc03c717fa9d938446752df53293' and 'cd775ef3764162a2493ef7060750cd8c8ef544d4' diff -r dda65a7151a2 -r f7ef790f3a44 pidgin/plugins/disco/gtkdisco.c --- 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);