annotate pidgin/plugins/disco/gtkdisco.c @ 29592:0b54934f2742

Remove a couple more unnecessary headers from media.c
author maiku@pidgin.im
date Tue, 27 Oct 2009 21:50:19 +0000
parents 8d408dff1bff
children 0486e2a9b48f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1 /**
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
2 * @file gtkdisco.c GTK+ Service Discovery UI
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
3 * @ingroup pidgin
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
4 */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
5
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
6 /* pidgin
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
7 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
10 * source distribution.
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
11 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
15 * (at your option) any later version.
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
16 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
20 * GNU General Public License for more details.
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
21 *
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
25 */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
26
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
27 #include "internal.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
28 #include "debug.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
29 #include "gtkutils.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
30 #include "pidgin.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
31 #include "request.h"
27161
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
32 #include "pidgintooltip.h"
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
33
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
34 #include "gtkdisco.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
35 #include "xmppdisco.h"
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
36
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
37 GList *dialogs = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
38
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
39 enum {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
40 PIXBUF_COLUMN = 0,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
41 NAME_COLUMN,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
42 DESCRIPTION_COLUMN,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
43 SERVICE_COLUMN,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
44 NUM_OF_COLUMNS
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
45 };
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
46
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
47 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
48 pidgin_disco_list_destroy(PidginDiscoList *list)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
49 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
50 g_hash_table_destroy(list->services);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
51 if (list->dialog && list->dialog->discolist == list)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
52 list->dialog->discolist = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
53
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
54 if (list->tree) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
55 gtk_widget_destroy(list->tree);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
56 list->tree = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
57 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
58
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
59 g_free((gchar*)list->server);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
60 g_free(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
61 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
62
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
63 PidginDiscoList *pidgin_disco_list_ref(PidginDiscoList *list)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
64 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
65 g_return_val_if_fail(list != NULL, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
66
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
67 ++list->ref;
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
68 purple_debug_misc("xmppdisco", "reffing list, ref count now %d\n", list->ref);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
69
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
70 return list;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
71 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
72
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
73 void pidgin_disco_list_unref(PidginDiscoList *list)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
74 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
75 g_return_if_fail(list != NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
76
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
77 --list->ref;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
78
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
79 purple_debug_misc("xmppdisco", "unreffing list, ref count now %d\n", list->ref);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
80 if (list->ref == 0)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
81 pidgin_disco_list_destroy(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
82 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
83
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
84 void pidgin_disco_list_set_in_progress(PidginDiscoList *list, gboolean in_progress)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
85 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
86 PidginDiscoDialog *dialog = list->dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
87
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
88 if (!dialog)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
89 return;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
90
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
91 list->in_progress = in_progress;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
92
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
93 if (in_progress) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
94 gtk_widget_set_sensitive(dialog->account_widget, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
95 gtk_widget_set_sensitive(dialog->stop_button, TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
96 gtk_widget_set_sensitive(dialog->browse_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
97 } else {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
98 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(dialog->progress), 0.0);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
99
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
100 gtk_widget_set_sensitive(dialog->account_widget, TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
101
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
102 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
103 gtk_widget_set_sensitive(dialog->browse_button, TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
104 /*
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
105 gtk_widget_set_sensitive(dialog->register_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
106 gtk_widget_set_sensitive(dialog->add_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
107 */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
108 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
109 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
110
27257
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
111 static GdkPixbuf *
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
112 pidgin_disco_load_icon(XmppDiscoService *service, const char *size)
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
113 {
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
114 GdkPixbuf *pixbuf = NULL;
27550
319b09e2590f Avoid a potentially uninitialized variable
Stu Tomlinson <stu@nosnilmot.com>
parents: 27257
diff changeset
115 char *filename = NULL;
27257
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
116
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
117 g_return_val_if_fail(service != NULL, NULL);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
118 g_return_val_if_fail(size != NULL, NULL);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
119
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
120 if (service->type == XMPP_DISCO_SERVICE_TYPE_GATEWAY && service->gateway_type) {
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
121 char *tmp = g_strconcat(service->gateway_type, ".png", NULL);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
122 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", size, tmp, NULL);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
123 g_free(tmp);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
124 #if 0
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
125 } else if (service->type == XMPP_DISCO_SERVICE_TYPE_USER) {
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
126 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", size, "person.png", NULL);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
127 #endif
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
128 } else if (service->type == XMPP_DISCO_SERVICE_TYPE_CHAT)
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
129 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", size, "chat.png", NULL);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
130
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
131 if (filename) {
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
132 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
133 g_free(filename);
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
134 }
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
135
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
136 return pixbuf;
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
137 }
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
138
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
139 static void pidgin_disco_create_tree(PidginDiscoList *pdl);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
140
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
141 static void dialog_select_account_cb(GObject *w, PurpleAccount *account,
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
142 PidginDiscoDialog *dialog)
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
143 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
144 dialog->account = account;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
145 gtk_widget_set_sensitive(dialog->browse_button, account != NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
146 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
147
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
148 static void register_button_cb(GtkWidget *unused, PidginDiscoDialog *dialog)
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
149 {
27166
abf989278782 Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents: 27165
diff changeset
150 xmpp_disco_service_register(dialog->selected);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
151 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
152
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
153 static void discolist_cancel_cb(PidginDiscoList *pdl, const char *server)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
154 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
155 pidgin_disco_list_set_in_progress(pdl, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
156 pidgin_disco_list_unref(pdl);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
157 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
158
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
159 static void discolist_ok_cb(PidginDiscoList *pdl, const char *server)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
160 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
161 gtk_widget_set_sensitive(pdl->dialog->browse_button, TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
162
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
163 if (!server || !*server) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
164 purple_notify_error(my_plugin, _("Invalid Server"), _("Invalid Server"),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
165 NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
166
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
167 pidgin_disco_list_set_in_progress(pdl, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
168 pidgin_disco_list_unref(pdl);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
169 return;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
170 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
171
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
172 pdl->server = g_strdup(server);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
173 pidgin_disco_list_set_in_progress(pdl, TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
174 xmpp_disco_start(pdl);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
175 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
176
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
177 static void browse_button_cb(GtkWidget *button, PidginDiscoDialog *dialog)
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
178 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
179 PurpleConnection *pc;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
180 PidginDiscoList *pdl;
27059
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
181 const char *username;
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
182 const char *at, *slash;
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
183 char *server = NULL;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
184
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
185 pc = purple_account_get_connection(dialog->account);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
186 if (!pc)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
187 return;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
188
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
189 gtk_widget_set_sensitive(dialog->browse_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
190 gtk_widget_set_sensitive(dialog->add_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
191 gtk_widget_set_sensitive(dialog->register_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
192
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
193 if (dialog->discolist != NULL) {
27059
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
194 if (dialog->discolist->tree) {
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
195 gtk_widget_destroy(dialog->discolist->tree);
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
196 dialog->discolist->tree = NULL;
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
197 }
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
198 pidgin_disco_list_unref(dialog->discolist);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
199 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
200
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
201 pdl = dialog->discolist = g_new0(PidginDiscoList, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
202 pdl->services = g_hash_table_new_full(NULL, NULL, NULL,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
203 (GDestroyNotify)gtk_tree_row_reference_free);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
204 pdl->pc = pc;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
205 /* We keep a copy... */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
206 pidgin_disco_list_ref(pdl);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
207
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
208 pdl->dialog = dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
209 pidgin_disco_create_tree(pdl);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
210
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
211 if (dialog->account_widget)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
212 gtk_widget_set_sensitive(dialog->account_widget, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
213
27059
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
214 username = purple_account_get_username(dialog->account);
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
215 at = g_utf8_strchr(username, -1, '@');
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
216 slash = g_utf8_strchr(username, -1, '/');
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
217 if (at && !slash) {
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
218 server = g_strdup_printf("%s", at + 1);
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
219 } else if (at && slash && at + 1 < slash) {
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
220 server = g_strdup_printf("%.*s", (int)(slash - (at + 1)), at + 1);
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
221 }
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
222
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
223 if (server == NULL)
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
224 /* This shouldn't ever happen since the account is connected */
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
225 server = g_strdup("jabber.org");
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
226
28373
8d408dff1bff Add a bunch of comments for translators that might make some of these
Mark Doliner <mark@kingant.net>
parents: 27550
diff changeset
227 /* Note to translators: The string "Enter an XMPP Server" is asking the
8d408dff1bff Add a bunch of comments for translators that might make some of these
Mark Doliner <mark@kingant.net>
parents: 27550
diff changeset
228 user to type the name of an XMPP server which will then be queried */
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
229 purple_request_input(my_plugin, _("Server name request"), _("Enter an XMPP Server"),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
230 _("Select an XMPP server to query"),
27059
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
231 server, FALSE, FALSE, NULL,
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
232 _("Find Services"), PURPLE_CALLBACK(discolist_ok_cb),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
233 _("Cancel"), PURPLE_CALLBACK(discolist_cancel_cb),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
234 purple_connection_get_account(pc), NULL, NULL, pdl);
27059
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
235
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
236 g_free(server);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
237 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
238
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
239 static void add_to_blist_cb(GtkWidget *unused, PidginDiscoDialog *dialog)
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
240 {
27166
abf989278782 Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents: 27165
diff changeset
241 XmppDiscoService *service = dialog->selected;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
242 PurpleAccount *account;
27160
0d01bd0c19ba Use the JID for adding a chat/buddy because the name is for descriptive
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27159
diff changeset
243 const char *jid;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
244
27162
7dbe7ae559d3 Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents: 27128
diff changeset
245 g_return_if_fail(service != NULL);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
246
27162
7dbe7ae559d3 Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents: 27128
diff changeset
247 account = purple_connection_get_account(service->list->pc);
27164
f7ef790f3a44 merge of '43b8c66366c5dc03c717fa9d938446752df53293'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27161 27163
diff changeset
248 jid = service->jid;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
249
27162
7dbe7ae559d3 Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents: 27128
diff changeset
250 if (service->type == XMPP_DISCO_SERVICE_TYPE_CHAT)
27160
0d01bd0c19ba Use the JID for adding a chat/buddy because the name is for descriptive
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27159
diff changeset
251 purple_blist_request_add_chat(account, NULL, NULL, jid);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
252 else
27160
0d01bd0c19ba Use the JID for adding a chat/buddy because the name is for descriptive
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27159
diff changeset
253 purple_blist_request_add_buddy(account, jid, NULL, NULL);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
254 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
255
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
256 static gboolean
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
257 service_click_cb(GtkTreeView *tree, GdkEventButton *event, gpointer user_data)
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
258 {
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
259 PidginDiscoList *pdl;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
260 XmppDiscoService *service;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
261 GtkWidget *menu;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
262
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
263 GtkTreePath *path;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
264 GtkTreeIter iter;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
265 GValue val;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
266
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
267 if (event->button != 3 || event->type != GDK_BUTTON_PRESS)
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
268 return FALSE;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
269
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
270 pdl = user_data;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
271
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
272 /* Figure out what was clicked */
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
273 if (!gtk_tree_view_get_path_at_pos(tree, event->x, event->y, &path,
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
274 NULL, NULL, NULL))
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
275 return FALSE;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
276 gtk_tree_model_get_iter(GTK_TREE_MODEL(pdl->model), &iter, path);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
277 gtk_tree_path_free(path);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
278 val.g_type = 0;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
279 gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN,
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
280 &val);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
281 service = g_value_get_pointer(&val);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
282
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
283 if (!service)
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
284 return FALSE;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
285
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
286 menu = gtk_menu_new();
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
287
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
288 if (service->flags & XMPP_DISCO_ADD)
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
289 pidgin_new_item_from_stock(menu, _("Add to Buddy List"), GTK_STOCK_ADD,
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
290 G_CALLBACK(add_to_blist_cb), pdl->dialog,
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
291 0, 0, NULL);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
292
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
293 if (service->flags & XMPP_DISCO_REGISTER) {
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
294 GtkWidget *item = pidgin_new_item(menu, _("Register"));
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
295 g_signal_connect(G_OBJECT(item), "activate",
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
296 G_CALLBACK(register_button_cb), pdl->dialog);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
297 }
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
298
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
299 gtk_widget_show_all(menu);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
300 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button,
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
301 event->time);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
302 return FALSE;
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
303 }
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
304
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
305 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
306 selection_changed_cb(GtkTreeSelection *selection, PidginDiscoList *pdl)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
307 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
308 GtkTreeIter iter;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
309 GValue val;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
310 PidginDiscoDialog *dialog = pdl->dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
311
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
312 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
313 val.g_type = 0;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
314 gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN, &val);
27166
abf989278782 Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents: 27165
diff changeset
315 dialog->selected = g_value_get_pointer(&val);
abf989278782 Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents: 27165
diff changeset
316 if (!dialog->selected) {
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
317 gtk_widget_set_sensitive(dialog->add_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
318 gtk_widget_set_sensitive(dialog->register_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
319 return;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
320 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
321
27166
abf989278782 Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents: 27165
diff changeset
322 gtk_widget_set_sensitive(dialog->add_button, dialog->selected->flags & XMPP_DISCO_ADD);
abf989278782 Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents: 27165
diff changeset
323 gtk_widget_set_sensitive(dialog->register_button, dialog->selected->flags & XMPP_DISCO_REGISTER);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
324 } else {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
325 gtk_widget_set_sensitive(dialog->add_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
326 gtk_widget_set_sensitive(dialog->register_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
327 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
328 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
329
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
330 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
331 row_expanded_cb(GtkTreeView *tree, GtkTreeIter *arg1, GtkTreePath *rg2,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
332 gpointer user_data)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
333 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
334 PidginDiscoList *pdl;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
335 XmppDiscoService *service;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
336 GValue val;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
337
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
338 pdl = user_data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
339
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
340 val.g_type = 0;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
341 gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), arg1, SERVICE_COLUMN,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
342 &val);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
343 service = g_value_get_pointer(&val);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
344 xmpp_disco_service_expand(service);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
345 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
346
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
347 static void
27159
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
348 row_activated_cb(GtkTreeView *tree_view,
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
349 GtkTreePath *path,
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
350 GtkTreeViewColumn *column,
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
351 gpointer user_data)
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
352 {
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
353 PidginDiscoList *pdl = user_data;
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
354 GtkTreeIter iter;
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
355 XmppDiscoService *service;
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
356 GValue val;
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
357
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
358 if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(pdl->model), &iter, path))
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
359 return;
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
360
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
361 val.g_type = 0;
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
362 gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN,
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
363 &val);
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
364 service = g_value_get_pointer(&val);
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
365
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
366 if (service->flags & XMPP_DISCO_BROWSE)
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
367 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(pdl->tree), path))
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
368 gtk_tree_view_collapse_row(GTK_TREE_VIEW(pdl->tree), path);
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
369 else
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
370 gtk_tree_view_expand_row(GTK_TREE_VIEW(pdl->tree), path, FALSE);
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
371 else if (service->flags & XMPP_DISCO_REGISTER)
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
372 register_button_cb(NULL, pdl->dialog);
27159
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
373 else if (service->flags & XMPP_DISCO_ADD)
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
374 add_to_blist_cb(NULL, pdl->dialog);
27159
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
375 }
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
376
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
377 static void
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
378 destroy_win_cb(GtkWidget *window, gpointer d)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
379 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
380 PidginDiscoDialog *dialog = d;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
381 PidginDiscoList *list = dialog->discolist;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
382
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
383 if (list) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
384 list->dialog = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
385
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
386 if (list->in_progress)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
387 list->in_progress = FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
388
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
389 pidgin_disco_list_unref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
390 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
391
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
392 dialogs = g_list_remove(dialogs, d);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
393 g_free(dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
394 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
395
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
396 static void stop_button_cb(GtkButton *button, PidginDiscoDialog *dialog)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
397 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
398 pidgin_disco_list_set_in_progress(dialog->discolist, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
399 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
400
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
401 static void close_button_cb(GtkButton *button, PidginDiscoDialog *dialog)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
402 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
403 GtkWidget *window = dialog->window;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
404
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
405 gtk_widget_destroy(window);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
406 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
407
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
408 static gboolean account_filter_func(PurpleAccount *account)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
409 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
410 return purple_strequal(purple_account_get_protocol_id(account), XMPP_PLUGIN_ID);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
411 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
412
27161
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
413 static gboolean
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
414 disco_paint_tooltip(GtkWidget *tipwindow, gpointer data)
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
415 {
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
416 PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
417 gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE,
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
418 NULL, tipwindow, "tooltip",
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
419 6, 6, layout);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
420 return TRUE;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
421 }
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
422
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
423 static gboolean
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
424 disco_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path,
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
425 gpointer data, int *w, int *h)
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
426 {
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
427 PidginDiscoList *pdl = data;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
428 GtkTreeIter iter;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
429 PangoLayout *layout;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
430 int width, height;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
431 XmppDiscoService *service;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
432 GValue val;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
433 const char *type = NULL;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
434 char *markup, *jid, *name, *desc = NULL;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
435
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
436 if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(pdl->model), &iter, path))
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
437 return FALSE;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
438
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
439 val.g_type = 0;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
440 gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN,
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
441 &val);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
442 service = g_value_get_pointer(&val);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
443
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
444 switch (service->type) {
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
445 case XMPP_DISCO_SERVICE_TYPE_UNSET:
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
446 type = _("Unknown");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
447 break;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
448
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
449 case XMPP_DISCO_SERVICE_TYPE_GATEWAY:
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
450 type = _("Gateway");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
451 break;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
452
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
453 case XMPP_DISCO_SERVICE_TYPE_DIRECTORY:
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
454 type = _("Directory");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
455 break;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
456
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
457 case XMPP_DISCO_SERVICE_TYPE_CHAT:
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
458 type = _("Chat");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
459 break;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
460
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
461 case XMPP_DISCO_SERVICE_TYPE_PUBSUB_COLLECTION:
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
462 type = _("PubSub Collection");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
463 break;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
464
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
465 case XMPP_DISCO_SERVICE_TYPE_PUBSUB_LEAF:
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
466 type = _("PubSub Leaf");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
467 break;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
468
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
469 case XMPP_DISCO_SERVICE_TYPE_OTHER:
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
470 type = _("Other");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
471 break;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
472 }
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
473
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
474 markup = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>\n<b>%s:</b> %s%s%s",
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
475 name = g_markup_escape_text(service->name, -1),
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
476 type,
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
477 jid = g_markup_escape_text(service->jid, -1),
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
478 service->description ? _("\n<b>Description:</b> ") : "",
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
479 service->description ? desc = g_markup_escape_text(service->description, -1) : "");
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
480
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
481 layout = gtk_widget_create_pango_layout(tipwindow, NULL);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
482 pango_layout_set_markup(layout, markup, -1);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
483 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
484 pango_layout_set_width(layout, 500000);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
485 pango_layout_get_size(layout, &width, &height);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
486 g_object_set_data_full(G_OBJECT(tipwindow), "tooltip-plugin", layout, g_object_unref);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
487
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
488 if (w)
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
489 *w = PANGO_PIXELS(width) + 12;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
490 if (h)
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
491 *h = PANGO_PIXELS(height) + 12;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
492
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
493 g_free(markup);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
494 g_free(jid);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
495 g_free(name);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
496 g_free(desc);
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
497
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
498 return TRUE;
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
499 }
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
500
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
501 static void pidgin_disco_create_tree(PidginDiscoList *pdl)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
502 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
503 GtkCellRenderer *text_renderer, *pixbuf_renderer;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
504 GtkTreeViewColumn *column;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
505 GtkTreeSelection *selection;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
506
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
507 pdl->model = gtk_tree_store_new(NUM_OF_COLUMNS,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
508 GDK_TYPE_PIXBUF, /* PIXBUF_COLUMN */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
509 G_TYPE_STRING, /* NAME_COLUMN */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
510 G_TYPE_STRING, /* DESCRIPTION_COLUMN */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
511 G_TYPE_POINTER /* SERVICE_COLUMN */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
512 );
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
513
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
514 pdl->tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdl->model));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
515 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(pdl->tree), TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
516
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
517 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pdl->tree));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
518 g_signal_connect(G_OBJECT(selection), "changed",
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
519 G_CALLBACK(selection_changed_cb), pdl);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
520
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
521 g_object_unref(pdl->model);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
522
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
523 gtk_container_add(GTK_CONTAINER(pdl->dialog->sw), pdl->tree);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
524 gtk_widget_show(pdl->tree);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
525
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
526 text_renderer = gtk_cell_renderer_text_new();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
527 pixbuf_renderer = gtk_cell_renderer_pixbuf_new();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
528
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
529 column = gtk_tree_view_column_new();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
530 gtk_tree_view_column_set_title(column, _("Name"));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
531
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
532 gtk_tree_view_column_pack_start(column, pixbuf_renderer, FALSE);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
533 gtk_tree_view_column_set_attributes(column, pixbuf_renderer,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
534 "pixbuf", PIXBUF_COLUMN, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
535
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
536 gtk_tree_view_column_pack_start(column, text_renderer, TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
537 gtk_tree_view_column_set_attributes(column, text_renderer,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
538 "text", NAME_COLUMN, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
539
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
540 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
541 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
542 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
543 gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), NAME_COLUMN);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
544 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
545 gtk_tree_view_append_column(GTK_TREE_VIEW(pdl->tree), column);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
546
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
547 column = gtk_tree_view_column_new_with_attributes(_("Description"), text_renderer,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
548 "text", DESCRIPTION_COLUMN, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
549 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
550 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
551 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
552 gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), DESCRIPTION_COLUMN);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
553 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
554 gtk_tree_view_append_column(GTK_TREE_VIEW(pdl->tree), column);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
555
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
556 g_signal_connect(G_OBJECT(pdl->tree), "button-press-event", G_CALLBACK(service_click_cb), pdl);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
557 g_signal_connect(G_OBJECT(pdl->tree), "row-expanded", G_CALLBACK(row_expanded_cb), pdl);
27159
0baf79f7a58d Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27158
diff changeset
558 g_signal_connect(G_OBJECT(pdl->tree), "row-activated", G_CALLBACK(row_activated_cb), pdl);
27161
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
559
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
560 pidgin_tooltip_setup_for_treeview(pdl->tree, pdl,
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
561 disco_create_tooltip,
dda65a7151a2 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27160
diff changeset
562 disco_paint_tooltip);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
563 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
564
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
565 void pidgin_disco_signed_off_cb(PurpleConnection *pc)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
566 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
567 GList *node;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
568
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
569 for (node = dialogs; node; node = node->next) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
570 PidginDiscoDialog *dialog = node->data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
571 PidginDiscoList *list = dialog->discolist;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
572
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
573 if (list && list->pc == pc) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
574 if (list->in_progress)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
575 pidgin_disco_list_set_in_progress(list, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
576
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
577 if (list->tree) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
578 gtk_widget_destroy(list->tree);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
579 list->tree = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
580 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
581
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
582 pidgin_disco_list_unref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
583 dialog->discolist = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
584
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
585 gtk_widget_set_sensitive(dialog->browse_button,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
586 pidgin_account_option_menu_get_selected(dialog->account_widget) != NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
587
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
588 gtk_widget_set_sensitive(dialog->register_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
589 gtk_widget_set_sensitive(dialog->add_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
590 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
591 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
592 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
593
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
594 void pidgin_disco_dialogs_destroy_all(void)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
595 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
596 while (dialogs) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
597 PidginDiscoDialog *dialog = dialogs->data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
598
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
599 gtk_widget_destroy(dialog->window);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
600 /* destroy_win_cb removes the dialog from the list */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
601 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
602 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
603
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
604 PidginDiscoDialog *pidgin_disco_dialog_new(void)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
605 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
606 PidginDiscoDialog *dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
607 GtkWidget *window, *vbox, *vbox2, *bbox;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
608
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
609 dialog = g_new0(PidginDiscoDialog, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
610 dialogs = g_list_prepend(dialogs, dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
611
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
612 /* Create the window. */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
613 dialog->window = window = pidgin_create_dialog(_("Service Discovery"), PIDGIN_HIG_BORDER, "service discovery", TRUE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
614
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
615 g_signal_connect(G_OBJECT(window), "destroy",
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
616 G_CALLBACK(destroy_win_cb), dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
617
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
618 /* Create the parent vbox for everything. */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
619 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(window), FALSE, PIDGIN_HIG_BORDER);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
620
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
621 vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
622 gtk_container_add(GTK_CONTAINER(vbox), vbox2);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
623 gtk_widget_show(vbox2);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
624
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
625 /* accounts dropdown list */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
626 dialog->account_widget = pidgin_account_option_menu_new(NULL, FALSE,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
627 G_CALLBACK(dialog_select_account_cb), account_filter_func, dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
628 dialog->account = pidgin_account_option_menu_get_selected(dialog->account_widget);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
629 pidgin_add_widget_to_vbox(GTK_BOX(vbox2), _("_Account:"), NULL, dialog->account_widget, TRUE, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
630
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
631 /* scrolled window */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
632 dialog->sw = gtk_scrolled_window_new(NULL, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
633 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(dialog->sw),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
634 GTK_SHADOW_IN);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
635 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dialog->sw),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
636 GTK_POLICY_AUTOMATIC,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
637 GTK_POLICY_AUTOMATIC);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
638 gtk_box_pack_start(GTK_BOX(vbox2), dialog->sw, TRUE, TRUE, 0);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
639 gtk_widget_set_size_request(dialog->sw, -1, 250);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
640 gtk_widget_show(dialog->sw);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
641
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
642 /* progress bar */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
643 dialog->progress = gtk_progress_bar_new();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
644 gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(dialog->progress), 0.1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
645 gtk_box_pack_start(GTK_BOX(vbox2), dialog->progress, FALSE, FALSE, 0);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
646 gtk_widget_show(dialog->progress);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
647
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
648 /* button box */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
649 bbox = pidgin_dialog_get_action_area(GTK_DIALOG(window));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
650 gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
651 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
652
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
653 /* stop button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
654 dialog->stop_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
655 pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP,
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
656 G_CALLBACK(stop_button_cb), dialog);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
657 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
658
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
659 /* browse button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
660 dialog->browse_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
661 pidgin_pixbuf_button_from_stock(_("_Browse"), GTK_STOCK_REFRESH,
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
662 PIDGIN_BUTTON_HORIZONTAL);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
663 gtk_box_pack_start(GTK_BOX(bbox), dialog->browse_button, FALSE, FALSE, 0);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
664 g_signal_connect(G_OBJECT(dialog->browse_button), "clicked",
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
665 G_CALLBACK(browse_button_cb), dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
666 gtk_widget_set_sensitive(dialog->browse_button, dialog->account != NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
667 gtk_widget_show(dialog->browse_button);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
668
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
669 /* register button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
670 dialog->register_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
671 pidgin_dialog_add_button(GTK_DIALOG(dialog->window), _("Register"),
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
672 G_CALLBACK(register_button_cb), dialog);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
673 gtk_widget_set_sensitive(dialog->register_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
674
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
675 /* add button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
676 dialog->add_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
677 pidgin_pixbuf_button_from_stock(_("_Add"), GTK_STOCK_ADD,
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
678 PIDGIN_BUTTON_HORIZONTAL);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
679 gtk_box_pack_start(GTK_BOX(bbox), dialog->add_button, FALSE, FALSE, 0);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
680 g_signal_connect(G_OBJECT(dialog->add_button), "clicked",
27163
22d73c75e546 Fix adding a chat to the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27162
diff changeset
681 G_CALLBACK(add_to_blist_cb), dialog);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
682 gtk_widget_set_sensitive(dialog->add_button, FALSE);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
683 gtk_widget_show(dialog->add_button);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
684
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
685 /* close button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
686 dialog->close_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
687 pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE,
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
688 G_CALLBACK(close_button_cb), dialog);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
689
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
690 /* show the dialog window and return the dialog */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
691 gtk_widget_show(dialog->window);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
692
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
693 return dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
694 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
695
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
696 void pidgin_disco_add_service(PidginDiscoList *pdl, XmppDiscoService *service, XmppDiscoService *parent)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
697 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
698 PidginDiscoDialog *dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
699 GtkTreeIter iter, parent_iter, child;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
700 GdkPixbuf *pixbuf = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
701 gboolean append = TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
702
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
703 dialog = pdl->dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
704 g_return_if_fail(dialog != NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
705
27085
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
706 if (service != NULL)
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
707 purple_debug_info("xmppdisco", "Adding service \"%s\"\n", service->name);
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
708 else
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
709 purple_debug_info("xmppdisco", "Service \"%s\" has no childrens\n", parent->name);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
710
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
711 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(dialog->progress));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
712
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
713 if (parent) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
714 GtkTreeRowReference *rr;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
715 GtkTreePath *path;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
716
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
717 rr = g_hash_table_lookup(pdl->services, parent);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
718 path = gtk_tree_row_reference_get_path(rr);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
719 if (path) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
720 gtk_tree_model_get_iter(GTK_TREE_MODEL(pdl->model), &parent_iter, path);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
721 gtk_tree_path_free(path);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
722
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
723 if (gtk_tree_model_iter_children(GTK_TREE_MODEL(pdl->model), &child,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
724 &parent_iter)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
725 PidginDiscoList *tmp;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
726 gtk_tree_model_get(GTK_TREE_MODEL(pdl->model), &child,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
727 SERVICE_COLUMN, &tmp, -1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
728 if (!tmp)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
729 append = FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
730 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
731 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
732 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
733
27085
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
734 if (service == NULL) {
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
735 if (parent != NULL && !append)
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
736 gtk_tree_store_remove(pdl->model, &child);
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
737 return;
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
738 }
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
739
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
740 if (append)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
741 gtk_tree_store_append(pdl->model, &iter, (parent ? &parent_iter : NULL));
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
742 else
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
743 iter = child;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
744
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
745 if (service->flags & XMPP_DISCO_BROWSE) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
746 GtkTreeRowReference *rr;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
747 GtkTreePath *path;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
748
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
749 gtk_tree_store_append(pdl->model, &child, &iter);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
750
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
751 path = gtk_tree_model_get_path(GTK_TREE_MODEL(pdl->model), &iter);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
752 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(pdl->model), path);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
753 g_hash_table_insert(pdl->services, service, rr);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
754 gtk_tree_path_free(path);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
755 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
756
27257
afcb1d41e557 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <paul@darkrain42.org>
parents: 27167
diff changeset
757 pixbuf = pidgin_disco_load_icon(service, "16");
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
758
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
759 gtk_tree_store_set(pdl->model, &iter,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
760 PIXBUF_COLUMN, pixbuf,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
761 NAME_COLUMN, service->name,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
762 DESCRIPTION_COLUMN, service->description,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
763 SERVICE_COLUMN, service,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
764 -1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
765
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
766 if (pixbuf)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
767 g_object_unref(pixbuf);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
768 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
769