Mercurial > pidgin.yaz
annotate pidgin/gtkdisco.c @ 26336:c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
allocated via ops->create.
When the prpl sets protocol data, it also passed in a close_cb which is called
when destroying the struct to clean up the protocol data.
This still works, but I've introduced some bugs with cancelling the disco or
closing the GtkDisco dialog
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 31 Mar 2009 05:18:09 +0000 |
parents | 535c866b433c |
children | d6b2944f04b3 |
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 |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
133 if (purple_disco_service_get_category(info->service) == PURPLE_DISCO_SERVICE_CAT_MUC) |
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 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
176 static gint |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
177 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
|
178 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
179 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
|
180 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
181 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
|
182 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
|
183 |
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
184 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
|
185 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
|
186 |
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
187 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
|
188 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
|
189 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
|
190 } |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
191 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
192 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
|
193 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
194 return FALSE; |
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 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
197 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
|
198 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
199 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
|
200 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
201 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
|
202 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
|
203 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 } |
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 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
|
210 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
211 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
|
212 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
213 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
|
214 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
|
215 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
216 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
217 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
|
218 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
219 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
|
220 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
|
221 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
222 if (conn) |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
223 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
|
224 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
225 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
|
226 } |
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 gboolean |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
229 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
|
230 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
231 GList *c; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
232 PurpleConnection *gc; |
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 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
|
235 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
|
236 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
237 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
|
238 return TRUE; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
239 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
240 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
241 return FALSE; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
242 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
243 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
244 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
|
245 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
246 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
|
247 GtkTreeViewColumn *column; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
248 GtkTreeSelection *selection; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
249 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
250 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
|
251 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
|
252 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
|
253 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
|
254 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
|
255 ); |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
256 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
257 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
|
258 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
|
259 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
264 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
|
265 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
266 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
|
267 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
|
268 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
269 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
|
270 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
|
271 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
272 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
|
273 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
|
274 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
275 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
|
276 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
|
277 "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
|
278 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
279 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
|
280 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
|
281 "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
|
282 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
283 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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 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
|
289 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
290 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
|
291 "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
|
292 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
|
293 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
|
294 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
|
295 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
|
296 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
|
297 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
|
298 } |
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 static PidginDiscoDialog* |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
301 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
|
302 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
303 PidginDiscoDialog *dialog; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
304 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
|
305 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
306 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
|
307 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
|
308 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
309 /* 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
|
310 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
|
311 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
312 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
|
313 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
|
314 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
315 /* 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
|
316 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
|
317 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
318 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
|
319 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
|
320 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
|
321 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
322 /* 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
|
323 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
|
324 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
|
325 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
|
326 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
|
327 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
|
328 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
329 /* scrolled window */ |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
330 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
|
331 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
|
332 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
|
333 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
|
334 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
|
335 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
|
336 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
|
337 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
|
338 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
|
339 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
340 /* progress bar */ |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
341 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
|
342 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
|
343 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
|
344 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
|
345 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
346 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
347 /* button box */ |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
348 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
|
349 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
|
350 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
|
351 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
352 /* stop button */ |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
353 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
|
354 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
|
355 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
|
356 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
357 /* list button */ |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 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
|
364 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
365 /* register button */ |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
366 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
|
367 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
|
368 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
|
369 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
370 /* add button */ |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
371 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
|
372 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
|
373 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
|
374 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
|
375 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
|
376 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
|
377 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
|
378 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
379 /* close button */ |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
380 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
|
381 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
|
382 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
383 /* 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
|
384 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
|
385 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
386 return dialog; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
387 } |
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 void |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
390 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
|
391 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
392 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
|
393 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
394 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
395 void |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
396 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
|
397 { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
398 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
|
399 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
400 if (!dialog) |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
401 return; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
402 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
403 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
|
404 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
405 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
406 static void |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
407 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
|
408 { |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
409 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
|
410 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
411 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
|
412 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
413 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
|
414 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
415 |
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 static void |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
418 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
|
419 { |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
420 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
|
421 |
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
422 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
|
423 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
424 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
|
425 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
|
426 |
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
427 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
|
428 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
429 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
430 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
|
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 PidginDiscoList *pdl; |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
433 PidginDiscoDialog *dialog; |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
434 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
435 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
|
436 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
|
437 return; |
26331
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 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
|
440 if (!dialog) |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
441 return; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
442 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
443 if (in_progress) { |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
444 gtk_tree_store_clear(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
|
445 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
|
446 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
|
447 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
|
448 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
|
449 } else { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
450 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
|
451 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
|
452 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
|
453 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
|
454 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
|
455 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
456 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
457 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
458 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
|
459 { |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
460 PidginDiscoList *pdl; |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
461 PidginDiscoDialog *dialog; |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
462 PurpleDiscoServiceCategory category; |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
463 PurpleDiscoServiceType type; |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
464 GtkTreeIter iter, parent_iter; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
465 GtkTreeRowReference *rr; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
466 GtkTreePath *path; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
467 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
|
468 GdkPixbuf *pixbuf = NULL; |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
469 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
470 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
|
471 dialog = pdl->dialog; |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
472 |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
473 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
|
474 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
475 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
|
476 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
477 if (parent) { |
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 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
|
479 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
|
480 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
|
481 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
|
482 gtk_tree_path_free(path); |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
483 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
484 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
485 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
486 gtk_tree_store_append(pdl->model, &iter, (parent ? &parent_iter : NULL)); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
487 |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
488 category = purple_disco_service_get_category(service); |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
489 type = purple_disco_service_get_type(service); |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
490 |
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
491 if (type == PURPLE_DISCO_SERVICE_TYPE_XMPP) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
492 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "jabber.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
493 else if (type == PURPLE_DISCO_SERVICE_TYPE_ICQ) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
494 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "icq.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
495 else if (type == PURPLE_DISCO_SERVICE_TYPE_YAHOO) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
496 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "yahoo.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
497 else if (type == PURPLE_DISCO_SERVICE_TYPE_GTALK) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
498 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "google-talk.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
499 else if (type == PURPLE_DISCO_SERVICE_TYPE_IRC) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
500 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "irc.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
501 else if (type == PURPLE_DISCO_SERVICE_TYPE_GG) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
502 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "gadu-gadu.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
503 else if (type == PURPLE_DISCO_SERVICE_TYPE_AIM) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
504 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "aim.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
505 else if (type == PURPLE_DISCO_SERVICE_TYPE_QQ) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
506 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "qq.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
507 else if (type == PURPLE_DISCO_SERVICE_TYPE_MSN) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
508 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", "22", "msn.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
509 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
|
510 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "22", "person.png", NULL); |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
511 else if (category == PURPLE_DISCO_SERVICE_CAT_MUC) |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
512 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
|
513 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
514 if (filename) { |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
515 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
|
516 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
|
517 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
518 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
519 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
|
520 PIXBUF_COLUMN, pixbuf, |
26334
535c866b433c
Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents:
26333
diff
changeset
|
521 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
|
522 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
|
523 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
|
524 -1); |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
525 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
526 path = gtk_tree_model_get_path(GTK_TREE_MODEL(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
|
527 |
26336
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
528 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(pdl->model), path); |
c619bef09bec
Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents:
26334
diff
changeset
|
529 g_hash_table_insert(pdl->cats, service, rr); |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
530 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
531 gtk_tree_path_free(path); |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
532 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
533 if (pixbuf) |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
534 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
|
535 } |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
536 |
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
537 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
|
538 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
|
539 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
|
540 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
|
541 pidgin_disco_add_service, |
26333
31e05bafd7a3
Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents:
26331
diff
changeset
|
542 pidgin_disco_in_progress, |
31e05bafd7a3
Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents:
26331
diff
changeset
|
543 /* padding */ |
31e05bafd7a3
Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents:
26331
diff
changeset
|
544 NULL, |
31e05bafd7a3
Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents:
26331
diff
changeset
|
545 NULL, |
31e05bafd7a3
Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents:
26331
diff
changeset
|
546 NULL, |
31e05bafd7a3
Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents:
26331
diff
changeset
|
547 NULL |
26331
a5010188c01e
Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
548 }; |
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 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
|
551 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
|
552 } |