Mercurial > pidgin.yaz
annotate pidgin/gtkroomlist.c @ 27737:a9cb48039d3b
propagate from branch 'im.pidgin.pidgin' (head 2c3b326b7734ae5211bccc072469632b5b560151)
to branch 'im.pidgin.pidgin.yaz' (head 84cfaa9f49f4017d8e890978ae333a7323a51062)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 24 Nov 2007 05:42:55 +0000 |
parents | a04a0d3f9b4f |
children | 2a2496044eef 29a4b8e5f4f6 |
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" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "account.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "connection.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "gtkroomlist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
38 typedef struct _PidginRoomlistDialog { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 GtkWidget *window; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 GtkWidget *account_widget; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 GtkWidget *progress; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 GtkWidget *sw; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 GtkWidget *stop_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 GtkWidget *list_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 GtkWidget *add_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 GtkWidget *join_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 GtkWidget *close_button; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 |
15823 | 50 PurpleAccount *account; |
51 PurpleRoomlist *roomlist; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 gboolean pg_needs_pulse; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 gboolean pg_to_active; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 guint pg_update_to; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
56 } PidginRoomlistDialog; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
58 typedef struct _PidginRoomlist { |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
59 PidginRoomlistDialog *dialog; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 GtkTreeStore *model; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 GtkWidget *tree; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 GHashTable *cats; /**< Meow. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 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
|
64 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
|
65 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
|
66 guint timeout; |
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 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
85 PidginRoomlistDialog *dialog; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
87 dialog = (PidginRoomlistDialog *) d; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
15823 | 89 if (dialog->roomlist && purple_roomlist_get_in_progress(dialog->roomlist)) |
90 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
|
91 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 if (dialog->roomlist) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 if (dialog->pg_to_active) { |
15823 | 94 purple_timeout_remove(dialog->pg_update_to); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 dialog->pg_to_active = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 /* yes, that's right, unref it twice. */ |
15823 | 97 purple_roomlist_unref(dialog->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 /* free stuff here */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 if (dialog->roomlist) |
15823 | 103 purple_roomlist_unref(dialog->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 g_free(dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 return FALSE; |
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 |
15823 | 109 static void dialog_select_account_cb(GObject *w, PurpleAccount *account, |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
110 PidginRoomlistDialog *dialog) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 dialog->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
115 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
|
116 { |
15823 | 117 PurpleConnection *gc; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
118 PidginRoomlist *rl; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 |
15823 | 120 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
|
121 if (!gc) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 if (dialog->roomlist != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 rl = dialog->roomlist->ui_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 gtk_widget_destroy(rl->tree); |
15823 | 127 purple_roomlist_unref(dialog->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 |
15823 | 130 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
|
131 if (!dialog->roomlist) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 return; |
15823 | 133 purple_roomlist_ref(dialog->roomlist); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 rl = dialog->roomlist->ui_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 rl->dialog = dialog; |
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->account_widget) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 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
|
139 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 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
|
141 |
15823 | 142 /* 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
|
143 * room list immediately */ |
15823 | 144 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
|
145 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
|
146 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
|
147 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 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
|
149 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
|
150 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 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
|
152 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
|
153 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
155 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
|
156 { |
15823 | 157 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
|
158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 if (dialog->account_widget) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 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
|
161 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 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
|
163 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
|
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 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
|
169 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 GtkWidget *window = dialog->window; |
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 delete_win_cb(NULL, NULL, dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 gtk_widget_destroy(window); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 struct _menu_cb_info { |
15823 | 177 PurpleRoomlist *list; |
178 PurpleRoomlistRoom *room; | |
15374
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 static void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
182 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
|
183 GtkTreeIter iter; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 GValue val; |
15823 | 185 PurpleRoomlistRoom *room; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 static struct _menu_cb_info *info; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
187 PidginRoomlistDialog *dialog; |
15374
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 dialog = grl->dialog; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 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
|
192 val.g_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 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
|
194 room = g_value_get_pointer(&val); |
15823 | 195 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
|
196 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
|
197 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
|
198 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 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
|
202 info->list = dialog->roomlist; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 info->room = room; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 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
|
206 info, g_free); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 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
|
208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 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
|
210 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
|
211 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 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
|
213 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
|
214 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 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
|
218 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 char *name; |
15823 | 220 PurpleConnection *gc = purple_account_get_connection(info->list->account); |
221 PurplePluginProtocolInfo *prpl_info = NULL; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 if(gc != NULL) |
15823 | 224 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
|
225 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 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
|
227 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
|
228 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 name = g_strdup(info->room->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 |
15823 | 231 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
|
232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
236 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
|
237 { |
15823 | 238 PurpleRoomlist *rl = dialog->roomlist; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
239 PidginRoomlist *grl = rl->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 struct _menu_cb_info *info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 info = (struct _menu_cb_info*)g_object_get_data(G_OBJECT(button), "room-info"); |
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 if(info != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 do_add_room_cb(grl->tree, info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 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
|
249 { |
15823 | 250 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
|
251 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
253 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
|
254 { |
15823 | 255 PurpleRoomlist *rl = dialog->roomlist; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
256 PidginRoomlist *grl = rl->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 struct _menu_cb_info *info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 info = (struct _menu_cb_info*)g_object_get_data(G_OBJECT(button), "room-info"); |
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 if(info != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 do_join_cb(grl->tree, info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2, |
15823 | 266 PurpleRoomlist *list) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
268 PidginRoomlist *grl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 GtkTreeIter iter; |
15823 | 270 PurpleRoomlistRoom *room; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 GValue val; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 struct _menu_cb_info info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 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
|
275 val.g_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 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
|
277 room = g_value_get_pointer(&val); |
15823 | 278 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
|
279 return; |
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 info.list = list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 info.room = room; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 do_join_cb(GTK_WIDGET(tv), &info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 |
15823 | 287 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
|
288 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 GtkTreePath *path; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
290 PidginRoomlist *grl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 GValue val; |
15823 | 292 PurpleRoomlistRoom *room; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 GtkTreeIter iter; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 GtkWidget *menu; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 static struct _menu_cb_info info; /* XXX? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 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
|
298 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 /* 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
|
301 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
|
302 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 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
|
304 gtk_tree_path_free(path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 val.g_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 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
|
307 room = g_value_get_pointer(&val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 |
15823 | 309 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
|
310 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 info.list = list; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 info.room = room; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 menu = gtk_menu_new(); |
15509 | 316 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
|
317 G_CALLBACK(do_join_cb), &info, 0, 0, NULL); |
15507 | 318 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
|
319 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
|
320 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 gtk_widget_show_all(menu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 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
|
323 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 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
|
328 { |
15823 | 329 PurpleRoomlist *list = user_data; |
330 PurpleRoomlistRoom *category; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 GValue val; |
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 val.g_type = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 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
|
335 category = g_value_get_pointer(&val); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 if (!category->expanded_once) { |
15823 | 338 purple_roomlist_expand_category(list, category); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 category->expanded_once = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
343 static void pidgin_roomlist_tooltip_destroy(PidginRoomlist *grl) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
344 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
345 if ((grl == NULL) || (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
|
346 return; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
347 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
348 gtk_widget_destroy(grl->tipwindow); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
349 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
|
350 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
351 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
352 static void pidgin_roomlist_tooltip_destroy_cb(GObject *object, PidginRoomlist *grl) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
353 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
354 if ((grl == NULL) || (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
|
355 return; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
356 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
357 if (grl->timeout) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
358 g_source_remove(grl->timeout); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
359 grl->timeout = 0; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
360 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
361 pidgin_roomlist_tooltip_destroy(grl); |
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 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
364 #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
|
365 #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
|
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 static void pidgin_roomlist_paint_tip(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
368 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
369 PidginRoomlist *grl = (PidginRoomlist *)user_data; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
370 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
|
371 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
|
372 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
|
373 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
|
374 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
375 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
|
376 gtk_paint_flat_box(style, grl->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
377 NULL, grl->tipwindow, "tooltip", 0, 0, -1, -1); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
378 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
379 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
|
380 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
381 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
|
382 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
|
383 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
384 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
|
385 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
386 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
|
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_layout); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
391 } else { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
392 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
|
393 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
|
394 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
|
395 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
396 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
|
397 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
|
398 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
|
399 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
|
400 } else { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
401 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
|
402 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
|
403 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
|
404 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
|
405 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
|
406 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
407 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
408 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
409 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
410 static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
411 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
412 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
|
413 GtkWidget *tv = 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
|
414 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
|
415 GtkTreePath *path; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
416 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
|
417 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
|
418 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
|
419 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
|
420 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
|
421 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
|
422 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
|
423 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
424 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
|
425 &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
|
426 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
|
427 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
428 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
|
429 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
430 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
|
431 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
|
432 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
|
433 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
434 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
|
435 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
|
436 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
437 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
|
438 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
|
439 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
440 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
|
441 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
|
442 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
|
443 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
|
444 continue; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
445 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
|
446 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
|
447 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
|
448 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
|
449 break; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
450 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
|
451 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
|
452 break; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
453 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
|
454 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
|
455 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
|
456 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
|
457 break; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
458 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
459 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
|
460 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
|
461 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
462 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
463 gtk_tree_path_free(path); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
464 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
465 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
|
466 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
|
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 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
|
469 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
|
470 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
|
471 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
|
472 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
473 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
|
474 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
|
475 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
|
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 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
|
478 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
|
479 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
|
480 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
481 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
|
482 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
|
483 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
|
484 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
485 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
|
486 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
|
487 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
|
488 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
489 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
|
490 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
|
491 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
492 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
|
493 } |
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 static void pidgin_roomlist_draw_tooltip(PurpleRoomlist *list, GtkWidget *widget) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
496 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
497 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
|
498 int scr_w, scr_h, w, h, x, y; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
499 #if GTK_CHECK_VERSION(2,2,0) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
500 int mon_num; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
501 GdkScreen *screen = NULL; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
502 #endif |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
503 GdkRectangle mon_size; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
504 int sig; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
505 const char *name; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
506 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
507 pidgin_roomlist_tooltip_destroy(grl); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
508 grl->tipwindow = gtk_window_new(GTK_WINDOW_POPUP); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
509 gtk_widget_ensure_style (grl->tipwindow); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
510 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
511 if (!pidgin_roomlist_create_tip(list)) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
512 pidgin_roomlist_tooltip_destroy(grl); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
513 return; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
514 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
515 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
516 name = gtk_window_get_title(GTK_WINDOW(gtk_widget_get_toplevel(widget))); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
517 gtk_widget_set_app_paintable(grl->tipwindow, TRUE); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
518 gtk_window_set_title(GTK_WINDOW(grl->tipwindow), name ? name : _("Room List")); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
519 gtk_window_set_resizable(GTK_WINDOW(grl->tipwindow), FALSE); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
520 gtk_widget_set_name(grl->tipwindow, "gtk-tooltips"); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
521 g_signal_connect(G_OBJECT(grl->tipwindow), "expose_event", |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
522 G_CALLBACK(pidgin_roomlist_paint_tip), grl); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
523 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
524 w = TOOLTIP_BORDER + 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
|
525 MAX(grl->tip_width, grl->tip_name_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
|
526 h = TOOLTIP_BORDER + grl->tip_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
|
527 + 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
|
528 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
529 #if GTK_CHECK_VERSION(2,2,0) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
530 gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
531 mon_num = gdk_screen_get_monitor_at_point(screen, x, y); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
532 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
533 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
534 scr_w = mon_size.width + mon_size.x; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
535 scr_h = mon_size.height + mon_size.y; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
536 #else |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
537 scr_w = gdk_screen_width(); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
538 scr_h = gdk_screen_height(); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
539 gdk_window_get_pointer(NULL, &x, &y, NULL); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
540 mon_size.x = 0; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
541 mon_size.y = 0; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
542 #endif |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
543 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
544 #if GTK_CHECK_VERSION(2,2,0) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
545 if (w > mon_size.width) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
546 w = mon_size.width - 10; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
547 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
548 if (h > mon_size.height) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
549 h = mon_size.height - 10; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
550 #endif |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
551 x -= ((w >> 1) + 4); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
552 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
553 if ((y + h + 4) > scr_h) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
554 y = y - h - 5; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
555 else |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
556 y = y + 6; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
557 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
558 if (y < mon_size.y) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
559 y = mon_size.y; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
560 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
561 if (y != mon_size.y) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
562 if ((x + w) > scr_w) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
563 x -= (x + w + 5) - scr_w; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
564 else if (x < mon_size.x) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
565 x = mon_size.x; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
566 } else { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
567 x -= (w / 2 + 10); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
568 if (x < mon_size.x) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
569 x = mon_size.x; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
570 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
571 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
572 gtk_widget_set_size_request(grl->tipwindow, w, h); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
573 gtk_window_move(GTK_WINDOW(grl->tipwindow), x, y); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
574 gtk_widget_show(grl->tipwindow); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
575 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
576 /* Hide the tooltip when the widget is destroyed */ |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
577 sig = g_signal_connect(G_OBJECT(widget), "destroy", G_CALLBACK(pidgin_roomlist_tooltip_destroy_cb), grl); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
578 g_signal_connect_swapped(G_OBJECT(grl->tipwindow), "destroy", G_CALLBACK(g_source_remove), GINT_TO_POINTER(sig)); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
579 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
580 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
581 static gboolean pidgin_roomlist_tooltip_timeout(PurpleRoomlist *list) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
582 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
583 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
|
584 GtkWidget *tv = 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
|
585 GtkTreePath *path; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
586 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
587 pidgin_roomlist_tooltip_destroy(grl); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
588 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
589 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
|
590 &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
|
591 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
|
592 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
593 pidgin_roomlist_draw_tooltip(list, 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
|
594 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
595 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
|
596 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
597 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
598 static gboolean row_motion_cb(GtkWidget *tv, GdkEventMotion *event, gpointer user_data) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
599 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
600 PurpleRoomlist *list = user_data; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
601 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
|
602 GtkTreePath *path; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
603 int delay; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
604 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
605 /* XXX: should this be using the blist delay pref? */ |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
606 delay = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay"); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
607 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
608 if (delay == 0) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
609 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
|
610 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
611 if (grl->timeout) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
612 if ((event->y > grl->tip_rect.y) && ((event->y - grl->tip_rect.height) < grl->tip_rect.y)) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
613 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
|
614 /* We've left the cell. Remove the timeout and create a new one below */ |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
615 pidgin_roomlist_tooltip_destroy(grl); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
616 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
617 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
618 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &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
|
619 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
620 if (path == NULL) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
621 pidgin_roomlist_tooltip_destroy(grl); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
622 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
|
623 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
624 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
625 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &grl->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
|
626 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
627 if (path) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
628 gtk_tree_path_free(path); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
629 grl->timeout = g_timeout_add(delay, (GSourceFunc)pidgin_roomlist_tooltip_timeout, list); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
630 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
631 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
|
632 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
633 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
634 static void row_leave_cb(GtkWidget *tv, GdkEventCrossing *e, gpointer user_data) |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
635 { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
636 PurpleRoomlist *list = user_data; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
637 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
|
638 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
639 if (grl->timeout) { |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
640 g_source_remove(grl->timeout); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
641 grl->timeout = 0; |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
642 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
643 |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
644 pidgin_roomlist_tooltip_destroy(grl); |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
645 } |
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
646 |
15823 | 647 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
|
648 { |
15823 | 649 PurpleConnection *gc = purple_account_get_connection(account); |
650 PurplePluginProtocolInfo *prpl_info = NULL; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 |
15823 | 652 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
|
653 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 return (prpl_info->roomlist_get_list != 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 gboolean |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
658 pidgin_roomlist_is_showable() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 { |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
660 GList *c; |
15823 | 661 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 |
15823 | 663 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
|
664 gc = c->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 |
15823 | 666 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
|
667 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
673 static PidginRoomlistDialog * |
15823 | 674 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
|
675 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
676 PidginRoomlistDialog *dialog; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 GtkWidget *window; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 GtkWidget *vbox; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 GtkWidget *vbox2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 GtkWidget *account_hbox; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 GtkWidget *bbox; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 GtkWidget *label; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
684 dialog = g_new0(PidginRoomlistDialog, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 dialog->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 /* Create the window. */ |
17166 | 688 dialog->window = window = pidgin_create_window(_("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
|
689 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 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
|
691 G_CALLBACK(delete_win_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 /* Create the parent vbox for everything. */ |
15821 | 694 vbox = 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
|
695 gtk_container_add(GTK_CONTAINER(window), vbox); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 gtk_widget_show(vbox); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 |
15821 | 698 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
|
699 gtk_container_add(GTK_CONTAINER(vbox), vbox2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 gtk_widget_show(vbox2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 /* accounts dropdown list */ |
15821 | 703 account_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 gtk_box_pack_start(GTK_BOX(vbox2), account_hbox, FALSE, FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 gtk_widget_show(account_hbox); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 label = gtk_label_new(NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 gtk_box_pack_start(GTK_BOX(account_hbox), label, FALSE, FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Account:")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 gtk_widget_show(label); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
713 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
|
714 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
|
715 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 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
|
717 dialog->account = pidgin_account_option_menu_get_selected(dialog->account_widget); |
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 gtk_box_pack_start(GTK_BOX(account_hbox), dialog->account_widget, TRUE, TRUE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(dialog->account_widget)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 gtk_widget_show(dialog->account_widget); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 /* scrolled window */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 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
|
725 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
|
726 GTK_SHADOW_IN); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 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
|
728 GTK_POLICY_AUTOMATIC, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 GTK_POLICY_AUTOMATIC); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 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
|
731 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
|
732 gtk_widget_show(dialog->sw); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 /* progress bar */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 dialog->progress = gtk_progress_bar_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 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
|
737 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
|
738 gtk_widget_show(dialog->progress); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 /* button box */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 bbox = gtk_hbutton_box_new(); |
15821 | 742 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
|
743 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
|
744 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 gtk_widget_show(bbox); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 /* stop button */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 dialog->stop_button = gtk_button_new_from_stock(GTK_STOCK_STOP); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 gtk_box_pack_start(GTK_BOX(bbox), dialog->stop_button, FALSE, FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 g_signal_connect(G_OBJECT(dialog->stop_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 G_CALLBACK(stop_button_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 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
|
753 gtk_widget_show(dialog->stop_button); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 /* list button */ |
15507 | 756 dialog->list_button = pidgin_pixbuf_button_from_stock(_("_Get List"), GTK_STOCK_REFRESH, |
757 PIDGIN_BUTTON_HORIZONTAL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 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
|
759 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
|
760 G_CALLBACK(list_button_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 gtk_widget_show(dialog->list_button); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 /* add button */ |
15507 | 764 dialog->add_button = pidgin_pixbuf_button_from_stock(_("_Add Chat"), GTK_STOCK_ADD, |
765 PIDGIN_BUTTON_HORIZONTAL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
766 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
|
767 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
|
768 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
|
769 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
|
770 gtk_widget_show(dialog->add_button); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 /* join button */ |
15509 | 773 dialog->join_button = pidgin_pixbuf_button_from_stock(_("_Join"), PIDGIN_STOCK_CHAT, |
15507 | 774 PIDGIN_BUTTON_HORIZONTAL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 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
|
776 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
|
777 G_CALLBACK(join_button_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 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
|
779 gtk_widget_show(dialog->join_button); |
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 /* close button */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 dialog->close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 gtk_box_pack_start(GTK_BOX(bbox), dialog->close_button, FALSE, FALSE, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 g_signal_connect(G_OBJECT(dialog->close_button), "clicked", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 G_CALLBACK(close_button_cb), dialog); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 gtk_widget_show(dialog->close_button); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 /* 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
|
789 gtk_widget_show(dialog->window); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 return dialog; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 |
15823 | 794 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
|
795 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
796 PidginRoomlistDialog *dialog; |
15374
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 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
|
799 if (!dialog) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 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
|
803 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
805 void pidgin_roomlist_dialog_show(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
807 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
|
808 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 |
15823 | 810 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
|
811 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
812 PidginRoomlist *rl; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
814 rl = g_new0(PidginRoomlist, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 list->ui_data = rl; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 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
|
819 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 roomlists = g_list_append(roomlists, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 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
|
824 GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 gchar buf[16]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 int myint; |
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 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
|
830 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 if (myint) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 g_snprintf(buf, sizeof(buf), "%d", myint); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 buf[0] = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 g_object_set(renderer, "text", buf, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 /* 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
|
840 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
|
841 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
|
842 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 int c, d; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 c = d = 0; |
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 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
|
848 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
|
849 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 if (c == d) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 else if (c > d) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 return 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 _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
|
860 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 gboolean result; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 gchar *name, *fold, *fkey; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 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
|
865 fold = g_utf8_casefold(name, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 fkey = g_utf8_casefold(key, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 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
|
869 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 g_free(fold); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 g_free(fkey); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 g_free(name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 return result; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 |
15823 | 877 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
|
878 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
879 PidginRoomlist *grl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
880 gint columns = NUM_OF_COLUMNS; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 int j; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 GtkTreeStore *model; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
883 GtkWidget *tree; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
884 GtkCellRenderer *renderer; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 GtkTreeViewColumn *column; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
886 GtkTreeSelection *selection; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 GType *types; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 g_return_if_fail(grl != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 columns += g_list_length(fields); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 types = g_new(GType, columns); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 types[NAME_COLUMN] = G_TYPE_STRING; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 types[ROOM_COLUMN] = G_TYPE_POINTER; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { |
15823 | 899 PurpleRoomlistField *f = l->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 switch (f->type) { |
15823 | 902 case PURPLE_ROOMLIST_FIELD_BOOL: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 types[j] = G_TYPE_BOOLEAN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 break; |
15823 | 905 case PURPLE_ROOMLIST_FIELD_INT: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 types[j] = G_TYPE_INT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 break; |
15823 | 908 case PURPLE_ROOMLIST_FIELD_STRING: |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 types[j] = G_TYPE_STRING; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 model = gtk_tree_store_newv(columns, types); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 g_free(types); |
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 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
|
918 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
|
919 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 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
|
921 g_signal_connect(G_OBJECT(selection), "changed", |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 G_CALLBACK(selection_changed_cb), grl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 g_object_unref(model); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 grl->model = model; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 grl->tree = tree; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 gtk_widget_show(grl->tree); |
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 renderer = gtk_cell_renderer_text_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 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
|
932 "text", NAME_COLUMN, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 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
|
934 GTK_TREE_VIEW_COLUMN_GROW_ONLY); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 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
|
936 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
|
937 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
|
938 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
|
939 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) { |
15823 | 941 PurpleRoomlistField *f = l->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
942 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 if (f->hidden) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 renderer = gtk_cell_renderer_text_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 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
|
948 "text", j, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 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
|
950 GTK_TREE_VIEW_COLUMN_GROW_ONLY); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 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
|
952 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
|
953 gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
15823 | 954 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
|
955 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
|
956 GINT_TO_POINTER(j), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 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
|
958 GINT_TO_POINTER(j), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 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
|
961 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 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
|
964 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
|
965 g_signal_connect(G_OBJECT(tree), "row-activated", G_CALLBACK(row_activated_cb), list); |
21329
a04a0d3f9b4f
Add tooltips when hovering over rooms in the roomlist so the full channel
Stu Tomlinson <stu@nosnilmot.com>
parents:
20074
diff
changeset
|
966 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
|
967 g_signal_connect(G_OBJECT(tree), "leave-notify-event", G_CALLBACK(row_leave_cb), list); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
968 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 /* Enable CTRL+F searching */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 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
|
971 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
|
972 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
975 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
|
976 { |
15823 | 977 PurpleRoomlist *list = data; |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
978 PidginRoomlist *rl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 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
|
981 if (rl && rl->dialog) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 rl->dialog->pg_to_active = FALSE; |
15823 | 983 purple_roomlist_unref(list); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 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
|
988 rl->dialog->pg_needs_pulse = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 |
15823 | 992 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
|
993 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
994 PidginRoomlist *rl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 GtkTreeRowReference *rr, *parentrr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 GtkTreePath *path; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
997 GtkTreeIter iter, parent, child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
998 GList *l, *k; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 int j; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 gboolean append = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1002 rl->total_rooms++; |
15823 | 1003 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
|
1004 rl->num_rooms++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 if (rl->dialog) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 if (!rl->dialog->pg_to_active) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 rl->dialog->pg_to_active = TRUE; |
15823 | 1009 purple_roomlist_ref(list); |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1010 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
|
1011 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
|
1012 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 rl->dialog->pg_needs_pulse = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1014 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 if (room->parent) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1017 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
|
1018 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
|
1019 if (path) { |
15823 | 1020 PurpleRoomlistRoom *tmproom = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1021 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 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
|
1023 gtk_tree_path_free(path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1025 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
|
1026 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
|
1027 if (!tmproom) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1028 append = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1029 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1030 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 if (append) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 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
|
1035 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 iter = child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 |
15823 | 1038 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
|
1039 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
|
1040 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1041 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
|
1042 |
15823 | 1043 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
|
1044 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
|
1045 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
|
1046 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 gtk_tree_path_free(path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 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
|
1051 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
|
1052 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) { |
15823 | 1054 PurpleRoomlistField *f = k->data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 if (f->hidden) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 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
|
1058 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 |
15823 | 1061 static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean flag) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1063 PidginRoomlist *rl = list->ui_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 if (!rl || !rl->dialog) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 if (flag) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 if (rl->dialog->account_widget) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 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
|
1071 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
|
1072 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
|
1073 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 rl->dialog->pg_needs_pulse = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 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
|
1076 if (rl->dialog->account_widget) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 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
|
1078 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
|
1079 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
|
1080 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 |
15823 | 1083 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
|
1084 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1085 PidginRoomlist *rl; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 roomlists = g_list_remove(roomlists, list); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 rl = list->ui_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 g_return_if_fail(rl != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 g_hash_table_destroy(rl->cats); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 g_free(rl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 list->ui_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 |
15823 | 1098 static PurpleRoomlistUiOps ops = { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1099 pidgin_roomlist_dialog_show_with_account, |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1100 pidgin_roomlist_new, |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1101 pidgin_roomlist_set_fields, |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1102 pidgin_roomlist_add_room, |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1103 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
|
1104 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
|
1105 NULL, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16193
diff
changeset
|
1106 NULL, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16193
diff
changeset
|
1107 NULL, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16193
diff
changeset
|
1108 NULL |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
1112 void pidgin_roomlist_init(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1113 { |
15823 | 1114 purple_roomlist_set_ui_ops(&ops); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1115 } |