Sat, 09 Jun 2018 01:43:48 +0000
Merged in CMaiku/pidgin (pull request #367)
gtkdebug: Fix initial filter level of debug window
Approved-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Approved-by: Eion Robb <eionrobb@gmail.com>
Approved-by: Gary Kramlich <grim@reaperworld.com>
|
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; |
|
39037
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
117 | gchar *tmp_size; |
|
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
|
118 | |
|
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(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
|
120 | 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
|
121 | |
|
39037
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
122 | tmp_size = g_strdup_printf("%sx%s", size, size); |
|
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
123 | |
|
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
|
124 | if (service->type == XMPP_DISCO_SERVICE_TYPE_GATEWAY && service->gateway_type) { |
|
39040
65ed0e8e8229
Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39037
diff
changeset
|
125 | char *tmp = g_strconcat("im-", service->gateway_type, |
|
65ed0e8e8229
Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39037
diff
changeset
|
126 | ".png", NULL); |
|
65ed0e8e8229
Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39037
diff
changeset
|
127 | |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
128 | filename = g_build_filename(PURPLE_DATADIR, |
|
39040
65ed0e8e8229
Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39037
diff
changeset
|
129 | "pidgin", "icons", "hicolor", tmp_size, "apps", |
|
65ed0e8e8229
Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39037
diff
changeset
|
130 | tmp, 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
|
131 | 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
|
132 | #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
|
133 | } else if (service->type == XMPP_DISCO_SERVICE_TYPE_USER) { |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
134 | filename = g_build_filename(PURPLE_DATADIR, |
|
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
135 | "pixmaps", "pidgin", "status", size, "person.png", 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
|
136 | #endif |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
137 | } else if (service->type == XMPP_DISCO_SERVICE_TYPE_CHAT) { |
|
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
138 | filename = g_build_filename(PURPLE_DATADIR, |
|
39037
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
139 | "pidgin", "icons", "hicolor", tmp_size, "status", |
|
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
140 | "chat.png", NULL); |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
141 | } |
|
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
|
142 | |
|
39037
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
143 | g_free(tmp_size); |
|
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
144 | |
|
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
|
145 | 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
|
146 | 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
|
147 | 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
|
148 | } |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
149 | |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
150 | 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
|
151 | } |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
152 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
153 | 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
|
154 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
155 | 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
|
156 | 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
|
157 | { |
|
28704
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
28304
diff
changeset
|
158 | 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
|
159 | dialog->account = account; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
160 | 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
|
161 | |
|
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
28304
diff
changeset
|
162 | 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
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | } |
|
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
28304
diff
changeset
|
167 | 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
|
168 | 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
|
169 | } |
|
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 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
172 | 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
|
173 | { |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
174 | 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
|
175 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
176 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
177 | 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
|
178 | { |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
179 | 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
|
180 | |
|
27217
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); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
183 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
184 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
185 | 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
|
186 | { |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
187 | 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
|
188 | 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
|
189 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
190 | if (!server || !*server) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
191 | 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
|
192 | 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
|
193 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
194 | 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
|
195 | pidgin_disco_list_unref(pdl); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
196 | return; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
197 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
198 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
199 | pdl->server = g_strdup(server); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
200 | 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
|
201 | xmpp_disco_start(pdl); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
202 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
203 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
204 | 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
|
205 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
206 | 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
|
207 | 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
|
208 | 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
|
209 | 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
|
210 | 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
|
211 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
212 | 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
|
213 | 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
|
214 | return; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
215 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
216 | 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
|
217 | 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
|
218 | 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
|
219 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
220 | 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
|
221 | 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
|
222 | 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
|
223 | 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
|
224 | } |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
225 | 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
|
226 | } |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
227 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
228 | 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
|
229 | 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
|
230 | (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
|
231 | 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
|
232 | /* We keep a copy... */ |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
233 | 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
|
234 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
235 | 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
|
236 | 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
|
237 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
238 | 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
|
239 | 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
|
240 | |
|
27218
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
241 | username = purple_account_get_username(dialog->account); |
| 29066 | 242 | at = strchr(username, '@'); |
| 243 | 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
|
244 | 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
|
245 | 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
|
246 | } 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
|
247 | 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
|
248 | } |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
249 | |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
250 | 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
|
251 | /* 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
|
252 | 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
|
253 | |
|
36135
b46d29bc9b35
Standardize the formatting we use to document hints for translators.
Mark Doliner <mark@kingant.net>
parents:
35850
diff
changeset
|
254 | /* Translators: The string "Enter an XMPP Server" is asking the user to |
|
b46d29bc9b35
Standardize the formatting we use to document hints for translators.
Mark Doliner <mark@kingant.net>
parents:
35850
diff
changeset
|
255 | 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
|
256 | 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
|
257 | _("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
|
258 | server, FALSE, FALSE, NULL, |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
259 | _("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
|
260 | _("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
|
261 | 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
|
262 | |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
263 | 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
|
264 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
265 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
266 | 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
|
267 | { |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
268 | 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
|
269 | 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
|
270 | 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
|
271 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
272 | 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
|
273 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
274 | account = purple_connection_get_account(service->list->pc); |
|
27316
4bcca82b93c1
merge of '898c56e61aa15d0978bf025f1d9a561c38372b03'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
275 | jid = service->jid; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
276 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
277 | 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
|
278 | 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
|
279 | 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
|
280 | 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
|
281 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
282 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
283 | 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
|
284 | 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
|
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 | 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
|
287 | 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
|
288 | 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
|
289 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
290 | 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
|
291 | 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
|
292 | 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
|
293 | |
|
38705
62a7a975251a
Use gdk_event_triggers_context_menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38583
diff
changeset
|
294 | if (!gdk_event_triggers_context_menu((GdkEvent *)event)) |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
295 | 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
|
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 | 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
|
298 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
299 | /* 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
|
300 | 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
|
301 | 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
|
302 | 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
|
303 | 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
|
304 | 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
|
305 | 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
|
306 | 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
|
307 | &val); |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
308 | 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
|
309 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
310 | 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
|
311 | 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
|
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 | 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
|
314 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
315 | if (service->flags & XMPP_DISCO_ADD) |
|
39008
a705bd1673dd
gtkdisco: Port off of GtkStock
Mike Ruprecht <cmaiku@gmail.com>
parents:
38707
diff
changeset
|
316 | pidgin_new_menu_item(menu, _("Add to Buddy List"), NULL, |
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
317 | G_CALLBACK(add_to_blist_cb), pdl->dialog); |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
318 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
319 | if (service->flags & XMPP_DISCO_REGISTER) { |
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
320 | GtkWidget *item = pidgin_new_menu_item(menu, _("Register"), |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
321 | NULL, NULL, NULL); |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
322 | 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
|
323 | 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
|
324 | } |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
325 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
326 | gtk_widget_show_all(menu); |
|
38707
6f4d3ab2f2ed
Use gtk_menu_popup_at_pointer instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
327 | gtk_menu_popup_at_pointer(GTK_MENU(menu), (GdkEvent *)event); |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
328 | 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
|
329 | } |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
330 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
331 | 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
|
332 | 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
|
333 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
334 | GtkTreeIter iter; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
335 | 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
|
336 | 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
|
337 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
338 | 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
|
339 | 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
|
340 | 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
|
341 | 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
|
342 | 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
|
343 | 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
|
344 | 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
|
345 | return; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
346 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
347 | |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
348 | 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
|
349 | 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
|
350 | } else { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
351 | 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
|
352 | 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
|
353 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
354 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
355 | |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
356 | static void |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
357 | 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
|
358 | gpointer user_data) |
|
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 | PidginDiscoList *pdl; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
361 | XmppDiscoService *service; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
362 | GValue val; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
363 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
364 | pdl = user_data; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
365 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
366 | val.g_type = 0; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
367 | 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
|
368 | &val); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
369 | 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
|
370 | xmpp_disco_service_expand(service); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
371 | } |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
372 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
373 | 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
|
374 | 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
|
375 | 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
|
376 | 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
|
377 | 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
|
378 | { |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
379 | 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
|
380 | 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
|
381 | 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
|
382 | 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
|
383 | |
|
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 | 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
|
385 | 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
|
386 | |
|
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 | 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
|
388 | 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
|
389 | &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
|
390 | 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
|
391 | |
|
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
|
392 | 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
|
393 | 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
|
394 | 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
|
395 | 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
|
396 | 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
|
397 | 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
|
398 | 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
|
399 | 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
|
400 | 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
|
401 | } |
|
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
|
402 | |
|
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
|
403 | static void |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
404 | 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
|
405 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
406 | PidginDiscoDialog *dialog = d; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
407 | 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
|
408 | |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
409 | 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
|
410 | 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
|
411 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
412 | if (list) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
413 | 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
|
414 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
415 | if (list->in_progress) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
416 | 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
|
417 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
418 | 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
|
419 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
420 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
421 | 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
|
422 | 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
|
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 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
|
426 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
427 | 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
|
428 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
429 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
430 | 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
|
431 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
432 | 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
|
433 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
434 | 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
|
435 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
436 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
437 | 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
|
438 | { |
|
36754
8250d6be8c02
Started refactoring pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34329
diff
changeset
|
439 | return purple_strequal(purple_account_get_protocol_id(account), XMPP_PROTOCOL_ID); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
440 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
441 | |
|
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
|
442 | static gboolean |
|
33166
e97c8ef10fd2
Fix tooltip paint function parameters in gtkdisco plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33128
diff
changeset
|
443 | 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
|
444 | { |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
445 | PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
446 | 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
|
447 | 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
|
448 | gtk_render_layout(context, cr, 6, 6, layout); |
|
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
|
449 | 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
|
450 | } |
|
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 | 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
|
453 | 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
|
454 | 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
|
455 | { |
|
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 | 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
|
457 | 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
|
458 | 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
|
459 | 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
|
460 | 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
|
461 | 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
|
462 | 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
|
463 | 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
|
464 | |
|
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 | 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
|
466 | 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
|
467 | |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
468 | 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
|
469 | 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
|
470 | &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
|
471 | service = g_value_get_pointer(&val); |
|
32081
49f0be55b564
gtkdisco: Prevent a NULL dereference crash
Paul Aurich <darkrain42@pidgin.im>
parents:
31321
diff
changeset
|
472 | if (!service) |
|
49f0be55b564
gtkdisco: Prevent a NULL dereference crash
Paul Aurich <darkrain42@pidgin.im>
parents:
31321
diff
changeset
|
473 | 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
|
474 | |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
475 | 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
|
476 | 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
|
477 | 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
|
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_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
|
481 | 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
|
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_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
|
485 | 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
|
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_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
|
489 | 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
|
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_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
|
493 | 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
|
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_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
|
497 | 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
|
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 | 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
|
501 | 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
|
502 | 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
|
503 | } |
|
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 | |
|
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 | 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
|
506 | 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
|
507 | 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
|
508 | 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
|
509 | 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
|
510 | 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
|
511 | |
|
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 | 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
|
513 | 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
|
514 | 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
|
515 | 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
|
516 | 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
|
517 | 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
|
518 | |
|
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 | 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
|
520 | *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
|
521 | 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
|
522 | *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
|
523 | |
|
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 | 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
|
525 | 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
|
526 | 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
|
527 | 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
|
528 | |
|
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
|
529 | 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
|
530 | } |
|
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
|
531 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
532 | 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
|
533 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
534 | 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
|
535 | GtkTreeViewColumn *column; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
536 | GtkTreeSelection *selection; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
537 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
538 | 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
|
539 | 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
|
540 | 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
|
541 | 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
|
542 | 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
|
543 | ); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
544 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
545 | pdl->tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(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
|
546 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
547 | 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
|
548 | 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
|
549 | 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
|
550 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
551 | 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
|
552 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
553 | 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
|
554 | 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
|
555 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
556 | 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
|
557 | 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
|
558 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
559 | 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
|
560 | 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
|
561 | |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
562 | 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
|
563 | 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
|
564 | "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
|
565 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
566 | gtk_tree_view_column_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
|
567 | 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
|
568 | "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
|
569 | |
|
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_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
|
571 | 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
|
572 | 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
|
573 | 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
|
574 | 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
|
575 | 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
|
576 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
577 | 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
|
578 | "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
|
579 | 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
|
580 | 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
|
581 | 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
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
586 | 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
|
587 | 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
|
588 | 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
|
589 | |
|
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
|
590 | 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
|
591 | 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
|
592 | 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
|
593 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
594 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
595 | 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
|
596 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
597 | GList *node; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
598 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
599 | 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
|
600 | PidginDiscoDialog *dialog = node->data; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
601 | PidginDiscoList *list = dialog->discolist; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
602 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
603 | if (list && list->pc == pc) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
604 | if (list->in_progress) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
605 | 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
|
606 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
607 | if (list->tree) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
608 | gtk_widget_destroy(list->tree); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
609 | list->tree = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
610 | } |
|
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 | pidgin_disco_list_unref(list); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
613 | dialog->discolist = 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->browse_button, |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
616 | 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
|
617 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
618 | 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
|
619 | 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
|
620 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
621 | } |
|
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 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
624 | 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
|
625 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
626 | while (dialogs) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
627 | PidginDiscoDialog *dialog = dialogs->data; |
|
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 | gtk_widget_destroy(dialog->window); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
630 | /* 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
|
631 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
632 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
633 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
634 | 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
|
635 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
636 | PidginDiscoDialog *dialog; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
637 | 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
|
638 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
639 | 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
|
640 | 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
|
641 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
642 | /* 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
|
643 | 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
|
644 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
645 | 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
|
646 | 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
|
647 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
648 | /* 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
|
649 | 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
|
650 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34449
diff
changeset
|
651 | 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
|
652 | 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
|
653 | 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
|
654 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
655 | /* accounts dropdown list */ |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
656 | 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
|
657 | 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
|
658 | 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
|
659 | 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
|
660 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
661 | /* 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
|
662 | 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
|
663 | 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
|
664 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
665 | /* progress bar */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
666 | 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
|
667 | 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
|
668 | 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
|
669 | 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
|
670 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
671 | /* button box */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
672 | 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
|
673 | 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
|
674 | 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
|
675 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
676 | /* stop button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
677 | dialog->stop_button = |
|
39008
a705bd1673dd
gtkdisco: Port off of GtkStock
Mike Ruprecht <cmaiku@gmail.com>
parents:
38707
diff
changeset
|
678 | pidgin_dialog_add_button(GTK_DIALOG(window), _("_Stop"), |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
679 | 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
|
680 | 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
|
681 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
682 | /* browse button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
683 | dialog->browse_button = |
|
39008
a705bd1673dd
gtkdisco: Port off of GtkStock
Mike Ruprecht <cmaiku@gmail.com>
parents:
38707
diff
changeset
|
684 | pidgin_dialog_add_button(GTK_DIALOG(window), _("_Browse"), |
|
a705bd1673dd
gtkdisco: Port off of GtkStock
Mike Ruprecht <cmaiku@gmail.com>
parents:
38707
diff
changeset
|
685 | G_CALLBACK(browse_button_cb), dialog); |
|
27217
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); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
687 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
688 | /* register button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
689 | dialog->register_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
690 | 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
|
691 | 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
|
692 | 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
|
693 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
694 | /* add button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
695 | dialog->add_button = |
|
39008
a705bd1673dd
gtkdisco: Port off of GtkStock
Mike Ruprecht <cmaiku@gmail.com>
parents:
38707
diff
changeset
|
696 | pidgin_dialog_add_button(GTK_DIALOG(dialog->window), _("_Add"), |
|
a705bd1673dd
gtkdisco: Port off of GtkStock
Mike Ruprecht <cmaiku@gmail.com>
parents:
38707
diff
changeset
|
697 | 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
|
698 | 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
|
699 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
700 | /* close button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
701 | dialog->close_button = |
|
39008
a705bd1673dd
gtkdisco: Port off of GtkStock
Mike Ruprecht <cmaiku@gmail.com>
parents:
38707
diff
changeset
|
702 | pidgin_dialog_add_button(GTK_DIALOG(window), _("_Close"), |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
703 | 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
|
704 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
705 | /* 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
|
706 | 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
|
707 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
708 | return dialog; |
|
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 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
711 | 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
|
712 | { |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
713 | PidginDiscoDialog *dialog; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
714 | 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
|
715 | GdkPixbuf *pixbuf = NULL; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
716 | 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
|
717 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
718 | dialog = pdl->dialog; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
719 | 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
|
720 | |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
721 | 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
|
722 | 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
|
723 | else |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
724 | 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
|
725 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
726 | 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
|
727 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
728 | if (parent) { |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
729 | GtkTreeRowReference *rr; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
730 | GtkTreePath *path; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
731 | |
|
26925
c8a3e1885041
Rename pdl->cats to pdl->services, since these aren't roomlist categories
Paul Aurich <darkrain42@pidgin.im>
parents:
26919
diff
changeset
|
732 | 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
|
733 | 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
|
734 | 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
|
735 | 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
|
736 | gtk_tree_path_free(path); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
737 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
738 | 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
|
739 | &parent_iter)) { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
740 | PidginDiscoList *tmp; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
741 | 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
|
742 | SERVICE_COLUMN, &tmp, -1); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
743 | if (!tmp) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
744 | append = FALSE; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
745 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
746 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
747 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
748 | |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
749 | 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
|
750 | 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
|
751 | 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
|
752 | return; |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
753 | } |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
754 | |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
755 | if (append) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
756 | 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
|
757 | else |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
758 | iter = child; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
759 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
760 | 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
|
761 | GtkTreeRowReference *rr; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
762 | GtkTreePath *path; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
763 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
764 | 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
|
765 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
766 | 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
|
767 | 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
|
768 | 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
|
769 | gtk_tree_path_free(path); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
770 | } |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
771 | |
|
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
|
772 | 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
|
773 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
774 | 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
|
775 | PIXBUF_COLUMN, pixbuf, |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
776 | NAME_COLUMN, service->name, |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
777 | 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
|
778 | 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
|
779 | -1); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
780 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
781 | if (pixbuf) |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
782 | 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
|
783 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
784 |