annotate pidgin/gtkdisco.c @ 26690:9fb8d8d9783a

Move the handling of chat rooms to jabber_disco_service_items_cb. This saves us from (needlessly) disco#info'ing the conference server once per chat, which adds up when you're testing against jabber.org.
author Paul Aurich <paul@darkrain42.org>
date Wed, 15 Apr 2009 04:38:28 +0000
parents 1009214ba476
children ba9876c35a5b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1 /**
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
2 * @file gtkdisco.c GTK+ Service Discovery UI
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
3 * @ingroup pidgin
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
4 */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
5
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
6 /* pidgin
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
7 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
10 * source distribution.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
11 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
15 * (at your option) any later version.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
16 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
20 * GNU General Public License for more details.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
21 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
25 */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
26
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
27 #include "internal.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
28 #include "pidgin.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
29 #include "gtkutils.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
30 #include "debug.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
31 #include "disco.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
32
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
33 #include "gtkdisco.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
34
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
35 typedef struct _PidginDiscoDialog {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
36 GtkWidget *window;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
37 GtkWidget *account_widget;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
38
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
39 GtkWidget *sw;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
40 GtkWidget *progress;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
41
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
42 GtkWidget *stop_button;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
43 GtkWidget *list_button;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
44 GtkWidget *register_button;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
45 GtkWidget *add_button;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
46 GtkWidget *close_button;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
47
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
48 PurpleAccount *account;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
49 PurpleDiscoList *discolist;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
50 } PidginDiscoDialog;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
51
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
52 typedef struct _PidginDiscoList {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
53 PidginDiscoDialog *dialog;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
54 GtkTreeStore *model;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
55 GtkWidget *tree;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
56 GHashTable *cats; /** Meow. */
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
57 } PidginDiscoList;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
58
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
59 struct _menu_cb_info {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
60 PurpleDiscoList *list;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
61 PurpleDiscoService *service;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
62 };
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
63
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
64 enum {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
65 PIXBUF_COLUMN = 0,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
66 NAME_COLUMN,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
67 DESCRIPTION_COLUMN,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
68 SERVICE_COLUMN,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
69 NUM_OF_COLUMNS
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
70 };
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
71
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
72 static void pidgin_disco_create_tree(PidginDiscoList *pdl);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
73
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
74 static void dialog_select_account_cb(GObject *w, PurpleAccount *account,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
75 PidginDiscoDialog *dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
76 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
77 dialog->account = account;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
78 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
79
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
80 static void register_button_cb(GtkButton *button, PidginDiscoDialog *dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
81 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
82 struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "disco-info");
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
83 PurpleAccount *account;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
84 PurpleConnection *gc;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
85
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
86 account = purple_disco_list_get_account(info->list);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
87 gc = purple_account_get_connection(account);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
88
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
89 purple_disco_service_register(info->service);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
90 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
91
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
92 static void list_button_cb(GtkButton *button, PidginDiscoDialog *dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
93 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
94 PurpleConnection *gc;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
95 PidginDiscoList *pdl;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
96
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
97 gc = purple_account_get_connection(dialog->account);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
98 if (!gc)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
99 return;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
100
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
101 if (dialog->discolist != NULL) {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
102 pdl = purple_disco_list_get_ui_data(dialog->discolist);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
103 gtk_widget_destroy(pdl->tree);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
104 purple_disco_list_unref(dialog->discolist);
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
105 }
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
106
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
107 dialog->discolist = purple_disco_get_list(gc);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
108 if (!dialog->discolist)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
109 return;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
110 /* We keep a copy... */
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
111 purple_disco_list_ref(dialog->discolist);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
112
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
113 pdl = purple_disco_list_get_ui_data(dialog->discolist);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
114 pdl->dialog = dialog;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
115
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
116 pidgin_disco_create_tree(pdl);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
117
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
118 if (dialog->account_widget)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
119 gtk_widget_set_sensitive(dialog->account_widget, FALSE);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
120 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
121
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
122 static void add_room_to_blist_cb(GtkButton *button, PidginDiscoDialog *dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
123 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
124 struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "disco-info");
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
125 PurpleAccount *account;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
126 const char *name;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
127
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
128 g_return_if_fail(info != NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
129
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
130 account = purple_disco_list_get_account(info->list);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
131 name = purple_disco_service_get_name(info->service);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
132
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
133 if (purple_disco_service_get_type(info->service) == PURPLE_DISCO_SERVICE_TYPE_CHAT)
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
134 purple_blist_request_add_chat(account, NULL, NULL, name);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
135 else
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
136 purple_blist_request_add_buddy(account, name, NULL, NULL);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
137 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
138
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
139 static void
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
140 selection_changed_cb(GtkTreeSelection *selection, PidginDiscoList *pdl)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
141 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
142 PurpleDiscoService *service;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
143 PurpleDiscoServiceFlags flags;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
144 GtkTreeIter iter;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
145 GValue val;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
146 static struct _menu_cb_info *info;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
147 PidginDiscoDialog *dialog = pdl->dialog;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
148
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
149 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
150 val.g_type = 0;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
151 gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), &iter, SERVICE_COLUMN, &val);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
152 service = g_value_get_pointer(&val);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
153 if (!service) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
154 gtk_widget_set_sensitive(dialog->add_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
155 gtk_widget_set_sensitive(dialog->register_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
156 return;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
157 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
158
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
159 info = g_new0(struct _menu_cb_info, 1);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
160 info->list = dialog->discolist;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
161 info->service = service;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
162
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
163 g_object_set_data(G_OBJECT(dialog->add_button), "disco-info", info);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
164 g_object_set_data(G_OBJECT(dialog->register_button), "disco-info", info);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
165
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
166 flags = purple_disco_service_get_flags(service);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
167
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
168 gtk_widget_set_sensitive(dialog->add_button, flags & PURPLE_DISCO_ADD);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
169 gtk_widget_set_sensitive(dialog->register_button, flags & PURPLE_DISCO_REGISTER);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
170 } else {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
171 gtk_widget_set_sensitive(dialog->add_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
172 gtk_widget_set_sensitive(dialog->register_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
173 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
174 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
175
26689
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
176 static void
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
177 row_expanded_cb(GtkTreeView *tree, GtkTreeIter *arg1, GtkTreePath *rg2,
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
178 gpointer user_data)
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
179 {
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
180 PidginDiscoList *pdl;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
181 PurpleDiscoService *service;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
182 GValue val;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
183
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
184 pdl = user_data;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
185
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
186 val.g_type = 0;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
187 gtk_tree_model_get_value(GTK_TREE_MODEL(pdl->model), arg1, SERVICE_COLUMN,
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
188 &val);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
189 service = g_value_get_pointer(&val);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
190 purple_disco_service_expand(service);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
191 }
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
192
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
193 static gint
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
194 delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
195 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
196 PidginDiscoDialog *dialog = d;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
197
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
198 if (dialog->discolist && purple_disco_list_get_in_progress(dialog->discolist))
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
199 purple_disco_cancel_get_list(dialog->discolist);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
200
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
201 if (dialog->discolist) {
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
202 PidginDiscoList *pdl = purple_disco_list_get_ui_data(dialog->discolist);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
203
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
204 if (pdl)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
205 pdl->dialog = NULL;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
206 purple_disco_list_unref(dialog->discolist);
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
207 }
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
208
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
209 g_free(dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
210
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
211 return FALSE;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
212 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
213
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
214 static void stop_button_cb(GtkButton *button, PidginDiscoDialog *dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
215 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
216 purple_disco_cancel_get_list(dialog->discolist);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
217
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
218 if (dialog->account_widget)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
219 gtk_widget_set_sensitive(dialog->account_widget, TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
220
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
221 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
222 gtk_widget_set_sensitive(dialog->list_button, TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
223 gtk_widget_set_sensitive(dialog->add_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
224 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
225
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
226 static void close_button_cb(GtkButton *button, PidginDiscoDialog *dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
227 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
228 GtkWidget *window = dialog->window;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
229
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
230 delete_win_cb(NULL, NULL, dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
231 gtk_widget_destroy(window);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
232 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
233
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
234 static gboolean account_filter_func(PurpleAccount *account)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
235 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
236 PurpleConnection *conn = purple_account_get_connection(account);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
237 PurplePluginProtocolInfo *prpl_info = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
238
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
239 if (conn)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
240 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(conn->prpl);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
241
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
242 return (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, disco_get_list));
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
243 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
244
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
245 gboolean
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
246 pidgin_disco_is_showable()
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
247 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
248 GList *c;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
249 PurpleConnection *gc;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
250
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
251 for (c = purple_connections_get_all(); c != NULL; c = c->next) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
252 gc = c->data;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
253
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
254 if (account_filter_func(purple_connection_get_account(gc)))
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
255 return TRUE;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
256 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
257
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
258 return FALSE;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
259 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
260
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
261 static void pidgin_disco_create_tree(PidginDiscoList *pdl)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
262 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
263 GtkCellRenderer *text_renderer, *pixbuf_renderer;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
264 GtkTreeViewColumn *column;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
265 GtkTreeSelection *selection;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
266
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
267 pdl->model = gtk_tree_store_new(NUM_OF_COLUMNS,
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
268 GDK_TYPE_PIXBUF, /* PIXBUF_COLUMN */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
269 G_TYPE_STRING, /* NAME_COLUMN */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
270 G_TYPE_STRING, /* DESCRIPTION_COLUMN */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
271 G_TYPE_POINTER /* SERVICE_COLUMN */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
272 );
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
273
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
274 pdl->tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pdl->model));
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
275 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(pdl->tree), TRUE);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
276
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
277 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pdl->tree));
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
278 g_signal_connect(G_OBJECT(selection), "changed",
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
279 G_CALLBACK(selection_changed_cb), pdl);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
280
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
281 g_object_unref(pdl->model);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
282
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
283 gtk_container_add(GTK_CONTAINER(pdl->dialog->sw), pdl->tree);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
284 gtk_widget_show(pdl->tree);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
285
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
286 text_renderer = gtk_cell_renderer_text_new();
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
287 pixbuf_renderer = gtk_cell_renderer_pixbuf_new();
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
288
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
289 column = gtk_tree_view_column_new();
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
290 gtk_tree_view_column_set_title(column, _("Name"));
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
291
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
292 gtk_tree_view_column_pack_start(column, pixbuf_renderer, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
293 gtk_tree_view_column_set_attributes(column, pixbuf_renderer,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
294 "pixbuf", PIXBUF_COLUMN, NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
295
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
296 gtk_tree_view_column_pack_start(column, text_renderer, TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
297 gtk_tree_view_column_set_attributes(column, text_renderer,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
298 "text", NAME_COLUMN, NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
299
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
300 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
301 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
302 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
303 gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), NAME_COLUMN);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
304 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
305 gtk_tree_view_append_column(GTK_TREE_VIEW(pdl->tree), column);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
306
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
307 column = gtk_tree_view_column_new_with_attributes(_("Description"), text_renderer,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
308 "text", DESCRIPTION_COLUMN, NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
309 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
310 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
311 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
312 gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), DESCRIPTION_COLUMN);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
313 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
314 gtk_tree_view_append_column(GTK_TREE_VIEW(pdl->tree), column);
26689
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
315
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
316 g_signal_connect(G_OBJECT(pdl->tree), "row-expanded", G_CALLBACK(row_expanded_cb), pdl);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
317 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
318
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
319 static PidginDiscoDialog*
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
320 pidgin_disco_dialog_new_with_account(PurpleAccount *account)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
321 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
322 PidginDiscoDialog *dialog;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
323 GtkWidget *window, *vbox, *vbox2, *bbox;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
324
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
325 dialog = g_new0(PidginDiscoDialog, 1);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
326 dialog->account = account;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
327
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
328 /* Create the window. */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
329 dialog->window = window = pidgin_create_dialog(_("Service Discovery"), PIDGIN_HIG_BORDER, "service discovery", TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
330
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
331 g_signal_connect(G_OBJECT(window), "delete_event",
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
332 G_CALLBACK(delete_win_cb), dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
333
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
334 /* Create the parent vbox for everything. */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
335 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(window), FALSE, PIDGIN_HIG_BORDER);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
336
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
337 vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
338 gtk_container_add(GTK_CONTAINER(vbox), vbox2);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
339 gtk_widget_show(vbox2);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
340
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
341 /* accounts dropdown list */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
342 dialog->account_widget = pidgin_account_option_menu_new(dialog->account, FALSE,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
343 G_CALLBACK(dialog_select_account_cb), account_filter_func, dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
344 if (!dialog->account) /* this is normally null, and we normally don't care what the first selected item is */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
345 dialog->account = pidgin_account_option_menu_get_selected(dialog->account_widget);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
346 pidgin_add_widget_to_vbox(GTK_BOX(vbox2), _("_Account:"), NULL, dialog->account_widget, TRUE, NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
347
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
348 /* scrolled window */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
349 dialog->sw = gtk_scrolled_window_new(NULL, NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
350 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(dialog->sw),
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
351 GTK_SHADOW_IN);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
352 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dialog->sw),
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
353 GTK_POLICY_AUTOMATIC,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
354 GTK_POLICY_AUTOMATIC);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
355 gtk_box_pack_start(GTK_BOX(vbox2), dialog->sw, TRUE, TRUE, 0);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
356 gtk_widget_set_size_request(dialog->sw, -1, 250);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
357 gtk_widget_show(dialog->sw);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
358
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
359 /* progress bar */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
360 dialog->progress = gtk_progress_bar_new();
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
361 gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(dialog->progress), 0.1);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
362 gtk_box_pack_start(GTK_BOX(vbox2), dialog->progress, FALSE, FALSE, 0);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
363 gtk_widget_show(dialog->progress);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
364
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
365
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
366 /* button box */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
367 bbox = pidgin_dialog_get_action_area(GTK_DIALOG(window));
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
368 gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
369 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
370
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
371 /* stop button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
372 dialog->stop_button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
373 G_CALLBACK(stop_button_cb), dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
374 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
375
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
376 /* list button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
377 dialog->list_button = pidgin_pixbuf_button_from_stock(_("_Get List"), GTK_STOCK_REFRESH,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
378 PIDGIN_BUTTON_HORIZONTAL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
379 gtk_box_pack_start(GTK_BOX(bbox), dialog->list_button, FALSE, FALSE, 0);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
380 g_signal_connect(G_OBJECT(dialog->list_button), "clicked",
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
381 G_CALLBACK(list_button_cb), dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
382 gtk_widget_show(dialog->list_button);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
383
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
384 /* register button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
385 dialog->register_button = pidgin_dialog_add_button(GTK_DIALOG(dialog->window), _("Register"),
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
386 G_CALLBACK(register_button_cb), dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
387 gtk_widget_set_sensitive(dialog->register_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
388
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
389 /* add button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
390 dialog->add_button = pidgin_pixbuf_button_from_stock(_("_Add"), GTK_STOCK_ADD,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
391 PIDGIN_BUTTON_HORIZONTAL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
392 gtk_box_pack_start(GTK_BOX(bbox), dialog->add_button, FALSE, FALSE, 0);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
393 g_signal_connect(G_OBJECT(dialog->add_button), "clicked",
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
394 G_CALLBACK(add_room_to_blist_cb), dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
395 gtk_widget_set_sensitive(dialog->add_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
396 gtk_widget_show(dialog->add_button);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
397
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
398 /* close button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
399 dialog->close_button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
400 G_CALLBACK(close_button_cb), dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
401
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
402 /* show the dialog window and return the dialog */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
403 gtk_widget_show(dialog->window);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
404
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
405 return dialog;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
406 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
407
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
408 void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
409 pidgin_disco_dialog_show(void)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
410 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
411 pidgin_disco_dialog_new_with_account(NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
412 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
413
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
414 void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
415 pidgin_disco_dialog_show_with_account(PurpleAccount* account)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
416 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
417 PidginDiscoDialog *dialog = pidgin_disco_dialog_new_with_account(account);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
418
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
419 if (!dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
420 return;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
421
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
422 list_button_cb(GTK_BUTTON(dialog->list_button), dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
423 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
424
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
425 static void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
426 pidgin_disco_create(PurpleDiscoList *list)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
427 {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
428 PidginDiscoList *pdl = g_new0(PidginDiscoList, 1);
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
429
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
430 purple_disco_list_set_ui_data(list, pdl);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
431
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
432 pdl->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
433 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
434
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
435
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
436 static void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
437 pidgin_disco_destroy(PurpleDiscoList *list)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
438 {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
439 PidginDiscoList *pdl;
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
440
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
441 pdl = purple_disco_list_get_ui_data(list);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
442
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
443 g_hash_table_destroy(pdl->cats);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
444 g_free(pdl);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
445
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
446 purple_disco_list_set_ui_data(list, NULL);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
447 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
448
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
449 static void pidgin_disco_in_progress(PurpleDiscoList *list, gboolean in_progress)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
450 {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
451 PidginDiscoList *pdl;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
452 PidginDiscoDialog *dialog;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
453
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
454 pdl = purple_disco_list_get_ui_data(list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
455 if (!pdl)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
456 return;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
457
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
458 dialog = pdl->dialog;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
459 if (!dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
460 return;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
461
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
462 if (in_progress) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
463 if (dialog->account_widget)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
464 gtk_widget_set_sensitive(dialog->account_widget, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
465 gtk_widget_set_sensitive(dialog->stop_button, TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
466 gtk_widget_set_sensitive(dialog->list_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
467 } else {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
468 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(dialog->progress), 0.0);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
469 if (dialog->account_widget)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
470 gtk_widget_set_sensitive(dialog->account_widget, TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
471 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
472 gtk_widget_set_sensitive(dialog->list_button, TRUE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
473 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
474 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
475
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
476 static void pidgin_disco_add_service(PurpleDiscoList *list, PurpleDiscoService *service, PurpleDiscoService *parent)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
477 {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
478 PidginDiscoList *pdl;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
479 PidginDiscoDialog *dialog;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
480 PurpleDiscoServiceType type;
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
481 const char *gateway_type;
26689
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
482 GtkTreeIter iter, parent_iter, child;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
483 char *filename = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
484 GdkPixbuf *pixbuf = NULL;
26689
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
485 gboolean append = TRUE;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
486
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
487 pdl = purple_disco_list_get_ui_data(list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
488 dialog = pdl->dialog;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
489
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
490 purple_debug_info("disco", "Add_service \"%s\"\n", purple_disco_service_get_name(service));
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
491
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
492 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(dialog->progress));
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
493
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
494 if (parent) {
26689
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
495 GtkTreeRowReference *rr;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
496 GtkTreePath *path;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
497
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
498 rr = g_hash_table_lookup(pdl->cats, parent);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
499 path = gtk_tree_row_reference_get_path(rr);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
500 if (path) {
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
501 gtk_tree_model_get_iter(GTK_TREE_MODEL(pdl->model), &parent_iter, path);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
502 gtk_tree_path_free(path);
26689
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
503
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
504 if (gtk_tree_model_iter_children(GTK_TREE_MODEL(pdl->model), &child,
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
505 &parent_iter)) {
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
506 PurpleDiscoList *tmp;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
507 gtk_tree_model_get(GTK_TREE_MODEL(pdl->model), &child,
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
508 SERVICE_COLUMN, &tmp, -1);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
509 if (!tmp)
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
510 append = FALSE;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
511 }
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
512 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
513 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
514
26689
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
515 if (append)
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
516 gtk_tree_store_append(pdl->model, &iter, (parent ? &parent_iter : NULL));
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
517 else
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
518 iter = child;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
519
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
520 if (purple_disco_service_get_flags(service) & PURPLE_DISCO_BROWSE) {
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
521 GtkTreeRowReference *rr;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
522 GtkTreePath *path;
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
523
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
524 gtk_tree_store_append(pdl->model, &child, &iter);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
525
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
526 path = gtk_tree_model_get_path(GTK_TREE_MODEL(pdl->model), &iter);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
527 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(pdl->model), path);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
528 g_hash_table_insert(pdl->cats, service, rr);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
529 gtk_tree_path_free(path);
1009214ba476 Handle expanding disco lists on the UI side
Paul Aurich <paul@darkrain42.org>
parents: 26342
diff changeset
530 }
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
531
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
532 type = purple_disco_service_get_type(service);
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
533 gateway_type = purple_disco_service_get_gateway_type(service);
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
534
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
535 if (type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY && gateway_type) {
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
536 char *tmp = g_strconcat(gateway_type, ".png", NULL);
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
537 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", tmp, NULL);
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
538 g_free(tmp);
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
539 #if 0
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
540 } else if (type == PURPLE_DISCO_SERVICE_TYPE_USER) {
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
541 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "22", "person.png", NULL);
26342
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
542 #endif
d6b2944f04b3 s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
543 } else if (type == PURPLE_DISCO_SERVICE_TYPE_CHAT)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
544 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "22", "chat.png", NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
545
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
546 if (filename) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
547 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
548 g_free(filename);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
549 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
550
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
551 gtk_tree_store_set(pdl->model, &iter,
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
552 PIXBUF_COLUMN, pixbuf,
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
553 NAME_COLUMN, purple_disco_service_get_name(service),
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
554 DESCRIPTION_COLUMN, purple_disco_service_get_description(service),
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
555 SERVICE_COLUMN, service,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
556 -1);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
557
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
558 if (pixbuf)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
559 g_object_unref(pixbuf);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
560 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
561
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
562 static PurpleDiscoUiOps ops = {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
563 pidgin_disco_dialog_show_with_account,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
564 pidgin_disco_create,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
565 pidgin_disco_destroy,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
566 pidgin_disco_add_service,
26333
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
567 pidgin_disco_in_progress,
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
568 /* padding */
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
569 NULL,
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
570 NULL,
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
571 NULL,
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
572 NULL
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
573 };
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
574
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
575 void pidgin_disco_init() {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
576 purple_disco_set_ui_ops(&ops);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
577 }