annotate src/gtkroomlist.c @ 9062:c6d32e1c0120

[gaim-migrate @ 9838] This adds a couple items to our service enum, and some #if 0'd code that doesn't do anything anyway, and makes us send a couple more flags with im's that don't mean a whole lot. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 25 May 2004 22:43:29 +0000
parents b875f5d57b81
children 1f2bbb359adb
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);
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;
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
274 GaimRoomlistRoom *category;
8113
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);
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
278 category = g_value_get_pointer(&val);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
280 if (!category->expanded_once) {
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
281 gaim_roomlist_expand_category(list, category);
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
282 category->expanded_once = TRUE;
8113
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
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
286 static gboolean account_filter_func(GaimAccount *account)
8113
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 GaimConnection *gc = gaim_account_get_connection(account);
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
289 GaimPluginProtocolInfo *prpl_info = NULL;
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
290
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
291 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
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 return (prpl_info->roomlist_get_list != NULL);
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
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
296 gboolean
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
297 gaim_gtk_roomlist_is_showable()
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
298 {
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
299 GList *c;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
300 GaimConnection *gc;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
301
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
302 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
303 gc = c->data;
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
304
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
305 if (account_filter_func(gaim_connection_get_account(gc)))
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
306 return TRUE;
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
307 }
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
308
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
309 return FALSE;
8113
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
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
312 GaimGtkRoomlistDialog *gaim_gtk_roomlist_dialog_new_with_account(GaimAccount *account)
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 *dialog;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
315 GtkWidget *window;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
316 GtkWidget *vbox;
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
317 GtkWidget *vbox2;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
318 GtkWidget *account_hbox;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
319 GtkWidget *bbox;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
320 GtkWidget *label;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
321
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
322 dialog = g_new0(GaimGtkRoomlistDialog, 1);
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8584
diff changeset
323 dialog->account = account;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
324
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
325 /* Create the window. */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
326 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
327 gtk_window_set_role(GTK_WINDOW(window), "room list");
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
328 gtk_window_set_title(GTK_WINDOW(window), _("Room List"));
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 gtk_container_set_border_width(GTK_CONTAINER(window), 12);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
331 gtk_widget_realize(window);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
332
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
333 g_signal_connect(G_OBJECT(window), "delete_event",
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
334 G_CALLBACK(delete_win_cb), dialog);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
335
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
336 /* Create the parent vbox for everything. */
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
337 vbox = gtk_vbox_new(FALSE, 12);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
338 gtk_container_add(GTK_CONTAINER(window), vbox);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
339 gtk_widget_show(vbox);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
340
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
341 vbox2 = gtk_vbox_new(FALSE, 12);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
342 gtk_container_add(GTK_CONTAINER(vbox), vbox2);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
343 gtk_widget_show(vbox2);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
344
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
345 /* accounts dropdown list */
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
346 account_hbox = gtk_hbox_new(FALSE, 6);
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
347 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
348 gtk_widget_show(account_hbox);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
349
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
350 label = gtk_label_new(NULL);
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
351 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
352 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:"));
8425
6d8ec773a485 [gaim-migrate @ 9155]
Christian Hammond <chipx86@chipx86.com>
parents: 8377
diff changeset
353 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
354 gtk_widget_show(label);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
355
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
356 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
357 G_CALLBACK(dialog_select_account_cb), account_filter_func, dialog);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
358
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
359 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
360 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
361 gtk_widget_show(dialog->account_widget);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
362
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
363 /* scrolled window */
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
364 dialog->sw = gtk_scrolled_window_new(NULL, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
365 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(dialog->sw),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
366 GTK_SHADOW_IN);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
367 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dialog->sw),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
368 GTK_POLICY_AUTOMATIC,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
369 GTK_POLICY_AUTOMATIC);
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
370 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
371 gtk_widget_set_size_request(dialog->sw, -1, 250);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
372 gtk_widget_show(dialog->sw);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
373
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
374 /* progress bar */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
375 dialog->progress = gtk_progress_bar_new();
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
376 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
377 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
378 gtk_widget_show(dialog->progress);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
379
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
380
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
381 /* button box */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
382 bbox = gtk_hbutton_box_new();
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
383 gtk_box_set_spacing(GTK_BOX(bbox), 6);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
384 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
385 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
386 gtk_widget_show(bbox);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
387
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
388 /* stop button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
389 dialog->stop_button = gtk_button_new_from_stock(GTK_STOCK_STOP);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
390 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
391 g_signal_connect(G_OBJECT(dialog->stop_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
392 G_CALLBACK(stop_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
393 gtk_widget_set_sensitive(dialog->stop_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
394 gtk_widget_show(dialog->stop_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
395
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
396 /* list button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
397 dialog->list_button = gtk_button_new_with_mnemonic(_("_Get List"));
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
398 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
399 g_signal_connect(G_OBJECT(dialog->list_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
400 G_CALLBACK(list_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
401 gtk_widget_show(dialog->list_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
402
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
403 /* join button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
404 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
405 GAIM_BUTTON_HORIZONTAL);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
406 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
407 g_signal_connect(G_OBJECT(dialog->join_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
408 G_CALLBACK(join_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
409 gtk_widget_set_sensitive(dialog->join_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
410 gtk_widget_show(dialog->join_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
411
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
412 /* close button */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
413 dialog->close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
414 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
415 g_signal_connect(G_OBJECT(dialog->close_button), "clicked",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
416 G_CALLBACK(close_button_cb), dialog);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
417 gtk_widget_show(dialog->close_button);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
418
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
419 /* show the dialog window and return the dialog */
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
420 gtk_widget_show(dialog->window);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
421
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
422 return dialog;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
423 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
424
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
425 GaimGtkRoomlistDialog *gaim_gtk_roomlist_dialog_new(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
426 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
427 return gaim_gtk_roomlist_dialog_new_with_account(NULL);
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
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
430 static void gaim_gtk_roomlist_dialog_show_with_account(GaimAccount *account)
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
431 {
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
432 GaimGtkRoomlistDialog *dialog;
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
433
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
434 dialog = gaim_gtk_roomlist_dialog_new_with_account(account);
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
435 if (!dialog)
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
436 return;
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
437
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
438 list_button_cb(GTK_BUTTON(dialog->list_button), dialog);
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
439 }
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
440
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
441 void gaim_gtk_roomlist_dialog_show(void)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
442 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
443 gaim_gtk_roomlist_dialog_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
444 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
445
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
446 static void gaim_gtk_roomlist_new(GaimRoomlist *list)
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 GaimGtkRoomlist *rl;
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 rl = g_new0(GaimGtkRoomlist, 1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
451
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
452 list->ui_data = rl;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
453
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
454 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
455
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
456 roomlists = g_list_append(roomlists, list);
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 int_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
460 GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
461 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
462 gchar buf[16];
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
463 int myint;
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 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
466
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
467 if (myint)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
468 g_snprintf(buf, sizeof(buf), "%d", myint);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
469 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
470 buf[0] = '\0';
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 g_object_set(renderer, "text", buf, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
473 }
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 /* 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
476 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
477 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
478 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
479 int c, d;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
480
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
481 c = d = 0;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
482
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
483 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
484 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
485
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
486 if (c == d)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
487 return 0;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
488 else if (c > d)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
489 return -1;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
490 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
491 return 1;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
492 }
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 static void gaim_gtk_roomlist_set_fields(GaimRoomlist *list, GList *fields)
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 GaimGtkRoomlist *grl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
497 gint columns = NUM_OF_COLUMNS;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
498 int j;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
499 GtkTreeStore *model;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
500 GtkWidget *tree;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
501 GtkCellRenderer *renderer;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
502 GtkTreeViewColumn *column;
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
503 GtkTreeSelection *selection;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
504 GList *l;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
505 GType *types;
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 g_return_if_fail(grl != NULL);
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 columns += g_list_length(fields);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
510 types = g_new(GType, columns);
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 types[NAME_COLUMN] = G_TYPE_STRING;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
513 types[ROOM_COLUMN] = G_TYPE_POINTER;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
514
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
515 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
516 GaimRoomlistField *f = l->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
517
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
518 switch (f->type) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
519 case GAIM_ROOMLIST_FIELD_BOOL:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
520 types[j] = G_TYPE_BOOLEAN;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
521 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
522 case GAIM_ROOMLIST_FIELD_INT:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
523 types[j] = G_TYPE_INT;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
524 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
525 case GAIM_ROOMLIST_FIELD_STRING:
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
526 types[j] = G_TYPE_STRING;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
527 break;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
528 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
529 }
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 model = gtk_tree_store_newv(columns, types);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
532 g_free(types);
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 tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
535 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
536
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
537 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
538 g_signal_connect(G_OBJECT(selection), "changed",
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
539 G_CALLBACK(selection_changed_cb), grl);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
540
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
541 g_object_unref(model);
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 grl->model = model;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
544 grl->tree = tree;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
545 gtk_widget_show(grl->tree);
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 renderer = gtk_cell_renderer_text_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
548 column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
549 "text", NAME_COLUMN, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
550 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
551 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
552 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
553 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
554 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
555 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
556
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
557 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
558 GaimRoomlistField *f = l->data;
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 if (f->hidden)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
561 continue;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
562
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
563 renderer = gtk_cell_renderer_text_new();
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
564 column = gtk_tree_view_column_new_with_attributes(f->label, renderer,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
565 "text", j, NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
566 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
567 GTK_TREE_VIEW_COLUMN_GROW_ONLY);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
568 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
569 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
570 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
571 if (f->type == GAIM_ROOMLIST_FIELD_INT) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
572 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
573 GINT_TO_POINTER(j), NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
574 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
575 GINT_TO_POINTER(j), NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
576 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
577 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
578 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
579
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
580 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
581 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
582 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
583 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
584
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
585 static gboolean gaim_gtk_progress_bar_pulse(gpointer data)
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
586 {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
587 GaimRoomlist *list = data;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
588 GaimGtkRoomlist *rl = list->ui_data;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
589
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
590 if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
591 rl->dialog->pg_to_active = FALSE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
592 gaim_roomlist_unref(list);
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
593 return FALSE;
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
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
596 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress));
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
597 rl->dialog->pg_needs_pulse = FALSE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
598 return TRUE;
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
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
601 static void gaim_gtk_roomlist_add_room(GaimRoomlist *list, GaimRoomlistRoom *room)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
602 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
603 GaimGtkRoomlist *rl= list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
604 GtkTreeRowReference *rr, *parentrr = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
605 GtkTreePath *path;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
606 GtkTreeIter iter, parent, child;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
607 GList *l, *k;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
608 int j;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
609 gboolean append = TRUE;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
610
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
611 rl->total_rooms++;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
612 if (room->type == GAIM_ROOMLIST_ROOMTYPE_ROOM)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
613 rl->num_rooms++;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
614
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
615 if (rl->dialog) {
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
616 if (!rl->dialog->pg_to_active) {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
617 rl->dialog->pg_to_active = TRUE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
618 gaim_roomlist_ref(list);
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
619 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
620 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress));
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
621 } else {
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
622 rl->dialog->pg_needs_pulse = TRUE;
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
623 }
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
624 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
625 if (room->parent) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
626 parentrr = g_hash_table_lookup(rl->cats, room->parent);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
627 path = gtk_tree_row_reference_get_path(parentrr);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
628 if (path) {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
629 GaimRoomlistRoom *tmproom = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
630
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
631 gtk_tree_model_get_iter(GTK_TREE_MODEL(rl->model), &parent, path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
632 gtk_tree_path_free(path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
633
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
634 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
635 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
636 if (!tmproom)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
637 append = FALSE;
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 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
640 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
641
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
642 if (append)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
643 gtk_tree_store_append(rl->model, &iter, (parentrr ? &parent : NULL));
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
644 else
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
645 iter = child;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
646
8584
058efd3cb86f [gaim-migrate @ 9334]
Luke Schierer <lschiere@pidgin.im>
parents: 8425
diff changeset
647 if (room->type & GAIM_ROOMLIST_ROOMTYPE_CATEGORY)
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
648 gtk_tree_store_append(rl->model, &child, &iter);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
649
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
650 path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter);
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 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
654 g_hash_table_insert(rl->cats, room, rr);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
655 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
656
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
657 gtk_tree_path_free(path);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
658
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
659 gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, room->name, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
660 gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1);
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 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
663 GaimRoomlistField *f = k->data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
664 if (f->hidden)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
665 continue;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
666 gtk_tree_store_set(rl->model, &iter, j, l->data, -1);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
667 }
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 static void gaim_gtk_roomlist_in_progress(GaimRoomlist *list, gboolean flag)
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 GaimGtkRoomlist *rl = list->ui_data;
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 if (!rl || !rl->dialog)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
675 return;
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 if (flag) {
8199
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
678 if (rl->dialog->account_widget)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
679 gtk_widget_set_sensitive(rl->dialog->account_widget, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
680 gtk_widget_set_sensitive(rl->dialog->stop_button, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
681 gtk_widget_set_sensitive(rl->dialog->list_button, FALSE);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
682 } else {
8230
4e354776ae2a [gaim-migrate @ 8953]
Luke Schierer <lschiere@pidgin.im>
parents: 8199
diff changeset
683 rl->dialog->pg_needs_pulse = FALSE;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
684 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
685 if (rl->dialog->account_widget)
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
686 gtk_widget_set_sensitive(rl->dialog->account_widget, TRUE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
687 gtk_widget_set_sensitive(rl->dialog->stop_button, FALSE);
12055bae7f59 [gaim-migrate @ 8922]
Nathan Walp <nwalp@pidgin.im>
parents: 8146
diff changeset
688 gtk_widget_set_sensitive(rl->dialog->list_button, TRUE);
8113
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 }
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
691
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
692 static void gaim_gtk_roomlist_destroy(GaimRoomlist *list)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
693 {
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
694 GaimGtkRoomlist *rl;
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 roomlists = g_list_remove(roomlists, list);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
697
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
698 rl = list->ui_data;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
699
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
700 g_return_if_fail(rl != NULL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
701
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
702 g_hash_table_destroy(rl->cats);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
703 g_free(rl);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
704 list->ui_data = NULL;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
705 }
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 static GaimRoomlistUiOps ops = {
8352
77baefe979c6 [gaim-migrate @ 9076]
Nathan Walp <nwalp@pidgin.im>
parents: 8287
diff changeset
708 gaim_gtk_roomlist_dialog_show_with_account,
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
709 gaim_gtk_roomlist_new,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
710 gaim_gtk_roomlist_set_fields,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
711 gaim_gtk_roomlist_add_room,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
712 gaim_gtk_roomlist_in_progress,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
713 gaim_gtk_roomlist_destroy
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
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
716
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
717 void gaim_gtk_roomlist_init(void)
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 gaim_roomlist_set_ui_ops(&ops);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
720 }