pidgin/plugins/disco/gtkdisco.c

Tue, 30 Aug 2022 04:21:55 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 30 Aug 2022 04:21:55 -0500
changeset 41634
f73f2b9c75b4
parent 41562
bfd0330f09fb
child 41854
c1d7e7445b0f
permissions
-rw-r--r--

Do our best to set a transient parent for all of our dialogs

Testing Done:
Opened all of the dialogs and verified that the `GWarning` was no where to be found.

Reviewed at https://reviews.imfreedom.org/r/1698/

41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
1 /*
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
2 * Pidgin - Internet Messenger
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
26585
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 * 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
6 * 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
7 * source distribution.
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
8 *
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
9 * 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
10 * 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
11 * 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
12 * (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
13 *
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
14 * 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
15 * 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
16 * 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
17 * 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
18 *
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
26585
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
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
23 #ifdef HAVE_CONFIG_H
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
24 # include <config.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
25 #endif
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
26
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
27 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 40360
diff changeset
28
40360
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
29 #include <purple.h>
e21f3bbcc2a5 Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents: 40197
diff changeset
30
40502
875489636847 pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
31 #include <pidgin.h>
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
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 enum {
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
39 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
40 NAME_COLUMN,
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
41 DESCRIPTION_COLUMN,
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
42 SERVICE_COLUMN,
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
43 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
44 };
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
45
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
46 static PidginDiscoList *
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
47 pidgin_disco_list_new(void) {
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
48 return g_rc_box_new0(PidginDiscoList);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
49 }
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
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);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
55 if (list->dialog && list->dialog->discolist == list) {
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
56 list->dialog->discolist = NULL;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
57 }
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
58
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
59 g_free((gchar*)list->server);
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
60 }
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 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
63 {
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
64 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
65
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
66 purple_debug_misc("xmppdisco", "reffing list");
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
67 return g_rc_box_acquire(list);
27217
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
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
70 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
71 {
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
72 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
73
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
74 purple_debug_misc("xmppdisco", "unreffing list");
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
75 g_rc_box_release_full(list, (GDestroyNotify)pidgin_disco_list_destroy);
27217
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
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
78 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
79 {
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
80 PidginDiscoDialog *dialog = list->dialog;
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
81
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
82 if (!dialog) {
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
83 return;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
84 }
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
85
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
86 list->in_progress = in_progress;
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
87
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
88 if (in_progress) {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
89 gtk_widget_set_sensitive(dialog->account_chooser, FALSE);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
90 g_simple_action_set_enabled(dialog->stop_action, TRUE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
91 g_simple_action_set_enabled(dialog->browse_action, FALSE);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
92 } else {
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
93 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
94
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
95 gtk_widget_set_sensitive(dialog->account_chooser, TRUE);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
96
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
97 g_simple_action_set_enabled(dialog->stop_action, FALSE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
98 g_simple_action_set_enabled(dialog->browse_action, TRUE);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
99 /*
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
100 g_simple_action_set_enabled(dialog->register_action, FALSE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
101 g_simple_action_set_enabled(dialog->add_action, FALSE);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
102 */
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
103 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
104 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
105
27399
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
106 static GdkPixbuf *
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
107 pidgin_disco_load_icon(XmppDiscoService *service, const char *size)
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
108 {
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
109 GdkPixbuf *pixbuf = NULL;
27733
3e20246d57f2 Avoid a potentially uninitialized variable
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 27399
diff changeset
110 char *filename = NULL;
39037
5014cd8d58e3 Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39008
diff changeset
111 gchar *tmp_size;
27399
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
112
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
113 g_return_val_if_fail(service != NULL, NULL);
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
114 g_return_val_if_fail(size != NULL, NULL);
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
115
39037
5014cd8d58e3 Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39008
diff changeset
116 tmp_size = g_strdup_printf("%sx%s", size, size);
5014cd8d58e3 Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39008
diff changeset
117
27399
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
118 if (service->type == XMPP_DISCO_SERVICE_TYPE_GATEWAY && service->gateway_type) {
39040
65ed0e8e8229 Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39037
diff changeset
119 char *tmp = g_strconcat("im-", service->gateway_type,
65ed0e8e8229 Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39037
diff changeset
120 ".png", NULL);
65ed0e8e8229 Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39037
diff changeset
121
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35526
diff changeset
122 filename = g_build_filename(PURPLE_DATADIR,
39040
65ed0e8e8229 Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39037
diff changeset
123 "pidgin", "icons", "hicolor", tmp_size, "apps",
65ed0e8e8229 Move protocol icons to the apps icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39037
diff changeset
124 tmp, NULL);
27399
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
125 g_free(tmp);
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
126 #if 0
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
127 } else if (service->type == XMPP_DISCO_SERVICE_TYPE_USER) {
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35526
diff changeset
128 filename = g_build_filename(PURPLE_DATADIR,
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35526
diff changeset
129 "pixmaps", "pidgin", "status", size, "person.png", NULL);
27399
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
130 #endif
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35526
diff changeset
131 } else if (service->type == XMPP_DISCO_SERVICE_TYPE_CHAT) {
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35526
diff changeset
132 filename = g_build_filename(PURPLE_DATADIR,
39037
5014cd8d58e3 Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39008
diff changeset
133 "pidgin", "icons", "hicolor", tmp_size, "status",
5014cd8d58e3 Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39008
diff changeset
134 "chat.png", NULL);
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35526
diff changeset
135 }
27399
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
136
39037
5014cd8d58e3 Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39008
diff changeset
137 g_free(tmp_size);
5014cd8d58e3 Move status icons to the status icon theme specification directory
Mike Ruprecht <cmaiku@gmail.com>
parents: 39008
diff changeset
138
27399
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
139 if (filename) {
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
140 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
141 g_free(filename);
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
142 }
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
143
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
144 return pixbuf;
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
145 }
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
146
39787
af7ae86ee287 Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39786
diff changeset
147 static void
af7ae86ee287 Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39786
diff changeset
148 dialog_select_account_cb(GtkWidget *chooser, PidginDiscoDialog *dialog)
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
149 {
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
150 PurpleAccount *account = pidgin_account_chooser_get_selected(PIDGIN_ACCOUNT_CHOOSER(chooser));
28704
0c1d6f63740f When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents: 28304
diff changeset
151 gboolean change = (account != dialog->account);
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
152 dialog->account = account;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
153 g_simple_action_set_enabled(dialog->browse_action, account != NULL);
28704
0c1d6f63740f When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents: 28304
diff changeset
154
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
155 if (change) {
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
156 g_clear_pointer(&dialog->discolist, pidgin_disco_list_unref);
28704
0c1d6f63740f When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents: 28304
diff changeset
157 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
158 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
159
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
160 static void
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
161 activate_register(G_GNUC_UNUSED GSimpleAction *action,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
162 G_GNUC_UNUSED GVariant *parameter,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
163 gpointer data)
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
164 {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
165 PidginDiscoDialog *dialog = data;
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
166 XmppDiscoService *service = dialog->selected;
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
167
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
168 g_return_if_fail(service != NULL);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
169
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
170 xmpp_disco_service_register(service);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
171 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
172
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
173 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
174 {
28839
16ed31feeabf xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents: 28704
diff changeset
175 pdl->dialog->prompt_handle = NULL;
16ed31feeabf xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents: 28704
diff changeset
176
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
177 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
178 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
179 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
180
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
181 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
182 {
28839
16ed31feeabf xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents: 28704
diff changeset
183 pdl->dialog->prompt_handle = NULL;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
184 g_simple_action_set_enabled(pdl->dialog->browse_action, TRUE);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
185
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
186 if (!server || !*server) {
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
187 purple_notify_error(my_plugin, _("Invalid Server"), _("Invalid Server"),
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34329
diff changeset
188 NULL, purple_request_cpar_from_connection(pdl->pc));
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
189
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
190 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
191 pidgin_disco_list_unref(pdl);
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
192 return;
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
193 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
194
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
195 pdl->server = g_strdup(server);
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
196 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
197 xmpp_disco_start(pdl);
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
198 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
199
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
200 static void
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
201 activate_browse(G_GNUC_UNUSED GSimpleAction *action,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
202 G_GNUC_UNUSED GVariant *parameter,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
203 gpointer data)
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
204 {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
205 PidginDiscoDialog *dialog = data;
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
206 PurpleConnection *pc;
26590
689f6f3b4d8a Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents: 26588
diff changeset
207 PidginDiscoList *pdl;
27218
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
208 const char *username;
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
209 const char *at, *slash;
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
210 char *server = NULL;
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
211
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
212 pc = purple_account_get_connection(dialog->account);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
213 if (!pc) {
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
214 return;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
215 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
216
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
217 g_simple_action_set_enabled(dialog->browse_action, FALSE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
218 g_simple_action_set_enabled(dialog->add_action, FALSE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
219 g_simple_action_set_enabled(dialog->register_action, 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
220
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
221 g_clear_pointer(&dialog->discolist, pidgin_disco_list_unref);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
222 gtk_tree_store_clear(dialog->model);
26590
689f6f3b4d8a Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents: 26588
diff changeset
223
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
224 pdl = dialog->discolist = pidgin_disco_list_new();
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
225 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
226 (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
227 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
228 /* We keep a copy... */
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
229 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
230
26590
689f6f3b4d8a Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents: 26588
diff changeset
231 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
232
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
233 gtk_widget_set_sensitive(dialog->account_chooser, FALSE);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
234
27218
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
235 username = purple_account_get_username(dialog->account);
29066
Paul Aurich <darkrain42@pidgin.im>
parents: 29060
diff changeset
236 at = strchr(username, '@');
Paul Aurich <darkrain42@pidgin.im>
parents: 29060
diff changeset
237 slash = strchr(username, '/');
27218
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
238 if (at && !slash) {
40700
4c3ee00e6107 Replace g_strdup_printf("%s", string) with g_strdup(string)
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40534
diff changeset
239 server = g_strdup(at + 1);
27218
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
240 } 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
241 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
242 }
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
243
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
244 if (server == 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
245 /* 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
246 server = g_strdup("jabber.org");
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
247 }
27218
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
248
36135
b46d29bc9b35 Standardize the formatting we use to document hints for translators.
Mark Doliner <mark@kingant.net>
parents: 35850
diff changeset
249 /* Translators: The string "Enter an XMPP Server" is asking the user to
b46d29bc9b35 Standardize the formatting we use to document hints for translators.
Mark Doliner <mark@kingant.net>
parents: 35850
diff changeset
250 type the name of an XMPP server which will then be queried */
28839
16ed31feeabf xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents: 28704
diff changeset
251 dialog->prompt_handle = purple_request_input(my_plugin, _("Server name request"), _("Enter an XMPP Server"),
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
252 _("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
253 server, FALSE, FALSE, NULL,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41030
diff changeset
254 _("Find Services"), G_CALLBACK(discolist_ok_cb),
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41030
diff changeset
255 _("Cancel"), G_CALLBACK(discolist_cancel_cb),
34329
ddbc1337332c Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33271
diff changeset
256 purple_request_cpar_from_connection(pc), pdl);
27218
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
257
36968b1cde87 Remove debugging, use user's server as default, and avoid a GTK+ assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27217
diff changeset
258 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
259 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
260
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
261 static void
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
262 activate_add_to_blist(G_GNUC_UNUSED GSimpleAction *action,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
263 G_GNUC_UNUSED GVariant *parameter,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
264 gpointer data)
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
265 {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
266 PidginDiscoDialog *dialog = data;
27318
c3f7edff8506 Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents: 27317
diff changeset
267 XmppDiscoService *service = dialog->selected;
26588
644d7d7ad292 Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents: 26587
diff changeset
268 PurpleAccount *account;
27314
402d25ce01da Use the JID for adding a chat/buddy because the name is for descriptive
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27313
diff changeset
269 const char *jid;
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
270
27310
fd59f3923233 Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents: 27265
diff changeset
271 g_return_if_fail(service != NULL);
26588
644d7d7ad292 Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents: 26587
diff changeset
272
27310
fd59f3923233 Get rid of _menu_cb_info; pass around the XmppDiscoService*
Paul Aurich <darkrain42@pidgin.im>
parents: 27265
diff changeset
273 account = purple_connection_get_account(service->list->pc);
27316
4bcca82b93c1 merge of '898c56e61aa15d0978bf025f1d9a561c38372b03'
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27315 27311
diff changeset
274 jid = service->jid;
26588
644d7d7ad292 Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents: 26587
diff changeset
275
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
276 if (service->type == XMPP_DISCO_SERVICE_TYPE_CHAT) {
27314
402d25ce01da Use the JID for adding a chat/buddy because the name is for descriptive
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27313
diff changeset
277 purple_blist_request_add_chat(account, NULL, NULL, jid);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
278 } else {
27314
402d25ce01da Use the JID for adding a chat/buddy because the name is for descriptive
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27313
diff changeset
279 purple_blist_request_add_buddy(account, jid, NULL, NULL);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
280 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
281 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
282
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
283 static gboolean
41562
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
284 service_click_cb(G_GNUC_UNUSED GtkGestureClick *click,
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
285 G_GNUC_UNUSED gint n_press,
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
286 gdouble x, gdouble y, gpointer data)
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
287 {
41562
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
288 PidginDiscoDialog *dialog = data;
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
289 XmppDiscoService *service;
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
290
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
291 GtkTreePath *path;
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
292 GtkTreeIter iter;
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
293 GValue val;
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
294
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
295 GdkRectangle rect;
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
296
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
297 /* Figure out what was clicked */
41562
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
298 if (!gtk_tree_view_get_path_at_pos(dialog->tree, (gint)x, (gint)y, &path,
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
299 NULL, NULL, NULL))
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
300 {
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
301 return FALSE;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
302 }
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
303 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path);
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
304 gtk_tree_path_free(path);
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
305 val.g_type = 0;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
306 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
307 SERVICE_COLUMN, &val);
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
308 service = g_value_get_pointer(&val);
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
309
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
310 if (!service) {
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
311 return FALSE;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
312 }
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
313
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
314 gtk_tree_view_convert_bin_window_to_widget_coords(dialog->tree,
41562
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
315 (gint)x, (gint)y,
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
316 &rect.x, &rect.y);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
317 rect.width = rect.height = 1;
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
318
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
319 gtk_popover_set_pointing_to(GTK_POPOVER(dialog->popover), &rect);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
320 gtk_popover_popup(GTK_POPOVER(dialog->popover));
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
321
27319
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
322 return FALSE;
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
323 }
f684f9ad6c79 Add a context menu with actions and re-arrange so registration takes preference
Paul Aurich <darkrain42@pidgin.im>
parents: 27318
diff changeset
324
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
325 static void
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
326 selection_changed_cb(GtkTreeSelection *selection, PidginDiscoDialog *dialog)
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
327 {
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
328 GtkTreeIter iter;
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
329 GValue val;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
330 gboolean allow_add = FALSE, allow_register = FALSE;
26585
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 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
333 val.g_type = 0;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
334 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
335 SERVICE_COLUMN, &val);
27318
c3f7edff8506 Store the currently selected service in the Dialog structure
Paul Aurich <darkrain42@pidgin.im>
parents: 27317
diff changeset
336 dialog->selected = g_value_get_pointer(&val);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
337 if (dialog->selected != NULL) {
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
338 allow_add = (dialog->selected->flags & XMPP_DISCO_ADD);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
339 allow_register = (dialog->selected->flags & XMPP_DISCO_REGISTER);
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
340 }
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
341 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
342
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
343 g_simple_action_set_enabled(dialog->add_action, allow_add);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
344 g_simple_action_set_enabled(dialog->register_action, allow_register);
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
345 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
346
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
347 static void
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
348 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
349 gpointer user_data)
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
350 {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
351 PidginDiscoDialog *dialog = user_data;
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
352 XmppDiscoService *service;
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
353 GValue val;
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
354
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
355 val.g_type = 0;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
356 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), arg1,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
357 SERVICE_COLUMN, &val);
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
358 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
359 xmpp_disco_service_expand(service);
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
360 }
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
361
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
362 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
363 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
364 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
365 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
366 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
367 {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
368 PidginDiscoDialog *dialog = user_data;
27313
957f9af1de2a Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27312
diff changeset
369 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
370 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
371 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
372
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
373 if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path)) {
27313
957f9af1de2a Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27312
diff changeset
374 return;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
375 }
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
376
957f9af1de2a Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27312
diff changeset
377 val.g_type = 0;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
378 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
379 SERVICE_COLUMN, &val);
27313
957f9af1de2a Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27312
diff changeset
380 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
381
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
382 if (service->flags & XMPP_DISCO_BROWSE) {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
383 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(dialog->tree), path)) {
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
384 gtk_tree_view_collapse_row(GTK_TREE_VIEW(dialog->tree), path);
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
385 } else {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
386 gtk_tree_view_expand_row(GTK_TREE_VIEW(dialog->tree), path, FALSE);
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
387 }
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
388 } else if (service->flags & XMPP_DISCO_REGISTER) {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
389 g_action_activate(G_ACTION(dialog->register_action), NULL);
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
390 } else if (service->flags & XMPP_DISCO_ADD) {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
391 g_action_activate(G_ACTION(dialog->add_action), NULL);
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
392 }
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
393 }
957f9af1de2a Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27312
diff changeset
394
957f9af1de2a Add a row-activated callback for the XMPP Disco browser that provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27312
diff changeset
395 static void
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
396 destroy_win_cb(GtkWidget *window, G_GNUC_UNUSED gpointer data)
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
397 {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
398 PidginDiscoDialog *dialog = PIDGIN_DISCO_DIALOG(window);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
399 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
400
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
401 if (dialog->prompt_handle) {
28839
16ed31feeabf xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents: 28704
diff changeset
402 purple_request_close(PURPLE_REQUEST_INPUT, dialog->prompt_handle);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
403 }
28839
16ed31feeabf xmppdisco: Close the input request when closing the dialog. Fixes a crash.
Paul Aurich <darkrain42@pidgin.im>
parents: 28704
diff changeset
404
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
405 if (list) {
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
406 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
407
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
408 if (list->in_progress) {
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
409 list->in_progress = FALSE;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
410 }
26590
689f6f3b4d8a Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents: 26588
diff changeset
411
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
412 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
413 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
414
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
415 dialogs = g_list_remove(dialogs, dialog);
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
416 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
417
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
418 static void
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
419 activate_stop(G_GNUC_UNUSED GSimpleAction *action,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
420 G_GNUC_UNUSED GVariant *parameter,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
421 gpointer data)
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
422 {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
423 PidginDiscoDialog *dialog = data;
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
424
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
425 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
426 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
427
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
428 static gboolean
40946
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
429 disco_query_tooltip(GtkWidget *widget, int x, int y, gboolean keyboard_mode,
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
430 GtkTooltip *tooltip, gpointer data)
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
431 {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
432 PidginDiscoDialog *dialog = data;
40946
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
433 GtkTreePath *path = NULL;
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
434 GtkTreeIter iter;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
435 XmppDiscoService *service;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
436 GValue val;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
437 const char *type = NULL;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
438 char *markup, *jid, *name, *desc = NULL;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
439
40946
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
440 if (keyboard_mode) {
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
441 GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
442 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) {
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
443 return FALSE;
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
444 }
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
445 path = gtk_tree_model_get_path(GTK_TREE_MODEL(dialog->model), &iter);
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
446 } else {
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
447 gint bx, by;
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
448
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
449 gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(widget),
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
450 x, y, &bx, &by);
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
451 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bx, by, &path,
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
452 NULL, NULL, NULL);
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
453 if (path == NULL) {
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
454 return FALSE;
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
455 }
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
456
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
457 if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path)) {
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
458 gtk_tree_path_free(path);
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
459 return FALSE;
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
460 }
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
461 }
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
462
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
463 val.g_type = 0;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
464 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
465 SERVICE_COLUMN, &val);
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
466 service = g_value_get_pointer(&val);
40946
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
467 if (!service) {
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
468 gtk_tree_path_free(path);
32081
49f0be55b564 gtkdisco: Prevent a NULL dereference crash
Paul Aurich <darkrain42@pidgin.im>
parents: 31321
diff changeset
469 return FALSE;
40946
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
470 }
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
471
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
472 switch (service->type) {
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
473 case XMPP_DISCO_SERVICE_TYPE_UNSET:
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
474 type = _("Unknown");
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
475 break;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
476
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
477 case XMPP_DISCO_SERVICE_TYPE_GATEWAY:
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
478 type = _("Gateway");
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
479 break;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
480
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
481 case XMPP_DISCO_SERVICE_TYPE_DIRECTORY:
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
482 type = _("Directory");
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
483 break;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
484
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
485 case XMPP_DISCO_SERVICE_TYPE_CHAT:
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
486 type = _("Chat");
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
487 break;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
488
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
489 case XMPP_DISCO_SERVICE_TYPE_PUBSUB_COLLECTION:
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
490 type = _("PubSub Collection");
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
491 break;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
492
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
493 case XMPP_DISCO_SERVICE_TYPE_PUBSUB_LEAF:
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
494 type = _("PubSub Leaf");
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
495 break;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
496
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
497 case XMPP_DISCO_SERVICE_TYPE_OTHER:
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
498 type = _("Other");
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
499 break;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
500 }
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
501
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
502 name = g_markup_escape_text(service->name, -1);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
503 jid = g_markup_escape_text(service->jid, -1);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
504 if (service->description != NULL) {
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
505 desc = g_markup_escape_text(service->description, -1);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
506 }
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
507
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
508 markup = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>\n<b>%s:</b> %s%s%s",
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
509 name, type, jid,
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
510 service->description ? _("\n<b>Description:</b> ") : "",
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
511 service->description ? desc : "");
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
512
40946
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
513 gtk_tooltip_set_markup(tooltip, markup);
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
514 gtk_tree_view_set_tooltip_row(GTK_TREE_VIEW(widget), tooltip, path);
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
515
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
516 g_free(markup);
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
517 g_free(jid);
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
518 g_free(name);
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
519 g_free(desc);
40946
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
520 gtk_tree_path_free(path);
27315
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
521
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
522 return TRUE;
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
523 }
898c56e61aa1 Add a tooltip to the XMPP Disco browser. Someone should probably fill this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27314
diff changeset
524
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
525 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
526 {
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
527 GList *node;
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
528
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
529 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
530 PidginDiscoDialog *dialog = node->data;
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
531 PidginDiscoList *list = dialog->discolist;
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
532
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
533 if (list && list->pc == pc) {
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
534 PurpleAccount *account = NULL;
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
535
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
536 if (list->in_progress) {
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
537 pidgin_disco_list_set_in_progress(list, FALSE);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
538 }
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
539
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
540 gtk_tree_store_clear(dialog->model);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
541
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
542 pidgin_disco_list_unref(list);
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
543 dialog->discolist = NULL;
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
544
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
545 account = pidgin_account_chooser_get_selected(
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
546 PIDGIN_ACCOUNT_CHOOSER(dialog->account_chooser));
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
547
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
548 g_simple_action_set_enabled(dialog->browse_action, account != NULL);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
549 g_simple_action_set_enabled(dialog->add_action, FALSE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
550 g_simple_action_set_enabled(dialog->register_action, FALSE);
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
551 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
552 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
553 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
554
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
555 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
556 {
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
557 while (dialogs) {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
558 GtkWidget *dialog = dialogs->data;
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
559
41562
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
560 gtk_window_destroy(GTK_WINDOW(dialog));
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
561 /* 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
562 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
563 }
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
564
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
565 /******************************************************************************
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
566 * GObject implementation
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
567 *****************************************************************************/
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
568
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
569 G_DEFINE_DYNAMIC_TYPE(PidginDiscoDialog, pidgin_disco_dialog, GTK_TYPE_DIALOG)
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
570
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
571 static void
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
572 pidgin_disco_dialog_class_init(PidginDiscoDialogClass *klass)
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
573 {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
574 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
575
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
576 gtk_widget_class_set_template_from_resource(
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 40946
diff changeset
577 widget_class, "/im/pidgin/Pidgin3/Plugin/XMPPDisco/disco.ui");
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
578
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
579 gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
580 account_chooser);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
581 gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
582 progress);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
583 gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
584 tree);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
585 gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
586 model);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
587 gtk_widget_class_bind_template_child(widget_class, PidginDiscoDialog,
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
588 popover);
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
589
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
590 gtk_widget_class_bind_template_callback(widget_class, destroy_win_cb);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
591 gtk_widget_class_bind_template_callback(widget_class,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
592 dialog_select_account_cb);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
593 gtk_widget_class_bind_template_callback(widget_class, row_activated_cb);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
594 gtk_widget_class_bind_template_callback(widget_class, row_expanded_cb);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
595 gtk_widget_class_bind_template_callback(widget_class, service_click_cb);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
596 gtk_widget_class_bind_template_callback(widget_class,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
597 selection_changed_cb);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
598 }
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
599
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
600 static void
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
601 pidgin_disco_dialog_class_finalize(PidginDiscoDialogClass *klass)
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
602 {
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
603 }
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
604
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
605 static void
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
606 pidgin_disco_dialog_init(PidginDiscoDialog *dialog)
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
607 {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
608 GActionEntry entries[] = {
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
609 { .name = "stop", .activate = activate_stop },
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
610 { .name = "browse", .activate = activate_browse },
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
611 { .name = "register", .activate = activate_register },
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
612 { .name = "add", .activate = activate_add_to_blist },
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
613 };
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
614 GSimpleActionGroup *action_group = NULL;
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
615 GActionMap *action_map = NULL;
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
616
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
617 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
618
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
619 gtk_widget_init_template(GTK_WIDGET(dialog));
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
620
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
621 /* accounts dropdown list */
40534
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
622 dialog->account = pidgin_account_chooser_get_selected(
8dad2981fb86 Separate the AccountChooser from its model and move options to filters
Gary Kramlich <grim@reaperworld.com>
parents: 40502
diff changeset
623 PIDGIN_ACCOUNT_CHOOSER(dialog->account_chooser));
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
624
40946
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
625 gtk_widget_set_has_tooltip(GTK_WIDGET(dialog->tree), TRUE);
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
626 g_signal_connect(G_OBJECT(dialog->tree), "query-tooltip",
f3bb3efca77b Use standard tooltips in XMPP Service Discovery plugin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40944
diff changeset
627 G_CALLBACK(disco_query_tooltip), dialog);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
628
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
629 action_group = g_simple_action_group_new();
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
630 action_map = G_ACTION_MAP(action_group);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
631 g_action_map_add_action_entries(action_map, entries, G_N_ELEMENTS(entries),
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
632 dialog);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
633
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
634 dialog->stop_action = G_SIMPLE_ACTION(
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
635 g_action_map_lookup_action(action_map, "stop"));
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
636 g_simple_action_set_enabled(dialog->stop_action, FALSE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
637
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
638 dialog->browse_action = G_SIMPLE_ACTION(
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
639 g_action_map_lookup_action(action_map, "browse"));
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
640 g_simple_action_set_enabled(dialog->browse_action, dialog->account != NULL);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
641
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
642 dialog->register_action = G_SIMPLE_ACTION(
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
643 g_action_map_lookup_action(action_map, "register"));
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
644 g_simple_action_set_enabled(dialog->register_action, FALSE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
645
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
646 dialog->add_action = G_SIMPLE_ACTION(
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
647 g_action_map_lookup_action(action_map, "add"));
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
648 g_simple_action_set_enabled(dialog->add_action, FALSE);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
649
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
650 gtk_widget_insert_action_group(GTK_WIDGET(dialog), "disco",
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
651 G_ACTION_GROUP(action_group));
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
652 }
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
653
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
654 /******************************************************************************
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
655 * Public API
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
656 *****************************************************************************/
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
657
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
658 void
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
659 pidgin_disco_dialog_register(PurplePlugin *plugin)
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
660 {
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
661 pidgin_disco_dialog_register_type(G_TYPE_MODULE(plugin));
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
662 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
663
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
664 PidginDiscoDialog *
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
665 pidgin_disco_dialog_new(void)
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
666 {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
667 PidginDiscoDialog *dialog = g_object_new(PIDGIN_TYPE_DISCO_DIALOG, NULL);
41562
bfd0330f09fb Port XMPP Service Discovery plugin to GTK4
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41499
diff changeset
668 gtk_widget_show(GTK_WIDGET(dialog));
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
669 return dialog;
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
670 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
671
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
672 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
673 {
26588
644d7d7ad292 Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents: 26587
diff changeset
674 PidginDiscoDialog *dialog;
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
675 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
676 GdkPixbuf *pixbuf = NULL;
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
677 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
678
26590
689f6f3b4d8a Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <darkrain42@pidgin.im>
parents: 26588
diff changeset
679 dialog = pdl->dialog;
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
680 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
681
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
682 if (service != NULL) {
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
683 purple_debug_info("xmppdisco", "Adding service \"%s\"", service->name);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
684 } else {
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
685 purple_debug_info("xmppdisco", "Service \"%s\" has no children",
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
686 parent->name);
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
687 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
688
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
689 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
690
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
691 if (parent) {
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
692 GtkTreeRowReference *rr;
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
693 GtkTreePath *path;
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
694
26925
c8a3e1885041 Rename pdl->cats to pdl->services, since these aren't roomlist categories
Paul Aurich <darkrain42@pidgin.im>
parents: 26919
diff changeset
695 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
696 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
697 if (path) {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
698 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model),
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
699 &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
700 gtk_tree_path_free(path);
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
701
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
702 if (gtk_tree_model_iter_children(
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
703 GTK_TREE_MODEL(dialog->model), &child,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
704 &parent_iter)) {
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
705 PidginDiscoList *tmp;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
706 gtk_tree_model_get(
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
707 GTK_TREE_MODEL(dialog->model), &child,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
708 SERVICE_COLUMN, &tmp, -1);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
709 if (!tmp) {
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
710 append = FALSE;
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
711 }
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
712 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
713 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
714 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
715
27222
9daa676e9244 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents: 27218
diff changeset
716 if (service == NULL) {
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
717 if (parent != NULL && !append) {
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
718 gtk_tree_store_remove(dialog->model, &child);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
719 }
27222
9daa676e9244 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents: 27218
diff changeset
720 return;
9daa676e9244 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents: 27218
diff changeset
721 }
9daa676e9244 Remove the pseudo-row child of expandable services if there are no children.
Paul Aurich <darkrain42@pidgin.im>
parents: 27218
diff changeset
722
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
723 if (append) {
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
724 gtk_tree_store_append(dialog->model, &iter,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
725 (parent ? &parent_iter : NULL));
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
726 } else {
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
727 iter = child;
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
728 }
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
729
27217
7509acac49de Convert the disco browser to a plugin. Refs #556
Paul Aurich <darkrain42@pidgin.im>
parents: 26926
diff changeset
730 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
731 GtkTreeRowReference *rr;
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
732 GtkTreePath *path;
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
733
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
734 gtk_tree_store_append(dialog->model, &child, &iter);
26919
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
735
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
736 path = gtk_tree_model_get_path(GTK_TREE_MODEL(dialog->model),
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
737 &iter);
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
738 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(dialog->model),
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
739 path);
26925
c8a3e1885041 Rename pdl->cats to pdl->services, since these aren't roomlist categories
Paul Aurich <darkrain42@pidgin.im>
parents: 26919
diff changeset
740 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
741 gtk_tree_path_free(path);
1be739ada7cd Handle expanding disco lists on the UI side
Paul Aurich <darkrain42@pidgin.im>
parents: 26596
diff changeset
742 }
26588
644d7d7ad292 Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <darkrain42@pidgin.im>
parents: 26587
diff changeset
743
27399
7f99a7d1f249 Abstract an "image loading function" (will be used for the tooltip in a sec)
Paul Aurich <darkrain42@pidgin.im>
parents: 27319
diff changeset
744 pixbuf = pidgin_disco_load_icon(service, "16");
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
745
39801
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
746 gtk_tree_store_set(dialog->model, &iter, PIXBUF_COLUMN, pixbuf,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
747 NAME_COLUMN, service->name, DESCRIPTION_COLUMN,
2bbed8148402 Convert Service Discovery plugin to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39793
diff changeset
748 service->description, SERVICE_COLUMN, service, -1);
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
749
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
750 if (pixbuf) {
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
751 g_object_unref(pixbuf);
41499
a80a41434f44 Modernize XMPP discovery plugin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41314
diff changeset
752 }
26585
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
753 }
11eaedca43b4 Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <darkrain42@pidgin.im>
parents:
diff changeset
754

mercurial