Sun, 07 Jun 2009 22:12:26 +0000
Add a row-activated callback for the XMPP Disco browser that provides a
default action for each row. Browseable services expand/collapse, services
with ADD flag open the add dialog, and services with the REGISTER flag will
open the register dialog (in that order).
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
2 | * @file gtkdisco.c GTK+ Service Discovery UI |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
3 | * @ingroup pidgin |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
4 | */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
5 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
6 | /* pidgin |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
7 | * |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
10 | * source distribution. |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
11 | * |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
12 | * This program is free software; you can redistribute it and/or modify |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
13 | * it under the terms of the GNU General Public License as published by |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
14 | * the Free Software Foundation; either version 2 of the License, or |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
15 | * (at your option) any later version. |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
16 | * |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
17 | * This program is distributed in the hope that it will be useful, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
20 | * GNU General Public License for more details. |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
21 | * |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
22 | * You should have received a copy of the GNU General Public License |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
23 | * along with this program; if not, write to the Free Software |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
25 | */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
26 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
27 | #include "internal.h" |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
28 | #include "debug.h" |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
29 | #include "gtkutils.h" |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
30 | #include "pidgin.h" |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
31 | #include "request.h" |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
32 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
33 | #include "gtkdisco.h" |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
34 | #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
|
35 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
36 | 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
|
37 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
38 | struct _menu_cb_info { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
39 | PidginDiscoList *list; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
40 | XmppDiscoService *service; |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
41 | }; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
42 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
43 | enum { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
44 | 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
|
45 | NAME_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
46 | DESCRIPTION_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
47 | SERVICE_COLUMN, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
48 | 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
|
49 | }; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
50 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
51 | static void |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
52 | 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
|
53 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
54 | 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
|
55 | 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
|
56 | list->dialog->discolist = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
57 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
58 | if (list->tree) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
59 | gtk_widget_destroy(list->tree); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
60 | list->tree = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
61 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
62 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
63 | g_free((gchar*)list->server); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
64 | g_free(list); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
65 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
66 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
67 | 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
|
68 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
69 | 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
|
70 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
71 | ++list->ref; |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
72 | 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
|
73 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
74 | return 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_unref(PidginDiscoList *list) |
|
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 | 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
|
80 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
81 | --list->ref; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
82 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
83 | 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
|
84 | if (list->ref == 0) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
85 | pidgin_disco_list_destroy(list); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
86 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
87 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
88 | 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
|
89 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
90 | PidginDiscoDialog *dialog = list->dialog; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
91 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
92 | if (!dialog) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
93 | return; |
|
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 | list->in_progress = in_progress; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
96 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
97 | if (in_progress) { |
|
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->account_widget, 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->stop_button, TRUE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
100 | gtk_widget_set_sensitive(dialog->browse_button, FALSE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
101 | } else { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
102 | 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
|
103 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
104 | gtk_widget_set_sensitive(dialog->account_widget, TRUE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
105 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
106 | gtk_widget_set_sensitive(dialog->stop_button, FALSE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
107 | gtk_widget_set_sensitive(dialog->browse_button, TRUE); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
108 | /* |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
109 | 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
|
110 | 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
|
111 | */ |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
112 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
113 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
114 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
115 | static void pidgin_disco_create_tree(PidginDiscoList *pdl); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
116 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
117 | static void dialog_select_account_cb(GObject *w, PurpleAccount *account, |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
118 | 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
|
119 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
120 | dialog->account = account; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
121 | gtk_widget_set_sensitive(dialog->browse_button, 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
|
122 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
123 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
124 | static void register_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
|
125 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
126 | struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "disco-info"); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
127 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
128 | xmpp_disco_service_register(info->service); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
129 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
130 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
131 | 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
|
132 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
133 | 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
|
134 | 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
|
135 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
136 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
137 | 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
|
138 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
139 | 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
|
140 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
141 | if (!server || !*server) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
142 | purple_notify_error(my_plugin, _("Invalid Server"), _("Invalid Server"), |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
143 | NULL); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
144 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
145 | 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
|
146 | pidgin_disco_list_unref(pdl); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
147 | return; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
148 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
149 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
150 | pdl->server = g_strdup(server); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
151 | 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
|
152 | xmpp_disco_start(pdl); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
153 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
154 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
155 | static void browse_button_cb(GtkButton *button, PidginDiscoDialog *dialog) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
156 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
157 | 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
|
158 | 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
|
159 | 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
|
160 | 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
|
161 | 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
|
162 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
163 | 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
|
164 | 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
|
165 | return; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
166 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
167 | 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
|
168 | 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
|
169 | 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
|
170 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
171 | if (dialog->discolist != NULL) { |
|
27218
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
172 | if (dialog->discolist->tree) { |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
173 | gtk_widget_destroy(dialog->discolist->tree); |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
174 | dialog->discolist->tree = NULL; |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
175 | } |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
176 | pidgin_disco_list_unref(dialog->discolist); |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
177 | } |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
178 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
179 | 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
|
180 | 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
|
181 | (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
|
182 | 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
|
183 | /* We keep a copy... */ |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
184 | 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
|
185 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
186 | 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
|
187 | pidgin_disco_create_tree(pdl); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
188 | |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
189 | if (dialog->account_widget) |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
190 | gtk_widget_set_sensitive(dialog->account_widget, FALSE); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
191 | |
|
27218
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
192 | username = purple_account_get_username(dialog->account); |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
193 | at = g_utf8_strchr(username, -1, '@'); |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
194 | slash = g_utf8_strchr(username, -1, '/'); |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
195 | 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
|
196 | 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
|
197 | } 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
|
198 | 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
|
199 | } |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
200 | |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
201 | 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
|
202 | /* 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
|
203 | 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
|
204 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
205 | purple_request_input(my_plugin, _("Server name request"), _("Enter an XMPP Server"), |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
206 | _("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
|
207 | server, FALSE, FALSE, NULL, |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
208 | _("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
|
209 | _("Cancel"), PURPLE_CALLBACK(discolist_cancel_cb), |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
210 | purple_connection_get_account(pc), NULL, NULL, pdl); |
|
27218
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
211 | |
|
36968b1cde87
Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents:
27217
diff
changeset
|
212 | 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
|
213 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
214 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
215 | static void add_room_to_blist_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
|
216 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
217 | struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "disco-info"); |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
218 | PurpleAccount *account; |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
219 | const char *name; |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
220 | |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
221 | g_return_if_fail(info != NULL); |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
222 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
223 | account = purple_connection_get_account(info->list->pc); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
224 | name = info->service->name; |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
225 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
226 | if (info->service->type == XMPP_DISCO_SERVICE_TYPE_CHAT) |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
227 | purple_blist_request_add_chat(account, NULL, NULL, name); |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
228 | else |
|
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
229 | purple_blist_request_add_buddy(account, name, 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
|
230 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
231 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
232 | static void |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
233 | selection_changed_cb(GtkTreeSelection *selection, PidginDiscoList *pdl) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
234 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
235 | XmppDiscoService *service; |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
236 | GtkTreeIter iter; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
237 | GValue val; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
238 | static struct _menu_cb_info *info; |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
239 | PidginDiscoDialog *dialog = pdl->dialog; |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
240 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
241 | 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
|
242 | val.g_type = 0; |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
243 | gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN, &val); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
244 | service = g_value_get_pointer(&val); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
245 | if (!service) { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
246 | 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
|
247 | 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
|
248 | return; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
249 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
250 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
251 | info = g_new0(struct _menu_cb_info, 1); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
252 | info->list = dialog->discolist; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
253 | info->service = service; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
254 | |
|
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
|
255 | g_object_set_data_full(G_OBJECT(dialog->add_button), "disco-info", |
|
7a52e5bbe52c
Don't leak the GObject data and disable the Add/Register buttons when browsing.
Paul Aurich <darkrain42@pidgin.im>
parents:
26925
diff
changeset
|
256 | info, g_free); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
257 | g_object_set_data(G_OBJECT(dialog->register_button), "disco-info", info); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
258 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
259 | gtk_widget_set_sensitive(dialog->add_button, service->flags & XMPP_DISCO_ADD); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
260 | gtk_widget_set_sensitive(dialog->register_button, service->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
|
261 | } else { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
262 | 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
|
263 | 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
|
264 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
265 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
266 | |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
267 | static void |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
268 | 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
|
269 | gpointer user_data) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
270 | { |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
271 | PidginDiscoList *pdl; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
272 | XmppDiscoService *service; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
273 | GValue val; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
274 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
275 | pdl = user_data; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
276 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
277 | val.g_type = 0; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
278 | gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), arg1, SERVICE_COLUMN, |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
279 | &val); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
280 | 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
|
281 | xmpp_disco_service_expand(service); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
282 | } |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
283 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
284 | 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
|
285 | 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
|
286 | 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
|
287 | 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
|
288 | 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
|
289 | { |
|
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
|
290 | PidginDiscoList *pdl = user_data; |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
291 | 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
|
292 | 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
|
293 | 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
|
294 | |
|
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
|
295 | if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(pdl->model), &iter, path)) |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
296 | return; |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
297 | |
|
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
|
298 | val.g_type = 0; |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
299 | gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN, |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
300 | &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
|
301 | 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
|
302 | |
|
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
|
303 | if (service->flags & XMPP_DISCO_BROWSE) |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
304 | if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(pdl->tree), path)) |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
305 | gtk_tree_view_collapse_row(GTK_TREE_VIEW(pdl->tree), path); |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
306 | else |
|
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
307 | gtk_tree_view_expand_row(GTK_TREE_VIEW(pdl->tree), path, FALSE); |
|
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
|
308 | else if (service->flags & XMPP_DISCO_ADD) |
|
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
|
309 | add_room_to_blist_cb(GTK_BUTTON(pdl->dialog->add_button), pdl->dialog); |
|
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
|
310 | else if (service->flags & XMPP_DISCO_REGISTER) |
|
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
|
311 | register_button_cb(GTK_BUTTON(pdl->dialog->register_button), pdl->dialog); |
|
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
|
312 | } |
|
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
|
313 | |
|
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
|
314 | static void |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
315 | destroy_win_cb(GtkWidget *window, gpointer d) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
316 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
317 | PidginDiscoDialog *dialog = d; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
318 | 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
|
319 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
320 | if (list) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
321 | 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
|
322 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
323 | if (list->in_progress) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
324 | 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
|
325 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
326 | 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
|
327 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
328 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
329 | dialogs = g_list_remove(dialogs, d); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
330 | g_free(dialog); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
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 | 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
|
334 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
335 | 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
|
336 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
337 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
338 | 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
|
339 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
340 | GtkWidget *window = dialog->window; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
341 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
342 | gtk_widget_destroy(window); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
343 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
344 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
345 | static gboolean account_filter_func(PurpleAccount *account) |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
346 | { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
347 | return purple_strequal(purple_account_get_protocol_id(account), XMPP_PLUGIN_ID); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
348 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
349 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
350 | static void pidgin_disco_create_tree(PidginDiscoList *pdl) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
351 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
352 | GtkCellRenderer *text_renderer, *pixbuf_renderer; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
353 | GtkTreeViewColumn *column; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
354 | GtkTreeSelection *selection; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
355 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
356 | pdl->model = gtk_tree_store_new(NUM_OF_COLUMNS, |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
357 | GDK_TYPE_PIXBUF, /* PIXBUF_COLUMN */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
358 | G_TYPE_STRING, /* NAME_COLUMN */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
359 | G_TYPE_STRING, /* DESCRIPTION_COLUMN */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
360 | G_TYPE_POINTER /* SERVICE_COLUMN */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
361 | ); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
362 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
363 | pdl->tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdl->model)); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
364 | gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(pdl->tree), TRUE); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
365 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
366 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pdl->tree)); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
367 | g_signal_connect(G_OBJECT(selection), "changed", |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
368 | G_CALLBACK(selection_changed_cb), pdl); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
369 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
370 | g_object_unref(pdl->model); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
371 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
372 | gtk_container_add(GTK_CONTAINER(pdl->dialog->sw), pdl->tree); |
|
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
373 | gtk_widget_show(pdl->tree); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
374 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
375 | text_renderer = gtk_cell_renderer_text_new(); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
376 | pixbuf_renderer = gtk_cell_renderer_pixbuf_new(); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
377 | |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
378 | column = gtk_tree_view_column_new(); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
379 | gtk_tree_view_column_set_title(column, _("Name")); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
380 | |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
381 | gtk_tree_view_column_pack_start(column, pixbuf_renderer, FALSE); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
382 | gtk_tree_view_column_set_attributes(column, pixbuf_renderer, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
383 | "pixbuf", PIXBUF_COLUMN, NULL); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
384 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
385 | gtk_tree_view_column_pack_start(column, text_renderer, TRUE); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
386 | gtk_tree_view_column_set_attributes(column, text_renderer, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
387 | "text", NAME_COLUMN, NULL); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
388 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
389 | gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
390 | GTK_TREE_VIEW_COLUMN_GROW_ONLY); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
391 | gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
392 | gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), NAME_COLUMN); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
393 | gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
394 | gtk_tree_view_append_column(GTK_TREE_VIEW(pdl->tree), column); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
395 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
396 | column = gtk_tree_view_column_new_with_attributes(_("Description"), text_renderer, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
397 | "text", DESCRIPTION_COLUMN, NULL); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
398 | gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
399 | GTK_TREE_VIEW_COLUMN_GROW_ONLY); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
400 | gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
401 | gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), DESCRIPTION_COLUMN); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
402 | gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
403 | gtk_tree_view_append_column(GTK_TREE_VIEW(pdl->tree), column); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
404 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
405 | g_signal_connect(G_OBJECT(pdl->tree), "row-expanded", G_CALLBACK(row_expanded_cb), pdl); |
|
27313
957f9af1de2a
Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27312
diff
changeset
|
406 | g_signal_connect(G_OBJECT(pdl->tree), "row-activated", G_CALLBACK(row_activated_cb), pdl); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
407 | } |
|
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 | 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
|
410 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
411 | GList *node; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
412 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
413 | 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
|
414 | PidginDiscoDialog *dialog = node->data; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
415 | PidginDiscoList *list = dialog->discolist; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
416 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
417 | if (list && list->pc == pc) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
418 | if (list->in_progress) |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
419 | 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
|
420 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
421 | if (list->tree) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
422 | gtk_widget_destroy(list->tree); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
423 | list->tree = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
424 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
425 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
426 | pidgin_disco_list_unref(list); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
427 | dialog->discolist = NULL; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
428 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
429 | gtk_widget_set_sensitive(dialog->browse_button, |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
430 | pidgin_account_option_menu_get_selected(dialog->account_widget) != NULL); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
431 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
432 | 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
|
433 | 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
|
434 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
435 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
436 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
437 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
438 | 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
|
439 | { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
440 | while (dialogs) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
441 | PidginDiscoDialog *dialog = dialogs->data; |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
442 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
443 | gtk_widget_destroy(dialog->window); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
444 | /* 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
|
445 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
446 | } |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
447 | |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
448 | PidginDiscoDialog *pidgin_disco_dialog_new(void) |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
449 | { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
450 | PidginDiscoDialog *dialog; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
451 | GtkWidget *window, *vbox, *vbox2, *bbox; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
452 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
453 | dialog = g_new0(PidginDiscoDialog, 1); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
454 | 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
|
455 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
456 | /* Create the window. */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
457 | dialog->window = window = pidgin_create_dialog(_("Service Discovery"), PIDGIN_HIG_BORDER, "service discovery", TRUE); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
458 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
459 | g_signal_connect(G_OBJECT(window), "destroy", |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
460 | G_CALLBACK(destroy_win_cb), dialog); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
461 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
462 | /* Create the parent vbox for everything. */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
463 | vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(window), FALSE, PIDGIN_HIG_BORDER); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
464 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
465 | vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
466 | gtk_container_add(GTK_CONTAINER(vbox), vbox2); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
467 | gtk_widget_show(vbox2); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
468 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
469 | /* accounts dropdown list */ |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
470 | dialog->account_widget = pidgin_account_option_menu_new(NULL, FALSE, |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
471 | G_CALLBACK(dialog_select_account_cb), account_filter_func, dialog); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
472 | dialog->account = pidgin_account_option_menu_get_selected(dialog->account_widget); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
473 | pidgin_add_widget_to_vbox(GTK_BOX(vbox2), _("_Account:"), NULL, dialog->account_widget, TRUE, NULL); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
474 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
475 | /* scrolled window */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
476 | dialog->sw = gtk_scrolled_window_new(NULL, NULL); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
477 | gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(dialog->sw), |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
478 | GTK_SHADOW_IN); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
479 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dialog->sw), |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
480 | GTK_POLICY_AUTOMATIC, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
481 | GTK_POLICY_AUTOMATIC); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
482 | gtk_box_pack_start(GTK_BOX(vbox2), dialog->sw, TRUE, TRUE, 0); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
483 | gtk_widget_set_size_request(dialog->sw, -1, 250); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
484 | gtk_widget_show(dialog->sw); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
485 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
486 | /* progress bar */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
487 | dialog->progress = gtk_progress_bar_new(); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
488 | gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(dialog->progress), 0.1); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
489 | gtk_box_pack_start(GTK_BOX(vbox2), dialog->progress, FALSE, FALSE, 0); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
490 | gtk_widget_show(dialog->progress); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
491 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
492 | /* button box */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
493 | bbox = pidgin_dialog_get_action_area(GTK_DIALOG(window)); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
494 | gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
495 | gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
496 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
497 | /* stop button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
498 | dialog->stop_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
499 | pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP, |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
500 | G_CALLBACK(stop_button_cb), dialog); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
501 | gtk_widget_set_sensitive(dialog->stop_button, FALSE); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
502 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
503 | /* browse button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
504 | dialog->browse_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
505 | pidgin_pixbuf_button_from_stock(_("_Browse"), GTK_STOCK_REFRESH, |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
506 | PIDGIN_BUTTON_HORIZONTAL); |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
507 | gtk_box_pack_start(GTK_BOX(bbox), dialog->browse_button, FALSE, FALSE, 0); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
508 | g_signal_connect(G_OBJECT(dialog->browse_button), "clicked", |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
509 | G_CALLBACK(browse_button_cb), dialog); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
510 | gtk_widget_set_sensitive(dialog->browse_button, dialog->account != NULL); |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
511 | gtk_widget_show(dialog->browse_button); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
512 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
513 | /* register button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
514 | dialog->register_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
515 | pidgin_dialog_add_button(GTK_DIALOG(dialog->window), _("Register"), |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
516 | G_CALLBACK(register_button_cb), dialog); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
517 | 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
|
518 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
519 | /* add button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
520 | dialog->add_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
521 | pidgin_pixbuf_button_from_stock(_("_Add"), GTK_STOCK_ADD, |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
522 | PIDGIN_BUTTON_HORIZONTAL); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
523 | gtk_box_pack_start(GTK_BOX(bbox), dialog->add_button, FALSE, FALSE, 0); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
524 | g_signal_connect(G_OBJECT(dialog->add_button), "clicked", |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
525 | G_CALLBACK(add_room_to_blist_cb), dialog); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
526 | 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
|
527 | gtk_widget_show(dialog->add_button); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
528 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
529 | /* close button */ |
|
27312
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
530 | dialog->close_button = |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
531 | pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, |
|
07a772783c0f
Make this whitespace a bit more consistent (I hope).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27265
diff
changeset
|
532 | G_CALLBACK(close_button_cb), dialog); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
533 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
534 | /* show the dialog window and return the dialog */ |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
535 | gtk_widget_show(dialog->window); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
536 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
537 | return dialog; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
538 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
539 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
540 | 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
|
541 | { |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
542 | PidginDiscoDialog *dialog; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
543 | 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
|
544 | char *filename = NULL; |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
545 | GdkPixbuf *pixbuf = NULL; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
546 | 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
|
547 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
548 | dialog = pdl->dialog; |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
549 | 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
|
550 | |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
551 | 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
|
552 | 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
|
553 | else |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
554 | 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
|
555 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
556 | 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
|
557 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
558 | if (parent) { |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
559 | GtkTreeRowReference *rr; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
560 | GtkTreePath *path; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
561 | |
|
26925
c8a3e1885041
Rename pdl->cats to pdl->services, since these aren't roomlist categories
Paul Aurich <darkrain42@pidgin.im>
parents:
26919
diff
changeset
|
562 | 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
|
563 | 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
|
564 | if (path) { |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
565 | gtk_tree_model_get_iter(GTK_TREE_MODEL(pdl->model), &parent_iter, path); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
566 | gtk_tree_path_free(path); |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
567 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
568 | if (gtk_tree_model_iter_children(GTK_TREE_MODEL(pdl->model), &child, |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
569 | &parent_iter)) { |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
570 | PidginDiscoList *tmp; |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
571 | gtk_tree_model_get(GTK_TREE_MODEL(pdl->model), &child, |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
572 | SERVICE_COLUMN, &tmp, -1); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
573 | if (!tmp) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
574 | append = FALSE; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
575 | } |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
576 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
577 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
578 | |
|
27222
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
579 | 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
|
580 | if (parent != NULL && !append) |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
581 | gtk_tree_store_remove(pdl->model, &child); |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
582 | return; |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
583 | } |
|
9daa676e9244
Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents:
27218
diff
changeset
|
584 | |
|
26919
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
585 | if (append) |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
586 | gtk_tree_store_append(pdl->model, &iter, (parent ? &parent_iter : NULL)); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
587 | else |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
588 | iter = child; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
589 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
590 | 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
|
591 | GtkTreeRowReference *rr; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
592 | GtkTreePath *path; |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
593 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
594 | gtk_tree_store_append(pdl->model, &child, &iter); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
595 | |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
596 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(pdl->model), &iter); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
597 | rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(pdl->model), path); |
|
26925
c8a3e1885041
Rename pdl->cats to pdl->services, since these aren't roomlist categories
Paul Aurich <darkrain42@pidgin.im>
parents:
26919
diff
changeset
|
598 | 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
|
599 | gtk_tree_path_free(path); |
|
1be739ada7cd
Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents:
26596
diff
changeset
|
600 | } |
|
26588
644d7d7ad292
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents:
26587
diff
changeset
|
601 | |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
602 | if (service->type == XMPP_DISCO_SERVICE_TYPE_GATEWAY && service->gateway_type) { |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
603 | char *tmp = g_strconcat(service->gateway_type, ".png", NULL); |
|
27265
d8e2fcfc3ebc
Use 16px icons in the XMPP disco browser as 22px seems a bit weird.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27222
diff
changeset
|
604 | filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "16", tmp, NULL); |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26590
diff
changeset
|
605 | g_free(tmp); |
|
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26590
diff
changeset
|
606 | #if 0 |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
607 | } else if (service->type == XMPP_DISCO_SERVICE_TYPE_USER) { |
|
27265
d8e2fcfc3ebc
Use 16px icons in the XMPP disco browser as 22px seems a bit weird.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27222
diff
changeset
|
608 | filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "16", "person.png", NULL); |
|
26596
d44a3a6a3046
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <darkrain42@pidgin.im>
parents:
26590
diff
changeset
|
609 | #endif |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
610 | } else if (service->type == XMPP_DISCO_SERVICE_TYPE_CHAT) |
|
27265
d8e2fcfc3ebc
Use 16px icons in the XMPP disco browser as 22px seems a bit weird.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27222
diff
changeset
|
611 | filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "16", "chat.png", NULL); |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
612 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
613 | if (filename) { |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
614 | pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
615 | g_free(filename); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
616 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
617 | |
|
26590
689f6f3b4d8a
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents:
26588
diff
changeset
|
618 | gtk_tree_store_set(pdl->model, &iter, |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
619 | PIXBUF_COLUMN, pixbuf, |
|
27217
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
620 | NAME_COLUMN, service->name, |
|
7509acac49de
Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents:
26926
diff
changeset
|
621 | DESCRIPTION_COLUMN, service->description, |
|
26585
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
622 | SERVICE_COLUMN, service, |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
623 | -1); |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
624 | |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
625 | if (pixbuf) |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
626 | 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
|
627 | } |
|
11eaedca43b4
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff
changeset
|
628 |