Wed, 05 Feb 2020 02:01:25 -0600
Fix whitespace
Signed-off-by: Richard Laager <rlaager@pidgin.im>
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 8113 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
8146
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8143
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8143
diff
changeset
|
5 | * source distribution. |
| 8113 | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18122
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8113 | 20 | */ |
| 21 | ||
| 9791 | 22 | #include "internal.h" |
| 15577 | 23 | #include "pidgin.h" |
| 8113 | 24 | #include "gtkutils.h" |
|
39785
aa7e3b71802d
Split pidgin_account_option_menu into its own files.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
25 | #include "pidginaccountchooser.h" |
|
15883
969b74a3e27a
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents:
15882
diff
changeset
|
26 | #include "pidginstock.h" |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
27 | #include "pidgintooltip.h" |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
28 | |
| 8113 | 29 | #include "debug.h" |
| 30 | #include "account.h" | |
| 31 | #include "connection.h" | |
| 32 | #include "notify.h" | |
| 33 | ||
| 34 | #include "gtkroomlist.h" | |
| 35 | ||
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
36 | #define PIDGIN_TYPE_ROOMLIST_DIALOG (pidgin_roomlist_dialog_get_type()) |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
37 | G_DECLARE_FINAL_TYPE(PidginRoomlistDialog, pidgin_roomlist_dialog, PIDGIN, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
38 | ROOMLIST_DIALOG, GtkDialog) |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
39 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
40 | struct _PidginRoomlistDialog { |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
41 | GtkDialog parent; |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
42 | |
| 8113 | 43 | GtkWidget *account_widget; |
| 44 | GtkWidget *progress; | |
| 45 | GtkWidget *sw; | |
| 46 | ||
| 8199 | 47 | GtkWidget *stop_button; |
| 8113 | 48 | GtkWidget *list_button; |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
49 | GtkWidget *add_button; |
| 8199 | 50 | GtkWidget *join_button; |
| 8113 | 51 | GtkWidget *close_button; |
| 52 | ||
| 15884 | 53 | PurpleAccount *account; |
| 54 | PurpleRoomlist *roomlist; | |
| 8230 | 55 | |
| 56 | gboolean pg_needs_pulse; | |
| 57 | guint pg_update_to; | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
58 | }; |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
59 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
60 | G_DEFINE_TYPE(PidginRoomlistDialog, pidgin_roomlist_dialog, GTK_TYPE_DIALOG) |
| 14649 | 61 | |
|
39556
622bf98df0ac
Remove unnecessary struct tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38707
diff
changeset
|
62 | typedef struct { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
63 | PidginRoomlistDialog *dialog; |
| 14649 | 64 | GtkTreeStore *model; |
| 65 | GtkWidget *tree; | |
|
35470
8ee08a41f2f3
Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
66 | GHashTable *cats; /* Meow. */ |
| 14649 | 67 | gint num_rooms, total_rooms; |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
68 | GtkWidget *tipwindow; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
69 | GdkRectangle tip_rect; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
70 | PangoLayout *tip_layout; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
71 | PangoLayout *tip_name_layout; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
72 | int tip_height; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
73 | int tip_width; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
74 | int tip_name_height; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
75 | int tip_name_width; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
76 | } PidginRoomlist; |
| 8113 | 77 | |
| 78 | enum { | |
| 79 | NAME_COLUMN = 0, | |
| 80 | ROOM_COLUMN, | |
| 81 | NUM_OF_COLUMNS, | |
| 82 | }; | |
| 83 | ||
| 84 | static GList *roomlists = NULL; | |
| 85 | ||
| 86 | static gint delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
| 87 | { | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
88 | PidginRoomlistDialog *dialog = PIDGIN_ROOMLIST_DIALOG(w); |
| 8113 | 89 | |
| 15884 | 90 | if (dialog->roomlist && purple_roomlist_get_in_progress(dialog->roomlist)) |
| 91 | purple_roomlist_cancel_get_list(dialog->roomlist); | |
| 8199 | 92 | |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
93 | if (dialog->pg_update_to > 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
37879
diff
changeset
|
94 | g_source_remove(dialog->pg_update_to); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
95 | |
| 8230 | 96 | if (dialog->roomlist) { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
97 | PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
98 | |
|
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
99 | if (dialog->pg_update_to > 0) |
| 8230 | 100 | /* yes, that's right, unref it twice. */ |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
101 | g_object_unref(dialog->roomlist); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
102 | |
|
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
103 | if (rl) |
|
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
104 | rl->dialog = NULL; |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
105 | g_object_unref(dialog->roomlist); |
| 8230 | 106 | } |
| 107 | ||
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
108 | dialog->progress = NULL; |
| 8113 | 109 | |
| 110 | return FALSE; | |
| 111 | } | |
| 112 | ||
|
39787
af7ae86ee287
Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39786
diff
changeset
|
113 | static void |
|
af7ae86ee287
Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39786
diff
changeset
|
114 | dialog_select_account_cb(GtkWidget *chooser, PidginRoomlistDialog *dialog) |
| 8113 | 115 | { |
|
39787
af7ae86ee287
Remove callback from account chooser constructor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39786
diff
changeset
|
116 | PurpleAccount *account = pidgin_account_chooser_get_selected(chooser); |
|
28704
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
117 | gboolean change = (account != dialog->account); |
| 8113 | 118 | dialog->account = account; |
|
28704
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
119 | |
|
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
120 | if (change && dialog->roomlist) { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
121 | PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist); |
|
28704
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
122 | if (rl->tree) { |
|
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
123 | gtk_widget_destroy(rl->tree); |
|
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
124 | rl->tree = NULL; |
|
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
125 | } |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
126 | g_object_unref(dialog->roomlist); |
|
28704
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
127 | dialog->roomlist = NULL; |
|
0c1d6f63740f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <darkrain42@pidgin.im>
parents:
26574
diff
changeset
|
128 | } |
| 8113 | 129 | } |
| 130 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
131 | static void list_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
| 8113 | 132 | { |
| 15884 | 133 | PurpleConnection *gc; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
134 | PidginRoomlist *rl; |
| 8113 | 135 | |
| 15884 | 136 | gc = purple_account_get_connection(dialog->account); |
| 8113 | 137 | if (!gc) |
| 138 | return; | |
| 139 | ||
| 8199 | 140 | if (dialog->roomlist != NULL) { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
141 | rl = purple_roomlist_get_ui_data(dialog->roomlist); |
| 8199 | 142 | gtk_widget_destroy(rl->tree); |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
143 | g_object_unref(dialog->roomlist); |
| 8199 | 144 | } |
| 145 | ||
| 15884 | 146 | dialog->roomlist = purple_roomlist_get_list(gc); |
| 9159 | 147 | if (!dialog->roomlist) |
| 148 | return; | |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
149 | g_object_ref(dialog->roomlist); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
150 | rl = purple_roomlist_get_ui_data(dialog->roomlist); |
| 8113 | 151 | rl->dialog = dialog; |
| 8199 | 152 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
153 | gtk_widget_set_sensitive(dialog->account_widget, FALSE); |
| 8199 | 154 | |
| 155 | gtk_container_add(GTK_CONTAINER(dialog->sw), rl->tree); | |
| 156 | ||
| 15884 | 157 | /* some protocols (not bundled with libpurple) finish getting their |
| 15350 | 158 | * room list immediately */ |
| 15884 | 159 | if(purple_roomlist_get_in_progress(dialog->roomlist)) { |
| 15350 | 160 | gtk_widget_set_sensitive(dialog->stop_button, TRUE); |
| 161 | gtk_widget_set_sensitive(dialog->list_button, FALSE); | |
| 162 | } else { | |
| 163 | gtk_widget_set_sensitive(dialog->stop_button, FALSE); | |
| 164 | gtk_widget_set_sensitive(dialog->list_button, TRUE); | |
| 165 | } | |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
166 | gtk_widget_set_sensitive(dialog->add_button, FALSE); |
| 8199 | 167 | gtk_widget_set_sensitive(dialog->join_button, FALSE); |
| 8113 | 168 | } |
| 169 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
170 | static void stop_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
| 8113 | 171 | { |
| 15884 | 172 | purple_roomlist_cancel_get_list(dialog->roomlist); |
| 8199 | 173 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
174 | gtk_widget_set_sensitive(dialog->account_widget, TRUE); |
| 8199 | 175 | |
| 176 | gtk_widget_set_sensitive(dialog->stop_button, FALSE); | |
| 177 | gtk_widget_set_sensitive(dialog->list_button, TRUE); | |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
178 | gtk_widget_set_sensitive(dialog->add_button, FALSE); |
| 8199 | 179 | gtk_widget_set_sensitive(dialog->join_button, FALSE); |
| 8113 | 180 | } |
| 181 | ||
| 182 | struct _menu_cb_info { | |
| 15884 | 183 | PurpleRoomlist *list; |
| 184 | PurpleRoomlistRoom *room; | |
| 8113 | 185 | }; |
| 186 | ||
| 8199 | 187 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
188 | selection_changed_cb(GtkTreeSelection *selection, PidginRoomlist *grl) { |
| 8199 | 189 | GtkTreeIter iter; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
190 | GValue val; |
| 15884 | 191 | PurpleRoomlistRoom *room; |
| 8199 | 192 | static struct _menu_cb_info *info; |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
193 | PidginRoomlistDialog *dialog = grl->dialog; |
| 8199 | 194 | |
| 195 | if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
196 | val.g_type = 0; |
| 8199 | 197 | gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); |
| 198 | room = g_value_get_pointer(&val); | |
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
199 | if (!room || !(purple_roomlist_room_get_room_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) { |
| 8199 | 200 | gtk_widget_set_sensitive(dialog->join_button, FALSE); |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
201 | gtk_widget_set_sensitive(dialog->add_button, FALSE); |
| 8199 | 202 | return; |
| 203 | } | |
| 204 | ||
| 205 | info = g_new0(struct _menu_cb_info, 1); | |
| 206 | info->list = dialog->roomlist; | |
| 207 | info->room = room; | |
| 208 | ||
| 8377 | 209 | g_object_set_data_full(G_OBJECT(dialog->join_button), "room-info", |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
210 | info, g_free); |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
211 | g_object_set_data(G_OBJECT(dialog->add_button), "room-info", info); |
| 8199 | 212 | |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
213 | gtk_widget_set_sensitive(dialog->add_button, TRUE); |
| 8199 | 214 | gtk_widget_set_sensitive(dialog->join_button, TRUE); |
| 215 | } else { | |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
216 | gtk_widget_set_sensitive(dialog->add_button, FALSE); |
| 8199 | 217 | gtk_widget_set_sensitive(dialog->join_button, FALSE); |
| 218 | } | |
| 219 | } | |
| 220 | ||
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
221 | static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
222 | { |
| 15185 | 223 | char *name; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
224 | PurpleAccount *account = purple_roomlist_get_account(info->list); |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
225 | PurpleConnection *gc = purple_account_get_connection(account); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36424
diff
changeset
|
226 | PurpleProtocol *protocol = NULL; |
| 15185 | 227 | |
| 228 | if(gc != NULL) | |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
229 | protocol = purple_connection_get_protocol(gc); |
| 15185 | 230 | |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39556
diff
changeset
|
231 | if(protocol != NULL && PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, room_serialize)) |
| 36719 | 232 | name = purple_protocol_roomlist_iface_room_serialize(protocol, info->room); |
| 15185 | 233 | else |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
234 | name = g_strdup(purple_roomlist_room_get_name(info->room)); |
| 15185 | 235 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
236 | purple_blist_request_add_chat(account, NULL, NULL, name); |
| 15185 | 237 | |
| 238 | g_free(name); | |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
239 | } |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
240 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
241 | static void add_room_to_blist_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
242 | { |
| 15884 | 243 | PurpleRoomlist *rl = dialog->roomlist; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
244 | PidginRoomlist *grl = purple_roomlist_get_ui_data(rl); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
245 | struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
246 | |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
247 | if(info != NULL) |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
248 | do_add_room_cb(grl->tree, info); |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
249 | } |
|
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
250 | |
| 8113 | 251 | static void do_join_cb(GtkWidget *w, struct _menu_cb_info *info) |
| 252 | { | |
| 15884 | 253 | purple_roomlist_room_join(info->list, info->room); |
| 8199 | 254 | } |
| 8113 | 255 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
256 | static void join_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
| 8199 | 257 | { |
| 15884 | 258 | PurpleRoomlist *rl = dialog->roomlist; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
259 | PidginRoomlist *grl = purple_roomlist_get_ui_data(rl); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
260 | struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); |
|
12896
d368037a2bb7
[gaim-migrate @ 15249]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12600
diff
changeset
|
261 | |
| 8377 | 262 | if(info != NULL) |
| 263 | do_join_cb(grl->tree, info); | |
| 8113 | 264 | } |
| 265 | ||
| 266 | static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2, | |
| 15884 | 267 | PurpleRoomlist *list) |
| 8113 | 268 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
269 | PidginRoomlist *grl = purple_roomlist_get_ui_data(list); |
| 8113 | 270 | GtkTreeIter iter; |
| 15884 | 271 | PurpleRoomlistRoom *room; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
272 | GValue val; |
| 8113 | 273 | struct _menu_cb_info info; |
| 274 | ||
| 275 | gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path); | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
276 | val.g_type = 0; |
| 8113 | 277 | gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); |
| 278 | room = g_value_get_pointer(&val); | |
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
279 | if (!room || !(purple_roomlist_room_get_room_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) |
| 8113 | 280 | return; |
| 281 | ||
| 282 | info.list = list; | |
| 283 | info.room = room; | |
| 284 | ||
| 285 | do_join_cb(GTK_WIDGET(tv), &info); | |
| 286 | } | |
| 287 | ||
| 15884 | 288 | static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, PurpleRoomlist *list) |
| 8113 | 289 | { |
| 290 | GtkTreePath *path; | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
291 | PidginRoomlist *grl = purple_roomlist_get_ui_data(list); |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
292 | GValue val; |
| 15884 | 293 | PurpleRoomlistRoom *room; |
| 8113 | 294 | GtkTreeIter iter; |
| 295 | GtkWidget *menu; | |
| 296 | static struct _menu_cb_info info; /* XXX? */ | |
| 297 | ||
|
38705
62a7a975251a
Use gdk_event_triggers_context_menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38583
diff
changeset
|
298 | if (!gdk_event_triggers_context_menu((GdkEvent *)event)) |
| 8113 | 299 | return FALSE; |
| 300 | ||
| 301 | /* Here we figure out which room was clicked */ | |
| 302 | if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL)) | |
| 303 | return FALSE; | |
| 304 | gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path); | |
| 305 | gtk_tree_path_free(path); | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
306 | val.g_type = 0; |
| 8113 | 307 | gtk_tree_model_get_value (GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); |
| 308 | room = g_value_get_pointer(&val); | |
| 309 | ||
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
310 | if (!room || !(purple_roomlist_room_get_room_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) |
| 8113 | 311 | return FALSE; |
| 312 | ||
| 313 | info.list = list; | |
| 314 | info.room = room; | |
| 315 | ||
| 316 | menu = gtk_menu_new(); | |
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
317 | pidgin_new_menu_item(menu, _("_Join"), PIDGIN_STOCK_CHAT, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
318 | G_CALLBACK(do_join_cb), &info); |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
319 | pidgin_new_menu_item(menu, _("_Add"), GTK_STOCK_ADD, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
320 | G_CALLBACK(do_add_room_cb), &info); |
| 8113 | 321 | |
| 322 | gtk_widget_show_all(menu); | |
|
38707
6f4d3ab2f2ed
Use gtk_menu_popup_at_pointer instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
323 | gtk_menu_popup_at_pointer(GTK_MENU(menu), (GdkEvent *)event); |
| 8113 | 324 | |
| 325 | return FALSE; | |
| 326 | } | |
| 327 | ||
| 328 | static void row_expanded_cb(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer user_data) | |
| 329 | { | |
| 15884 | 330 | PurpleRoomlist *list = user_data; |
| 331 | PurpleRoomlistRoom *category; | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
332 | GValue val; |
| 8113 | 333 | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
334 | val.g_type = 0; |
| 8113 | 335 | gtk_tree_model_get_value(gtk_tree_view_get_model(treeview), arg1, ROOM_COLUMN, &val); |
| 8584 | 336 | category = g_value_get_pointer(&val); |
| 8113 | 337 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
338 | if (!purple_roomlist_room_get_expanded_once(category)) { |
| 15884 | 339 | purple_roomlist_expand_category(list, category); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
340 | purple_roomlist_room_set_expanded_once(category, TRUE); |
| 8113 | 341 | } |
| 342 | } | |
| 343 | ||
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
344 | #define SMALL_SPACE 6 |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
345 | #define TOOLTIP_BORDER 12 |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
346 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
347 | static gboolean |
|
33161
c248c062f272
Pass the cairo context to the tooltip paint function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33141
diff
changeset
|
348 | pidgin_roomlist_paint_tooltip(GtkWidget *widget, cairo_t *cr, gpointer user_data) |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
349 | { |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
350 | PurpleRoomlist *list = user_data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
351 | PidginRoomlist *grl = purple_roomlist_get_ui_data(list); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
352 | int current_height, max_width; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
353 | int max_text_width; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
354 | GtkTextDirection dir = gtk_widget_get_direction(GTK_WIDGET(grl->tree)); |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
355 | GtkStyleContext *context; |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
356 | |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
357 | context = gtk_widget_get_style_context(grl->tipwindow); |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
358 | gtk_style_context_add_class(context, GTK_STYLE_CLASS_TOOLTIP); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
359 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
360 | max_text_width = MAX(grl->tip_width, grl->tip_name_width); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
361 | max_width = TOOLTIP_BORDER + SMALL_SPACE + max_text_width + TOOLTIP_BORDER; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
362 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
363 | current_height = 12; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
364 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
365 | if (dir == GTK_TEXT_DIR_RTL) { |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
366 | gtk_render_layout(context, cr, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
367 | max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
368 | current_height, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
369 | grl->tip_name_layout); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
370 | } else { |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
371 | gtk_render_layout(context, cr, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
372 | TOOLTIP_BORDER + SMALL_SPACE, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
373 | current_height, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
374 | grl->tip_name_layout); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
375 | } |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
376 | if (dir != GTK_TEXT_DIR_RTL) { |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
377 | gtk_render_layout(context, cr, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
378 | TOOLTIP_BORDER + SMALL_SPACE, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
379 | current_height + grl->tip_name_height, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
380 | grl->tip_layout); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
381 | } else { |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
382 | gtk_render_layout(context, cr, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
383 | max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
384 | current_height + grl->tip_name_height, |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
385 | grl->tip_layout); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
386 | } |
|
32394
f883709bdba4
compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents:
30706
diff
changeset
|
387 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
388 | return FALSE; |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
389 | } |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
390 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
391 | static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list, GtkTreePath *path) |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
392 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
393 | PidginRoomlist *grl = purple_roomlist_get_ui_data(list); |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
394 | PurpleRoomlistRoom *room; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
395 | GtkTreeIter iter; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
396 | GValue val; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
397 | gchar *name, *tmp, *node_name; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
398 | GString *tooltip_text = NULL; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
399 | GList *l, *k; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
400 | gint j; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
401 | gboolean first = TRUE; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
402 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
403 | #if 0 |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
404 | if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), grl->tip_rect.x, grl->tip_rect.y + (grl->tip_rect.height/2), |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
405 | &path, NULL, NULL, NULL)) |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
406 | return FALSE; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
407 | #endif |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
408 | gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
409 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
410 | val.g_type = 0; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
411 | gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
412 | room = g_value_get_pointer(&val); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
413 | |
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
414 | if (!room || !(purple_roomlist_room_get_room_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
415 | return FALSE; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
416 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
417 | tooltip_text = g_string_new(""); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
418 | gtk_tree_model_get(GTK_TREE_MODEL(grl->model), &iter, NAME_COLUMN, &name, -1); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
419 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
420 | for (j = NUM_OF_COLUMNS, |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
421 | l = purple_roomlist_room_get_fields(room), |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
422 | k = purple_roomlist_get_fields(list); |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
423 | l && k; j++, l = l->next, k = k->next) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
424 | { |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
425 | PurpleRoomlistField *f = k->data; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
426 | gchar *label; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
427 | if (purple_roomlist_field_get_hidden(f)) |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
428 | continue; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
429 | label = g_markup_escape_text(purple_roomlist_field_get_label(f), -1); |
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
430 | switch (purple_roomlist_field_get_field_type(f)) { |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
431 | case PURPLE_ROOMLIST_FIELD_BOOL: |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
432 | g_string_append_printf(tooltip_text, "%s<b>%s:</b> %s", first ? "" : "\n", label, l->data ? "True" : "False"); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
433 | break; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
434 | case PURPLE_ROOMLIST_FIELD_INT: |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
435 | g_string_append_printf(tooltip_text, "%s<b>%s:</b> %d", first ? "" : "\n", label, GPOINTER_TO_INT(l->data)); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
436 | break; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
437 | case PURPLE_ROOMLIST_FIELD_STRING: |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
438 | tmp = g_markup_escape_text((char *)l->data, -1); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
439 | g_string_append_printf(tooltip_text, "%s<b>%s:</b> %s", first ? "" : "\n", label, tmp); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
440 | g_free(tmp); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
441 | break; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
442 | } |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
443 | first = FALSE; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
444 | g_free(label); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
445 | } |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
446 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
447 | grl->tip_layout = gtk_widget_create_pango_layout(grl->tipwindow, NULL); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
448 | grl->tip_name_layout = gtk_widget_create_pango_layout(grl->tipwindow, NULL); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
449 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
450 | tmp = g_markup_escape_text(name, -1); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
451 | g_free(name); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
452 | node_name = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>", tmp); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
453 | g_free(tmp); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
454 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
455 | pango_layout_set_markup(grl->tip_layout, tooltip_text->str, -1); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
456 | pango_layout_set_wrap(grl->tip_layout, PANGO_WRAP_WORD); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
457 | pango_layout_set_width(grl->tip_layout, 600000); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
458 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
459 | pango_layout_get_size (grl->tip_layout, &grl->tip_width, &grl->tip_height); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
460 | grl->tip_width = PANGO_PIXELS(grl->tip_width); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
461 | grl->tip_height = PANGO_PIXELS(grl->tip_height); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
462 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
463 | pango_layout_set_markup(grl->tip_name_layout, node_name, -1); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
464 | pango_layout_set_wrap(grl->tip_name_layout, PANGO_WRAP_WORD); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
465 | pango_layout_set_width(grl->tip_name_layout, 600000); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
466 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
467 | pango_layout_get_size (grl->tip_name_layout, &grl->tip_name_width, &grl->tip_name_height); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
468 | grl->tip_name_width = PANGO_PIXELS(grl->tip_name_width) + SMALL_SPACE; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
469 | grl->tip_name_height = MAX(PANGO_PIXELS(grl->tip_name_height), SMALL_SPACE); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
470 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
471 | g_free(node_name); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
472 | g_string_free(tooltip_text, TRUE); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
473 | |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
474 | return TRUE; |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
475 | } |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
476 | |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
477 | static gboolean |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
478 | pidgin_roomlist_create_tooltip(GtkWidget *widget, GtkTreePath *path, |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
479 | gpointer data, int *w, int *h) |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
480 | { |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
481 | PurpleRoomlist *list = data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
482 | PidginRoomlist *grl = purple_roomlist_get_ui_data(list); |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
483 | grl->tipwindow = widget; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
484 | if (!pidgin_roomlist_create_tip(data, path)) |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
485 | return FALSE; |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
486 | if (w) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
487 | *w = TOOLTIP_BORDER + SMALL_SPACE + |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
488 | MAX(grl->tip_width, grl->tip_name_width) + TOOLTIP_BORDER; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
489 | if (h) |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
490 | *h = TOOLTIP_BORDER + grl->tip_height + grl->tip_name_height |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
491 | + TOOLTIP_BORDER; |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
492 | return TRUE; |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
493 | } |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
494 | |
| 15884 | 495 | static gboolean account_filter_func(PurpleAccount *account) |
| 8113 | 496 | { |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
497 | PurpleConnection *conn = purple_account_get_connection(account); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36424
diff
changeset
|
498 | PurpleProtocol *protocol = NULL; |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
499 | |
|
24863
68c109ca0089
Fix a crash that happens when accessing the roomlist for an account that's
Paul Aurich <darkrain42@pidgin.im>
parents:
23918
diff
changeset
|
500 | if (conn && PURPLE_CONNECTION_IS_CONNECTED(conn)) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
501 | protocol = purple_connection_get_protocol(conn); |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
502 | |
|
39759
ea1401483849
Rename *_GET_*_IFACE to more standard *_GET_IFACE.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39556
diff
changeset
|
503 | return (protocol && PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, get_list)); |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
504 | } |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
505 | |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
506 | gboolean |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
507 | pidgin_roomlist_is_showable() |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
508 | { |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
509 | GList *c; |
| 15884 | 510 | PurpleConnection *gc; |
| 8113 | 511 | |
| 15884 | 512 | for (c = purple_connections_get_all(); c != NULL; c = c->next) { |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
513 | gc = c->data; |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
514 | |
| 15884 | 515 | if (account_filter_func(purple_connection_get_account(gc))) |
|
8939
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
516 | return TRUE; |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
517 | } |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
518 | |
|
ec2ecc652447
[gaim-migrate @ 9709]
Mark Doliner <markdoliner@pidgin.im>
parents:
8937
diff
changeset
|
519 | return FALSE; |
| 8113 | 520 | } |
| 521 | ||
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
522 | static void |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
523 | pidgin_roomlist_dialog_class_init(PidginRoomlistDialogClass *klass) |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
524 | { |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
525 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
526 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
527 | gtk_widget_class_set_template_from_resource( |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
528 | widget_class, "/im/pidgin/Pidgin/Roomlist/roomlist.ui"); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
529 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
530 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
531 | account_widget); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
532 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
533 | add_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
534 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
535 | close_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
536 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
537 | join_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
538 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
539 | list_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
540 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
541 | progress); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
542 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
543 | stop_button); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
544 | gtk_widget_class_bind_template_child(widget_class, PidginRoomlistDialog, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
545 | sw); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
546 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
547 | gtk_widget_class_bind_template_callback(widget_class, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
548 | add_room_to_blist_cb); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
549 | gtk_widget_class_bind_template_callback(widget_class, delete_win_cb); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
550 | gtk_widget_class_bind_template_callback(widget_class, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
551 | dialog_select_account_cb); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
552 | gtk_widget_class_bind_template_callback(widget_class, join_button_cb); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
553 | gtk_widget_class_bind_template_callback(widget_class, list_button_cb); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
554 | gtk_widget_class_bind_template_callback(widget_class, stop_button_cb); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
555 | } |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
556 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
557 | static void |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
558 | pidgin_roomlist_dialog_init(PidginRoomlistDialog *self) |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
559 | { |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
560 | gtk_widget_init_template(GTK_WIDGET(self)); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
561 | |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
562 | pidgin_account_chooser_set_filter_func( |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
563 | PIDGIN_ACCOUNT_CHOOSER(self->account_widget), |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
564 | account_filter_func); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
565 | } |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
566 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
567 | static PidginRoomlistDialog * |
| 15884 | 568 | pidgin_roomlist_dialog_new_with_account(PurpleAccount *account) |
| 8113 | 569 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
570 | PidginRoomlistDialog *dialog; |
| 8113 | 571 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
572 | dialog = g_object_new(PIDGIN_TYPE_ROOMLIST_DIALOG, NULL); |
|
8937
b436e9cbd701
[gaim-migrate @ 9707]
Mark Doliner <markdoliner@pidgin.im>
parents:
8584
diff
changeset
|
573 | dialog->account = account; |
| 8113 | 574 | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
575 | if (!account) { |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
576 | /* This is normally NULL, and we normally don't care what the |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
577 | * first selected item is */ |
|
39786
7800f52d0ae6
Rename pidgin_account_option_menu_* to pidgin_account_chooser_*.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39785
diff
changeset
|
578 | dialog->account = pidgin_account_chooser_get_selected( |
|
7800f52d0ae6
Rename pidgin_account_option_menu_* to pidgin_account_chooser_*.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39785
diff
changeset
|
579 | dialog->account_widget); |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
580 | } else { |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
581 | pidgin_account_chooser_set_selected(dialog->account_widget, |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
582 | account); |
|
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
583 | } |
| 8199 | 584 | |
| 585 | /* show the dialog window and return the dialog */ | |
|
40250
19acef70137d
Convert PidginRoomlistDialog to Glade.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40197
diff
changeset
|
586 | gtk_widget_show(GTK_WIDGET(dialog)); |
| 8199 | 587 | |
| 8113 | 588 | return dialog; |
| 589 | } | |
| 590 | ||
| 15884 | 591 | void pidgin_roomlist_dialog_show_with_account(PurpleAccount *account) |
| 8352 | 592 | { |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
593 | PidginRoomlistDialog *dialog = pidgin_roomlist_dialog_new_with_account(account); |
| 8352 | 594 | |
| 595 | if (!dialog) | |
| 596 | return; | |
| 597 | ||
| 598 | list_button_cb(GTK_BUTTON(dialog->list_button), dialog); | |
| 599 | } | |
| 600 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
601 | void pidgin_roomlist_dialog_show(void) |
| 8113 | 602 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
603 | pidgin_roomlist_dialog_new_with_account(NULL); |
| 8113 | 604 | } |
| 605 | ||
| 15884 | 606 | static void pidgin_roomlist_new(PurpleRoomlist *list) |
| 8113 | 607 | { |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
608 | PidginRoomlist *rl = g_new0(PidginRoomlist, 1); |
| 8113 | 609 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
610 | purple_roomlist_set_ui_data(list, rl); |
| 8113 | 611 | |
| 612 | rl->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free); | |
| 613 | ||
| 614 | roomlists = g_list_append(roomlists, list); | |
| 615 | } | |
| 616 | ||
| 617 | static void int_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer, | |
| 618 | GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) | |
| 619 | { | |
| 620 | gchar buf[16]; | |
| 621 | int myint; | |
| 622 | ||
| 623 | gtk_tree_model_get(model, iter, GPOINTER_TO_INT(user_data), &myint, -1); | |
| 624 | ||
| 625 | if (myint) | |
| 626 | g_snprintf(buf, sizeof(buf), "%d", myint); | |
| 627 | else | |
| 628 | buf[0] = '\0'; | |
| 629 | ||
| 630 | g_object_set(renderer, "text", buf, NULL); | |
| 631 | } | |
| 632 | ||
| 633 | /* this sorts backwards on purpose, so that clicking name sorts a-z, while clicking users sorts | |
| 634 | infinity-0. you can still click again to reverse it on any of them. */ | |
| 635 | static gint int_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data) | |
| 636 | { | |
| 637 | int c, d; | |
| 638 | ||
| 639 | c = d = 0; | |
| 640 | ||
| 641 | gtk_tree_model_get(model, a, GPOINTER_TO_INT(user_data), &c, -1); | |
| 642 | gtk_tree_model_get(model, b, GPOINTER_TO_INT(user_data), &d, -1); | |
| 643 | ||
| 644 | if (c == d) | |
| 645 | return 0; | |
| 646 | else if (c > d) | |
| 647 | return -1; | |
| 648 | else | |
| 649 | return 1; | |
| 650 | } | |
| 651 | ||
|
11490
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
652 | static gboolean |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
653 | _search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data) |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
654 | { |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
655 | gboolean result; |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
656 | gchar *name, *fold, *fkey; |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
657 | |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
658 | gtk_tree_model_get(model, iter, column, &name, -1); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
659 | fold = g_utf8_casefold(name, -1); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
660 | fkey = g_utf8_casefold(key, -1); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
661 | |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
662 | result = (g_strstr_len(fold, strlen(fold), fkey) == NULL); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
663 | |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
664 | g_free(fold); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
665 | g_free(fkey); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
666 | g_free(name); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
667 | |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
668 | return result; |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
669 | } |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
670 | |
| 15884 | 671 | static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) |
| 8113 | 672 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
673 | PidginRoomlist *grl = purple_roomlist_get_ui_data(list); |
| 8113 | 674 | gint columns = NUM_OF_COLUMNS; |
| 675 | int j; | |
| 676 | GtkTreeStore *model; | |
| 677 | GtkWidget *tree; | |
| 678 | GtkCellRenderer *renderer; | |
| 679 | GtkTreeViewColumn *column; | |
| 8199 | 680 | GtkTreeSelection *selection; |
| 8113 | 681 | GList *l; |
| 682 | GType *types; | |
| 683 | ||
| 684 | g_return_if_fail(grl != NULL); | |
| 685 | ||
| 686 | columns += g_list_length(fields); | |
| 687 | types = g_new(GType, columns); | |
| 688 | ||
| 689 | types[NAME_COLUMN] = G_TYPE_STRING; | |
| 690 | types[ROOM_COLUMN] = G_TYPE_POINTER; | |
| 691 | ||
| 692 | for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { | |
| 15884 | 693 | PurpleRoomlistField *f = l->data; |
| 8113 | 694 | |
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
695 | switch (purple_roomlist_field_get_field_type(f)) { |
| 15884 | 696 | case PURPLE_ROOMLIST_FIELD_BOOL: |
| 8113 | 697 | types[j] = G_TYPE_BOOLEAN; |
| 698 | break; | |
| 15884 | 699 | case PURPLE_ROOMLIST_FIELD_INT: |
| 8113 | 700 | types[j] = G_TYPE_INT; |
| 701 | break; | |
| 15884 | 702 | case PURPLE_ROOMLIST_FIELD_STRING: |
| 8113 | 703 | types[j] = G_TYPE_STRING; |
| 704 | break; | |
| 705 | } | |
| 706 | } | |
| 707 | ||
| 708 | model = gtk_tree_store_newv(columns, types); | |
| 709 | g_free(types); | |
| 710 | ||
| 711 | tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); | |
| 712 | ||
| 8199 | 713 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
| 714 | g_signal_connect(G_OBJECT(selection), "changed", | |
| 715 | G_CALLBACK(selection_changed_cb), grl); | |
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13448
diff
changeset
|
716 | |
| 8113 | 717 | g_object_unref(model); |
| 718 | ||
| 719 | grl->model = model; | |
| 720 | grl->tree = tree; | |
| 721 | gtk_widget_show(grl->tree); | |
| 722 | ||
| 723 | renderer = gtk_cell_renderer_text_new(); | |
| 724 | column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer, | |
| 725 | "text", NAME_COLUMN, NULL); | |
| 726 | gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), | |
| 727 | GTK_TREE_VIEW_COLUMN_GROW_ONLY); | |
| 728 | gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
| 729 | gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), NAME_COLUMN); | |
| 730 | gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
| 731 | gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); | |
| 732 | ||
| 733 | for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { | |
| 15884 | 734 | PurpleRoomlistField *f = l->data; |
| 8113 | 735 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
736 | if (purple_roomlist_field_get_hidden(f)) |
| 8113 | 737 | continue; |
| 738 | ||
| 739 | renderer = gtk_cell_renderer_text_new(); | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
740 | column = gtk_tree_view_column_new_with_attributes( |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
741 | purple_roomlist_field_get_label(f), renderer, |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
742 | "text", j, NULL); |
| 8113 | 743 | gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), |
| 744 | GTK_TREE_VIEW_COLUMN_GROW_ONLY); | |
| 745 | gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
| 746 | gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), j); | |
| 747 | gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
748 | if (purple_roomlist_field_get_field_type(f) == PURPLE_ROOMLIST_FIELD_INT) { |
| 8113 | 749 | gtk_tree_view_column_set_cell_data_func(column, renderer, int_cell_data_func, |
| 750 | GINT_TO_POINTER(j), NULL); | |
| 751 | gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), j, int_sort_func, | |
| 752 | GINT_TO_POINTER(j), NULL); | |
| 753 | } | |
| 754 | gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); | |
| 755 | } | |
| 756 | ||
| 757 | g_signal_connect(G_OBJECT(tree), "button-press-event", G_CALLBACK(room_click_cb), list); | |
| 758 | g_signal_connect(G_OBJECT(tree), "row-expanded", G_CALLBACK(row_expanded_cb), list); | |
| 759 | g_signal_connect(G_OBJECT(tree), "row-activated", G_CALLBACK(row_activated_cb), list); | |
|
21741
0855e8f1a6af
applied changes from b52ee4ed509de4ed4f568b335e1e4499f0829f64
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21494
diff
changeset
|
760 | #if 0 /* uncomment this when the tooltips are slightly less annoying and more well behaved */ |
|
21494
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
761 | g_signal_connect(G_OBJECT(tree), "motion-notify-event", G_CALLBACK(row_motion_cb), list); |
|
c7368d0f5d5a
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20147
diff
changeset
|
762 | g_signal_connect(G_OBJECT(tree), "leave-notify-event", G_CALLBACK(row_leave_cb), list); |
|
21741
0855e8f1a6af
applied changes from b52ee4ed509de4ed4f568b335e1e4499f0829f64
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21494
diff
changeset
|
763 | #endif |
|
21903
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
764 | pidgin_tooltip_setup_for_treeview(tree, list, |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
765 | pidgin_roomlist_create_tooltip, |
|
5b5ad54ae1da
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21741
diff
changeset
|
766 | pidgin_roomlist_paint_tooltip); |
|
11490
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
767 | |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
768 | /* Enable CTRL+F searching */ |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
769 | gtk_tree_view_set_search_column(GTK_TREE_VIEW(tree), NAME_COLUMN); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
770 | gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(tree), _search_func, NULL, NULL); |
|
7a4f16625f66
[gaim-migrate @ 13733]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11243
diff
changeset
|
771 | |
| 8113 | 772 | } |
| 773 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
774 | static gboolean pidgin_progress_bar_pulse(gpointer data) |
| 8230 | 775 | { |
| 15884 | 776 | PurpleRoomlist *list = data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
777 | PidginRoomlist *rl = purple_roomlist_get_ui_data(list); |
| 8230 | 778 | |
| 779 | if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) { | |
|
13448
27832a91b988
[gaim-migrate @ 15822]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12896
diff
changeset
|
780 | if (rl && rl->dialog) |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
781 | rl->dialog->pg_update_to = 0; |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
782 | g_object_unref(list); |
| 8230 | 783 | return FALSE; |
| 784 | } | |
| 785 | ||
| 786 | gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress)); | |
| 787 | rl->dialog->pg_needs_pulse = FALSE; | |
| 788 | return TRUE; | |
| 789 | } | |
| 790 | ||
| 15884 | 791 | static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8113 | 792 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
793 | PidginRoomlist *rl = purple_roomlist_get_ui_data(list); |
| 8113 | 794 | GtkTreeRowReference *rr, *parentrr = NULL; |
| 795 | GtkTreePath *path; | |
| 796 | GtkTreeIter iter, parent, child; | |
| 797 | GList *l, *k; | |
| 798 | int j; | |
| 799 | gboolean append = TRUE; | |
| 800 | ||
| 801 | rl->total_rooms++; | |
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
802 | if (purple_roomlist_room_get_room_type(room) == PURPLE_ROOMLIST_ROOMTYPE_ROOM) |
| 8113 | 803 | rl->num_rooms++; |
| 804 | ||
| 805 | if (rl->dialog) { | |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
806 | if (rl->dialog->pg_update_to == 0) { |
|
34932
1b74e5c63144
Use g_object_{ref|unref} instead of purple_roomlist_{ref|unref}
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
807 | g_object_ref(list); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
808 | rl->dialog->pg_update_to = g_timeout_add(100, pidgin_progress_bar_pulse, list); |
| 8230 | 809 | gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress)); |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
810 | } else |
| 8230 | 811 | rl->dialog->pg_needs_pulse = TRUE; |
| 8113 | 812 | } |
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
813 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
814 | if (purple_roomlist_room_get_parent(room)) { |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
815 | parentrr = g_hash_table_lookup(rl->cats, purple_roomlist_room_get_parent(room)); |
| 8113 | 816 | path = gtk_tree_row_reference_get_path(parentrr); |
| 817 | if (path) { | |
| 15884 | 818 | PurpleRoomlistRoom *tmproom = NULL; |
| 8113 | 819 | |
| 820 | gtk_tree_model_get_iter(GTK_TREE_MODEL(rl->model), &parent, path); | |
| 821 | gtk_tree_path_free(path); | |
| 822 | ||
| 823 | if (gtk_tree_model_iter_children(GTK_TREE_MODEL(rl->model), &child, &parent)) { | |
| 824 | gtk_tree_model_get(GTK_TREE_MODEL(rl->model), &child, ROOM_COLUMN, &tmproom, -1); | |
| 825 | if (!tmproom) | |
| 826 | append = FALSE; | |
| 827 | } | |
| 828 | } | |
| 829 | } | |
| 830 | ||
| 831 | if (append) | |
| 832 | gtk_tree_store_append(rl->model, &iter, (parentrr ? &parent : NULL)); | |
| 833 | else | |
| 834 | iter = child; | |
| 835 | ||
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
836 | if (purple_roomlist_room_get_room_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) |
| 8113 | 837 | gtk_tree_store_append(rl->model, &child, &iter); |
| 838 | ||
| 839 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter); | |
| 840 | ||
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
34932
diff
changeset
|
841 | if (purple_roomlist_room_get_room_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { |
| 8113 | 842 | rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path); |
| 843 | g_hash_table_insert(rl->cats, room, rr); | |
| 844 | } | |
| 845 | ||
| 846 | gtk_tree_path_free(path); | |
| 847 | ||
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
848 | gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, purple_roomlist_room_get_name(room), -1); |
| 8113 | 849 | gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1); |
| 850 | ||
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
851 | for (j = NUM_OF_COLUMNS, |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
852 | l = purple_roomlist_room_get_fields(room), |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
853 | k = purple_roomlist_get_fields(list); |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
854 | l && k; j++, l = l->next, k = k->next) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
855 | { |
| 15884 | 856 | PurpleRoomlistField *f = k->data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
857 | if (purple_roomlist_field_get_hidden(f)) |
| 8113 | 858 | continue; |
| 859 | gtk_tree_store_set(rl->model, &iter, j, l->data, -1); | |
| 860 | } | |
| 861 | } | |
| 862 | ||
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
863 | static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progress) |
| 8113 | 864 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
865 | PidginRoomlist *rl = purple_roomlist_get_ui_data(list); |
| 8113 | 866 | |
| 867 | if (!rl || !rl->dialog) | |
| 868 | return; | |
| 869 | ||
|
23918
ae3c8eb64659
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <datallah@pidgin.im>
parents:
22131
diff
changeset
|
870 | if (in_progress) { |
| 8199 | 871 | if (rl->dialog->account_widget) |
| 872 | gtk_widget_set_sensitive(rl->dialog->account_widget, FALSE); | |
| 873 | gtk_widget_set_sensitive(rl->dialog->stop_button, TRUE); | |
| 874 | gtk_widget_set_sensitive(rl->dialog->list_button, FALSE); | |
| 8113 | 875 | } else { |
| 8230 | 876 | rl->dialog->pg_needs_pulse = FALSE; |
| 8113 | 877 | gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(rl->dialog->progress), 0.0); |
| 8199 | 878 | if (rl->dialog->account_widget) |
| 879 | gtk_widget_set_sensitive(rl->dialog->account_widget, TRUE); | |
| 880 | gtk_widget_set_sensitive(rl->dialog->stop_button, FALSE); | |
| 881 | gtk_widget_set_sensitive(rl->dialog->list_button, TRUE); | |
| 8113 | 882 | } |
| 883 | } | |
| 884 | ||
| 15884 | 885 | static void pidgin_roomlist_destroy(PurpleRoomlist *list) |
| 8113 | 886 | { |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
887 | PidginRoomlist *rl = purple_roomlist_get_ui_data(list); |
| 8113 | 888 | |
| 889 | roomlists = g_list_remove(roomlists, list); | |
| 890 | ||
| 891 | g_return_if_fail(rl != NULL); | |
| 892 | ||
| 893 | g_hash_table_destroy(rl->cats); | |
| 894 | g_free(rl); | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
31321
diff
changeset
|
895 | purple_roomlist_set_ui_data(list, NULL); |
| 8113 | 896 | } |
| 897 | ||
| 15884 | 898 | static PurpleRoomlistUiOps ops = { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
899 | pidgin_roomlist_dialog_show_with_account, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
900 | pidgin_roomlist_new, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
901 | pidgin_roomlist_set_fields, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
902 | pidgin_roomlist_add_room, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
903 | pidgin_roomlist_in_progress, |
|
16752
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
904 | pidgin_roomlist_destroy, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
905 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
906 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
907 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16254
diff
changeset
|
908 | NULL |
| 8113 | 909 | }; |
| 910 | ||
| 911 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
912 | void pidgin_roomlist_init(void) |
| 8113 | 913 | { |
| 15884 | 914 | purple_roomlist_set_ui_ops(&ops); |
| 8113 | 915 | } |