pidgin: 6b692544: Store the currently selected service in ...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Mon Jun 8 01:25:28 EDT 2009
-----------------------------------------------------------------
Revision: 6b69254404671988c8c10e80e81d165ac7601990
Ancestor: 5705f7649aaeaec4e84ce7037f354d24f7fad7c7
Author: darkrain42 at pidgin.im
Date: 2009-06-08T05:23:45
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6b69254404671988c8c10e80e81d165ac7601990
Modified files:
pidgin/plugins/disco/gtkdisco.c
pidgin/plugins/disco/gtkdisco.h
ChangeLog:
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*).
-------------- next part --------------
============================================================
--- pidgin/plugins/disco/gtkdisco.c 82fddbf1a61758651af5b72d66aff108a39bb189
+++ pidgin/plugins/disco/gtkdisco.c 9a67d3cd8fb12644108ce7af9826a996fe370681
@@ -119,8 +119,7 @@ static void register_button_cb(GtkButton
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 *b
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 @@ selection_changed_cb(GtkTreeSelection *s
static void
selection_changed_cb(GtkTreeSelection *selection, PidginDiscoList *pdl)
{
- XmppDiscoService *service;
GtkTreeIter iter;
GValue val;
PidginDiscoDialog *dialog = pdl->dialog;
@@ -235,18 +233,15 @@ selection_changed_cb(GtkTreeSelection *s
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);
============================================================
--- pidgin/plugins/disco/gtkdisco.h ec9e2a0587c92d85c8adb45f080557fdf075d6e4
+++ pidgin/plugins/disco/gtkdisco.h 314a7bc42016d7fbdb310f4484372d8d86200967
@@ -39,6 +39,7 @@ struct _PidginDiscoDialog {
GtkWidget *register_button;
GtkWidget *add_button;
GtkWidget *close_button;
+ XmppDiscoService *selected;
PurpleAccount *account;
PidginDiscoList *discolist;
More information about the Commits
mailing list