Mercurial > pidgin
annotate finch/gntroomlist.c @ 32411:85d75e81e12f
Fix insertion order of search results in Finch.
I fixed the type from the original patch by Howard.
Fixes #14822.
committer: Elliott Sales de Andrade <qulogic@pidgin.im>
author | hyc@symas.com |
---|---|
date | Thu, 22 Dec 2011 23:23:49 +0000 |
parents | ecfbb3ba0135 |
children |
rev | line source |
---|---|
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 /** |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 * @file gntroomlist.c GNT Room List API |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 * @ingroup finch |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 /* finch |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 * |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 * Finch is the legal property of its developers, whose names are too numerous |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 * source distribution. |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 * |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 * |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 * |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22214
diff
changeset
|
27 #include "finch.h" |
27587
f7c5bb2f6623
Don't include an internal header in the public finch headers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26199
diff
changeset
|
28 #include <internal.h> |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 #include "gntrequest.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #include "gntroomlist.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 #include "gntbox.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 #include "gntbutton.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 #include "gntcombobox.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 #include "gnttextview.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 #include "gnttree.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 #include "gntwindow.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 #include "debug.h" |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
42 #define PREF_ROOT "/finch/roomlist" |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
43 |
31934
5dafa68c8eb0
Some struct hiding. What a pain.
Mark Doliner <mark@kingant.net>
parents:
27587
diff
changeset
|
44 |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 /* Yes, just one roomlist at a time. Let's not get greedy. Aight? */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 struct _FinchRoomlist |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 GntWidget *window; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 GntWidget *accounts; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 GntWidget *tree; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 GntWidget *details; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 GntWidget *getlist; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 GntWidget *add; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 GntWidget *join; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 GntWidget *stop; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 GntWidget *close; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 PurpleAccount *account; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 PurpleRoomlist *roomlist; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 } froomlist; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 typedef struct _FinchRoomlist FinchRoomlist; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 unset_roomlist(gpointer null) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 froomlist.window = NULL; |
22028
bfa85af677f2
Unset some stuff to make sure Sylar can't kill us.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22024
diff
changeset
|
70 if (froomlist.roomlist) { |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 purple_roomlist_unref(froomlist.roomlist); |
22028
bfa85af677f2
Unset some stuff to make sure Sylar can't kill us.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22024
diff
changeset
|
72 froomlist.roomlist = NULL; |
bfa85af677f2
Unset some stuff to make sure Sylar can't kill us.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22024
diff
changeset
|
73 } |
bfa85af677f2
Unset some stuff to make sure Sylar can't kill us.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22024
diff
changeset
|
74 froomlist.account = NULL; |
bfa85af677f2
Unset some stuff to make sure Sylar can't kill us.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22024
diff
changeset
|
75 froomlist.tree = NULL; |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 update_roomlist(PurpleRoomlist *list) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 if (froomlist.roomlist == list) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 if (froomlist.roomlist) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 purple_roomlist_unref(froomlist.roomlist); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 if ((froomlist.roomlist = list) != NULL) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 purple_roomlist_ref(list); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 static void fl_stop(GntWidget *button, gpointer null) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 if (froomlist.roomlist && |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 purple_roomlist_get_in_progress(froomlist.roomlist)) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 purple_roomlist_cancel_get_list(froomlist.roomlist); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 static void fl_get_list(GntWidget *button, gpointer null) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 PurpleAccount *account = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(froomlist.accounts)); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 PurpleConnection *gc = purple_account_get_connection(account); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 if (!gc) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 |
22028
bfa85af677f2
Unset some stuff to make sure Sylar can't kill us.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22024
diff
changeset
|
106 update_roomlist(NULL); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 froomlist.roomlist = purple_roomlist_get_list(gc); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 gnt_box_give_focus_to_child(GNT_BOX(froomlist.window), froomlist.tree); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 static void fl_add_chat(GntWidget *button, gpointer null) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 char *name; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 PurpleRoomlistRoom *room = gnt_tree_get_selection_data(GNT_TREE(froomlist.tree)); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 PurpleConnection *gc = purple_account_get_connection(froomlist.account); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 PurplePluginProtocolInfo *prpl_info = NULL; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 if (gc == NULL || room == NULL) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22085
diff
changeset
|
121 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 if(prpl_info != NULL && prpl_info->roomlist_room_serialize) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 name = prpl_info->roomlist_room_serialize(room); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 else |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 name = g_strdup(purple_roomlist_room_get_name(room)); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 purple_blist_request_add_chat(froomlist.account, NULL, NULL, name); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 g_free(name); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 static void fl_close(GntWidget *button, gpointer null) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 gnt_widget_destroy(froomlist.window); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 roomlist_activated(GntWidget *widget) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 PurpleRoomlistRoom *room = gnt_tree_get_selection_data(GNT_TREE(widget)); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 if (!room) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 switch (purple_roomlist_room_get_type(room)) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 case PURPLE_ROOMLIST_ROOMTYPE_ROOM: |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 purple_roomlist_room_join(froomlist.roomlist, room); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 break; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 case PURPLE_ROOMLIST_ROOMTYPE_CATEGORY: |
31934
5dafa68c8eb0
Some struct hiding. What a pain.
Mark Doliner <mark@kingant.net>
parents:
27587
diff
changeset
|
150 if (!purple_roomlist_room_get_expanded_once(room)) { |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
151 purple_roomlist_expand_category(froomlist.roomlist, room); |
31934
5dafa68c8eb0
Some struct hiding. What a pain.
Mark Doliner <mark@kingant.net>
parents:
27587
diff
changeset
|
152 purple_roomlist_room_set_expanded_once(room, TRUE); |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
153 } |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 break; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 } |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
156 gnt_tree_set_expanded(GNT_TREE(widget), room, TRUE); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 roomlist_selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 GList *iter, *field; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 PurpleRoomlistRoom *room = current; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 GntTextView *tv = GNT_TEXT_VIEW(froomlist.details); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 gboolean first = TRUE; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 gnt_text_view_clear(tv); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 if (!room) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 for (iter = purple_roomlist_room_get_fields(room), |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 field = purple_roomlist_get_fields(froomlist.roomlist); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 iter && field; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 iter = iter->next, field = field->next) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 PurpleRoomlistField *f = field->data; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 char *label = NULL; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 if (purple_roomlist_field_get_hidden(f)) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 continue; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 if (!first) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 gnt_text_view_append_text_with_flags(tv, "\n", GNT_TEXT_FLAG_NORMAL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 gnt_text_view_append_text_with_flags(tv, |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 purple_roomlist_field_get_label(f), GNT_TEXT_FLAG_BOLD); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 gnt_text_view_append_text_with_flags(tv, ": ", GNT_TEXT_FLAG_BOLD); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 switch (purple_roomlist_field_get_type(f)) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 case PURPLE_ROOMLIST_FIELD_BOOL: |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 label = g_strdup(iter->data ? "True" : "False"); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 break; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 case PURPLE_ROOMLIST_FIELD_INT: |
26199
b23211876f47
Fix Finch warnings when building on 64-bit
Paul Aurich <paul@darkrain42.org>
parents:
24597
diff
changeset
|
195 label = g_strdup_printf("%d", GPOINTER_TO_INT(iter->data)); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 break; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 case PURPLE_ROOMLIST_FIELD_STRING: |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 label = g_strdup(iter->data); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 break; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 gnt_text_view_append_text_with_flags(tv, label, GNT_TEXT_FLAG_NORMAL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 g_free(label); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 first = FALSE; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 if (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) { |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
207 if (!first) |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
208 gnt_text_view_append_text_with_flags(tv, "\n", GNT_TEXT_FLAG_NORMAL); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 gnt_text_view_append_text_with_flags(tv, |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
210 _("Hit 'Enter' to find more rooms of this category."), |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 GNT_TEXT_FLAG_NORMAL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 roomlist_account_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
218 if (froomlist.account == current) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
221 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
222 froomlist.account = current; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 if (froomlist.roomlist) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 if (purple_roomlist_get_in_progress(froomlist.roomlist)) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 purple_roomlist_cancel_get_list(froomlist.roomlist); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 update_roomlist(NULL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
229 gnt_tree_remove_all(GNT_TREE(froomlist.tree)); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
230 gnt_widget_draw(froomlist.tree); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
232 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
233 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
234 reset_account_list(PurpleAccount *account) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
235 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
236 GList *list; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
237 GntComboBox *accounts = GNT_COMBO_BOX(froomlist.accounts); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
238 gnt_combo_box_remove_all(accounts); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
239 for (list = purple_connections_get_all(); list; list = list->next) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
240 PurplePluginProtocolInfo *prpl_info = NULL; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
241 PurpleConnection *gc = list->data; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
242 |
22214
2b426862ffbf
Add accessor and update finch to not touch the internals of PurpleConnection.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22085
diff
changeset
|
243 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
24597
c1f954e51389
Fix a crash that happens when accessing the roomlist for an account that's
Paul Aurich <paul@darkrain42.org>
parents:
22217
diff
changeset
|
244 if (PURPLE_CONNECTION_IS_CONNECTED(gc) && |
c1f954e51389
Fix a crash that happens when accessing the roomlist for an account that's
Paul Aurich <paul@darkrain42.org>
parents:
22217
diff
changeset
|
245 prpl_info->roomlist_get_list != NULL) { |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
246 PurpleAccount *account = purple_connection_get_account(gc); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
247 char *text = g_strdup_printf("%s (%s)", |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
248 purple_account_get_username(account), |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
249 purple_account_get_protocol_name(account)); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
250 gnt_combo_box_add_data(accounts, account, text); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
251 g_free(text); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
252 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
253 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
254 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
255 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
256 static void |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
257 size_changed_cb(GntWidget *widget, int oldw, int oldh) |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
258 { |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
259 int w, h; |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
260 gnt_widget_get_size(widget, &w, &h); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
261 purple_prefs_set_int(PREF_ROOT "/size/width", w); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
262 purple_prefs_set_int(PREF_ROOT "/size/height", h); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
263 } |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
264 |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
265 static void |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
266 setup_roomlist(PurpleAccount *account) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 GntWidget *window, *tree, *hbox, *accounts; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
269 int iter; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 struct { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
271 const char *label; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 GCallback callback; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 GntWidget **widget; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 } buttons[] = { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 {_("Stop"), G_CALLBACK(fl_stop), &froomlist.stop}, |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 {_("Get"), G_CALLBACK(fl_get_list), &froomlist.getlist}, |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
277 {_("Add"), G_CALLBACK(fl_add_chat), &froomlist.add}, |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
278 {_("Close"), G_CALLBACK(fl_close), &froomlist.close}, |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
279 {NULL, NULL, NULL} |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 }; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
281 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 if (froomlist.window) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
283 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 froomlist.window = window = gnt_window_new(); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
286 g_object_set(G_OBJECT(window), "vertical", TRUE, NULL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 gnt_box_set_pad(GNT_BOX(window), 0); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 gnt_box_set_title(GNT_BOX(window), _("Room List")); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
289 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
290 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
291 froomlist.accounts = accounts = gnt_combo_box_new(); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 reset_account_list(account); |
22085
a2db27c84346
Fix CID #380 by using an assigned variable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22028
diff
changeset
|
293 gnt_box_add_widget(GNT_BOX(window), accounts); |
a2db27c84346
Fix CID #380 by using an assigned variable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22028
diff
changeset
|
294 g_signal_connect(G_OBJECT(accounts), "selection-changed", |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 G_CALLBACK(roomlist_account_changed), NULL); |
22085
a2db27c84346
Fix CID #380 by using an assigned variable.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22028
diff
changeset
|
296 froomlist.account = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(accounts)); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
297 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
298 froomlist.tree = tree = gnt_tree_new_with_columns(2); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
299 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
300 g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(roomlist_activated), NULL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
301 gnt_tree_set_column_titles(GNT_TREE(tree), _("Name"), ""); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
302 gnt_tree_set_show_separator(GNT_TREE(tree), FALSE); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
303 gnt_tree_set_col_width(GNT_TREE(tree), 1, 1); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
304 gnt_tree_set_column_resizable(GNT_TREE(tree), 1, FALSE); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
305 gnt_tree_set_search_column(GNT_TREE(tree), 0); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
306 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
307 gnt_box_add_widget(GNT_BOX(window), tree); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
308 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
309 froomlist.details = gnt_text_view_new(); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
310 gnt_text_view_set_flag(GNT_TEXT_VIEW(froomlist.details), GNT_TEXT_VIEW_TOP_ALIGN); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
311 gnt_box_add_widget(GNT_BOX(window), froomlist.details); |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
312 gnt_widget_set_size(froomlist.details, -1, 8); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
313 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
314 hbox = gnt_hbox_new(FALSE); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
315 gnt_box_add_widget(GNT_BOX(window), hbox); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
317 for (iter = 0; buttons[iter].label; iter++) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
318 GntWidget *button = gnt_button_new(buttons[iter].label); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 gnt_box_add_widget(GNT_BOX(hbox), button); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 g_signal_connect(G_OBJECT(button), "activate", buttons[iter].callback, NULL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 *buttons[iter].widget = button; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(froomlist.details), button); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
324 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 g_signal_connect(G_OBJECT(tree), "selection-changed", G_CALLBACK(roomlist_selection_changed), NULL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
327 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(unset_roomlist), NULL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
328 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
329 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
330 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 fl_show_with_account(PurpleAccount *account) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
333 setup_roomlist(account); |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
334 g_signal_handlers_disconnect_matched(G_OBJECT(froomlist.window), G_SIGNAL_MATCH_FUNC, |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
335 0, 0, NULL, G_CALLBACK(size_changed_cb), NULL); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
336 gnt_widget_show(froomlist.window); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
337 gnt_screen_resize_widget(froomlist.window, |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
338 purple_prefs_get_int(PREF_ROOT "/size/width"), |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
339 purple_prefs_get_int(PREF_ROOT "/size/height")); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
340 g_signal_connect(G_OBJECT(froomlist.window), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 gnt_window_present(froomlist.window); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
342 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
345 fl_create(PurpleRoomlist *list) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
346 { |
31971
ecfbb3ba0135
Rather use the accessor functions directly.
andrew.victor@mxit.com
parents:
31934
diff
changeset
|
347 purple_roomlist_set_ui_data(list, &froomlist); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
348 setup_roomlist(NULL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 update_roomlist(list); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
353 fl_set_fields(PurpleRoomlist *list, GList *fields) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
354 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
355 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
356 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
357 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 fl_add_room(PurpleRoomlist *roomlist, PurpleRoomlistRoom *room) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
359 { |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
360 gboolean category; |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 if (froomlist.roomlist != roomlist) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
362 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
363 |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
364 category = (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
365 gnt_tree_remove(GNT_TREE(froomlist.tree), room); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 gnt_tree_add_row_after(GNT_TREE(froomlist.tree), room, |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
367 gnt_tree_create_row(GNT_TREE(froomlist.tree), |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
368 purple_roomlist_room_get_name(room), |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
369 category ? "<" : ""), |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
370 purple_roomlist_room_get_parent(room), NULL); |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
371 gnt_tree_set_expanded(GNT_TREE(froomlist.tree), room, !category); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
373 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
374 static void |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
375 fl_destroy(PurpleRoomlist *list) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
376 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
377 if (!froomlist.window) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
378 return; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
379 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
380 if (froomlist.roomlist == list) { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
381 froomlist.roomlist = NULL; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
382 gnt_tree_remove_all(GNT_TREE(froomlist.tree)); |
22023
d65fd48a3ad9
Typo can cause crashes.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22006
diff
changeset
|
383 gnt_widget_draw(froomlist.tree); |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
384 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
385 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
386 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
387 static PurpleRoomlistUiOps ui_ops = |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
388 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
389 fl_show_with_account, /* void (*show_with_account)(PurpleAccount *account); **< Force the ui to pop up a dialog and get the list */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
390 fl_create, /* void (*create)(PurpleRoomlist *list); **< A new list was created. */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
391 fl_set_fields, /* void (*set_fields)(PurpleRoomlist *list, GList *fields); **< Sets the columns. */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
392 fl_add_room, /* void (*add_room)(PurpleRoomlist *list, PurpleRoomlistRoom *room); **< Add a room to the list. */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
393 NULL, /* void (*in_progress)(PurpleRoomlist *list, gboolean flag); **< Are we fetching stuff still? */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
394 fl_destroy, /* void (*destroy)(PurpleRoomlist *list); **< We're destroying list. */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
395 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
396 NULL, /* void (*_purple_reserved1)(void); */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
397 NULL, /* void (*_purple_reserved2)(void); */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
398 NULL, /* void (*_purple_reserved3)(void); */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
399 NULL /* void (*_purple_reserved4)(void); */ |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
400 }; |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
401 |
22006
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
402 PurpleRoomlistUiOps *finch_roomlist_get_ui_ops(void) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
403 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
404 return &ui_ops; |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
405 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
406 |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
407 void finch_roomlist_show_all(void) |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
408 { |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
409 purple_roomlist_show_with_account(NULL); |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 } |
1278280fa0b6
Implementation of the roomlist API.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
411 |
22024
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
412 void finch_roomlist_init(void) |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
413 { |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
414 purple_prefs_add_none(PREF_ROOT); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
415 purple_prefs_add_none(PREF_ROOT "/size"); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
416 purple_prefs_add_int(PREF_ROOT "/size/width", 60); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
417 purple_prefs_add_int(PREF_ROOT "/size/height", 15); |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
418 } |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
419 |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
420 void finch_roomlist_uninit(void) |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
421 { |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
422 } |
57cac5dfda2a
Remember the size of the roomlist window. Handle the categories better.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22023
diff
changeset
|
423 |