Mercurial > pidgin.yaz
annotate pidgin/plugins/disco/gtkdisco.c @ 28776:0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
results, as the results are not at all guaranteed to be applicable to the
newly-selected account.
Among other things, this happens when you disconnect an account with the
Disco Browser or Room List dialogs open.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 19 Oct 2009 22:56:27 +0000 |
parents | 8d408dff1bff |
children | 6126436715e8 |
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 { |
28776
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
144 gboolean change = (account != dialog->account); |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
145 dialog->account = account; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
146 gtk_widget_set_sensitive(dialog->browse_button, account != NULL); |
28776
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
147 |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
148 if (change && dialog->discolist) { |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
149 if (dialog->discolist->tree) { |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
150 gtk_widget_destroy(dialog->discolist->tree); |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
151 dialog->discolist->tree = NULL; |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
152 } |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
153 pidgin_disco_list_unref(dialog->discolist); |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
154 dialog->discolist = NULL; |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
28373
diff
changeset
|
155 } |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
156 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
157 |
27167
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
158 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
|
159 { |
27166
abf989278782
Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents:
27165
diff
changeset
|
160 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
|
161 } |
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 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
|
164 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
165 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
|
166 pidgin_disco_list_unref(pdl); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
167 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
168 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
169 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
|
170 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
171 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
|
172 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
173 if (!server || !*server) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
174 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
|
175 NULL); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
176 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
177 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
|
178 pidgin_disco_list_unref(pdl); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
179 return; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
180 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
181 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
182 pdl->server = g_strdup(server); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
183 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
|
184 xmpp_disco_start(pdl); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
185 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
186 |
27167
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
187 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
|
188 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
189 PurpleConnection *pc; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
190 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
|
191 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
|
192 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
|
193 char *server = NULL; |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
194 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
195 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
|
196 if (!pc) |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
197 return; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
198 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
199 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
|
200 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
|
201 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
|
202 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
203 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
|
204 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
|
205 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
|
206 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
|
207 } |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
208 pidgin_disco_list_unref(dialog->discolist); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
209 } |
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 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
|
212 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
|
213 (GDestroyNotify)gtk_tree_row_reference_free); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
214 pdl->pc = pc; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
215 /* We keep a copy... */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
216 pidgin_disco_list_ref(pdl); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
217 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
218 pdl->dialog = dialog; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
219 pidgin_disco_create_tree(pdl); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
220 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
221 if (dialog->account_widget) |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
222 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
|
223 |
27059
9639747bb98c
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents:
27058
diff
changeset
|
224 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 } 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
|
230 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
|
231 } |
9639747bb98c
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents:
27058
diff
changeset
|
232 |
9639747bb98c
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents:
27058
diff
changeset
|
233 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
|
234 /* 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
|
235 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
|
236 |
28373
8d408dff1bff
Add a bunch of comments for translators that might make some of these
Mark Doliner <mark@kingant.net>
parents:
27550
diff
changeset
|
237 /* Note to translators: The string "Enter an XMPP Server" is asking the |
8d408dff1bff
Add a bunch of comments for translators that might make some of these
Mark Doliner <mark@kingant.net>
parents:
27550
diff
changeset
|
238 user to type the name of an XMPP server which will then be queried */ |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
239 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
|
240 _("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
|
241 server, FALSE, FALSE, NULL, |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
242 _("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
|
243 _("Cancel"), PURPLE_CALLBACK(discolist_cancel_cb), |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
244 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
|
245 |
9639747bb98c
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <paul@darkrain42.org>
parents:
27058
diff
changeset
|
246 g_free(server); |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
247 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
248 |
27167
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
249 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
|
250 { |
27166
abf989278782
Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents:
27165
diff
changeset
|
251 XmppDiscoService *service = dialog->selected; |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
252 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
|
253 const char *jid; |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
254 |
27162
7dbe7ae559d3
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents:
27128
diff
changeset
|
255 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
|
256 |
27162
7dbe7ae559d3
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents:
27128
diff
changeset
|
257 account = purple_connection_get_account(service->list->pc); |
27164
f7ef790f3a44
merge of '43b8c66366c5dc03c717fa9d938446752df53293'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
258 jid = service->jid; |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
259 |
27162
7dbe7ae559d3
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <paul@darkrain42.org>
parents:
27128
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 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
|
264 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
265 |
27167
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
266 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
|
267 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
|
268 { |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
269 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
|
270 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
|
271 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
|
272 |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
273 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
|
274 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
|
275 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
|
276 |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
277 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
|
278 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
|
279 |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
280 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
|
281 |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
282 /* 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
|
283 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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 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
|
289 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
|
290 &val); |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
291 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
|
292 |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
293 if (!service) |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
294 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
|
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 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
|
297 |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
298 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
|
299 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
|
300 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
|
301 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
|
302 |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 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
|
307 } |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
308 |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
309 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
|
310 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
|
311 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
|
312 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
|
313 } |
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
314 |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
315 static void |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
316 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
|
317 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
318 GtkTreeIter iter; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
319 GValue val; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
320 PidginDiscoDialog *dialog = pdl->dialog; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
321 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
322 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
|
323 val.g_type = 0; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
324 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
|
325 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
|
326 if (!dialog->selected) { |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
327 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
|
328 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
|
329 return; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
330 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
331 |
27166
abf989278782
Store the currently selected service in the Dialog structure
Paul Aurich <paul@darkrain42.org>
parents:
27165
diff
changeset
|
332 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
|
333 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
|
334 } else { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
335 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
|
336 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
|
337 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
338 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
339 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
340 static void |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
341 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
|
342 gpointer user_data) |
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 PidginDiscoList *pdl; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
345 XmppDiscoService *service; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
346 GValue val; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
347 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
348 pdl = user_data; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
349 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
350 val.g_type = 0; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
351 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
|
352 &val); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
353 service = g_value_get_pointer(&val); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
354 xmpp_disco_service_expand(service); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
355 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
356 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
357 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 { |
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 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
|
364 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
|
365 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
|
366 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
|
367 |
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 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
|
369 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
|
370 |
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 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
|
372 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
|
373 &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
|
374 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
|
375 |
0baf79f7a58d
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27158
diff
changeset
|
376 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
|
377 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 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
|
383 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
|
384 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
|
385 } |
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
|
386 |
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
|
387 static void |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
388 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
|
389 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
390 PidginDiscoDialog *dialog = d; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
391 PidginDiscoList *list = dialog->discolist; |
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 if (list) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
394 list->dialog = NULL; |
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 if (list->in_progress) |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
397 list->in_progress = FALSE; |
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 pidgin_disco_list_unref(list); |
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 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
402 dialogs = g_list_remove(dialogs, d); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
403 g_free(dialog); |
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 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
|
407 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
408 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
|
409 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
410 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
411 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
|
412 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
413 GtkWidget *window = dialog->window; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
414 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
415 gtk_widget_destroy(window); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
416 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
417 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
418 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
|
419 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
420 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
|
421 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
422 |
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
|
423 static gboolean |
dda65a7151a2
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27160
diff
changeset
|
424 disco_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
|
425 { |
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 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
|
427 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
|
428 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
|
429 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
|
430 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
|
431 } |
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 |
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 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
|
434 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
|
435 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
|
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 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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 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
|
443 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
|
444 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
|
445 |
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 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
|
447 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
|
448 |
dda65a7151a2
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27160
diff
changeset
|
449 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
|
450 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
|
451 &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
|
452 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
|
453 |
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 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
|
455 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
|
456 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
|
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_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
|
460 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
|
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_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
|
464 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
|
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_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
|
468 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
|
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 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
|
472 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
|
473 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
|
474 |
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 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
|
476 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
|
477 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
|
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 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
|
480 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
|
481 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
|
482 } |
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 |
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 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
|
485 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
|
486 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
|
487 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
|
488 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
|
489 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
|
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 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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
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 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
|
499 *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
|
500 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
|
501 *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
|
502 |
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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 |
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
|
508 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
|
509 } |
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
|
510 |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
511 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
|
512 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
513 GtkCellRenderer *text_renderer, *pixbuf_renderer; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
514 GtkTreeViewColumn *column; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
515 GtkTreeSelection *selection; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
516 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
517 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
|
518 GDK_TYPE_PIXBUF, /* PIXBUF_COLUMN */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
519 G_TYPE_STRING, /* NAME_COLUMN */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
520 G_TYPE_STRING, /* DESCRIPTION_COLUMN */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
521 G_TYPE_POINTER /* SERVICE_COLUMN */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
522 ); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
523 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
524 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
|
525 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
|
526 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
527 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
|
528 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
|
529 G_CALLBACK(selection_changed_cb), pdl); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
530 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
531 g_object_unref(pdl->model); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
532 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
533 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
|
534 gtk_widget_show(pdl->tree); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
535 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
536 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
|
537 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
|
538 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
539 column = gtk_tree_view_column_new(); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
540 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
|
541 |
27158
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
542 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
|
543 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
|
544 "pixbuf", PIXBUF_COLUMN, NULL); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
545 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
546 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
|
547 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
|
548 "text", NAME_COLUMN, NULL); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
549 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
550 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
|
551 GTK_TREE_VIEW_COLUMN_GROW_ONLY); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
552 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
|
553 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
|
554 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
|
555 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
|
556 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
557 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
|
558 "text", DESCRIPTION_COLUMN, NULL); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
559 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
|
560 GTK_TREE_VIEW_COLUMN_GROW_ONLY); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 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
|
565 |
27167
fc7b9ca819c3
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <paul@darkrain42.org>
parents:
27166
diff
changeset
|
566 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
|
567 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
|
568 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
|
569 |
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
|
570 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
|
571 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
|
572 disco_paint_tooltip); |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
573 } |
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 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
|
576 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
577 GList *node; |
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 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
|
580 PidginDiscoDialog *dialog = node->data; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
581 PidginDiscoList *list = dialog->discolist; |
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 if (list && list->pc == pc) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
584 if (list->in_progress) |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
585 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
|
586 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
587 if (list->tree) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
588 gtk_widget_destroy(list->tree); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
589 list->tree = NULL; |
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 pidgin_disco_list_unref(list); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
593 dialog->discolist = NULL; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
594 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
595 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
|
596 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
|
597 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
598 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
|
599 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
|
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 } |
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 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
|
605 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
606 while (dialogs) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
607 PidginDiscoDialog *dialog = dialogs->data; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
608 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
609 gtk_widget_destroy(dialog->window); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
610 /* 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
|
611 } |
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 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
614 PidginDiscoDialog *pidgin_disco_dialog_new(void) |
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 PidginDiscoDialog *dialog; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
617 GtkWidget *window, *vbox, *vbox2, *bbox; |
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 dialog = g_new0(PidginDiscoDialog, 1); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
620 dialogs = g_list_prepend(dialogs, dialog); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
621 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
622 /* Create the window. */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
623 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
|
624 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
625 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
|
626 G_CALLBACK(destroy_win_cb), dialog); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
627 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
628 /* Create the parent vbox for everything. */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
629 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
|
630 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
631 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
|
632 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
|
633 gtk_widget_show(vbox2); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
634 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
635 /* accounts dropdown list */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
636 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
|
637 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
|
638 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
|
639 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
|
640 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
641 /* scrolled window */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
642 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
|
643 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
|
644 GTK_SHADOW_IN); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
645 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
|
646 GTK_POLICY_AUTOMATIC, |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
647 GTK_POLICY_AUTOMATIC); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
648 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
|
649 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
|
650 gtk_widget_show(dialog->sw); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
651 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
652 /* progress bar */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
653 dialog->progress = gtk_progress_bar_new(); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
654 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
|
655 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
|
656 gtk_widget_show(dialog->progress); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
657 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
658 /* button box */ |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
659 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
|
660 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
|
661 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
|
662 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
663 /* stop button */ |
27158
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
664 dialog->stop_button = |
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
665 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
|
666 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
|
667 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
|
668 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
669 /* browse button */ |
27158
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
670 dialog->browse_button = |
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
671 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
|
672 PIDGIN_BUTTON_HORIZONTAL); |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
673 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
|
674 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
|
675 G_CALLBACK(browse_button_cb), dialog); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
676 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
|
677 gtk_widget_show(dialog->browse_button); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
678 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
679 /* register button */ |
27158
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
680 dialog->register_button = |
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
681 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
|
682 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
|
683 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
|
684 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
685 /* add button */ |
27158
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
686 dialog->add_button = |
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
687 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
|
688 PIDGIN_BUTTON_HORIZONTAL); |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
689 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
|
690 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
|
691 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
|
692 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
|
693 gtk_widget_show(dialog->add_button); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
694 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
695 /* close button */ |
27158
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
696 dialog->close_button = |
abab554140b5
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27128
diff
changeset
|
697 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
|
698 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
|
699 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
700 /* 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
|
701 gtk_widget_show(dialog->window); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
702 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
703 return dialog; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
704 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
705 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
706 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
|
707 { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
708 PidginDiscoDialog *dialog; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
709 GtkTreeIter iter, parent_iter, child; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
710 GdkPixbuf *pixbuf = NULL; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
711 gboolean append = TRUE; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
712 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
713 dialog = pdl->dialog; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
714 g_return_if_fail(dialog != NULL); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
715 |
27085
61d817c4c935
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents:
27059
diff
changeset
|
716 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
|
717 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
|
718 else |
61d817c4c935
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents:
27059
diff
changeset
|
719 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
|
720 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
721 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
|
722 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
723 if (parent) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
724 GtkTreeRowReference *rr; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
725 GtkTreePath *path; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
726 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
727 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
|
728 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
|
729 if (path) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
730 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
|
731 gtk_tree_path_free(path); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
732 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
733 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
|
734 &parent_iter)) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
735 PidginDiscoList *tmp; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
736 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
|
737 SERVICE_COLUMN, &tmp, -1); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
738 if (!tmp) |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
739 append = FALSE; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
740 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
741 } |
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 |
27085
61d817c4c935
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents:
27059
diff
changeset
|
744 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
|
745 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
|
746 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
|
747 return; |
61d817c4c935
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents:
27059
diff
changeset
|
748 } |
61d817c4c935
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <paul@darkrain42.org>
parents:
27059
diff
changeset
|
749 |
27058
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
750 if (append) |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
751 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
|
752 else |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
753 iter = child; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
754 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
755 if (service->flags & XMPP_DISCO_BROWSE) { |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
756 GtkTreeRowReference *rr; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
757 GtkTreePath *path; |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
758 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
759 gtk_tree_store_append(pdl->model, &child, &iter); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
760 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
761 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
|
762 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
|
763 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
|
764 gtk_tree_path_free(path); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
765 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
766 |
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
|
767 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
|
768 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
769 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
|
770 PIXBUF_COLUMN, pixbuf, |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
771 NAME_COLUMN, service->name, |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
772 DESCRIPTION_COLUMN, service->description, |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
773 SERVICE_COLUMN, service, |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
774 -1); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
775 |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
776 if (pixbuf) |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
777 g_object_unref(pixbuf); |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
778 } |
08964b4b2fe4
Convert the disco browser to a plugin. Refs #556
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
779 |