Mercurial > pidgin
changeset 27084:abf989278782
Store the currently selected service in the Dialog structure
This will come in handy with the context menu, since the callbacks for
those will just pass the dialog (and most of these callbacks don't use the
GtkFirstArgument*).
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 08 Jun 2009 05:23:45 +0000 |
parents | 8671d9a37002 |
children | fc7b9ca819c3 |
files | pidgin/plugins/disco/gtkdisco.c pidgin/plugins/disco/gtkdisco.h |
diffstat | 2 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/plugins/disco/gtkdisco.c Mon Jun 08 04:42:33 2009 +0000 +++ b/pidgin/plugins/disco/gtkdisco.c Mon Jun 08 05:23:45 2009 +0000 @@ -119,8 +119,7 @@ static void register_button_cb(GtkButton *button, PidginDiscoDialog *dialog) { - XmppDiscoService *service = g_object_get_data(G_OBJECT(button), "service"); - xmpp_disco_service_register(service); + xmpp_disco_service_register(dialog->selected); } static void discolist_cancel_cb(PidginDiscoList *pdl, const char *server) @@ -209,7 +208,7 @@ static void add_to_blist_cb(GtkButton *button, PidginDiscoDialog *dialog) { - XmppDiscoService *service = g_object_get_data(G_OBJECT(button), "service"); + XmppDiscoService *service = dialog->selected; PurpleAccount *account; const char *jid; @@ -227,7 +226,6 @@ static void selection_changed_cb(GtkTreeSelection *selection, PidginDiscoList *pdl) { - XmppDiscoService *service; GtkTreeIter iter; GValue val; PidginDiscoDialog *dialog = pdl->dialog; @@ -235,18 +233,15 @@ if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { val.g_type = 0; gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN, &val); - service = g_value_get_pointer(&val); - if (!service) { + dialog->selected = g_value_get_pointer(&val); + if (!dialog->selected) { gtk_widget_set_sensitive(dialog->add_button, FALSE); gtk_widget_set_sensitive(dialog->register_button, FALSE); return; } - 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); + gtk_widget_set_sensitive(dialog->add_button, dialog->selected->flags & XMPP_DISCO_ADD); + gtk_widget_set_sensitive(dialog->register_button, dialog->selected->flags & XMPP_DISCO_REGISTER); } else { gtk_widget_set_sensitive(dialog->add_button, FALSE); gtk_widget_set_sensitive(dialog->register_button, FALSE);
--- a/pidgin/plugins/disco/gtkdisco.h Mon Jun 08 04:42:33 2009 +0000 +++ b/pidgin/plugins/disco/gtkdisco.h Mon Jun 08 05:23:45 2009 +0000 @@ -39,6 +39,7 @@ GtkWidget *register_button; GtkWidget *add_button; GtkWidget *close_button; + XmppDiscoService *selected; PurpleAccount *account; PidginDiscoList *discolist;