Wed, 02 Apr 2014 18:50:03 +0200
Smiley manager: more cleanup
|
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 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
34 | #include "gtk3compat.h" |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
35 | #include "gtkdisco.h" |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
36 | #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
|
37 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
38 | 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
|
39 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
40 | enum { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
41 | 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
|
42 | NAME_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
43 | DESCRIPTION_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
44 | SERVICE_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
45 | 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
|
46 | }; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
47 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
48 | static void |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
49 | 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
|
50 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
51 | 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
|
52 | 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
|
53 | list->dialog->discolist = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
54 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
55 | if (list->tree) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
56 | gtk_widget_destroy(list->tree); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
57 | list->tree = NULL; |
|
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 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
60 | g_free((gchar*)list->server); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
61 | g_free(list); |
|
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 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
64 | 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
|
65 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
66 | 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
|
67 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
68 | ++list->ref; |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
69 | 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
|
70 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
71 | return list; |
|
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 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
74 | 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
|
75 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
76 | 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
|
77 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
78 | --list->ref; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
79 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
80 | 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
|
81 | if (list->ref == 0) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
82 | pidgin_disco_list_destroy(list); |
|
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 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
85 | 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
|
86 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
87 | PidginDiscoDialog *dialog = list->dialog; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
88 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
89 | if (!dialog) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
90 | return; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
91 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
92 | list->in_progress = in_progress; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
93 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
94 | if (in_progress) { |
|
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->account_widget, FALSE); |
|
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->stop_button, TRUE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
97 | 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
|
98 | } else { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
99 | 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
|
100 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
101 | 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
|
102 | |
|
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->stop_button, FALSE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
104 | 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
|
105 | /* |
|
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->register_button, FALSE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
107 | 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
|
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 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
111 | |
|
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
|
112 | 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
|
113 | 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
|
114 | { |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
115 | GdkPixbuf *pixbuf = NULL; |
|
27733
3e20246d57f2
Avoid a potentially uninitialized variable
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27399
diff
changeset
|
116 | 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
|
117 | |
|
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(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
|
119 | 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
|
120 | |
|
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 | 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
|
122 | 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
|
123 | 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
|
124 | 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
|
125 | #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
|
126 | } 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
|
127 | 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
|
128 | #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
|
129 | } 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
|
130 | 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
|
131 | |
|
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 | 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
|
133 | 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
|
134 | 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
|
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 | |
|
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 | 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
|
138 | } |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
139 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
140 | 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
|
141 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
142 | 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
|
143 | 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
|
144 | { |
|
28704
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
28304
diff
changeset
|
145 | 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
|
146 | dialog->account = account; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
147 | 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
|
148 | |
|
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 (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
|
150 | 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
|
151 | 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
|
152 | 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
|
153 | } |
|
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
28304
diff
changeset
|
154 | 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
|
155 | 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
|
156 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
157 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
158 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
159 | 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
|
160 | { |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
161 | 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
|
162 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
163 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
164 | 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
|
165 | { |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
166 | 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
|
167 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
168 | 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
|
169 | 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
|
170 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
171 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
172 | 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
|
173 | { |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
174 | 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
|
175 | 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
|
176 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
177 | if (!server || !*server) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
178 | purple_notify_error(my_plugin, _("Invalid Server"), _("Invalid Server"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
179 | NULL, purple_request_cpar_from_connection(pdl->pc)); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
180 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
181 | 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
|
182 | pidgin_disco_list_unref(pdl); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
183 | return; |
|
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 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
186 | pdl->server = g_strdup(server); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
187 | 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
|
188 | xmpp_disco_start(pdl); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
189 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
190 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
191 | 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
|
192 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
193 | 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
|
194 | 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
|
195 | 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
|
196 | 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
|
197 | 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
|
198 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
199 | 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
|
200 | 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
|
201 | return; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
202 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
203 | 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
|
204 | 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
|
205 | 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
|
206 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
207 | 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
|
208 | 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
|
209 | 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
|
210 | 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
|
211 | } |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
212 | 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
|
213 | } |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
214 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
215 | 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
|
216 | 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
|
217 | (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
|
218 | 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
|
219 | /* We keep a copy... */ |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
220 | 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
|
221 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
222 | 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
|
223 | 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
|
224 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
225 | 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
|
226 | 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
|
227 | |
|
27218
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
228 | username = purple_account_get_username(dialog->account); |
| 29066 | 229 | at = strchr(username, '@'); |
| 230 | 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
|
231 | 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
|
232 | 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
|
233 | } 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
|
234 | 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
|
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 | |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
237 | 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
|
238 | /* 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
|
239 | 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
|
240 | |
|
28304
c8eaf4b58a8f
Add a bunch of comments for translators that might make some of these
Mark Doliner <markdoliner@pidgin.im>
parents:
27733
diff
changeset
|
241 | /* 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
|
242 | 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
|
243 | 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
|
244 | _("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
|
245 | server, FALSE, FALSE, NULL, |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
246 | _("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
|
247 | _("Cancel"), PURPLE_CALLBACK(discolist_cancel_cb), |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33271
diff
changeset
|
248 | purple_request_cpar_from_connection(pc), 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
|
249 | |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
250 | 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
|
251 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
252 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
253 | 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
|
254 | { |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
255 | 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
|
256 | 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
|
257 | 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
|
258 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
259 | 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
|
260 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
261 | account = purple_connection_get_account(service->list->pc); |
|
27316
4bcca82b93c1
merge of '898c56e61aa15d0978bf025f1d9a561c38372b03'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
262 | jid = service->jid; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
263 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
264 | 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
|
265 | 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
|
266 | 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
|
267 | 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
|
268 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
269 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
270 | 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
|
271 | 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
|
272 | { |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
273 | 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
|
274 | 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
|
275 | 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
|
276 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
277 | 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
|
278 | 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
|
279 | 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
|
280 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
281 | 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
|
282 | 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
|
283 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
284 | 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
|
285 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
286 | /* 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
|
287 | 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
|
288 | 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
|
289 | 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
|
290 | 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
|
291 | 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
|
292 | 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
|
293 | 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
|
294 | &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 | 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
|
296 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
297 | 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
|
298 | 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
|
299 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
300 | 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
|
301 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
302 | 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
|
303 | 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
|
304 | 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
|
305 | 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
|
306 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
307 | 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
|
308 | 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
|
309 | 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
|
310 | 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
|
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 | |
|
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_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
|
314 | 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
|
315 | 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
|
316 | 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
|
317 | } |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
318 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
319 | 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
|
320 | 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
|
321 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
322 | GtkTreeIter iter; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
323 | 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
|
324 | 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
|
325 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
326 | 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
|
327 | 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
|
328 | 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
|
329 | 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
|
330 | 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
|
331 | 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
|
332 | 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
|
333 | return; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
334 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
335 | |
|
27318
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->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
|
337 | 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
|
338 | } else { |
|
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->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
|
340 | 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
|
341 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
342 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
343 | |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
344 | static void |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
345 | 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
|
346 | gpointer user_data) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
347 | { |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
348 | PidginDiscoList *pdl; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
349 | XmppDiscoService *service; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
350 | GValue val; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
351 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
352 | pdl = user_data; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
353 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
354 | val.g_type = 0; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
355 | 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
|
356 | &val); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
357 | 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
|
358 | xmpp_disco_service_expand(service); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
359 | } |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
360 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
361 | 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
|
362 | 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
|
363 | 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
|
364 | 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
|
365 | 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
|
366 | { |
|
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 | 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
|
368 | 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
|
369 | 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
|
370 | 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
|
371 | |
|
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 | 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
|
373 | 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
|
374 | |
|
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 | 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
|
376 | 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
|
377 | &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 | 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
|
379 | |
|
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 (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
|
381 | 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
|
382 | 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
|
383 | 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
|
384 | 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
|
385 | 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
|
386 | 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
|
387 | 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
|
388 | 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
|
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 | |
|
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
|
391 | static void |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
392 | 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
|
393 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
394 | PidginDiscoDialog *dialog = d; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
395 | 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
|
396 | |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
397 | 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
|
398 | 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
|
399 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
400 | if (list) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
401 | 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
|
402 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
403 | if (list->in_progress) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
404 | 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
|
405 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
406 | 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
|
407 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
408 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
409 | 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
|
410 | 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
|
411 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
412 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
413 | 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
|
414 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
415 | 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
|
416 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
417 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
418 | 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
|
419 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
420 | 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
|
421 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
422 | 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
|
423 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
424 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
425 | 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
|
426 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
427 | 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
|
428 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
429 | |
|
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
|
430 | static gboolean |
|
33166
e97c8ef10fd2
Fix tooltip paint function parameters in gtkdisco plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33128
diff
changeset
|
431 | disco_paint_tooltip(GtkWidget *tipwindow, cairo_t *cr, gpointer data) |
|
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
|
432 | { |
|
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
|
433 | PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33166
diff
changeset
|
434 | #if GTK_CHECK_VERSION(3,0,0) |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
435 | GtkStyleContext *context = gtk_widget_get_style_context(tipwindow); |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
436 | gtk_style_context_add_class(context, GTK_STYLE_CLASS_TOOLTIP); |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
437 | gtk_render_layout(context, cr, 6, 6, layout); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33166
diff
changeset
|
438 | #else |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33166
diff
changeset
|
439 | gtk_paint_layout(gtk_widget_get_style(tipwindow), |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33166
diff
changeset
|
440 | gtk_widget_get_window(tipwindow), |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33166
diff
changeset
|
441 | GTK_STATE_NORMAL, FALSE, |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33166
diff
changeset
|
442 | NULL, tipwindow, "tooltip", |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33166
diff
changeset
|
443 | 6, 6, layout); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33166
diff
changeset
|
444 | #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
|
445 | 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
|
446 | } |
|
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 | |
|
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 | 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
|
449 | 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
|
450 | 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
|
451 | { |
|
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 | 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
|
453 | 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
|
454 | 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
|
455 | 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
|
456 | 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
|
457 | 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
|
458 | 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
|
459 | 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
|
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 | 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
|
462 | 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
|
463 | |
|
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 | 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
|
465 | 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
|
466 | &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
|
467 | service = g_value_get_pointer(&val); |
|
32081
49f0be55b564
gtkdisco: Prevent a NULL dereference crash
Paul Aurich <darkrain42@pidgin.im>
parents:
31321
diff
changeset
|
468 | if (!service) |
|
49f0be55b564
gtkdisco: Prevent a NULL dereference crash
Paul Aurich <darkrain42@pidgin.im>
parents:
31321
diff
changeset
|
469 | return FALSE; |
|
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
|
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 | 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
|
472 | 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
|
473 | 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
|
474 | 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
|
475 | |
|
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 | 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
|
477 | 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
|
478 | 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
|
479 | |
|
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 | 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
|
481 | 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
|
482 | 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
|
483 | |
|
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 | 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
|
485 | 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
|
486 | 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
|
487 | |
|
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 | 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
|
489 | 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
|
490 | 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
|
491 | |
|
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 | 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
|
493 | 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
|
494 | 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
|
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 | 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
|
497 | 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
|
498 | 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
|
499 | } |
|
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 | |
|
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 | 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
|
502 | 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
|
503 | 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
|
504 | 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
|
505 | 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
|
506 | 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
|
507 | |
|
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 | 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
|
509 | 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
|
510 | 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
|
511 | 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
|
512 | 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
|
513 | 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
|
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 | 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
|
516 | *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
|
517 | 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
|
518 | *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
|
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 | 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
|
521 | 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
|
522 | 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
|
523 | 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
|
524 | |
|
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
|
525 | 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
|
526 | } |
|
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
|
527 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
528 | 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
|
529 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
530 | 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
|
531 | GtkTreeViewColumn *column; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
532 | GtkTreeSelection *selection; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
533 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
534 | 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
|
535 | 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
|
536 | 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
|
537 | 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
|
538 | 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
|
539 | ); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
540 | |
|
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 | 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
|
542 | 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
|
543 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
544 | 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
|
545 | 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
|
546 | 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
|
547 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
548 | 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
|
549 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
550 | 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
|
551 | 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
|
552 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
553 | 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
|
554 | 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
|
555 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
556 | 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
|
557 | 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
|
558 | |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
559 | 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
|
560 | 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
|
561 | "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
|
562 | |
|
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_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
|
564 | 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
|
565 | "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
|
566 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
567 | 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
|
568 | 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
|
569 | 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
|
570 | 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
|
571 | 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
|
572 | 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
|
573 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
574 | 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
|
575 | "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
|
576 | 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
|
577 | 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
|
578 | 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
|
579 | 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
|
580 | 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
|
581 | 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
|
582 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
583 | 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
|
584 | 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
|
585 | 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
|
586 | |
|
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
|
587 | 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
|
588 | 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
|
589 | 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
|
590 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
591 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
592 | 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
|
593 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
594 | GList *node; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
595 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
596 | 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
|
597 | PidginDiscoDialog *dialog = node->data; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
598 | PidginDiscoList *list = dialog->discolist; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
599 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
600 | if (list && list->pc == pc) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
601 | if (list->in_progress) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
602 | 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
|
603 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
604 | if (list->tree) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
605 | gtk_widget_destroy(list->tree); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
606 | list->tree = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
607 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
608 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
609 | pidgin_disco_list_unref(list); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
610 | dialog->discolist = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
611 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
612 | 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
|
613 | 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
|
614 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
615 | 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
|
616 | 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
|
617 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
618 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
619 | } |
|
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 | 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
|
622 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
623 | while (dialogs) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
624 | PidginDiscoDialog *dialog = dialogs->data; |
|
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 | gtk_widget_destroy(dialog->window); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
627 | /* 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
|
628 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
629 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
630 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
631 | 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
|
632 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
633 | PidginDiscoDialog *dialog; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
634 | 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
|
635 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
636 | 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
|
637 | 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
|
638 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
639 | /* 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
|
640 | 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
|
641 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
642 | 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
|
643 | 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
|
644 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
645 | /* 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
|
646 | 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
|
647 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
648 | vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_BORDER); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
649 | 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
|
650 | 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
|
651 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
652 | /* accounts dropdown list */ |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
653 | 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
|
654 | 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
|
655 | 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
|
656 | 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
|
657 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
658 | /* scrolled window */ |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30010
diff
changeset
|
659 | dialog->sw = pidgin_make_scrollable(NULL, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS, GTK_SHADOW_IN, -1, 250); |
|
26585
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 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
662 | /* progress bar */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
663 | 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
|
664 | 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
|
665 | 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
|
666 | 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
|
667 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
668 | /* button box */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
669 | 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
|
670 | 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
|
671 | 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
|
672 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
673 | /* stop button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
674 | dialog->stop_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
675 | 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
|
676 | 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
|
677 | 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
|
678 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
679 | /* browse button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
680 | dialog->browse_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
681 | 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
|
682 | PIDGIN_BUTTON_HORIZONTAL); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
683 | 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
|
684 | 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
|
685 | 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
|
686 | 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
|
687 | 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
|
688 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
689 | /* register button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
690 | dialog->register_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
691 | 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
|
692 | 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
|
693 | 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
|
694 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
695 | /* add button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
696 | dialog->add_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
697 | 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
|
698 | 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
|
699 | 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
|
700 | 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
|
701 | 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
|
702 | 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
|
703 | 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
|
704 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
705 | /* close button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
706 | dialog->close_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
707 | 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
|
708 | 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
|
709 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
710 | /* 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
|
711 | 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
|
712 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
713 | return dialog; |
|
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 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
716 | 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
|
717 | { |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
718 | PidginDiscoDialog *dialog; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
719 | 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
|
720 | GdkPixbuf *pixbuf = NULL; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
721 | 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
|
722 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
723 | dialog = pdl->dialog; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
724 | 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
|
725 | |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
726 | 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
|
727 | 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
|
728 | else |
|
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", "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
|
730 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
731 | 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
|
732 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
733 | if (parent) { |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
734 | GtkTreeRowReference *rr; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
735 | GtkTreePath *path; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
736 | |
|
26925
c8a3e1885041
Rename pdl->cats to pdl->services, since these aren't roomlist categories
Paul Aurich <darkrain42@pidgin.im>
parents:
26919
diff
changeset
|
737 | 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
|
738 | 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
|
739 | 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
|
740 | 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
|
741 | gtk_tree_path_free(path); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
742 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
743 | 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
|
744 | &parent_iter)) { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
745 | PidginDiscoList *tmp; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
746 | 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
|
747 | SERVICE_COLUMN, &tmp, -1); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
748 | if (!tmp) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
749 | append = FALSE; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
750 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
751 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
752 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
753 | |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
754 | 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
|
755 | 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
|
756 | 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
|
757 | return; |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
758 | } |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
759 | |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
760 | if (append) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
761 | 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
|
762 | else |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
763 | iter = child; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
764 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
765 | 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
|
766 | GtkTreeRowReference *rr; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
767 | GtkTreePath *path; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
768 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
769 | 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
|
770 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
771 | 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
|
772 | 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
|
773 | 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
|
774 | gtk_tree_path_free(path); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
775 | } |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
776 | |
|
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
|
777 | 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
|
778 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
779 | 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
|
780 | PIXBUF_COLUMN, pixbuf, |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
781 | NAME_COLUMN, service->name, |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
782 | 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
|
783 | 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
|
784 | -1); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
785 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
786 | if (pixbuf) |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
787 | 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
|
788 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
789 |