Tue, 15 Sep 2020 21:54:10 -0500
Separate the AccountChooser from its model and move options to filters
Create a store for accounts and a filter to only show connected accounts
Update everything to use the new PidginAccountStore and PidginAccountFilterConnected filter
Add a GtkTreeModelFilter for protocols by id
Testing Done:
Compiled and opened most of the dialogs to make sure they're still working the same. Was unable to test gevolution.
Reviewed at https://reviews.imfreedom.org/r/95/
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
1 | /* pidgin |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
2 | * |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
3 | * 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
|
4 | * 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
|
5 | * source distribution. |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
6 | * |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
7 | * 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
|
8 | * 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
|
9 | * 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
|
10 | * (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
|
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 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
|
13 | * 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
|
14 | * 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
|
15 | * 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
|
16 | * |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
17 | * 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
|
18 | * 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
|
19 | * 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
|
20 | */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
21 | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
22 | #ifdef HAVE_CONFIG_H |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
23 | # include <config.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
24 | #endif |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
25 | |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
26 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
27 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
28 | #include <purple.h> |
|
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
29 | |
|
40502
875489636847
pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents:
40496
diff
changeset
|
30 | #include <pidgin.h> |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
31 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
32 | #include "gtkdisco.h" |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
33 | #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
|
34 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
35 | 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
|
36 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
37 | enum { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
38 | 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
|
39 | NAME_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
40 | DESCRIPTION_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
41 | SERVICE_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
42 | 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
|
43 | }; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
44 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
45 | static void |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
46 | 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
|
47 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
48 | 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
|
49 | 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
|
50 | list->dialog->discolist = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
51 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
52 | g_free((gchar*)list->server); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
53 | g_free(list); |
|
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 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
56 | 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
|
57 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
58 | 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
|
59 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
60 | ++list->ref; |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
61 | 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
|
62 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
63 | return list; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
64 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
65 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
66 | 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
|
67 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
68 | 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
|
69 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
70 | --list->ref; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
71 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
72 | 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
|
73 | if (list->ref == 0) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
74 | pidgin_disco_list_destroy(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 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
77 | 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
|
78 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
79 | PidginDiscoDialog *dialog = list->dialog; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
80 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
81 | if (!dialog) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
82 | return; |
|
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 | list->in_progress = in_progress; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
85 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
86 | if (in_progress) { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
87 | gtk_widget_set_sensitive(dialog->account_chooser, FALSE); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
88 | 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
|
89 | 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
|
90 | } else { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
91 | 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
|
92 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
93 | gtk_widget_set_sensitive(dialog->account_chooser, TRUE); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
94 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
95 | gtk_widget_set_sensitive(dialog->stop_button, 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->browse_button, TRUE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
97 | /* |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
98 | 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
|
99 | 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
|
100 | */ |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
101 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
102 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
103 | |
|
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
|
104 | 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
|
105 | 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
|
106 | { |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
107 | GdkPixbuf *pixbuf = NULL; |
|
27733
3e20246d57f2
Avoid a potentially uninitialized variable
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27399
diff
changeset
|
108 | char *filename = NULL; |
|
39037
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
109 | 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
|
110 | |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
111 | 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
|
112 | 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
|
113 | |
|
39037
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
114 | 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
|
115 | |
|
27399
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
116 | 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
|
117 | 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
|
118 | ".png", NULL); |
|
65ed0e8e8229
Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39037
diff
changeset
|
119 | |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
120 | 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
|
121 | "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
|
122 | 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
|
123 | g_free(tmp); |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
124 | #if 0 |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
125 | } else if (service->type == XMPP_DISCO_SERVICE_TYPE_USER) { |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
126 | 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
|
127 | "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
|
128 | #endif |
|
35850
1abeda205d6c
cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35526
diff
changeset
|
129 | } 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
|
130 | 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
|
131 | "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
|
132 | "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
|
133 | } |
|
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
|
134 | |
|
39037
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
135 | g_free(tmp_size); |
|
5014cd8d58e3
Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents:
39008
diff
changeset
|
136 | |
|
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
|
137 | 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
|
138 | 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
|
139 | 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
|
140 | } |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
141 | |
|
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 | 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
|
143 | } |
|
7f99a7d1f249
Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents:
27319
diff
changeset
|
144 | |
|
39787
af7ae86ee287
Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39786
diff
changeset
|
145 | static void |
|
af7ae86ee287
Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39786
diff
changeset
|
146 | dialog_select_account_cb(GtkWidget *chooser, 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
|
147 | { |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
148 | PurpleAccount *account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(chooser)); |
|
28704
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
28304
diff
changeset
|
149 | 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
|
150 | dialog->account = account; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
151 | 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
|
152 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
153 | if (change) { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
154 | g_clear_pointer(&dialog->discolist, pidgin_disco_list_unref); |
|
28704
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
28304
diff
changeset
|
155 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
156 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
157 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
158 | static void register_button_cb(GtkWidget *unused, PidginDiscoDialog *dialog) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
159 | { |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
160 | xmpp_disco_service_register(dialog->selected); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
161 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
162 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
163 | static void discolist_cancel_cb(PidginDiscoList *pdl, const char *server) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
164 | { |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
165 | pdl->dialog->prompt_handle = NULL; |
|
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
166 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
167 | pidgin_disco_list_set_in_progress(pdl, FALSE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
168 | pidgin_disco_list_unref(pdl); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
169 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
170 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
171 | static void discolist_ok_cb(PidginDiscoList *pdl, const char *server) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
172 | { |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
173 | pdl->dialog->prompt_handle = NULL; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
174 | gtk_widget_set_sensitive(pdl->dialog->browse_button, TRUE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
175 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
176 | if (!server || !*server) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
177 | purple_notify_error(my_plugin, _("Invalid Server"), _("Invalid Server"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
178 | 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
|
179 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
180 | pidgin_disco_list_set_in_progress(pdl, FALSE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
181 | pidgin_disco_list_unref(pdl); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
182 | return; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
183 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
184 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
185 | pdl->server = g_strdup(server); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
186 | pidgin_disco_list_set_in_progress(pdl, TRUE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
187 | xmpp_disco_start(pdl); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
188 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
189 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
190 | static void browse_button_cb(GtkWidget *button, PidginDiscoDialog *dialog) |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
191 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
192 | PurpleConnection *pc; |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
193 | PidginDiscoList *pdl; |
|
27218
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
194 | const char *username; |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
195 | const char *at, *slash; |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
196 | char *server = NULL; |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
197 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
198 | pc = purple_account_get_connection(dialog->account); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
199 | if (!pc) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
200 | return; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
201 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
202 | gtk_widget_set_sensitive(dialog->browse_button, FALSE); |
|
26926
7a52e5bbe52c
Don't leak the GObject data and disable the Add/Register buttons when browsing.
Paul Aurich <darkrain42@pidgin.im>
parents:
26925
diff
changeset
|
203 | gtk_widget_set_sensitive(dialog->add_button, FALSE); |
|
7a52e5bbe52c
Don't leak the GObject data and disable the Add/Register buttons when browsing.
Paul Aurich <darkrain42@pidgin.im>
parents:
26925
diff
changeset
|
204 | gtk_widget_set_sensitive(dialog->register_button, FALSE); |
|
7a52e5bbe52c
Don't leak the GObject data and disable the Add/Register buttons when browsing.
Paul Aurich <darkrain42@pidgin.im>
parents:
26925
diff
changeset
|
205 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
206 | g_clear_pointer(&dialog->discolist, pidgin_disco_list_unref); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
207 | gtk_tree_store_clear(dialog->model); |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
208 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
209 | 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
|
210 | 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
|
211 | (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
|
212 | 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
|
213 | /* We keep a copy... */ |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
214 | 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
|
215 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
216 | 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
|
217 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
218 | gtk_widget_set_sensitive(dialog->account_chooser, FALSE); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
219 | |
|
27218
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
220 | username = purple_account_get_username(dialog->account); |
| 29066 | 221 | at = strchr(username, '@'); |
| 222 | 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
|
223 | 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
|
224 | 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
|
225 | } 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
|
226 | 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
|
227 | } |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
228 | |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
229 | 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
|
230 | /* 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
|
231 | 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
|
232 | |
|
36135
b46d29bc9b35
Standardize the formatting we use to document hints for translators.
Mark Doliner <mark@kingant.net>
parents:
35850
diff
changeset
|
233 | /* 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
|
234 | 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
|
235 | 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
|
236 | _("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
|
237 | server, FALSE, FALSE, NULL, |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
238 | _("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
|
239 | _("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
|
240 | 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
|
241 | |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
242 | 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
|
243 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
244 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
245 | 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
|
246 | { |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
247 | 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
|
248 | 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
|
249 | 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
|
250 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
251 | 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
|
252 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
253 | account = purple_connection_get_account(service->list->pc); |
|
27316
4bcca82b93c1
merge of '898c56e61aa15d0978bf025f1d9a561c38372b03'
Elliott Sales de Andrade <qulogic@pidgin.im>
diff
changeset
|
254 | jid = service->jid; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
255 | |
|
27310
fd59f3923233
Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents:
27265
diff
changeset
|
256 | 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
|
257 | 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
|
258 | 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
|
259 | 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
|
260 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
261 | |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
262 | 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
|
263 | 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
|
264 | { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
265 | PidginDiscoDialog *dialog = user_data; |
|
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 | 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
|
267 | 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
|
268 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
269 | 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
|
270 | 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
|
271 | 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
|
272 | |
|
38705
62a7a975251a
Use gdk_event_triggers_context_menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38583
diff
changeset
|
273 | 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
|
274 | 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
|
275 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
276 | /* 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
|
277 | 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
|
278 | 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
|
279 | return FALSE; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
280 | gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path); |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
281 | 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
|
282 | val.g_type = 0; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
283 | gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
284 | SERVICE_COLUMN, &val); |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
285 | 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
|
286 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
287 | if (!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 | return FALSE; |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
289 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
290 | 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
|
291 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
292 | if (service->flags & XMPP_DISCO_ADD) { |
|
39008
a705bd1673dd
gtkdisco: Port off of GtkStock
Mike Ruprecht <cmaiku@gmail.com>
parents:
38707
diff
changeset
|
293 | pidgin_new_menu_item(menu, _("Add to Buddy List"), NULL, |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
294 | G_CALLBACK(add_to_blist_cb), dialog); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
295 | } |
|
27319
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
296 | |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
297 | if (service->flags & XMPP_DISCO_REGISTER) { |
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
298 | 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
|
299 | 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
|
300 | g_signal_connect(G_OBJECT(item), "activate", |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
301 | G_CALLBACK(register_button_cb), 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
|
302 | } |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
303 | |
|
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_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
|
305 | 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
|
306 | 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
|
307 | } |
|
f684f9ad6c79
Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents:
27318
diff
changeset
|
308 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
309 | static void |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
310 | selection_changed_cb(GtkTreeSelection *selection, 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
|
311 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
312 | GtkTreeIter iter; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
313 | GValue val; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
314 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
315 | 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
|
316 | val.g_type = 0; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
317 | gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
318 | SERVICE_COLUMN, &val); |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
319 | 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
|
320 | 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
|
321 | 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
|
322 | 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
|
323 | return; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
324 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
325 | |
|
27318
c3f7edff8506
Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents:
27317
diff
changeset
|
326 | 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
|
327 | 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
|
328 | } else { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
329 | 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
|
330 | 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
|
331 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
332 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
333 | |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
334 | static void |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
335 | 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
|
336 | gpointer user_data) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
337 | { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
338 | PidginDiscoDialog *dialog = user_data; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
339 | XmppDiscoService *service; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
340 | GValue val; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
341 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
342 | val.g_type = 0; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
343 | gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), arg1, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
344 | SERVICE_COLUMN, &val); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
345 | 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
|
346 | xmpp_disco_service_expand(service); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
347 | } |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
348 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
349 | 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
|
350 | 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
|
351 | 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
|
352 | 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
|
353 | 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
|
354 | { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
355 | PidginDiscoDialog *dialog = user_data; |
|
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
|
356 | 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
|
357 | 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
|
358 | 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
|
359 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
360 | if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
361 | path)) { |
|
27313
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
362 | return; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
363 | } |
|
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
|
364 | |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
365 | val.g_type = 0; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
366 | gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
367 | SERVICE_COLUMN, &val); |
|
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
|
368 | 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
|
369 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
370 | if (service->flags & XMPP_DISCO_BROWSE) { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
371 | if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(dialog->tree), |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
372 | path)) { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
373 | gtk_tree_view_collapse_row(GTK_TREE_VIEW(dialog->tree), |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
374 | path); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
375 | } else { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
376 | gtk_tree_view_expand_row(GTK_TREE_VIEW(dialog->tree), |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
377 | path, FALSE); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
378 | } |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
379 | } else if (service->flags & XMPP_DISCO_REGISTER) { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
380 | register_button_cb(NULL, dialog); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
381 | } else if (service->flags & XMPP_DISCO_ADD) { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
382 | add_to_blist_cb(NULL, dialog); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
383 | } |
|
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
|
384 | } |
|
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 | |
|
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 | static void |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
387 | destroy_win_cb(GtkWidget *window, G_GNUC_UNUSED gpointer data) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
388 | { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
389 | PidginDiscoDialog *dialog = PIDGIN_DISCO_DIALOG(window); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
390 | 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
|
391 | |
|
28839
16ed31feeabf
xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents:
28704
diff
changeset
|
392 | 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
|
393 | 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
|
394 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
395 | if (list) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
396 | 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
|
397 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
398 | if (list->in_progress) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
399 | 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
|
400 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
401 | 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
|
402 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
403 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
404 | dialogs = g_list_remove(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
|
405 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
406 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
407 | 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
|
408 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
409 | 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
|
410 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
411 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
412 | static void 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
|
413 | { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
414 | gtk_widget_destroy(GTK_WIDGET(dialog)); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
415 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
416 | |
|
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
|
417 | static gboolean |
|
33166
e97c8ef10fd2
Fix tooltip paint function parameters in gtkdisco plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33128
diff
changeset
|
418 | 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
|
419 | { |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
420 | 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
|
421 | 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
|
422 | 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
|
423 | 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
|
424 | 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
|
425 | } |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
426 | |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
427 | 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
|
428 | 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
|
429 | 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
|
430 | { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
431 | PidginDiscoDialog *dialog = data; |
|
27315
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
432 | 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
|
433 | 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
|
434 | 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
|
435 | 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
|
436 | 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
|
437 | 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
|
438 | 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
|
439 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
440 | if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
441 | path)) { |
|
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 | return FALSE; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
443 | } |
|
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 | val.g_type = 0; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
446 | gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
447 | SERVICE_COLUMN, &val); |
|
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
|
448 | service = g_value_get_pointer(&val); |
|
32081
49f0be55b564
gtkdisco: Prevent a NULL dereference crash
Paul Aurich <darkrain42@pidgin.im>
parents:
31321
diff
changeset
|
449 | if (!service) |
|
49f0be55b564
gtkdisco: Prevent a NULL dereference crash
Paul Aurich <darkrain42@pidgin.im>
parents:
31321
diff
changeset
|
450 | 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
|
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 | 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
|
453 | 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
|
454 | 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
|
455 | 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
|
456 | |
|
898c56e61aa1
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 | 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
|
458 | 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
|
459 | 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
|
460 | |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
461 | 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
|
462 | 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
|
463 | 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
|
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 | 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
|
466 | 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
|
467 | 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
|
468 | |
|
898c56e61aa1
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 | 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
|
470 | 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
|
471 | 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
|
472 | |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
473 | 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
|
474 | 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
|
475 | 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
|
476 | |
|
898c56e61aa1
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 | 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
|
478 | 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
|
479 | 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
|
480 | } |
|
898c56e61aa1
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 | |
|
898c56e61aa1
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 | 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
|
483 | 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
|
484 | 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
|
485 | 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
|
486 | 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
|
487 | 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
|
488 | |
|
898c56e61aa1
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 | 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
|
490 | 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
|
491 | 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
|
492 | 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
|
493 | 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
|
494 | 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
|
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 | 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
|
497 | *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
|
498 | 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
|
499 | *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
|
500 | |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
501 | 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
|
502 | 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
|
503 | 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
|
504 | 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
|
505 | |
|
898c56e61aa1
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 | 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
|
507 | } |
|
898c56e61aa1
Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27314
diff
changeset
|
508 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
509 | 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
|
510 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
511 | GList *node; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
512 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
513 | 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
|
514 | PidginDiscoDialog *dialog = node->data; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
515 | PidginDiscoList *list = dialog->discolist; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
516 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
517 | if (list && list->pc == pc) { |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
518 | PurpleAccount *account = NULL; |
|
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
519 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
520 | if (list->in_progress) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
521 | 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
|
522 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
523 | gtk_tree_store_clear(dialog->model); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
524 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
525 | pidgin_disco_list_unref(list); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
526 | dialog->discolist = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
527 | |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
528 | account = pidgin_account_chooser_get_selected( |
|
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
529 | PIDGIN_ACCOUNT_CHOOSER(dialog->account_chooser)); |
|
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
530 | |
|
39786
7800f52d0ae6
Rename pidgin_account_option_menu_* to pidgin_account_chooser_*.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39785
diff
changeset
|
531 | gtk_widget_set_sensitive( |
|
7800f52d0ae6
Rename pidgin_account_option_menu_* to pidgin_account_chooser_*.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39785
diff
changeset
|
532 | dialog->browse_button, |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
533 | account != NULL); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
534 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
535 | 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
|
536 | 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
|
537 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
538 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
539 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
540 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
541 | 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
|
542 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
543 | while (dialogs) { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
544 | GtkWidget *dialog = dialogs->data; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
545 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
546 | gtk_widget_destroy(dialog); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
547 | /* 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
|
548 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
549 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
550 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
551 | /****************************************************************************** |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
552 | * GObject implementation |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
553 | *****************************************************************************/ |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
554 | |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
555 | G_DEFINE_DYNAMIC_TYPE(PidginDiscoDialog, pidgin_disco_dialog, GTK_TYPE_DIALOG) |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
556 | |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
557 | static void |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
558 | pidgin_disco_dialog_class_init(PidginDiscoDialogClass *klass) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
559 | { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
560 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
561 | |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
562 | gtk_widget_class_set_template_from_resource( |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
563 | widget_class, "/im/pidgin/Pidgin/Plugin/XMPPDisco/disco.ui"); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
564 | |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
565 | gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
566 | account_chooser); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
567 | gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
568 | progress); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
569 | gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
570 | stop_button); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
571 | gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
572 | browse_button); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
573 | gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
574 | register_button); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
575 | gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
576 | add_button); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
577 | gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
578 | tree); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
579 | gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
580 | model); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
581 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
582 | gtk_widget_class_bind_template_callback(widget_class, destroy_win_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
583 | gtk_widget_class_bind_template_callback(widget_class, stop_button_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
584 | gtk_widget_class_bind_template_callback(widget_class, browse_button_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
585 | gtk_widget_class_bind_template_callback(widget_class, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
586 | register_button_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
587 | gtk_widget_class_bind_template_callback(widget_class, add_to_blist_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
588 | gtk_widget_class_bind_template_callback(widget_class, close_button_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
589 | gtk_widget_class_bind_template_callback(widget_class, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
590 | dialog_select_account_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
591 | gtk_widget_class_bind_template_callback(widget_class, row_activated_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
592 | gtk_widget_class_bind_template_callback(widget_class, row_expanded_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
593 | gtk_widget_class_bind_template_callback(widget_class, service_click_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
594 | gtk_widget_class_bind_template_callback(widget_class, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
595 | selection_changed_cb); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
596 | } |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
597 | |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
598 | static void |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
599 | pidgin_disco_dialog_class_finalize(PidginDiscoDialogClass *klass) |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
600 | { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
601 | } |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
602 | |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
603 | static void |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
604 | pidgin_disco_dialog_init(PidginDiscoDialog *dialog) |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
605 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
606 | 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
|
607 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
608 | gtk_widget_init_template(GTK_WIDGET(dialog)); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
609 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
610 | /* accounts dropdown list */ |
|
40534
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
611 | dialog->account = pidgin_account_chooser_get_selected( |
|
8dad2981fb86
Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
612 | PIDGIN_ACCOUNT_CHOOSER(dialog->account_chooser)); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
613 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
614 | /* browse button */ |
|
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, 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
|
616 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
617 | pidgin_tooltip_setup_for_treeview(GTK_WIDGET(dialog->tree), dialog, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
618 | disco_create_tooltip, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
619 | disco_paint_tooltip); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
620 | } |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
621 | |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
622 | /****************************************************************************** |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
623 | * Public API |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
624 | *****************************************************************************/ |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
625 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
626 | void |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
627 | pidgin_disco_dialog_register(PurplePlugin *plugin) |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
628 | { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
629 | pidgin_disco_dialog_register_type(G_TYPE_MODULE(plugin)); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
630 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
631 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
632 | PidginDiscoDialog * |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
633 | pidgin_disco_dialog_new(void) |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
634 | { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
635 | PidginDiscoDialog *dialog = |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
636 | g_object_new(PIDGIN_TYPE_DISCO_DIALOG, NULL); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
637 | gtk_widget_show_all(GTK_WIDGET(dialog)); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
638 | return dialog; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
639 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
640 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
641 | 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
|
642 | { |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
643 | PidginDiscoDialog *dialog; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
644 | 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
|
645 | GdkPixbuf *pixbuf = NULL; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
646 | 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
|
647 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
648 | dialog = pdl->dialog; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
649 | 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
|
650 | |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
651 | 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
|
652 | 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
|
653 | else |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
654 | 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
|
655 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
656 | 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
|
657 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
658 | if (parent) { |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
659 | GtkTreeRowReference *rr; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
660 | GtkTreePath *path; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
661 | |
|
26925
c8a3e1885041
Rename pdl->cats to pdl->services, since these aren't roomlist categories
Paul Aurich <darkrain42@pidgin.im>
parents:
26919
diff
changeset
|
662 | 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
|
663 | 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
|
664 | if (path) { |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
665 | gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
666 | &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
|
667 | gtk_tree_path_free(path); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
668 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
669 | if (gtk_tree_model_iter_children( |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
670 | GTK_TREE_MODEL(dialog->model), &child, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
671 | &parent_iter)) { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
672 | PidginDiscoList *tmp; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
673 | gtk_tree_model_get( |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
674 | GTK_TREE_MODEL(dialog->model), &child, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
675 | SERVICE_COLUMN, &tmp, -1); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
676 | if (!tmp) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
677 | append = FALSE; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
678 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
679 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
680 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
681 | |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
682 | 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
|
683 | if (parent != NULL && !append) |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
684 | gtk_tree_store_remove(dialog->model, &child); |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
685 | return; |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
686 | } |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
687 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
688 | if (append) { |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
689 | gtk_tree_store_append(dialog->model, &iter, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
690 | (parent ? &parent_iter : NULL)); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
691 | } else { |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
692 | iter = child; |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
693 | } |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
694 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
695 | 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
|
696 | GtkTreeRowReference *rr; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
697 | GtkTreePath *path; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
698 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
699 | gtk_tree_store_append(dialog->model, &child, &iter); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
700 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
701 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(dialog->model), |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
702 | &iter); |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
703 | rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(dialog->model), |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
704 | path); |
|
26925
c8a3e1885041
Rename pdl->cats to pdl->services, since these aren't roomlist categories
Paul Aurich <darkrain42@pidgin.im>
parents:
26919
diff
changeset
|
705 | 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
|
706 | gtk_tree_path_free(path); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
707 | } |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
708 | |
|
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
|
709 | 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
|
710 | |
|
39801
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
711 | gtk_tree_store_set(dialog->model, &iter, PIXBUF_COLUMN, pixbuf, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
712 | NAME_COLUMN, service->name, DESCRIPTION_COLUMN, |
|
2bbed8148402
Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39793
diff
changeset
|
713 | service->description, SERVICE_COLUMN, service, -1); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
714 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
715 | if (pixbuf) |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
716 | 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
|
717 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
718 |