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