Mercurial > pidgin.yaz
annotate pidgin/gtkroomlist.c @ 29192:4066bd054421
Fix -uninstalled pc files for out-of-tree builds.
${pcfiledir} expands to the directory that the .pc file is in. This isn't right
for out-of-tree builds: we want to add the source directory to the include
path.
In the case of libpurple, we need both because some of the headers are
generated.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Sun, 20 Dec 2009 17:13:47 +0000 |
parents | 0486e2a9b48f |
children | 351d07aefb09 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file gtkroomlist.c GTK+ Room List UI |
16193
247e421c4fa6
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents:
15871
diff
changeset
|
3 * @ingroup pidgin |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
6 /* pidgin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
8 * Pidgin is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18063
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "internal.h" |
15514 | 28 #include "pidgin.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "gtkutils.h" |
15822
84b0f9b23ede
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@gmail.com>
parents:
15821
diff
changeset
|
30 #include "pidginstock.h" |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
31 #include "pidgintooltip.h" |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
32 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "account.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "connection.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "gtkroomlist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
40 typedef struct _PidginRoomlistDialog { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 GtkWidget *window; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 GtkWidget *account_widget; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 GtkWidget *progress; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 GtkWidget *sw; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 GtkWidget *stop_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 GtkWidget *list_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 GtkWidget *add_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 GtkWidget *join_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 GtkWidget *close_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 |
15823 | 52 PurpleAccount *account; |
53 PurpleRoomlist *roomlist; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 gboolean pg_needs_pulse; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 guint pg_update_to; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
57 } PidginRoomlistDialog; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
59 typedef struct _PidginRoomlist { |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
60 PidginRoomlistDialog *dialog; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 GtkTreeStore *model; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 GtkWidget *tree; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 GHashTable *cats; /**< Meow. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 gint num_rooms, total_rooms; |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
65 GtkWidget *tipwindow; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
66 GdkRectangle tip_rect; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
67 PangoLayout *tip_layout; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
68 PangoLayout *tip_name_layout; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
69 int tip_height; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
70 int tip_width; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
71 int tip_name_height; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
72 int tip_name_width; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
73 } PidginRoomlist; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 enum { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 NAME_COLUMN = 0, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 ROOM_COLUMN, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 NUM_OF_COLUMNS, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 static GList *roomlists = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 static gint delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 { |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
85 PidginRoomlistDialog *dialog = d; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
15823 | 87 if (dialog->roomlist && purple_roomlist_get_in_progress(dialog->roomlist)) |
88 purple_roomlist_cancel_get_list(dialog->roomlist); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
90 if (dialog->pg_update_to > 0) |
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
91 purple_timeout_remove(dialog->pg_update_to); |
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
92 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 if (dialog->roomlist) { |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
94 PidginRoomlist *rl = dialog->roomlist->ui_data; |
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
95 |
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
96 if (dialog->pg_update_to > 0) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 /* yes, that's right, unref it twice. */ |
15823 | 98 purple_roomlist_unref(dialog->roomlist); |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
99 |
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
100 if (rl) |
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
101 rl->dialog = NULL; |
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
102 purple_roomlist_unref(dialog->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
105 dialog->progress = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 g_free(dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 |
15823 | 111 static void dialog_select_account_cb(GObject *w, PurpleAccount *account, |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
112 PidginRoomlistDialog *dialog) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 { |
28776
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
114 gboolean change = (account != dialog->account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 dialog->account = account; |
28776
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
116 |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
117 if (change && dialog->roomlist) { |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
118 PidginRoomlist *rl = dialog->roomlist->ui_data; |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
119 if (rl->tree) { |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
120 gtk_widget_destroy(rl->tree); |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
121 rl->tree = NULL; |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
122 } |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
123 purple_roomlist_unref(dialog->roomlist); |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
124 dialog->roomlist = NULL; |
0486e2a9b48f
When switching the account in the Disco / Room List dialogs, kill the visible
Paul Aurich <paul@darkrain42.org>
parents:
26319
diff
changeset
|
125 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
128 static void list_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 { |
15823 | 130 PurpleConnection *gc; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
131 PidginRoomlist *rl; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 |
15823 | 133 gc = purple_account_get_connection(dialog->account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 if (!gc) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 if (dialog->roomlist != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 rl = dialog->roomlist->ui_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 gtk_widget_destroy(rl->tree); |
15823 | 140 purple_roomlist_unref(dialog->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 |
15823 | 143 dialog->roomlist = purple_roomlist_get_list(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 if (!dialog->roomlist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 return; |
15823 | 146 purple_roomlist_ref(dialog->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 rl = dialog->roomlist->ui_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 rl->dialog = dialog; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 if (dialog->account_widget) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 gtk_widget_set_sensitive(dialog->account_widget, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 gtk_container_add(GTK_CONTAINER(dialog->sw), rl->tree); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 |
15823 | 155 /* some protocols (not bundled with libpurple) finish getting their |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 * room list immediately */ |
15823 | 157 if(purple_roomlist_get_in_progress(dialog->roomlist)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 gtk_widget_set_sensitive(dialog->stop_button, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 gtk_widget_set_sensitive(dialog->list_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 gtk_widget_set_sensitive(dialog->stop_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 gtk_widget_set_sensitive(dialog->list_button, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 gtk_widget_set_sensitive(dialog->add_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 gtk_widget_set_sensitive(dialog->join_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
168 static void stop_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 { |
15823 | 170 purple_roomlist_cancel_get_list(dialog->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 if (dialog->account_widget) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 gtk_widget_set_sensitive(dialog->account_widget, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 gtk_widget_set_sensitive(dialog->stop_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 gtk_widget_set_sensitive(dialog->list_button, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 gtk_widget_set_sensitive(dialog->add_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 gtk_widget_set_sensitive(dialog->join_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
181 static void close_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 GtkWidget *window = dialog->window; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 delete_win_cb(NULL, NULL, dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 gtk_widget_destroy(window); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 struct _menu_cb_info { |
15823 | 190 PurpleRoomlist *list; |
191 PurpleRoomlistRoom *room; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 static void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
195 selection_changed_cb(GtkTreeSelection *selection, PidginRoomlist *grl) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 GtkTreeIter iter; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 GValue val; |
15823 | 198 PurpleRoomlistRoom *room; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 static struct _menu_cb_info *info; |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
200 PidginRoomlistDialog *dialog = grl->dialog; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 val.g_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 room = g_value_get_pointer(&val); |
15823 | 206 if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 gtk_widget_set_sensitive(dialog->join_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 gtk_widget_set_sensitive(dialog->add_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 info = g_new0(struct _menu_cb_info, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 info->list = dialog->roomlist; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 info->room = room; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 g_object_set_data_full(G_OBJECT(dialog->join_button), "room-info", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 info, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 g_object_set_data(G_OBJECT(dialog->add_button), "room-info", info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 gtk_widget_set_sensitive(dialog->add_button, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 gtk_widget_set_sensitive(dialog->join_button, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 gtk_widget_set_sensitive(dialog->add_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 gtk_widget_set_sensitive(dialog->join_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 char *name; |
15823 | 231 PurpleConnection *gc = purple_account_get_connection(info->list->account); |
232 PurplePluginProtocolInfo *prpl_info = NULL; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 if(gc != NULL) |
15823 | 235 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 if(prpl_info != NULL && prpl_info->roomlist_room_serialize) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 name = prpl_info->roomlist_room_serialize(info->room); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 name = g_strdup(info->room->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
15823 | 242 purple_blist_request_add_chat(info->list->account, NULL, NULL, name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
247 static void add_room_to_blist_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 { |
15823 | 249 PurpleRoomlist *rl = dialog->roomlist; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
250 PidginRoomlist *grl = rl->ui_data; |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
251 struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 if(info != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 do_add_room_cb(grl->tree, info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 static void do_join_cb(GtkWidget *w, struct _menu_cb_info *info) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 { |
15823 | 259 purple_roomlist_room_join(info->list, info->room); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
262 static void join_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 { |
15823 | 264 PurpleRoomlist *rl = dialog->roomlist; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
265 PidginRoomlist *grl = rl->ui_data; |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
266 struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 if(info != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 do_join_cb(grl->tree, info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2, |
15823 | 273 PurpleRoomlist *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
275 PidginRoomlist *grl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 GtkTreeIter iter; |
15823 | 277 PurpleRoomlistRoom *room; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 GValue val; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 struct _menu_cb_info info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 val.g_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 room = g_value_get_pointer(&val); |
15823 | 285 if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 info.list = list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 info.room = room; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 do_join_cb(GTK_WIDGET(tv), &info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 |
15823 | 294 static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, PurpleRoomlist *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 GtkTreePath *path; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
297 PidginRoomlist *grl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 GValue val; |
15823 | 299 PurpleRoomlistRoom *room; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 GtkTreeIter iter; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 GtkWidget *menu; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 static struct _menu_cb_info info; /* XXX? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 if (event->button != 3 || event->type != GDK_BUTTON_PRESS) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 /* Here we figure out which room was clicked */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 gtk_tree_path_free(path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 val.g_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 gtk_tree_model_get_value (GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 room = g_value_get_pointer(&val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 |
15823 | 316 if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 info.list = list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 info.room = room; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 menu = gtk_menu_new(); |
15509 | 323 pidgin_new_item_from_stock(menu, _("_Join"), PIDGIN_STOCK_CHAT, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 G_CALLBACK(do_join_cb), &info, 0, 0, NULL); |
15507 | 325 pidgin_new_item_from_stock(menu, _("_Add"), GTK_STOCK_ADD, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 G_CALLBACK(do_add_room_cb), &info, 0, 0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 gtk_widget_show_all(menu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 static void row_expanded_cb(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 { |
15823 | 336 PurpleRoomlist *list = user_data; |
337 PurpleRoomlistRoom *category; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 GValue val; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 val.g_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 gtk_tree_model_get_value(gtk_tree_view_get_model(treeview), arg1, ROOM_COLUMN, &val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 category = g_value_get_pointer(&val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 if (!category->expanded_once) { |
15823 | 345 purple_roomlist_expand_category(list, category); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 category->expanded_once = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
350 #define SMALL_SPACE 6 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
351 #define TOOLTIP_BORDER 12 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
352 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
353 static gboolean |
21885
f5d961556972
Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21877
diff
changeset
|
354 pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data) |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
355 { |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
356 PurpleRoomlist *list = user_data; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
357 PidginRoomlist *grl = list->ui_data; |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
358 GtkStyle *style; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
359 int current_height, max_width; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
360 int max_text_width; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
361 GtkTextDirection dir = gtk_widget_get_direction(GTK_WIDGET(grl->tree)); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
362 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
363 style = grl->tipwindow->style; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
364 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
365 max_text_width = 0; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
366 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
367 max_text_width = MAX(grl->tip_width, grl->tip_name_width); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
368 max_width = TOOLTIP_BORDER + SMALL_SPACE + max_text_width + TOOLTIP_BORDER; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
369 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
370 current_height = 12; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
371 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
372 if (dir == GTK_TEXT_DIR_RTL) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
373 gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
374 NULL, grl->tipwindow, "tooltip", |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
375 max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
376 current_height, grl->tip_name_layout); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
377 } else { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
378 gtk_paint_layout (style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
379 NULL, grl->tipwindow, "tooltip", |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
380 TOOLTIP_BORDER + SMALL_SPACE, current_height, grl->tip_name_layout); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
381 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
382 if (dir != GTK_TEXT_DIR_RTL) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
383 gtk_paint_layout (style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
384 NULL, grl->tipwindow, "tooltip", |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
385 TOOLTIP_BORDER + SMALL_SPACE, current_height + grl->tip_name_height, grl->tip_layout); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
386 } else { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
387 gtk_paint_layout(style, grl->tipwindow->window, GTK_STATE_NORMAL, FALSE, |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
388 NULL, grl->tipwindow, "tooltip", |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
389 max_width - (TOOLTIP_BORDER + SMALL_SPACE) - PANGO_PIXELS(600000), |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
390 current_height + grl->tip_name_height, |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
391 grl->tip_layout); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
392 } |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
393 return FALSE; |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
394 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
395 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
396 static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list, GtkTreePath *path) |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
397 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
398 PidginRoomlist *grl = list->ui_data; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
399 PurpleRoomlistRoom *room; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
400 GtkTreeIter iter; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
401 GValue val; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
402 gchar *name, *tmp, *node_name; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
403 GString *tooltip_text = NULL; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
404 GList *l, *k; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
405 gint j; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
406 gboolean first = TRUE; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
407 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
408 #if 0 |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
409 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), |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
410 &path, NULL, NULL, NULL)) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
411 return FALSE; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
412 #endif |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
413 gtk_tree_model_get_iter(GTK_TREE_MODEL(grl->model), &iter, path); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
414 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
415 val.g_type = 0; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
416 gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
417 room = g_value_get_pointer(&val); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
418 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
419 if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
420 return FALSE; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
421 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
422 tooltip_text = g_string_new(""); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
423 gtk_tree_model_get(GTK_TREE_MODEL(grl->model), &iter, NAME_COLUMN, &name, -1); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
424 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
425 for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
426 PurpleRoomlistField *f = k->data; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
427 gchar *label; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
428 if (f->hidden) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
429 continue; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
430 label = g_markup_escape_text(f->label, -1); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
431 switch (f->type) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
432 case PURPLE_ROOMLIST_FIELD_BOOL: |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
433 g_string_append_printf(tooltip_text, "%s<b>%s:</b> %s", first ? "" : "\n", label, l->data ? "True" : "False"); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
434 break; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
435 case PURPLE_ROOMLIST_FIELD_INT: |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
436 g_string_append_printf(tooltip_text, "%s<b>%s:</b> %d", first ? "" : "\n", label, GPOINTER_TO_INT(l->data)); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
437 break; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
438 case PURPLE_ROOMLIST_FIELD_STRING: |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
439 tmp = g_markup_escape_text((char *)l->data, -1); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
440 g_string_append_printf(tooltip_text, "%s<b>%s:</b> %s", first ? "" : "\n", label, tmp); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
441 g_free(tmp); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
442 break; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
443 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
444 first = FALSE; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
445 g_free(label); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
446 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
447 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
448 grl->tip_layout = gtk_widget_create_pango_layout(grl->tipwindow, NULL); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
449 grl->tip_name_layout = gtk_widget_create_pango_layout(grl->tipwindow, NULL); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
450 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
451 tmp = g_markup_escape_text(name, -1); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
452 g_free(name); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
453 node_name = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>", tmp); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
454 g_free(tmp); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
455 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
456 pango_layout_set_markup(grl->tip_layout, tooltip_text->str, -1); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
457 pango_layout_set_wrap(grl->tip_layout, PANGO_WRAP_WORD); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
458 pango_layout_set_width(grl->tip_layout, 600000); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
459 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
460 pango_layout_get_size (grl->tip_layout, &grl->tip_width, &grl->tip_height); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
461 grl->tip_width = PANGO_PIXELS(grl->tip_width); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
462 grl->tip_height = PANGO_PIXELS(grl->tip_height); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
463 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
464 pango_layout_set_markup(grl->tip_name_layout, node_name, -1); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
465 pango_layout_set_wrap(grl->tip_name_layout, PANGO_WRAP_WORD); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
466 pango_layout_set_width(grl->tip_name_layout, 600000); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
467 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
468 pango_layout_get_size (grl->tip_name_layout, &grl->tip_name_width, &grl->tip_name_height); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
469 grl->tip_name_width = PANGO_PIXELS(grl->tip_name_width) + SMALL_SPACE; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
470 grl->tip_name_height = MAX(PANGO_PIXELS(grl->tip_name_height), SMALL_SPACE); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
471 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
472 g_free(node_name); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
473 g_string_free(tooltip_text, TRUE); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
474 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
475 return TRUE; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
476 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
477 |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
478 static gboolean |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
479 pidgin_roomlist_create_tooltip(GtkWidget *widget, GtkTreePath *path, |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
480 gpointer data, int *w, int *h) |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
481 { |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
482 PurpleRoomlist *list = data; |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
483 PidginRoomlist *grl = list->ui_data; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
484 grl->tipwindow = widget; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
485 if (!pidgin_roomlist_create_tip(data, path)) |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
486 return FALSE; |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
487 if (w) |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
488 *w = TOOLTIP_BORDER + SMALL_SPACE + |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
489 MAX(grl->tip_width, grl->tip_name_width) + TOOLTIP_BORDER; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
490 if (h) |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
491 *h = TOOLTIP_BORDER + grl->tip_height + grl->tip_name_height |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
492 + TOOLTIP_BORDER; |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
493 return TRUE; |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
494 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
495 |
15823 | 496 static gboolean account_filter_func(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 { |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
498 PurpleConnection *conn = purple_account_get_connection(account); |
15823 | 499 PurplePluginProtocolInfo *prpl_info = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
24543
c1f954e51389
Fix a crash that happens when accessing the roomlist for an account that's
Paul Aurich <paul@darkrain42.org>
parents:
23651
diff
changeset
|
501 if (conn && PURPLE_CONNECTION_IS_CONNECTED(conn)) |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
502 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(conn->prpl); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
504 return (prpl_info && prpl_info->roomlist_get_list != NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 gboolean |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
508 pidgin_roomlist_is_showable() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
510 GList *c; |
15823 | 511 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 |
15823 | 513 for (c = purple_connections_get_all(); c != NULL; c = c->next) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 gc = c->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 |
15823 | 516 if (account_filter_func(purple_connection_get_account(gc))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
523 static PidginRoomlistDialog * |
15823 | 524 pidgin_roomlist_dialog_new_with_account(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
526 PidginRoomlistDialog *dialog; |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
527 GtkWidget *window, *vbox, *vbox2, *bbox; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
529 dialog = g_new0(PidginRoomlistDialog, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 dialog->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 /* Create the window. */ |
21646
2a2496044eef
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21329
diff
changeset
|
533 dialog->window = window = pidgin_create_dialog(_("Room List"), PIDGIN_HIG_BORDER, "room list", TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 g_signal_connect(G_OBJECT(window), "delete_event", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 G_CALLBACK(delete_win_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 /* Create the parent vbox for everything. */ |
21646
2a2496044eef
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21329
diff
changeset
|
539 vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(window), FALSE, PIDGIN_HIG_BORDER); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 |
15821 | 541 vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 gtk_container_add(GTK_CONTAINER(vbox), vbox2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 gtk_widget_show(vbox2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 /* accounts dropdown list */ |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
546 dialog->account_widget = pidgin_account_option_menu_new(dialog->account, FALSE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 G_CALLBACK(dialog_select_account_cb), account_filter_func, dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 if (!dialog->account) /* this is normally null, and we normally don't care what the first selected item is */ |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
549 dialog->account = pidgin_account_option_menu_get_selected(dialog->account_widget); |
21992
1690d040addd
Remove a lot of duplication from a lot of places. Closes #4558.
Gabriel Schulhof <nix@go-nix.ca>
parents:
21945
diff
changeset
|
550 pidgin_add_widget_to_vbox(GTK_BOX(vbox2), _("_Account:"), NULL, dialog->account_widget, TRUE, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 /* scrolled window */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 dialog->sw = gtk_scrolled_window_new(NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(dialog->sw), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 GTK_SHADOW_IN); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dialog->sw), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 GTK_POLICY_AUTOMATIC, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 GTK_POLICY_AUTOMATIC); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 gtk_box_pack_start(GTK_BOX(vbox2), dialog->sw, TRUE, TRUE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 gtk_widget_set_size_request(dialog->sw, -1, 250); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 gtk_widget_show(dialog->sw); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 /* progress bar */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 dialog->progress = gtk_progress_bar_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(dialog->progress), 0.1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 gtk_box_pack_start(GTK_BOX(vbox2), dialog->progress, FALSE, FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 gtk_widget_show(dialog->progress); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 /* button box */ |
21646
2a2496044eef
Patch from fmoo. This makes a lot of the windows closeable with Escape. There
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21329
diff
changeset
|
570 bbox = pidgin_dialog_get_action_area(GTK_DIALOG(window)); |
15821 | 571 gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 /* stop button */ |
21652
eb2d5ba2a50d
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21646
diff
changeset
|
575 dialog->stop_button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 G_CALLBACK(stop_button_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 gtk_widget_set_sensitive(dialog->stop_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 /* list button */ |
15507 | 580 dialog->list_button = pidgin_pixbuf_button_from_stock(_("_Get List"), GTK_STOCK_REFRESH, |
581 PIDGIN_BUTTON_HORIZONTAL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 gtk_box_pack_start(GTK_BOX(bbox), dialog->list_button, FALSE, FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 g_signal_connect(G_OBJECT(dialog->list_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 G_CALLBACK(list_button_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 gtk_widget_show(dialog->list_button); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 /* add button */ |
15507 | 588 dialog->add_button = pidgin_pixbuf_button_from_stock(_("_Add Chat"), GTK_STOCK_ADD, |
589 PIDGIN_BUTTON_HORIZONTAL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 gtk_box_pack_start(GTK_BOX(bbox), dialog->add_button, FALSE, FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 g_signal_connect(G_OBJECT(dialog->add_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 G_CALLBACK(add_room_to_blist_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 gtk_widget_set_sensitive(dialog->add_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 gtk_widget_show(dialog->add_button); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 /* join button */ |
15509 | 597 dialog->join_button = pidgin_pixbuf_button_from_stock(_("_Join"), PIDGIN_STOCK_CHAT, |
15507 | 598 PIDGIN_BUTTON_HORIZONTAL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 gtk_box_pack_start(GTK_BOX(bbox), dialog->join_button, FALSE, FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 g_signal_connect(G_OBJECT(dialog->join_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 G_CALLBACK(join_button_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 gtk_widget_set_sensitive(dialog->join_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 gtk_widget_show(dialog->join_button); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 /* close button */ |
21652
eb2d5ba2a50d
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21646
diff
changeset
|
606 dialog->close_button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 G_CALLBACK(close_button_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 /* show the dialog window and return the dialog */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 gtk_widget_show(dialog->window); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 return dialog; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 |
15823 | 615 void pidgin_roomlist_dialog_show_with_account(PurpleAccount *account) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 { |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
617 PidginRoomlistDialog *dialog = pidgin_roomlist_dialog_new_with_account(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 if (!dialog) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 list_button_cb(GTK_BUTTON(dialog->list_button), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
625 void pidgin_roomlist_dialog_show(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
627 pidgin_roomlist_dialog_new_with_account(NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 |
15823 | 630 static void pidgin_roomlist_new(PurpleRoomlist *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 { |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
632 PidginRoomlist *rl = g_new0(PidginRoomlist, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 list->ui_data = rl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 rl->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 roomlists = g_list_append(roomlists, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 static void int_cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *renderer, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 gchar buf[16]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 int myint; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 gtk_tree_model_get(model, iter, GPOINTER_TO_INT(user_data), &myint, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 if (myint) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 g_snprintf(buf, sizeof(buf), "%d", myint); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 buf[0] = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 g_object_set(renderer, "text", buf, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 /* this sorts backwards on purpose, so that clicking name sorts a-z, while clicking users sorts |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 infinity-0. you can still click again to reverse it on any of them. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 static gint int_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 int c, d; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 c = d = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 gtk_tree_model_get(model, a, GPOINTER_TO_INT(user_data), &c, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 gtk_tree_model_get(model, b, GPOINTER_TO_INT(user_data), &d, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 if (c == d) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 else if (c > d) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 return 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 _search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 gboolean result; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 gchar *name, *fold, *fkey; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 gtk_tree_model_get(model, iter, column, &name, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 fold = g_utf8_casefold(name, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 fkey = g_utf8_casefold(key, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 result = (g_strstr_len(fold, strlen(fold), fkey) == NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 g_free(fold); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 g_free(fkey); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 return result; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 |
15823 | 695 static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
697 PidginRoomlist *grl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 gint columns = NUM_OF_COLUMNS; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 int j; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 GtkTreeStore *model; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 GtkWidget *tree; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 GtkCellRenderer *renderer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 GtkTreeViewColumn *column; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 GtkTreeSelection *selection; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 GType *types; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 g_return_if_fail(grl != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 columns += g_list_length(fields); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 types = g_new(GType, columns); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 types[NAME_COLUMN] = G_TYPE_STRING; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 types[ROOM_COLUMN] = G_TYPE_POINTER; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { |
15823 | 717 PurpleRoomlistField *f = l->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 switch (f->type) { |
15823 | 720 case PURPLE_ROOMLIST_FIELD_BOOL: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 types[j] = G_TYPE_BOOLEAN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 break; |
15823 | 723 case PURPLE_ROOMLIST_FIELD_INT: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 types[j] = G_TYPE_INT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 break; |
15823 | 726 case PURPLE_ROOMLIST_FIELD_STRING: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 types[j] = G_TYPE_STRING; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 model = gtk_tree_store_newv(columns, types); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 g_free(types); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 g_signal_connect(G_OBJECT(selection), "changed", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 G_CALLBACK(selection_changed_cb), grl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 g_object_unref(model); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 grl->model = model; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 grl->tree = tree; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 gtk_widget_show(grl->tree); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 renderer = gtk_cell_renderer_text_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 "text", NAME_COLUMN, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 GTK_TREE_VIEW_COLUMN_GROW_ONLY); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), NAME_COLUMN); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { |
15823 | 759 PurpleRoomlistField *f = l->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 if (f->hidden) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 renderer = gtk_cell_renderer_text_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 column = gtk_tree_view_column_new_with_attributes(f->label, renderer, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 "text", j, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 GTK_TREE_VIEW_COLUMN_GROW_ONLY); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), j); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
15823 | 772 if (f->type == PURPLE_ROOMLIST_FIELD_INT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 gtk_tree_view_column_set_cell_data_func(column, renderer, int_cell_data_func, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 GINT_TO_POINTER(j), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), j, int_sort_func, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 GINT_TO_POINTER(j), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 g_signal_connect(G_OBJECT(tree), "button-press-event", G_CALLBACK(room_click_cb), list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 g_signal_connect(G_OBJECT(tree), "row-expanded", G_CALLBACK(row_expanded_cb), list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 g_signal_connect(G_OBJECT(tree), "row-activated", G_CALLBACK(row_activated_cb), list); |
21788
29a4b8e5f4f6
Disable roomlist tooltips until I (or anyone else!) fix them to be less
Stu Tomlinson <stu@nosnilmot.com>
parents:
21329
diff
changeset
|
784 #if 0 /* uncomment this when the tooltips are slightly less annoying and more well behaved */ |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
785 g_signal_connect(G_OBJECT(tree), "motion-notify-event", G_CALLBACK(row_motion_cb), list); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
786 g_signal_connect(G_OBJECT(tree), "leave-notify-event", G_CALLBACK(row_leave_cb), list); |
21788
29a4b8e5f4f6
Disable roomlist tooltips until I (or anyone else!) fix them to be less
Stu Tomlinson <stu@nosnilmot.com>
parents:
21329
diff
changeset
|
787 #endif |
21877
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
788 pidgin_tooltip_setup_for_treeview(tree, list, |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
789 pidgin_roomlist_create_tooltip, |
6bf73aea6450
Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21788
diff
changeset
|
790 pidgin_roomlist_paint_tooltip); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 /* Enable CTRL+F searching */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 gtk_tree_view_set_search_column(GTK_TREE_VIEW(tree), NAME_COLUMN); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(tree), _search_func, NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
798 static gboolean pidgin_progress_bar_pulse(gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 { |
15823 | 800 PurpleRoomlist *list = data; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
801 PidginRoomlist *rl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 if (rl && rl->dialog) |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
805 rl->dialog->pg_update_to = 0; |
15823 | 806 purple_roomlist_unref(list); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 rl->dialog->pg_needs_pulse = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 |
15823 | 815 static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
817 PidginRoomlist *rl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 GtkTreeRowReference *rr, *parentrr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 GtkTreePath *path; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 GtkTreeIter iter, parent, child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 GList *l, *k; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 int j; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 gboolean append = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 rl->total_rooms++; |
15823 | 826 if (room->type == PURPLE_ROOMLIST_ROOMTYPE_ROOM) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 rl->num_rooms++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 if (rl->dialog) { |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
830 if (rl->dialog->pg_update_to == 0) { |
15823 | 831 purple_roomlist_ref(list); |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
832 rl->dialog->pg_update_to = g_timeout_add(100, pidgin_progress_bar_pulse, list); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(rl->dialog->progress)); |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
834 } else |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 rl->dialog->pg_needs_pulse = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 } |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
837 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 if (room->parent) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 parentrr = g_hash_table_lookup(rl->cats, room->parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 path = gtk_tree_row_reference_get_path(parentrr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 if (path) { |
15823 | 842 PurpleRoomlistRoom *tmproom = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 gtk_tree_model_get_iter(GTK_TREE_MODEL(rl->model), &parent, path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 gtk_tree_path_free(path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 if (gtk_tree_model_iter_children(GTK_TREE_MODEL(rl->model), &child, &parent)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 gtk_tree_model_get(GTK_TREE_MODEL(rl->model), &child, ROOM_COLUMN, &tmproom, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 if (!tmproom) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 append = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 if (append) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 gtk_tree_store_append(rl->model, &iter, (parentrr ? &parent : NULL)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 iter = child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 |
15823 | 860 if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 gtk_tree_store_append(rl->model, &child, &iter); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 |
15823 | 865 if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 g_hash_table_insert(rl->cats, room, rr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 gtk_tree_path_free(path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, room->name, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { |
15823 | 876 PurpleRoomlistField *f = k->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 if (f->hidden) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 gtk_tree_store_set(rl->model, &iter, j, l->data, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
880 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
883 static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progress) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
884 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
885 PidginRoomlist *rl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
886 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 if (!rl || !rl->dialog) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
890 if (in_progress) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 if (rl->dialog->account_widget) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 gtk_widget_set_sensitive(rl->dialog->account_widget, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 gtk_widget_set_sensitive(rl->dialog->stop_button, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 gtk_widget_set_sensitive(rl->dialog->list_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 rl->dialog->pg_needs_pulse = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(rl->dialog->progress), 0.0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 if (rl->dialog->account_widget) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 gtk_widget_set_sensitive(rl->dialog->account_widget, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 gtk_widget_set_sensitive(rl->dialog->stop_button, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 gtk_widget_set_sensitive(rl->dialog->list_button, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 |
15823 | 905 static void pidgin_roomlist_destroy(PurpleRoomlist *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 { |
23651
e97ff340bbf3
Fix a race related to closing the roomlist window and do some minor cleanup.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21992
diff
changeset
|
907 PidginRoomlist *rl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 roomlists = g_list_remove(roomlists, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 g_return_if_fail(rl != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 g_hash_table_destroy(rl->cats); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 g_free(rl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 list->ui_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
916 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 |
15823 | 918 static PurpleRoomlistUiOps ops = { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
919 pidgin_roomlist_dialog_show_with_account, |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
920 pidgin_roomlist_new, |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
921 pidgin_roomlist_set_fields, |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
922 pidgin_roomlist_add_room, |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
923 pidgin_roomlist_in_progress, |
16681
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16193
diff
changeset
|
924 pidgin_roomlist_destroy, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16193
diff
changeset
|
925 NULL, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16193
diff
changeset
|
926 NULL, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16193
diff
changeset
|
927 NULL, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16193
diff
changeset
|
928 NULL |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
932 void pidgin_roomlist_init(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 { |
15823 | 934 purple_roomlist_set_ui_ops(&ops); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 } |