annotate src/gtkroomlist.c @ 9273:227d3d6c6565

[gaim-migrate @ 10076] this fixes a logging issue with apostrophes committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 12 Jun 2004 21:48:49 +0000
parents 31be05742be9
children 03be9d653123
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 /**
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
2 * @file gtkroomlist.c GTK+ Room List UI
8113
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);
9159
31be05742be9 [gaim-migrate @ 9943]
Tim Ringenbach <marv@pidgin.im>
parents: 9067
diff changeset
119 if (!dialog->roomlist)
31be05742be9 [gaim-migrate @ 9943]
Tim Ringenbach <marv@pidgin.im>
parents: 9067
diff changeset
120 return;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
121 gaim_roomlist_ref(dialog->roomlist);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
122 rl = dialog->roomlist->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
123 rl->dialog = dialog;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
124
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
125 if (dialog->account_widget)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
126 gtk_widget_set_sensitive(dialog->account_widget, FALSE);
8199
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_container_add(GTK_CONTAINER(dialog->sw), rl->tree);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
129
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
130 gtk_widget_set_sensitive(dialog->stop_button, TRUE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
131 gtk_widget_set_sensitive(dialog->list_button, FALSE);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
132 gtk_widget_set_sensitive(dialog->join_button, FALSE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
133 }
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 static void stop_button_cb(GtkButton *button, GaimGtkRoomlistDialog *dialog)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
136 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
137 gaim_roomlist_cancel_get_list(dialog->roomlist);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
138
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
139 if (dialog->account_widget)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
140 gtk_widget_set_sensitive(dialog->account_widget, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
141
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
142 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
143 gtk_widget_set_sensitive(dialog->list_button, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
144 gtk_widget_set_sensitive(dialog->join_button, FALSE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
145 }
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 static void close_button_cb(GtkButton *button, GaimGtkRoomlistDialog *dialog)
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 GtkWidget *window = dialog->window;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
150
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
151 delete_win_cb(NULL, NULL, dialog);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
152 gtk_widget_destroy(window);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
153 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
155 struct _menu_cb_info {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
156 GaimRoomlist *list;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
157 GaimRoomlistRoom *room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
158 };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
159
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
160 static void
8377
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
161 join_button_data_change_cb(gpointer data) {
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
162 g_free(data);
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
163 }
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
164
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
165 static void
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
166 selection_changed_cb(GtkTreeSelection *selection, GaimGtkRoomlist *grl) {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
167 GtkTreeIter iter;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
168 GValue val = { 0, };
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
169 GaimRoomlistRoom *room;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
170 static struct _menu_cb_info *info;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
171 GaimGtkRoomlistDialog *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 dialog = grl->dialog;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
174
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
175 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
176 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
177 room = g_value_get_pointer(&val);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
178 if (!room || !(room->type & GAIM_ROOMLIST_ROOMTYPE_ROOM)) {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
179 gtk_widget_set_sensitive(dialog->join_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
180 return;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
181 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
182
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
183 info = g_new0(struct _menu_cb_info, 1);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
184 info->list = dialog->roomlist;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
185 info->room = room;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
186
8377
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
187 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
188 info, join_button_data_change_cb);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
189
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
190 gtk_widget_set_sensitive(dialog->join_button, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
191 } else {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
192 gtk_widget_set_sensitive(dialog->join_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
193 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
194 }
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
195
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
196 static void do_join_cb(GtkWidget *w, struct _menu_cb_info *info)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
197 {
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
198 gaim_roomlist_room_join(info->list, info->room);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
199 }
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
200
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
201 static void join_button_cb(GtkButton *button, GaimGtkRoomlistDialog *dialog)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
202 {
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
203 GaimRoomlist *rl = dialog->roomlist;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
204 GaimGtkRoomlist *grl = rl->ui_data;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
205 struct _menu_cb_info *info;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
206
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
207 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
208
8377
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
209 if(info != NULL)
c1ca19c8f749 [gaim-migrate @ 9104]
Luke Schierer <lschiere@pidgin.im>
parents: 8352
diff changeset
210 do_join_cb(grl->tree, info);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
211 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
212
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
213 static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
214 GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
215 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 GaimGtkRoomlist *grl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217 GtkTreeIter iter;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218 GaimRoomlistRoom *room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 GValue val = { 0, };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
220 struct _menu_cb_info info;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
221
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
223 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
224 room = g_value_get_pointer(&val);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225 if (!room || !(room->type & GAIM_ROOMLIST_ROOMTYPE_ROOM))
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
226 return;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228 info.list = list;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229 info.room = room;
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 do_join_cb(GTK_WIDGET(tv), &info);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
232 }
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 static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
235 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
236 GtkTreePath *path;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
237 GaimGtkRoomlist *grl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
238 GValue val = { 0, };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
239 GaimRoomlistRoom *room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
240 GtkTreeIter iter;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
241 GtkWidget *menu;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
242 static struct _menu_cb_info info; /* XXX? */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
243
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
244 if (event->button != 3 || event->type != GDK_BUTTON_PRESS)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
245 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
246
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
247 /* Here we figure out which room was clicked */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
248 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
249 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
250 gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
251 gtk_tree_path_free(path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
252 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
253 room = g_value_get_pointer(&val);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
254
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
255 if (!room || !(room->type & GAIM_ROOMLIST_ROOMTYPE_ROOM))
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
256 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
257
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
258 info.list = list;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
259 info.room = room;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
260
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
261
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
262 menu = gtk_menu_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
263 gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
264 G_CALLBACK(do_join_cb), &info, 0, 0, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
265
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
266
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
267 gtk_widget_show_all(menu);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
268 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
269
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
270 return FALSE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
271 }
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 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
274 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
275 GaimRoomlist *list = user_data;
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
276 GaimRoomlistRoom *category;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
277 GValue val = { 0, };
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
278
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279 gtk_tree_model_get_value(gtk_tree_view_get_model(treeview), arg1, ROOM_COLUMN, &val);
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
280 category = g_value_get_pointer(&val);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
281
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
282 if (!category->expanded_once) {
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
283 gaim_roomlist_expand_category(list, category);
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
284 category->expanded_once = TRUE;
8113
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 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
287
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
288 static gboolean account_filter_func(GaimAccount *account)
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
289 {
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
290 GaimConnection *gc = gaim_account_get_connection(account);
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
291 GaimPluginProtocolInfo *prpl_info = NULL;
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
292
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
293 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
294
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
295 return (prpl_info->roomlist_get_list != NULL);
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
296 }
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
297
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
298 gboolean
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
299 gaim_gtk_roomlist_is_showable()
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
300 {
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
301 GList *c;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
302 GaimConnection *gc;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
303
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
304 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
305 gc = c->data;
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
306
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
307 if (account_filter_func(gaim_connection_get_account(gc)))
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
308 return TRUE;
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
309 }
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
310
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
311 return FALSE;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
312 }
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 GaimGtkRoomlistDialog *gaim_gtk_roomlist_dialog_new_with_account(GaimAccount *account)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
315 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
316 GaimGtkRoomlistDialog *dialog;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
317 GtkWidget *window;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
318 GtkWidget *vbox;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
319 GtkWidget *vbox2;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
320 GtkWidget *account_hbox;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
321 GtkWidget *bbox;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
322 GtkWidget *label;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
323
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
324 dialog = g_new0(GaimGtkRoomlistDialog, 1);
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8584
diff changeset
325 dialog->account = account;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
326
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
327 /* Create the window. */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
328 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
329 gtk_window_set_role(GTK_WINDOW(window), "room list");
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
330 gtk_window_set_title(GTK_WINDOW(window), _("Room List"));
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 gtk_container_set_border_width(GTK_CONTAINER(window), 12);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
333 gtk_widget_realize(window);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
334
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
335 g_signal_connect(G_OBJECT(window), "delete_event",
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
336 G_CALLBACK(delete_win_cb), dialog);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
337
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
338 /* Create the parent vbox for everything. */
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
339 vbox = gtk_vbox_new(FALSE, 12);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
340 gtk_container_add(GTK_CONTAINER(window), vbox);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
341 gtk_widget_show(vbox);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
342
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
343 vbox2 = gtk_vbox_new(FALSE, 12);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
344 gtk_container_add(GTK_CONTAINER(vbox), vbox2);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
345 gtk_widget_show(vbox2);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
346
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
347 /* accounts dropdown list */
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
348 account_hbox = gtk_hbox_new(FALSE, 6);
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
349 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
350 gtk_widget_show(account_hbox);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
351
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
352 label = gtk_label_new(NULL);
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
353 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
354 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:"));
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
355 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
356 gtk_widget_show(label);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
357
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
358 dialog->account_widget = gaim_gtk_account_option_menu_new(dialog->account, FALSE,
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
359 G_CALLBACK(dialog_select_account_cb), account_filter_func, dialog);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
360
9067
1f2bbb359adb [gaim-migrate @ 9843]
Tim Ringenbach <marv@pidgin.im>
parents: 8940
diff changeset
361 if (!dialog->account) /* this is normally null, and we normally don't care what the first selected item is */
1f2bbb359adb [gaim-migrate @ 9843]
Tim Ringenbach <marv@pidgin.im>
parents: 8940
diff changeset
362 dialog->account = gaim_gtk_account_option_menu_get_selected(dialog->account_widget);
1f2bbb359adb [gaim-migrate @ 9843]
Tim Ringenbach <marv@pidgin.im>
parents: 8940
diff changeset
363
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
364 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
365 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
366 gtk_widget_show(dialog->account_widget);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
367
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
368 /* scrolled window */
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
369 dialog->sw = gtk_scrolled_window_new(NULL, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
370 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(dialog->sw),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
371 GTK_SHADOW_IN);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
372 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dialog->sw),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
373 GTK_POLICY_AUTOMATIC,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
374 GTK_POLICY_AUTOMATIC);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
375 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
376 gtk_widget_set_size_request(dialog->sw, -1, 250);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
377 gtk_widget_show(dialog->sw);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
378
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
379 /* progress bar */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
380 dialog->progress = gtk_progress_bar_new();
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
381 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
382 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
383 gtk_widget_show(dialog->progress);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
384
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
385
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
386 /* button box */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
387 bbox = gtk_hbutton_box_new();
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
388 gtk_box_set_spacing(GTK_BOX(bbox), 6);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
389 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
390 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
391 gtk_widget_show(bbox);
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 /* stop button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
394 dialog->stop_button = gtk_button_new_from_stock(GTK_STOCK_STOP);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
395 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
396 g_signal_connect(G_OBJECT(dialog->stop_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
397 G_CALLBACK(stop_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
398 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
399 gtk_widget_show(dialog->stop_button);
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 /* list button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
402 dialog->list_button = gtk_button_new_with_mnemonic(_("_Get List"));
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
403 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
404 g_signal_connect(G_OBJECT(dialog->list_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
405 G_CALLBACK(list_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
406 gtk_widget_show(dialog->list_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
407
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
408 /* join button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
409 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
410 GAIM_BUTTON_HORIZONTAL);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
411 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
412 g_signal_connect(G_OBJECT(dialog->join_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
413 G_CALLBACK(join_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
414 gtk_widget_set_sensitive(dialog->join_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
415 gtk_widget_show(dialog->join_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
416
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
417 /* close button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
418 dialog->close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
419 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
420 g_signal_connect(G_OBJECT(dialog->close_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
421 G_CALLBACK(close_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
422 gtk_widget_show(dialog->close_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
423
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
424 /* show the dialog window and return the dialog */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
425 gtk_widget_show(dialog->window);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
426
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
427 return dialog;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
428 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
429
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
430 GaimGtkRoomlistDialog *gaim_gtk_roomlist_dialog_new(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
431 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
432 return gaim_gtk_roomlist_dialog_new_with_account(NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
433 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
434
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
435 static void gaim_gtk_roomlist_dialog_show_with_account(GaimAccount *account)
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
436 {
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
437 GaimGtkRoomlistDialog *dialog;
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
438
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
439 dialog = gaim_gtk_roomlist_dialog_new_with_account(account);
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
440 if (!dialog)
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
441 return;
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
442
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
443 list_button_cb(GTK_BUTTON(dialog->list_button), dialog);
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
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
446 void gaim_gtk_roomlist_dialog_show(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
447 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
448 gaim_gtk_roomlist_dialog_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
449 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
450
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
451 static void gaim_gtk_roomlist_new(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
452 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
453 GaimGtkRoomlist *rl;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
454
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
455 rl = g_new0(GaimGtkRoomlist, 1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
456
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
457 list->ui_data = rl;
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 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
460
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
461 roomlists = g_list_append(roomlists, list);
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
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
464 static void int_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
465 GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
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 gchar buf[16];
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
468 int myint;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
469
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
470 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
471
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
472 if (myint)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
473 g_snprintf(buf, sizeof(buf), "%d", myint);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
474 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
475 buf[0] = '\0';
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
476
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
477 g_object_set(renderer, "text", buf, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
478 }
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 /* 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
481 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
482 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
483 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
484 int c, d;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
485
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
486 c = d = 0;
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 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
489 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
490
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
491 if (c == d)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
492 return 0;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
493 else if (c > d)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
494 return -1;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
495 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
496 return 1;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
497 }
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 static void gaim_gtk_roomlist_set_fields(GaimRoomlist *list, GList *fields)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
500 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
501 GaimGtkRoomlist *grl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
502 gint columns = NUM_OF_COLUMNS;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
503 int j;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
504 GtkTreeStore *model;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
505 GtkWidget *tree;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
506 GtkCellRenderer *renderer;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
507 GtkTreeViewColumn *column;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
508 GtkTreeSelection *selection;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
509 GList *l;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
510 GType *types;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
511
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
512 g_return_if_fail(grl != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
513
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
514 columns += g_list_length(fields);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
515 types = g_new(GType, columns);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
516
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
517 types[NAME_COLUMN] = G_TYPE_STRING;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
518 types[ROOM_COLUMN] = G_TYPE_POINTER;
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 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
521 GaimRoomlistField *f = l->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
522
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
523 switch (f->type) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
524 case GAIM_ROOMLIST_FIELD_BOOL:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
525 types[j] = G_TYPE_BOOLEAN;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
526 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
527 case GAIM_ROOMLIST_FIELD_INT:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
528 types[j] = G_TYPE_INT;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
529 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
530 case GAIM_ROOMLIST_FIELD_STRING:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
531 types[j] = G_TYPE_STRING;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
532 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
533 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
534 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
535
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
536 model = gtk_tree_store_newv(columns, types);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
537 g_free(types);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
538
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
539 tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
540 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
541
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
542 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
543 g_signal_connect(G_OBJECT(selection), "changed",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
544 G_CALLBACK(selection_changed_cb), grl);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
545
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
546 g_object_unref(model);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
547
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
548 grl->model = model;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
549 grl->tree = tree;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
550 gtk_widget_show(grl->tree);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
551
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
552 renderer = gtk_cell_renderer_text_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
553 column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
554 "text", NAME_COLUMN, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
555 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
556 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
557 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
558 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
559 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
560 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
561
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
562 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
563 GaimRoomlistField *f = l->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
564
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
565 if (f->hidden)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
566 continue;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
567
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
568 renderer = gtk_cell_renderer_text_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
569 column = gtk_tree_view_column_new_with_attributes(f->label, renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
570 "text", j, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
571 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
572 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
573 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
574 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
575 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
576 if (f->type == GAIM_ROOMLIST_FIELD_INT) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
577 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
578 GINT_TO_POINTER(j), NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
579 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
580 GINT_TO_POINTER(j), NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
581 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
582 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
583 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
584
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
585 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
586 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
587 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
588 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
589
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
590 static gboolean gaim_gtk_progress_bar_pulse(gpointer data)
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
591 {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
592 GaimRoomlist *list = data;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
593 GaimGtkRoomlist *rl = list->ui_data;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
594
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
595 if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
596 rl->dialog->pg_to_active = FALSE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
597 gaim_roomlist_unref(list);
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
598 return FALSE;
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
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
601 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress));
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
602 rl->dialog->pg_needs_pulse = FALSE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
603 return TRUE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
604 }
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
605
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
606 static void gaim_gtk_roomlist_add_room(GaimRoomlist *list, GaimRoomlistRoom *room)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
607 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
608 GaimGtkRoomlist *rl= list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
609 GtkTreeRowReference *rr, *parentrr = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
610 GtkTreePath *path;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
611 GtkTreeIter iter, parent, child;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
612 GList *l, *k;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
613 int j;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
614 gboolean append = TRUE;
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 rl->total_rooms++;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
617 if (room->type == GAIM_ROOMLIST_ROOMTYPE_ROOM)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
618 rl->num_rooms++;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
619
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
620 if (rl->dialog) {
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
621 if (!rl->dialog->pg_to_active) {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
622 rl->dialog->pg_to_active = TRUE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
623 gaim_roomlist_ref(list);
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
624 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
625 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress));
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
626 } else {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
627 rl->dialog->pg_needs_pulse = TRUE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
628 }
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
629 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
630 if (room->parent) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
631 parentrr = g_hash_table_lookup(rl->cats, room->parent);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
632 path = gtk_tree_row_reference_get_path(parentrr);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
633 if (path) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
634 GaimRoomlistRoom *tmproom = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
635
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
636 gtk_tree_model_get_iter(GTK_TREE_MODEL(rl->model), &parent, path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
637 gtk_tree_path_free(path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
638
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
639 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
640 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
641 if (!tmproom)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
642 append = FALSE;
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 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
645 }
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 (append)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
648 gtk_tree_store_append(rl->model, &iter, (parentrr ? &parent : NULL));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
649 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
650 iter = child;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
651
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
652 if (room->type & GAIM_ROOMLIST_ROOMTYPE_CATEGORY)
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
653 gtk_tree_store_append(rl->model, &child, &iter);
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 path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
656
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
657 if (room->type & GAIM_ROOMLIST_ROOMTYPE_CATEGORY) {
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
658 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
659 g_hash_table_insert(rl->cats, room, rr);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
660 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
661
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
662 gtk_tree_path_free(path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
663
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
664 gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, room->name, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
665 gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
666
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
667 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
668 GaimRoomlistField *f = k->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
669 if (f->hidden)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
670 continue;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
671 gtk_tree_store_set(rl->model, &iter, j, l->data, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
672 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
673 }
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 static void gaim_gtk_roomlist_in_progress(GaimRoomlist *list, gboolean flag)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
676 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
677 GaimGtkRoomlist *rl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
678
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
679 if (!rl || !rl->dialog)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
680 return;
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 if (flag) {
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
683 if (rl->dialog->account_widget)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
684 gtk_widget_set_sensitive(rl->dialog->account_widget, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
685 gtk_widget_set_sensitive(rl->dialog->stop_button, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
686 gtk_widget_set_sensitive(rl->dialog->list_button, FALSE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
687 } else {
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
688 rl->dialog->pg_needs_pulse = FALSE;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
689 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
690 if (rl->dialog->account_widget)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
691 gtk_widget_set_sensitive(rl->dialog->account_widget, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
692 gtk_widget_set_sensitive(rl->dialog->stop_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
693 gtk_widget_set_sensitive(rl->dialog->list_button, TRUE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
694 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
695 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
696
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
697 static void gaim_gtk_roomlist_destroy(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
698 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
699 GaimGtkRoomlist *rl;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
700
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
701 roomlists = g_list_remove(roomlists, list);
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 rl = list->ui_data;
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 g_return_if_fail(rl != NULL);
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 g_hash_table_destroy(rl->cats);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
708 g_free(rl);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
709 list->ui_data = NULL;
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
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
712 static GaimRoomlistUiOps ops = {
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
713 gaim_gtk_roomlist_dialog_show_with_account,
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
714 gaim_gtk_roomlist_new,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
715 gaim_gtk_roomlist_set_fields,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
716 gaim_gtk_roomlist_add_room,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
717 gaim_gtk_roomlist_in_progress,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
718 gaim_gtk_roomlist_destroy
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
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
721
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
722 void gaim_gtk_roomlist_init(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
723 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
724 gaim_roomlist_set_ui_ops(&ops);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
725 }