pidgin: be31b219: Add a row-activated callback for the XMP...
qulogic at pidgin.im
qulogic at pidgin.im
Mon Jun 8 00:35:39 EDT 2009
-----------------------------------------------------------------
Revision: be31b2193ea41c6ab30443f2e1240f7faa0a25ac
Ancestor: 925a41f329f13a62dca98bb71bad77eba8a5d062
Author: qulogic at pidgin.im
Date: 2009-06-07T22:12:26
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/be31b2193ea41c6ab30443f2e1240f7faa0a25ac
Modified files:
pidgin/plugins/disco/gtkdisco.c
ChangeLog:
Add a row-activated callback for the XMPP Disco browser that provides a
default action for each row. Browseable services expand/collapse, services
with ADD flag open the add dialog, and services with the REGISTER flag will
open the register dialog (in that order).
-------------- next part --------------
============================================================
--- pidgin/plugins/disco/gtkdisco.c a1d567a24ad131019368fda570e93eb0978190ce
+++ pidgin/plugins/disco/gtkdisco.c 57dfe6b05e1db1b809a7e626f469304f637f325d
@@ -282,6 +282,36 @@ static void
}
static void
+row_activated_cb(GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ PidginDiscoList *pdl = user_data;
+ GtkTreeIter iter;
+ XmppDiscoService *service;
+ GValue val;
+
+ if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(pdl->model), &iter, path))
+ return;
+
+ 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->flags & XMPP_DISCO_BROWSE)
+ if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(pdl->tree), path))
+ gtk_tree_view_collapse_row(GTK_TREE_VIEW(pdl->tree), path);
+ else
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(pdl->tree), path, FALSE);
+ else if (service->flags & XMPP_DISCO_ADD)
+ add_room_to_blist_cb(GTK_BUTTON(pdl->dialog->add_button), pdl->dialog);
+ else if (service->flags & XMPP_DISCO_REGISTER)
+ register_button_cb(GTK_BUTTON(pdl->dialog->register_button), pdl->dialog);
+}
+
+static void
destroy_win_cb(GtkWidget *window, gpointer d)
{
PidginDiscoDialog *dialog = d;
@@ -373,6 +403,7 @@ static void pidgin_disco_create_tree(Pid
gtk_tree_view_append_column(GTK_TREE_VIEW(pdl->tree), column);
g_signal_connect(G_OBJECT(pdl->tree), "row-expanded", G_CALLBACK(row_expanded_cb), pdl);
+ g_signal_connect(G_OBJECT(pdl->tree), "row-activated", G_CALLBACK(row_activated_cb), pdl);
}
void pidgin_disco_signed_off_cb(PurpleConnection *pc)
More information about the Commits
mailing list