annotate pidgin/plugins/disco/gtkdisco.c @ 27550:319b09e2590f

Avoid a potentially uninitialized variable
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 11 Jul 2009 15:36:57 +0000
parents afcb1d41e557
children 8d408dff1bff
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
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
227 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
228 _("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
229 server, FALSE, FALSE, NULL,
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
230 _("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
231 _("Cancel"), PURPLE_CALLBACK(discolist_cancel_cb),
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
232 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
233
9639747bb98c Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents: 27058
diff changeset
234 g_free(server);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
235 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
236
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
237 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
238 {
27166
abf989278782 Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents: 27165
diff changeset
239 XmppDiscoService *service = dialog->selected;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
240 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
241 const char *jid;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
242
27162
7dbe7ae559d3 Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents: 27128
diff changeset
243 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
244
27162
7dbe7ae559d3 Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents: 27128
diff changeset
245 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
246 jid = service->jid;
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
247
27162
7dbe7ae559d3 Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents: 27128
diff changeset
248 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
249 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
250 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
251 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
252 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
253
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
254 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
255 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
256 {
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
257 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
258 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
259 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
260
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
261 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
262 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
263 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
264
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
265 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
266 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
267
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
268 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
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 /* 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
271 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
272 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
273 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
274 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
275 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
276 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
277 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
278 &val);
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
279 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
280
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
281 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
282 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
283
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
284 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
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 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
287 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
288 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
289 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
290
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
291 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
292 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
293 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
294 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
295 }
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
296
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
297 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
298 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
299 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
300 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
301 }
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
302
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
303 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
304 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
305 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
306 GtkTreeIter iter;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
307 GValue val;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
308 PidginDiscoDialog *dialog = pdl->dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
309
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
310 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
311 val.g_type = 0;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
312 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
313 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
314 if (!dialog->selected) {
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
315 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
316 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
317 return;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
318 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
319
27166
abf989278782 Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents: 27165
diff changeset
320 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
321 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
322 } else {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
323 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
324 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
325 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
326 }
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 static void
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
329 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
330 gpointer user_data)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
331 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
332 PidginDiscoList *pdl;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
333 XmppDiscoService *service;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
334 GValue val;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
335
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
336 pdl = user_data;
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 val.g_type = 0;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
339 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
340 &val);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
341 service = g_value_get_pointer(&val);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
342 xmpp_disco_service_expand(service);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
343 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
344
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
345 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
346 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
347 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
348 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
349 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
350 {
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 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
352 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
353 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
354 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
355
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 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
357 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
358
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 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
360 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
361 &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
362 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
363
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 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
365 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
366 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
367 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
368 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
369 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
370 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
371 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
372 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
373 }
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
374
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 static void
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
376 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
377 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
378 PidginDiscoDialog *dialog = d;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
379 PidginDiscoList *list = dialog->discolist;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
380
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
381 if (list) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
382 list->dialog = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
383
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
384 if (list->in_progress)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
385 list->in_progress = FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
386
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
387 pidgin_disco_list_unref(list);
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
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
390 dialogs = g_list_remove(dialogs, d);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
391 g_free(dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
392 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
393
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
394 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
395 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
396 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
397 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
398
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
399 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
400 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
401 GtkWidget *window = dialog->window;
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 gtk_widget_destroy(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
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
406 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
407 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
408 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
409 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
410
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
411 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
412 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
413 {
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 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
415 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
416 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
417 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
418 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
419 }
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
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 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
422 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
423 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
424 {
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 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433
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 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
435 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
436
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 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
438 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
439 &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
440 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
441
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 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
443 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
444 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
445 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
446
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 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
448 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
449 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
450
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 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
452 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
453 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
454
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 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
456 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
457 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
458
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 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
460 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
461 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
462
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 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
464 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
465 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
466
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 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
468 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
469 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
470 }
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
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 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
473 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
474 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
475 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
476 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
477 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
478
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 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
480 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
481 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
482 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
483 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
484 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
485
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 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
487 *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
488 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
489 *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
490
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 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
492 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
493 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
494 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
495
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 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
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
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
499 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
500 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
501 GtkCellRenderer *text_renderer, *pixbuf_renderer;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
502 GtkTreeViewColumn *column;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
503 GtkTreeSelection *selection;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
504
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
505 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
506 GDK_TYPE_PIXBUF, /* PIXBUF_COLUMN */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
507 G_TYPE_STRING, /* NAME_COLUMN */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
508 G_TYPE_STRING, /* DESCRIPTION_COLUMN */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
509 G_TYPE_POINTER /* SERVICE_COLUMN */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
510 );
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
511
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
512 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
513 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
514
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
515 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
516 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
517 G_CALLBACK(selection_changed_cb), pdl);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
518
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
519 g_object_unref(pdl->model);
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 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
522 gtk_widget_show(pdl->tree);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
523
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
524 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
525 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
526
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
527 column = gtk_tree_view_column_new();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
528 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
529
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
530 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
531 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
532 "pixbuf", PIXBUF_COLUMN, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
533
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
534 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
535 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
536 "text", NAME_COLUMN, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
537
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
538 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
539 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
540 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
541 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
542 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
543 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
544
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
545 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
546 "text", DESCRIPTION_COLUMN, NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
547 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
548 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
549 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
550 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
551 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
552 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
553
27167
fc7b9ca819c3 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents: 27166
diff changeset
554 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
555 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
556 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
557
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
558 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
559 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
560 disco_paint_tooltip);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
561 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
562
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
563 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
564 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
565 GList *node;
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 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
568 PidginDiscoDialog *dialog = node->data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
569 PidginDiscoList *list = dialog->discolist;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
570
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
571 if (list && list->pc == pc) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
572 if (list->in_progress)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
573 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
574
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
575 if (list->tree) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
576 gtk_widget_destroy(list->tree);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
577 list->tree = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
578 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
579
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
580 pidgin_disco_list_unref(list);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
581 dialog->discolist = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
582
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
583 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
584 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
585
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
586 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
587 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
588 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
589 }
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 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
593 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
594 while (dialogs) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
595 PidginDiscoDialog *dialog = dialogs->data;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
596
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
597 gtk_widget_destroy(dialog->window);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
598 /* 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
599 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
600 }
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 PidginDiscoDialog *pidgin_disco_dialog_new(void)
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 *dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
605 GtkWidget *window, *vbox, *vbox2, *bbox;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
606
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
607 dialog = g_new0(PidginDiscoDialog, 1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
608 dialogs = g_list_prepend(dialogs, dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
609
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
610 /* Create the window. */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
611 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
612
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
613 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
614 G_CALLBACK(destroy_win_cb), dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
615
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
616 /* Create the parent vbox for everything. */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
617 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
618
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
619 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
620 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
621 gtk_widget_show(vbox2);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
622
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
623 /* accounts dropdown list */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
624 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
625 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
626 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
627 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
628
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
629 /* scrolled window */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
630 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
631 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
632 GTK_SHADOW_IN);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
633 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
634 GTK_POLICY_AUTOMATIC,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
635 GTK_POLICY_AUTOMATIC);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
636 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
637 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
638 gtk_widget_show(dialog->sw);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
639
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
640 /* progress bar */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
641 dialog->progress = gtk_progress_bar_new();
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
642 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
643 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
644 gtk_widget_show(dialog->progress);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
645
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
646 /* button box */
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
647 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
648 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
649 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
650
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
651 /* stop button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
652 dialog->stop_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
653 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
654 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
655 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
656
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
657 /* browse button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
658 dialog->browse_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
659 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
660 PIDGIN_BUTTON_HORIZONTAL);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
661 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
662 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
663 G_CALLBACK(browse_button_cb), dialog);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
664 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
665 gtk_widget_show(dialog->browse_button);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
666
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
667 /* register button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
668 dialog->register_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
669 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
670 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
671 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
672
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
673 /* add button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
674 dialog->add_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
675 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
676 PIDGIN_BUTTON_HORIZONTAL);
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
677 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
678 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
679 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
680 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
681 gtk_widget_show(dialog->add_button);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
682
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
683 /* close button */
27158
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
684 dialog->close_button =
abab554140b5 Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27128
diff changeset
685 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
686 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
687
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
688 /* 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
689 gtk_widget_show(dialog->window);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
690
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
691 return dialog;
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
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
694 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
695 {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
696 PidginDiscoDialog *dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
697 GtkTreeIter iter, parent_iter, child;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
698 GdkPixbuf *pixbuf = NULL;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
699 gboolean append = TRUE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
700
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
701 dialog = pdl->dialog;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
702 g_return_if_fail(dialog != NULL);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
703
27085
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
704 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
705 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
706 else
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", "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
708
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
709 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
710
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
711 if (parent) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
712 GtkTreeRowReference *rr;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
713 GtkTreePath *path;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
714
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
715 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
716 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
717 if (path) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
718 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
719 gtk_tree_path_free(path);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
720
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
721 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
722 &parent_iter)) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
723 PidginDiscoList *tmp;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
724 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
725 SERVICE_COLUMN, &tmp, -1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
726 if (!tmp)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
727 append = FALSE;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
728 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
729 }
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
27085
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
732 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
733 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
734 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
735 return;
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
736 }
61d817c4c935 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents: 27059
diff changeset
737
27058
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
738 if (append)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
739 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
740 else
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
741 iter = child;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
742
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
743 if (service->flags & XMPP_DISCO_BROWSE) {
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
744 GtkTreeRowReference *rr;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
745 GtkTreePath *path;
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
746
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
747 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
748
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
749 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
750 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
751 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
752 gtk_tree_path_free(path);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
753 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
754
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
755 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
756
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
757 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
758 PIXBUF_COLUMN, pixbuf,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
759 NAME_COLUMN, service->name,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
760 DESCRIPTION_COLUMN, service->description,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
761 SERVICE_COLUMN, service,
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
762 -1);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
763
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
764 if (pixbuf)
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
765 g_object_unref(pixbuf);
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
766 }
08964b4b2fe4 Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
767