annotate pidgin/gtkdisco.c @ 26334:535c866b433c

Hide the structs, add accessors, and fix various smaller things: * Make the flags an enum instead of #defines * There were two sets of _in_progress functions, removed one. * Adjusted a few return types to match usage * Move the fetch_count into the prpl's protocol_data (which is no longer the JabberStream but a dedicated struct)
author Paul Aurich <paul@darkrain42.org>
date Mon, 30 Mar 2009 00:42:15 +0000
parents 31e05bafd7a3
children c619bef09bec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1 /**
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
2 * @file gtkdisco.c GTK+ Service Discovery UI
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
3 * @ingroup pidgin
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
4 */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
5
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
6 /* pidgin
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
7 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
10 * source distribution.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
11 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
15 * (at your option) any later version.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
16 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
20 * GNU General Public License for more details.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
21 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
25 */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
26
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
27 #include "internal.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
28 #include "pidgin.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
29 #include "gtkutils.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
30 #include "debug.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
31 #include "disco.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
32
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
33 #include "gtkdisco.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
34
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
35 typedef struct _PidginDiscoDialog {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
36 GtkWidget *window;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
37 GtkWidget *account_widget;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
38
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
39 GtkWidget *sw;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
40 GtkWidget *progress;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
41 GtkTreeStore *model;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
42 GtkWidget *tree;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
43 GHashTable *cats; /** Meow. */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
44
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
45 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
46 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
47 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
48 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
49 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
50
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
51 PurpleAccount *account;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
52 PurpleDiscoList *discolist;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
53 } PidginDiscoDialog;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
54
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
55 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
56 PurpleDiscoList *list;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
57 PurpleDiscoService *service;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
58 };
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
59
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
60 enum {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
61 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
62 NAME_COLUMN,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
63 DESCRIPTION_COLUMN,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
64 SERVICE_COLUMN,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
65 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
66 };
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
67
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
68 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
69 PidginDiscoDialog *dialog)
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 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
72 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
73
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 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
75 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
76 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
77 PurpleAccount *account;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
78 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
79
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
80 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
81 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
82
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
83 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
84 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
85
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
86 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
87 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
88 PurpleConnection *gc;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
89
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
90 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
91 if (!gc)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
92 return;
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 if (dialog->discolist != NULL)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
95 purple_disco_list_unref(dialog->discolist);
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 dialog->discolist = purple_disco_list_new(dialog->account, (void*) dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
98
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
99 purple_disco_get_list(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
100 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
101
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
102 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
103 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
104 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
105 PurpleAccount *account;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
106 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
107
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
108 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
109
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
110 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
111 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
112
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
113 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
114 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
115 else
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
116 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
117 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
118
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
119 static void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
120 selection_changed_cb(GtkTreeSelection *selection, PidginDiscoDialog *dialog)
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 PurpleDiscoService *service;
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
123 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
124 GtkTreeIter iter;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
125 GValue val;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
126 static struct _menu_cb_info *info;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
127
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
128 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
129 val.g_type = 0;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
130 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog-> model), &iter, SERVICE_COLUMN, &val);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
131 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
132 if (!service) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
133 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
134 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
135 return;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
136 }
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 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
139 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
140 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
141
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
142 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
143 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
144
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
145 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
146
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
147 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
148 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
149 } else {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
150 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
151 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
152 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
153 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
154
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
155 static gint
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
156 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
157 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
158 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
159
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
160 if (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 purple_disco_list_unref(dialog->discolist);
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_free(dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
164
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
165 return FALSE;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
166 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
167
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
168 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
169 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
170 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
171
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
172 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
173 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
174
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
175 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
176 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
177 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
178 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
179
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
180 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
181 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
182 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
183
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
184 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
185 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
186 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
187
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
188 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
189 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
190 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
191 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
192
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
193 if (conn)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
194 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
195
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
196 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
197 }
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 gboolean
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
200 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
201 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
202 GList *c;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
203 PurpleConnection *gc;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
204
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
205 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
206 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
207
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
208 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
209 return TRUE;
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
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
212 return FALSE;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
213 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
214
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
215 static void pidgin_disco_create_tree(PidginDiscoDialog *dialog)
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 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
218 GtkTreeViewColumn *column;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
219 GtkTreeSelection *selection;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
220
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
221 dialog->model = gtk_tree_store_new(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
222 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
223 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
224 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
225 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
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 dialog->tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model));
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
229 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(dialog->tree), TRUE);
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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->tree));
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
232 g_signal_connect(G_OBJECT(selection), "changed",
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
233 G_CALLBACK(selection_changed_cb), dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
234
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
235 g_object_unref(dialog->model);
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 gtk_container_add(GTK_CONTAINER(dialog->sw), dialog->tree);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
238 gtk_widget_show(dialog->tree);
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 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
241 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
242
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
243 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
244 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
245
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
246 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
247 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
248 "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
249
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
250 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
251 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
252 "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
253
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
254 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
255 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
256 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
257 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
258 gtk_tree_view_column_set_reorderable(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
259 gtk_tree_view_append_column(GTK_TREE_VIEW(dialog->tree), column);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
260
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
261 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
262 "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
263 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
264 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
265 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
266 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
267 gtk_tree_view_column_set_reorderable(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
268 gtk_tree_view_append_column(GTK_TREE_VIEW(dialog->tree), column);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
269 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
270
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
271 static PidginDiscoDialog*
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
272 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
273 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
274 PidginDiscoDialog *dialog;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
275 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
276
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
277 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
278 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
279
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
280 /* 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
281 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
282
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
283 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
284 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
285
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
286 /* 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
287 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
288
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
289 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
290 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
291 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
292
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
293 /* 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
294 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
295 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
296 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
297 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
298 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
299
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
300 /* scrolled window */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
301 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
302 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
303 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
304 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
305 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
306 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
307 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
308 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
309 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
310
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
311 /* progress bar */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
312 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
313 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
314 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
315 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
316
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 /* button box */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
319 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
320 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
321 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
322
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
323 /* stop button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
324 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
325 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
326 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
327
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
328 /* list button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
329 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
330 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
331 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
332 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
333 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
334 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
335
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
336 /* register button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
337 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
338 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
339 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
340
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
341 /* add button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
342 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
343 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
344 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
345 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
346 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
347 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
348 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
349
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
350 /* close button */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
351 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
352 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
353
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
354 pidgin_disco_create_tree(dialog);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
355
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
356 /* 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
357 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
358
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
359 return dialog;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
360 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
361
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
362 void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
363 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
364 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
365 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
366 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
367
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
368 void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
369 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
370 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
371 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
372
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
373 if (!dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
374 return;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
375
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
376 list_button_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
377 }
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 static void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
380 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
381 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
382 PidginDiscoDialog *dialog;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
383
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
384 dialog = 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
385
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
386 dialog->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free);
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
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
390 static void
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
391 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
392 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
393 PidginDiscoDialog *dialog;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
394
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
395 dialog = 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
396
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
397 g_hash_table_destroy(dialog->cats);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
398 }
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 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
401 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
402 PidginDiscoDialog *dialog;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
403
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
404 dialog = 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
405
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
406 if (!dialog)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
407 return;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
408
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
409 if (in_progress) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
410 gtk_tree_store_clear(dialog->model);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
411 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
412 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
413 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
414 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
415 } else {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
416 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
417 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
418 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
419 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
420 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
421 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
422 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
423
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
424 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
425 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
426 PidginDiscoDialog *dialog;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
427 PurpleDiscoServiceCategory category;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
428 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
429 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
430 GtkTreeRowReference *rr;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
431 GtkTreePath *path;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
432 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
433 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
434
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
435 dialog = purple_disco_list_get_ui_data(list);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
436
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
437 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
438
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
439 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
440
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
441 if (parent) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
442 rr = g_hash_table_lookup(dialog->cats, parent);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
443 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
444 if (path) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
445 gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &parent_iter, path);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
446 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
447 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
448 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
449
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
450 gtk_tree_store_append(dialog->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
451
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
452 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
453 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
454
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463 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
464 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
465 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
466 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
467 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
468 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
469 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
470 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
471 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
472 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
473 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
474 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
475 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
476 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
477
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
478 if (filename) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
479 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
480 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
481 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
482
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
483 gtk_tree_store_set(dialog->model, &iter,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
484 PIXBUF_COLUMN, pixbuf,
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26333
diff changeset
485 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
486 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
487 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
488 -1);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
489
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
490 path = gtk_tree_model_get_path(GTK_TREE_MODEL(dialog->model), &iter);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
491
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
492 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(dialog->model), path);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
493 g_hash_table_insert(dialog->cats, service, rr);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
494
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
495 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
496
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
497 if (pixbuf)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
498 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
499 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
500
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
501 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
502 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
503 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
504 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
505 pidgin_disco_add_service,
26333
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
506 pidgin_disco_in_progress,
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
507 /* padding */
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
508 NULL,
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
509 NULL,
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
510 NULL,
31e05bafd7a3 Add the padding needed from the previous commit
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
511 NULL
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
512 };
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
513
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
514 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
515 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
516 }