annotate src/gtkroomlist.c @ 8485:db4a125edd7b

[gaim-migrate @ 9220] It looks like the new-style AC_INIT_AUTOMAKE _isn't_ something we can rely upon ... but fortunately there's a trivial fix for that, too. Thanks to John Silvestri for pointing out that debian's automake is too gimpy for the "new" way of doing things. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Mon, 22 Mar 2004 06:00:12 +0000
parents 6d8ec773a485
children 058efd3cb86f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file gtkroomlist.c Gtk Room List UI
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 * @ingroup gtkui
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 *
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 * gaim
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 *
8146
596c64a2a2d0 [gaim-migrate @ 8854]
Luke Schierer <lschiere@pidgin.im>
parents: 8143
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
596c64a2a2d0 [gaim-migrate @ 8854]
Luke Schierer <lschiere@pidgin.im>
parents: 8143
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
596c64a2a2d0 [gaim-migrate @ 8854]
Luke Schierer <lschiere@pidgin.im>
parents: 8143
diff changeset
9 * source distribution.
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 *
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24 */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #include "gtkinternal.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 #include "gtkutils.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28 #include "stock.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 #include "debug.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30 #include "account.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 #include "connection.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32 #include "notify.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34 #include "gtkroomlist.h"
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36 typedef struct _GaimGtkRoomlist {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 GaimGtkRoomlistDialog *dialog;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 GtkTreeStore *model;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
39 GtkWidget *tree;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40 GHashTable *cats; /**< Meow. */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 gint num_rooms, total_rooms;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 } GaimGtkRoomlist;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44 struct _GaimGtkRoomlistDialog {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 GtkWidget *window;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 GtkWidget *account_widget;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 GtkWidget *progress;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 GtkWidget *sw;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
49
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
50 GtkWidget *stop_button;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 GtkWidget *list_button;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
52 GtkWidget *join_button;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
53 GtkWidget *close_button;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
54
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
55 GaimAccount *account;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
56 GaimRoomlist *roomlist;
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
57
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
58 gboolean pg_needs_pulse;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
59 gboolean pg_to_active;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
60 guint pg_update_to;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
61 };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
62
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
63 enum {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
64 NAME_COLUMN = 0,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
65 ROOM_COLUMN,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
66 NUM_OF_COLUMNS,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
67 };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
69 static GList *roomlists = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
70
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
71 static gint delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
72 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73 GaimGtkRoomlistDialog *dialog;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
74
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
75 dialog = (GaimGtkRoomlistDialog *) d;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
76
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
77 if (dialog->roomlist && gaim_roomlist_get_in_progress(dialog->roomlist))
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
78 gaim_roomlist_cancel_get_list(dialog->roomlist);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
79
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
80 if (dialog->roomlist) {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
81 if (dialog->pg_to_active) {
8287
ef881489396e [gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents: 8230
diff changeset
82 gaim_timeout_remove(dialog->pg_update_to);
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
83 dialog->pg_to_active = FALSE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
84 /* yes, that's right, unref it twice. */
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
85 gaim_roomlist_unref(dialog->roomlist);
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
86 }
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
87 }
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
88
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89 /* free stuff here */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90 if (dialog->roomlist)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91 gaim_roomlist_unref(dialog->roomlist);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
92 g_free(dialog);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
93
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
94 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
95 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
96
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
97 static void dialog_select_account_cb(GObject *w, GaimAccount *account,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
98 GaimGtkRoomlistDialog *dialog)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
99 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
100 dialog->account = account;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
101 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
102
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
103 static void list_button_cb(GtkButton *button, GaimGtkRoomlistDialog *dialog)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
104 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
105 GaimConnection *gc;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
106 GaimGtkRoomlist *rl;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
107
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
108 gc = gaim_account_get_connection(dialog->account);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
109 if (!gc)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
110 return;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
111
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
112 if (dialog->roomlist != NULL) {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
113 rl = dialog->roomlist->ui_data;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
114 gtk_widget_destroy(rl->tree);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
115 gaim_roomlist_unref(dialog->roomlist);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
116 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
117
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
118 dialog->roomlist = gaim_roomlist_get_list(gc);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
119 gaim_roomlist_ref(dialog->roomlist);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
120 rl = dialog->roomlist->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
121 rl->dialog = dialog;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
122
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
123 if (dialog->account_widget)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
124 gtk_widget_set_sensitive(dialog->account_widget, FALSE);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
125
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
126 gtk_container_add(GTK_CONTAINER(dialog->sw), rl->tree);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
127
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
128 gtk_widget_set_sensitive(dialog->stop_button, TRUE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
129 gtk_widget_set_sensitive(dialog->list_button, FALSE);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
130 gtk_widget_set_sensitive(dialog->join_button, FALSE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
131 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
132
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
133 static void stop_button_cb(GtkButton *button, GaimGtkRoomlistDialog *dialog)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
134 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
135 gaim_roomlist_cancel_get_list(dialog->roomlist);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
136
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
137 if (dialog->account_widget)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
138 gtk_widget_set_sensitive(dialog->account_widget, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
139
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
140 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
141 gtk_widget_set_sensitive(dialog->list_button, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
142 gtk_widget_set_sensitive(dialog->join_button, FALSE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
143 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
144
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
145 static void close_button_cb(GtkButton *button, GaimGtkRoomlistDialog *dialog)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
146 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
147 GtkWidget *window = dialog->window;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
148
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
149 delete_win_cb(NULL, NULL, dialog);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
150 gtk_widget_destroy(window);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
151 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
152
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
153 struct _menu_cb_info {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154 GaimRoomlist *list;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
155 GaimRoomlistRoom *room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
156 };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
157
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
158 static void
8377
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
159 join_button_data_change_cb(gpointer data) {
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
160 g_free(data);
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
161 }
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
162
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
163 static void
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
164 selection_changed_cb(GtkTreeSelection *selection, GaimGtkRoomlist *grl) {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
165 GtkTreeIter iter;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
166 GValue val = { 0, };
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
167 GaimRoomlistRoom *room;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
168 static struct _menu_cb_info *info;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
169 GaimGtkRoomlistDialog *dialog;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
170
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
171 dialog = grl->dialog;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
172
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
173 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
174 gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
175 room = g_value_get_pointer(&val);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
176 if (!room || !(room->type & GAIM_ROOMLIST_ROOMTYPE_ROOM)) {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
177 gtk_widget_set_sensitive(dialog->join_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
178 return;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
179 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
180
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
181 info = g_new0(struct _menu_cb_info, 1);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
182 info->list = dialog->roomlist;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
183 info->room = room;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
184
8377
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
185 g_object_set_data_full(G_OBJECT(dialog->join_button), "room-info",
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
186 info, join_button_data_change_cb);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
187
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
188 gtk_widget_set_sensitive(dialog->join_button, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
189 } else {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
190 gtk_widget_set_sensitive(dialog->join_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
191 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
192 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
193
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
194 static void do_join_cb(GtkWidget *w, struct _menu_cb_info *info)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
195 {
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
196 gaim_roomlist_room_join(info->list, info->room);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
197 }
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
198
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
199 static void join_button_cb(GtkButton *button, GaimGtkRoomlistDialog *dialog)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
200 {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
201 GaimRoomlist *rl = dialog->roomlist;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
202 GaimGtkRoomlist *grl = rl->ui_data;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
203 struct _menu_cb_info *info;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
204
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
205 info = (struct _menu_cb_info*)g_object_get_data(G_OBJECT(button), "room-info");
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
206
8377
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
207 if(info != NULL)
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
208 do_join_cb(grl->tree, info);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
209 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
210
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
211 static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
212 GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
213 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
214 GaimGtkRoomlist *grl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
215 GtkTreeIter iter;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 GaimRoomlistRoom *room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217 GValue val = { 0, };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218 struct _menu_cb_info info;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
220 gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
221 gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 room = g_value_get_pointer(&val);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
223 if (!room || !(room->type & GAIM_ROOMLIST_ROOMTYPE_ROOM))
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
224 return;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
226 info.list = list;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227 info.room = room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229 do_join_cb(GTK_WIDGET(tv), &info);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
230 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
231
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
232 static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
233 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
234 GtkTreePath *path;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
235 GaimGtkRoomlist *grl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
236 GValue val = { 0, };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
237 GaimRoomlistRoom *room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
238 GtkTreeIter iter;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
239 GtkWidget *menu;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
240 static struct _menu_cb_info info; /* XXX? */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
241
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
242 if (event->button != 3 || event->type != GDK_BUTTON_PRESS)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
243 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
244
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
245 /* Here we figure out which room was clicked */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
246 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL))
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
247 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
248 gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
249 gtk_tree_path_free(path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
250 gtk_tree_model_get_value (GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
251 room = g_value_get_pointer(&val);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
252
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
253 if (!room || !(room->type & GAIM_ROOMLIST_ROOMTYPE_ROOM))
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
254 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
255
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
256 info.list = list;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
257 info.room = room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
258
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
259
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
260 menu = gtk_menu_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
261 gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
262 G_CALLBACK(do_join_cb), &info, 0, 0, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
263
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
265 gtk_widget_show_all(menu);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
266 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
267
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
268 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
269 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
270
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
271 static void row_expanded_cb(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer user_data)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
272 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
273 GaimRoomlist *list = user_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
274 GaimRoomlistRoom *catagory;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
275 GValue val = { 0, };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
276
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
277 gtk_tree_model_get_value(gtk_tree_view_get_model(treeview), arg1, ROOM_COLUMN, &val);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
278 catagory = g_value_get_pointer(&val);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
280 if (!catagory->expanded_once) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
281 gaim_roomlist_expand_catagory(list, catagory);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
282 catagory->expanded_once = TRUE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
283 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
284 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
285
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
286 static gboolean accounts_filter_func(GaimAccount *account)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
287 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
288 GaimConnection *gc;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
289
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
290 gc = gaim_account_get_connection(account);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
291 if (!gc)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
292 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
293 return gaim_roomlist_is_possible(gc);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
294 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
295
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
296 GaimGtkRoomlistDialog *gaim_gtk_roomlist_dialog_new_with_account(GaimAccount *account)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
297 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
298 GaimGtkRoomlistDialog *dialog;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
299 GtkWidget *window;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
300 GtkWidget *vbox;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
301 GtkWidget *vbox2;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
302 GtkWidget *account_hbox;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
303 GtkWidget *bbox;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
304 GtkWidget *label;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
305 GaimAccount *first_account = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
306
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
307 if (!account) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
308 GList *c;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
309 GaimConnection *gc;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
310
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
311 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
312 gc = c->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
313
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
314 if (gaim_roomlist_is_possible(gc)) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
315 first_account = gaim_connection_get_account(gc);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
316 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
317 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
318 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
319
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
320 if (first_account == NULL) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
321 gaim_notify_error(NULL, NULL,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
322 _("You are not currently signed on with any "
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
323 "protocols that have the ability to list rooms."),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
324 NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
325
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
326 return NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
327 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
328 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
329
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
330 dialog = g_new0(GaimGtkRoomlistDialog, 1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
331
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
332 /* Create the window. */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
333 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
334 gtk_window_set_role(GTK_WINDOW(window), "room list");
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
335 gtk_window_set_title(GTK_WINDOW(window), _("Room List"));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
336
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
337 gtk_container_set_border_width(GTK_CONTAINER(window), 12);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
338 gtk_widget_realize(window);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
339
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
340 g_signal_connect(G_OBJECT(window), "delete_event",
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
341 G_CALLBACK(delete_win_cb), dialog);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
342
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
343 /* Create the parent vbox for everything. */
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
344 vbox = gtk_vbox_new(FALSE, 12);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
345 gtk_container_add(GTK_CONTAINER(window), vbox);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
346 gtk_widget_show(vbox);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
347
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
348 vbox2 = gtk_vbox_new(FALSE, 12);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
349 gtk_container_add(GTK_CONTAINER(vbox), vbox2);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
350 gtk_widget_show(vbox2);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
351
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
352
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
353 if (!account)
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
354 dialog->account = first_account;
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
355 else
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
356 dialog->account = account;
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
357
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
358 /* accounts dropdown list */
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
359 account_hbox = gtk_hbox_new(FALSE, 6);
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
360 gtk_box_pack_start(GTK_BOX(vbox2), account_hbox, FALSE, FALSE, 0);
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
361 gtk_widget_show(account_hbox);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
362
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
363 label = gtk_label_new(NULL);
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
364 gtk_box_pack_start(GTK_BOX(account_hbox), label, FALSE, FALSE, 0);
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
365 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:"));
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
366 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
367 gtk_widget_show(label);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
368
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
369 dialog->account_widget = gaim_gtk_account_option_menu_new(dialog->account, FALSE,
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
370 G_CALLBACK(dialog_select_account_cb), accounts_filter_func, dialog);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
371
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
372 gtk_box_pack_start(GTK_BOX(account_hbox), dialog->account_widget, TRUE, TRUE, 0);
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
373 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(dialog->account_widget));
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
374 gtk_widget_show(dialog->account_widget);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
375
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
376 /* scrolled window */
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
377 dialog->sw = gtk_scrolled_window_new(NULL, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
378 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(dialog->sw),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
379 GTK_SHADOW_IN);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
380 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dialog->sw),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
381 GTK_POLICY_AUTOMATIC,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
382 GTK_POLICY_AUTOMATIC);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
383 gtk_box_pack_start(GTK_BOX(vbox2), dialog->sw, TRUE, TRUE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
384 gtk_widget_set_size_request(dialog->sw, -1, 250);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
385 gtk_widget_show(dialog->sw);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
386
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
387 /* progress bar */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
388 dialog->progress = gtk_progress_bar_new();
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
389 gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(dialog->progress), 0.1);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
390 gtk_box_pack_start(GTK_BOX(vbox2), dialog->progress, FALSE, FALSE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
391 gtk_widget_show(dialog->progress);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
392
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
393
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
394 /* button box */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
395 bbox = gtk_hbutton_box_new();
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
396 gtk_box_set_spacing(GTK_BOX(bbox), 6);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
397 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
398 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
399 gtk_widget_show(bbox);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
400
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
401 /* stop button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
402 dialog->stop_button = gtk_button_new_from_stock(GTK_STOCK_STOP);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
403 gtk_box_pack_start(GTK_BOX(bbox), dialog->stop_button, FALSE, FALSE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
404 g_signal_connect(G_OBJECT(dialog->stop_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
405 G_CALLBACK(stop_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
406 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
407 gtk_widget_show(dialog->stop_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
408
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
409 /* list button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
410 dialog->list_button = gtk_button_new_with_mnemonic(_("_Get List"));
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
411 gtk_box_pack_start(GTK_BOX(bbox), dialog->list_button, FALSE, FALSE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
412 g_signal_connect(G_OBJECT(dialog->list_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
413 G_CALLBACK(list_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
414 gtk_widget_show(dialog->list_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
415
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
416 /* join button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
417 dialog->join_button = gaim_pixbuf_button_from_stock(_("_Join"), GAIM_STOCK_CHAT,
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
418 GAIM_BUTTON_HORIZONTAL);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
419 gtk_box_pack_start(GTK_BOX(bbox), dialog->join_button, FALSE, FALSE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
420 g_signal_connect(G_OBJECT(dialog->join_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
421 G_CALLBACK(join_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
422 gtk_widget_set_sensitive(dialog->join_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
423 gtk_widget_show(dialog->join_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
424
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
425 /* close button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
426 dialog->close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
427 gtk_box_pack_start(GTK_BOX(bbox), dialog->close_button, FALSE, FALSE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
428 g_signal_connect(G_OBJECT(dialog->close_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
429 G_CALLBACK(close_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
430 gtk_widget_show(dialog->close_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
431
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
432 /* show the dialog window and return the dialog */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
433 gtk_widget_show(dialog->window);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
434
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
435 return dialog;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
436 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
437
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
438 GaimGtkRoomlistDialog *gaim_gtk_roomlist_dialog_new(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
439 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
440 return gaim_gtk_roomlist_dialog_new_with_account(NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
441 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
442
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
443 static void gaim_gtk_roomlist_dialog_show_with_account(GaimAccount *account)
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
444 {
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
445 GaimGtkRoomlistDialog *dialog;
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
446
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
447 dialog = gaim_gtk_roomlist_dialog_new_with_account(account);
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
448 if (!dialog)
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
449 return;
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
450
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
451 list_button_cb(GTK_BUTTON(dialog->list_button), dialog);
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
452 }
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
453
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
454 void gaim_gtk_roomlist_dialog_show(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
455 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
456 gaim_gtk_roomlist_dialog_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
457 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
458
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
459 static void gaim_gtk_roomlist_new(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
460 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
461 GaimGtkRoomlist *rl;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
462
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
463 rl = g_new0(GaimGtkRoomlist, 1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
464
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
465 list->ui_data = rl;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
466
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
467 rl->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
468
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
469 roomlists = g_list_append(roomlists, list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
470 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
471
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
472 static void int_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
473 GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
474 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
475 gchar buf[16];
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
476 int myint;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
477
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
478 gtk_tree_model_get(model, iter, GPOINTER_TO_INT(user_data), &myint, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
479
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
480 if (myint)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
481 g_snprintf(buf, sizeof(buf), "%d", myint);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
482 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
483 buf[0] = '\0';
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
484
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
485 g_object_set(renderer, "text", buf, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
486 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
487
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
488 /* this sorts backwards on purpose, so that clicking name sorts a-z, while clicking users sorts
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
489 infinity-0. you can still click again to reverse it on any of them. */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
490 static gint int_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
491 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
492 int c, d;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
493
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
494 c = d = 0;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
495
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
496 gtk_tree_model_get(model, a, GPOINTER_TO_INT(user_data), &c, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
497 gtk_tree_model_get(model, b, GPOINTER_TO_INT(user_data), &d, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
498
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
499 if (c == d)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
500 return 0;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
501 else if (c > d)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
502 return -1;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
503 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
504 return 1;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
505 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
506
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
507 static void gaim_gtk_roomlist_set_fields(GaimRoomlist *list, GList *fields)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
508 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
509 GaimGtkRoomlist *grl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
510 gint columns = NUM_OF_COLUMNS;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
511 int j;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
512 GtkTreeStore *model;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
513 GtkWidget *tree;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
514 GtkCellRenderer *renderer;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
515 GtkTreeViewColumn *column;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
516 GtkTreeSelection *selection;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
517 GList *l;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
518 GType *types;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
519
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
520 g_return_if_fail(grl != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
521
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
522 columns += g_list_length(fields);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
523 types = g_new(GType, columns);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
524
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
525 types[NAME_COLUMN] = G_TYPE_STRING;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
526 types[ROOM_COLUMN] = G_TYPE_POINTER;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
527
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
528 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
529 GaimRoomlistField *f = l->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
530
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
531 switch (f->type) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
532 case GAIM_ROOMLIST_FIELD_BOOL:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
533 types[j] = G_TYPE_BOOLEAN;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
534 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
535 case GAIM_ROOMLIST_FIELD_INT:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
536 types[j] = G_TYPE_INT;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
537 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
538 case GAIM_ROOMLIST_FIELD_STRING:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
539 types[j] = G_TYPE_STRING;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
540 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
541 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
542 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
543
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
544 model = gtk_tree_store_newv(columns, types);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
545 g_free(types);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
546
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
547 tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
548 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
549
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
550 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
551 g_signal_connect(G_OBJECT(selection), "changed",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
552 G_CALLBACK(selection_changed_cb), grl);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
553
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
554 g_object_unref(model);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
555
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
556 grl->model = model;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
557 grl->tree = tree;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
558 gtk_widget_show(grl->tree);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
559
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
560 renderer = gtk_cell_renderer_text_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
561 column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
562 "text", NAME_COLUMN, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
563 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
564 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
565 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
566 gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), NAME_COLUMN);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
567 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
568 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
569
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
570 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
571 GaimRoomlistField *f = l->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
572
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
573 if (f->hidden)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
574 continue;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
575
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
576 renderer = gtk_cell_renderer_text_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
577 column = gtk_tree_view_column_new_with_attributes(f->label, renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
578 "text", j, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
579 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
580 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
581 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
582 gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), j);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
583 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
584 if (f->type == GAIM_ROOMLIST_FIELD_INT) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
585 gtk_tree_view_column_set_cell_data_func(column, renderer, int_cell_data_func,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
586 GINT_TO_POINTER(j), NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
587 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), j, int_sort_func,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
588 GINT_TO_POINTER(j), NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
589 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
590 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
591 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
592
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
593 g_signal_connect(G_OBJECT(tree), "button-press-event", G_CALLBACK(room_click_cb), list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
594 g_signal_connect(G_OBJECT(tree), "row-expanded", G_CALLBACK(row_expanded_cb), list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
595 g_signal_connect(G_OBJECT(tree), "row-activated", G_CALLBACK(row_activated_cb), list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
596 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
597
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
598 static gboolean gaim_gtk_progress_bar_pulse(gpointer data)
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
599 {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
600 GaimRoomlist *list = data;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
601 GaimGtkRoomlist *rl = list->ui_data;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
602
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
603 if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
604 rl->dialog->pg_to_active = FALSE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
605 gaim_roomlist_unref(list);
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
606 return FALSE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
607 }
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
608
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
609 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress));
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
610 rl->dialog->pg_needs_pulse = FALSE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
611 return TRUE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
612 }
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
613
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
614 static void gaim_gtk_roomlist_add_room(GaimRoomlist *list, GaimRoomlistRoom *room)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
615 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
616 GaimGtkRoomlist *rl= list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
617 GtkTreeRowReference *rr, *parentrr = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
618 GtkTreePath *path;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
619 GtkTreeIter iter, parent, child;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
620 GList *l, *k;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
621 int j;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
622 gboolean append = TRUE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
623
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
624 rl->total_rooms++;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
625 if (room->type == GAIM_ROOMLIST_ROOMTYPE_ROOM)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
626 rl->num_rooms++;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
627
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
628 if (rl->dialog) {
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
629 if (!rl->dialog->pg_to_active) {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
630 rl->dialog->pg_to_active = TRUE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
631 gaim_roomlist_ref(list);
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
632 rl->dialog->pg_update_to = g_timeout_add(100, gaim_gtk_progress_bar_pulse, list);
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
633 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress));
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
634 } else {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
635 rl->dialog->pg_needs_pulse = TRUE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
636 }
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
637 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
638 if (room->parent) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
639 parentrr = g_hash_table_lookup(rl->cats, room->parent);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
640 path = gtk_tree_row_reference_get_path(parentrr);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
641 if (path) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
642 GaimRoomlistRoom *tmproom = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
643
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
644 gtk_tree_model_get_iter(GTK_TREE_MODEL(rl->model), &parent, path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
645 gtk_tree_path_free(path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
646
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
647 if (gtk_tree_model_iter_children(GTK_TREE_MODEL(rl->model), &child, &parent)) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
648 gtk_tree_model_get(GTK_TREE_MODEL(rl->model), &child, ROOM_COLUMN, &tmproom, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
649 if (!tmproom)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
650 append = FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
651 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
652 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
653 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
654
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
655 if (append)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
656 gtk_tree_store_append(rl->model, &iter, (parentrr ? &parent : NULL));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
657 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
658 iter = child;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
659
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
660 if (room->type & GAIM_ROOMLIST_ROOMTYPE_CATAGORY)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
661 gtk_tree_store_append(rl->model, &child, &iter);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
662
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
663 path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
664
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
665 if (room->type & GAIM_ROOMLIST_ROOMTYPE_CATAGORY) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
666 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
667 g_hash_table_insert(rl->cats, room, rr);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
668 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
669
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
670 gtk_tree_path_free(path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
671
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
672 gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, room->name, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
673 gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
674
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
675 for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
676 GaimRoomlistField *f = k->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
677 if (f->hidden)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
678 continue;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
679 gtk_tree_store_set(rl->model, &iter, j, l->data, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
680 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
681 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
682
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
683 static void gaim_gtk_roomlist_in_progress(GaimRoomlist *list, gboolean flag)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
684 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
685 GaimGtkRoomlist *rl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
686
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
687 if (!rl || !rl->dialog)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
688 return;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
689
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
690 if (flag) {
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
691 if (rl->dialog->account_widget)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
692 gtk_widget_set_sensitive(rl->dialog->account_widget, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
693 gtk_widget_set_sensitive(rl->dialog->stop_button, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
694 gtk_widget_set_sensitive(rl->dialog->list_button, FALSE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
695 } else {
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
696 rl->dialog->pg_needs_pulse = FALSE;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
697 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(rl->dialog->progress), 0.0);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
698 if (rl->dialog->account_widget)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
699 gtk_widget_set_sensitive(rl->dialog->account_widget, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
700 gtk_widget_set_sensitive(rl->dialog->stop_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
701 gtk_widget_set_sensitive(rl->dialog->list_button, TRUE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
702 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
703 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
704
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
705 static void gaim_gtk_roomlist_destroy(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
706 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
707 GaimGtkRoomlist *rl;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
708
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
709 roomlists = g_list_remove(roomlists, list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
710
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
711 rl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
712
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
713 g_return_if_fail(rl != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
714
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
715 g_hash_table_destroy(rl->cats);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
716 g_free(rl);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
717 list->ui_data = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
718 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
719
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
720 static GaimRoomlistUiOps ops = {
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
721 gaim_gtk_roomlist_dialog_show_with_account,
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
722 gaim_gtk_roomlist_new,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
723 gaim_gtk_roomlist_set_fields,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
724 gaim_gtk_roomlist_add_room,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
725 gaim_gtk_roomlist_in_progress,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
726 gaim_gtk_roomlist_destroy
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
727 };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
728
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
729
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
730 void gaim_gtk_roomlist_init(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
731 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
732 gaim_roomlist_set_ui_ops(&ops);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
733 }