Sat, 15 Feb 2014 22:10:38 +0530
Merged default branch
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* purple |
| 8113 | 2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
|
8146
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8113
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8113
diff
changeset
|
5 | * source distribution. |
| 8113 | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18265
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8113 | 20 | */ |
| 21 | ||
|
18265
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
22 | #include "internal.h" |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
23 | #include "glibcompat.h" |
|
18265
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
24 | |
| 8113 | 25 | #include "account.h" |
| 26 | #include "connection.h" | |
| 27 | #include "debug.h" | |
| 28 | #include "roomlist.h" | |
| 8199 | 29 | #include "server.h" |
| 8113 | 30 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
31 | #define PURPLE_ROOMLIST_GET_PRIVATE(obj) \ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
32 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_ROOMLIST, PurpleRoomlistPrivate)) |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
33 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
34 | typedef struct _PurpleRoomlistPrivate PurpleRoomlistPrivate; |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
35 | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
36 | /* |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
37 | * Private data for a room list. |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
38 | */ |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
39 | struct _PurpleRoomlistPrivate { |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
40 | PurpleAccount *account; /* The account this list belongs to. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
41 | GList *fields; /* The fields. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
42 | GList *rooms; /* The list of rooms. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
43 | gboolean in_progress; /* The listing is in progress. */ |
| 35097 | 44 | |
| 45 | /* TODO Remove this and use protocol-specific subclasses. */ | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
46 | gpointer proto_data; /* Protocol private data. */ |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
47 | }; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
48 | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
49 | /* |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
50 | * Represents a room. |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
51 | */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
52 | struct _PurpleRoomlistRoom { |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
53 | PurpleRoomlistRoomType type; /* The type of room. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
54 | gchar *name; /* The name of the room. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
55 | GList *fields; /* Other fields. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
56 | PurpleRoomlistRoom *parent; /* The parent room, or NULL. */ |
| 37072 | 57 | gboolean expanded_once; /* A flag the UI uses to avoid multiple expand protocol cbs. */ |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
58 | }; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
59 | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
60 | /* |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
61 | * A field a room might have. |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
62 | */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
63 | struct _PurpleRoomlistField { |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
64 | PurpleRoomlistFieldType type; /* The type of field. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
65 | gchar *label; /* The i18n user displayed name of the field. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
66 | gchar *name; /* The internal name of the field. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
67 | gboolean hidden; /* Hidden? */ |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
68 | }; |
| 8113 | 69 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
70 | /* Room list property enums */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
71 | enum |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
72 | { |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
73 | PROP_0, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
74 | PROP_ACCOUNT, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
75 | PROP_FIELDS, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
76 | PROP_IN_PROGRESS, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
77 | PROP_LAST |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
78 | }; |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
79 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
80 | static GObjectClass *parent_class; |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
81 | static GParamSpec *properties[PROP_LAST]; |
| 15884 | 82 | static PurpleRoomlistUiOps *ops = NULL; |
| 8113 | 83 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
84 | static void purple_roomlist_field_free(PurpleRoomlistField *f); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
85 | static void purple_roomlist_room_destroy(PurpleRoomlist *list, PurpleRoomlistRoom *r); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
86 | |
| 8113 | 87 | /**************************************************************************/ |
| 35472 | 88 | /* Room List API */ |
| 8113 | 89 | /**************************************************************************/ |
| 90 | ||
| 15884 | 91 | void purple_roomlist_show_with_account(PurpleAccount *account) |
| 8352 | 92 | { |
| 93 | if (ops && ops->show_with_account) | |
| 94 | ops->show_with_account(account); | |
| 95 | } | |
| 96 | ||
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
97 | PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
98 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
99 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
100 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
101 | g_return_val_if_fail(priv != NULL, NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
102 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
103 | return priv->account; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
104 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
105 | |
| 15884 | 106 | void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) |
| 8113 | 107 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
108 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8113 | 109 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
110 | g_return_if_fail(priv != NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
111 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
112 | priv->fields = fields; |
| 8113 | 113 | |
| 114 | if (ops && ops->set_fields) | |
| 115 | ops->set_fields(list, fields); | |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
116 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
117 | g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_FIELDS]); |
| 8113 | 118 | } |
| 119 | ||
| 15884 | 120 | void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress) |
| 8113 | 121 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
122 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8113 | 123 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
124 | g_return_if_fail(priv != NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
125 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
126 | priv->in_progress = in_progress; |
| 8199 | 127 | |
| 8113 | 128 | if (ops && ops->in_progress) |
| 129 | ops->in_progress(list, in_progress); | |
|
35013
4718438d053b
Cleaned up properties and added g_object_notify calls for everything else
Ankit Vani <a@nevitus.org>
parents:
34986
diff
changeset
|
130 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
131 | g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_IN_PROGRESS]); |
| 8113 | 132 | } |
| 133 | ||
| 15884 | 134 | gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list) |
| 8199 | 135 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
136 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8199 | 137 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
138 | g_return_val_if_fail(priv != NULL, FALSE); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
139 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
140 | return priv->in_progress; |
| 8199 | 141 | } |
| 142 | ||
| 15884 | 143 | void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8113 | 144 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
145 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
146 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
147 | g_return_if_fail(priv != NULL); |
| 8113 | 148 | g_return_if_fail(room != NULL); |
| 149 | ||
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
150 | priv->rooms = g_list_append(priv->rooms, room); |
| 8113 | 151 | |
| 152 | if (ops && ops->add_room) | |
| 153 | ops->add_room(list, room); | |
| 154 | } | |
| 155 | ||
| 15884 | 156 | PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc) |
| 8113 | 157 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
158 | PurpleProtocol *protocol = NULL; |
| 8113 | 159 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
160 | g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL); |
|
24863
68c109ca0089
Fix a crash that happens when accessing the roomlist for an account that's
Paul Aurich <darkrain42@pidgin.im>
parents:
24814
diff
changeset
|
161 | g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL); |
| 8113 | 162 | |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
163 | protocol = purple_connection_get_protocol(gc); |
| 8113 | 164 | |
|
36630
ff356949df25
Refactored the rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
165 | if(protocol) |
| 36719 | 166 | return purple_protocol_roomlist_iface_get_list(protocol, gc); |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
167 | |
| 8113 | 168 | return NULL; |
| 169 | } | |
| 170 | ||
| 15884 | 171 | void purple_roomlist_cancel_get_list(PurpleRoomlist *list) |
| 8113 | 172 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
173 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
174 | PurpleProtocol *protocol = NULL; |
| 15884 | 175 | PurpleConnection *gc; |
| 8113 | 176 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
177 | g_return_if_fail(priv != NULL); |
| 8113 | 178 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
179 | gc = purple_account_get_connection(priv->account); |
| 8113 | 180 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
181 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 8113 | 182 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
183 | if(gc) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
184 | protocol = purple_connection_get_protocol(gc); |
| 8113 | 185 | |
|
36630
ff356949df25
Refactored the rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
186 | if(protocol) |
| 36719 | 187 | purple_protocol_roomlist_iface_cancel(protocol, list); |
| 8113 | 188 | } |
| 189 | ||
| 15884 | 190 | void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) |
| 8113 | 191 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
192 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
193 | PurpleProtocol *protocol = NULL; |
| 15884 | 194 | PurpleConnection *gc; |
| 8113 | 195 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
196 | g_return_if_fail(priv != NULL); |
| 8584 | 197 | g_return_if_fail(category != NULL); |
| 15884 | 198 | g_return_if_fail(category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); |
| 8113 | 199 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
200 | gc = purple_account_get_connection(priv->account); |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
201 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 8113 | 202 | |
|
22390
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
203 | if(gc) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
204 | protocol = purple_connection_get_protocol(gc); |
| 8113 | 205 | |
|
36630
ff356949df25
Refactored the rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
206 | if(protocol) |
| 36719 | 207 | purple_protocol_roomlist_iface_expand_category(protocol, list, category); |
| 8113 | 208 | } |
| 209 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
210 | GList * purple_roomlist_get_fields(PurpleRoomlist *list) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
211 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
212 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
213 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
214 | g_return_val_if_fail(priv != NULL, NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
215 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
216 | return priv->fields; |
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
217 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
218 | |
|
34942
e1783e620a85
Renamed purple_roomlist_[gs]et_proto_data to purple_roomlist_[gs]et_protocol_data
Ankit Vani <a@nevitus.org>
parents:
34934
diff
changeset
|
219 | gpointer purple_roomlist_get_protocol_data(PurpleRoomlist *list) |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
220 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
221 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
222 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
223 | g_return_val_if_fail(priv != NULL, NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
224 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
225 | return priv->proto_data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
226 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
227 | |
|
34942
e1783e620a85
Renamed purple_roomlist_[gs]et_proto_data to purple_roomlist_[gs]et_protocol_data
Ankit Vani <a@nevitus.org>
parents:
34934
diff
changeset
|
228 | void purple_roomlist_set_protocol_data(PurpleRoomlist *list, gpointer proto_data) |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
229 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
230 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
231 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
232 | g_return_if_fail(priv != NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
233 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
234 | priv->proto_data = proto_data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
235 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
236 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
237 | gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
238 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
239 | g_return_val_if_fail(PURPLE_IS_ROOMLIST(list), NULL); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
240 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
241 | return list->ui_data; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
242 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
243 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
244 | void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
245 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
246 | g_return_if_fail(PURPLE_IS_ROOMLIST(list)); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
247 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
248 | list->ui_data = ui_data; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
249 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
250 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
251 | /**************************************************************************/ |
| 35472 | 252 | /* Room List GObject code */ |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
253 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
254 | |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
255 | /* Set method for GObject properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
256 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
257 | purple_roomlist_set_property(GObject *obj, guint param_id, const GValue *value, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
258 | GParamSpec *pspec) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
259 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
260 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
261 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
262 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
263 | switch (param_id) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
264 | case PROP_ACCOUNT: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
265 | priv->account = g_value_get_object(value); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
266 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
267 | case PROP_FIELDS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
268 | purple_roomlist_set_fields(list, g_value_get_pointer(value)); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
269 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
270 | case PROP_IN_PROGRESS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
271 | purple_roomlist_set_in_progress(list, g_value_get_boolean(value)); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
272 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
273 | default: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
274 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
275 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
276 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
277 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
278 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
279 | /* Get method for GObject properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
280 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
281 | purple_roomlist_get_property(GObject *obj, guint param_id, GValue *value, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
282 | GParamSpec *pspec) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
283 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
284 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
285 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
286 | switch (param_id) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
287 | case PROP_ACCOUNT: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
288 | g_value_set_object(value, purple_roomlist_get_account(list)); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
289 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
290 | case PROP_FIELDS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
291 | g_value_set_pointer(value, purple_roomlist_get_fields(list)); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
292 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
293 | case PROP_IN_PROGRESS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
294 | g_value_set_boolean(value, purple_roomlist_get_in_progress(list)); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
295 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
296 | default: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
297 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
298 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
299 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
300 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
301 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
302 | /* Called when done constructing */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
303 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
304 | purple_roomlist_constructed(GObject *object) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
305 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
306 | PurpleRoomlist *list = PURPLE_ROOMLIST(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
307 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
308 | parent_class->constructed(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
309 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
310 | if (ops && ops->create) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
311 | ops->create(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
312 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
313 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
314 | /* GObject finalize function */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
315 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
316 | purple_roomlist_finalize(GObject *object) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
317 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
318 | PurpleRoomlist *list = PURPLE_ROOMLIST(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
319 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
320 | GList *l; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
321 | |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
322 | purple_debug_misc("roomlist", "destroying list %p\n", list); |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
323 | |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
324 | if (ops && ops->destroy) |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
325 | ops->destroy(list); |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
326 | |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
327 | for (l = priv->rooms; l; l = l->next) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
328 | PurpleRoomlistRoom *r = l->data; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
329 | purple_roomlist_room_destroy(list, r); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
330 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
331 | g_list_free(priv->rooms); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
332 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
333 | g_list_foreach(priv->fields, (GFunc)purple_roomlist_field_free, NULL); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
334 | g_list_free(priv->fields); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
335 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
336 | parent_class->finalize(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
337 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
338 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
339 | /* Class initializer function */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
340 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
341 | purple_roomlist_class_init(PurpleRoomlistClass *klass) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
342 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
343 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
344 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
345 | parent_class = g_type_class_peek_parent(klass); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
346 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
347 | obj_class->finalize = purple_roomlist_finalize; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
348 | obj_class->constructed = purple_roomlist_constructed; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
349 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
350 | /* Setup properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
351 | obj_class->get_property = purple_roomlist_get_property; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
352 | obj_class->set_property = purple_roomlist_set_property; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
353 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
354 | g_type_class_add_private(klass, sizeof(PurpleRoomlistPrivate)); |
|
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
355 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
356 | properties[PROP_ACCOUNT] = g_param_spec_object("account", "Account", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35022
diff
changeset
|
357 | "The account for the room list.", |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
358 | PURPLE_TYPE_ACCOUNT, |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
359 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
360 | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
361 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
362 | properties[PROP_FIELDS] = g_param_spec_pointer("fields", "Fields", |
|
35058
506740af931c
Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents:
35022
diff
changeset
|
363 | "The list of fields for a roomlist.", |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
364 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
365 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
366 | properties[PROP_IN_PROGRESS] = g_param_spec_boolean("in-progress", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
367 | "In progress", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
368 | "Whether the room list is being fetched.", FALSE, |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
369 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
370 | |
|
35085
abab0adfa0ec
libpurple: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents:
35080
diff
changeset
|
371 | g_object_class_install_properties(obj_class, PROP_LAST, properties); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
372 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
373 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
374 | GType |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
375 | purple_roomlist_get_type(void) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
376 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
377 | static GType type = 0; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
378 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
379 | if(type == 0) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
380 | static const GTypeInfo info = { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
381 | sizeof(PurpleRoomlistClass), |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
382 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
383 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
384 | (GClassInitFunc)purple_roomlist_class_init, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
385 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
386 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
387 | sizeof(PurpleRoomlist), |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
388 | 0, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
389 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
390 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
391 | }; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
392 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
393 | type = g_type_register_static(G_TYPE_OBJECT, "PurpleRoomlist", |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
394 | &info, 0); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
395 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
396 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
397 | return type; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
398 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
399 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
400 | PurpleRoomlist *purple_roomlist_new(PurpleAccount *account) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
401 | { |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
402 | PurpleRoomlist *list; |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
403 | PurpleProtocol *protocol; |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
404 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
405 | g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
406 | |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
407 | protocol = purple_protocols_find(purple_account_get_protocol_id(account)); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
408 | |
|
36844
b62140058cd3
Check for valid PurpleProtocols
Ankit Vani <a@nevitus.org>
parents:
36843
diff
changeset
|
409 | g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL); |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
410 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
411 | if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, FACTORY_IFACE, roomlist_new)) |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
412 | list = purple_protocol_factory_iface_roomlist_new(protocol, account); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
413 | else |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
414 | list = g_object_new(PURPLE_TYPE_ROOMLIST, |
| 36872 | 415 | "account", account, |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
416 | NULL |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
417 | ); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
418 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
419 | g_return_val_if_fail(list != NULL, NULL); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
420 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
421 | return list; |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
422 | } |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
423 | |
| 8113 | 424 | /**************************************************************************/ |
| 35472 | 425 | /* Room API */ |
| 8113 | 426 | /**************************************************************************/ |
| 427 | ||
| 15884 | 428 | PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, |
| 429 | PurpleRoomlistRoom *parent) | |
| 8113 | 430 | { |
| 15884 | 431 | PurpleRoomlistRoom *room; |
| 8113 | 432 | |
| 433 | g_return_val_if_fail(name != NULL, NULL); | |
| 434 | ||
| 15884 | 435 | room = g_new0(PurpleRoomlistRoom, 1); |
| 8113 | 436 | room->type = type; |
| 437 | room->name = g_strdup(name); | |
| 438 | room->parent = parent; | |
| 439 | ||
| 440 | return room; | |
| 441 | } | |
| 442 | ||
| 15884 | 443 | void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field) |
| 8113 | 444 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
445 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 15884 | 446 | PurpleRoomlistField *f; |
| 8113 | 447 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
448 | g_return_if_fail(priv != NULL); |
| 8113 | 449 | g_return_if_fail(room != NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
450 | g_return_if_fail(priv->fields != NULL); |
| 8113 | 451 | |
|
24814
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
452 | /* If this is the first call for this room, grab the first field in |
|
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
453 | * the Roomlist's fields. Otherwise, grab the field that is one |
|
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
454 | * more than the number of fields already present for the room. |
|
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
455 | * (This works because g_list_nth_data() is zero-indexed and |
|
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
456 | * g_list_length() is one-indexed.) */ |
| 8113 | 457 | if (!room->fields) |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
458 | f = priv->fields->data; |
| 8113 | 459 | else |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
460 | f = g_list_nth_data(priv->fields, g_list_length(room->fields)); |
| 8113 | 461 | |
| 462 | g_return_if_fail(f != NULL); | |
| 463 | ||
| 464 | switch(f->type) { | |
| 15884 | 465 | case PURPLE_ROOMLIST_FIELD_STRING: |
| 8113 | 466 | room->fields = g_list_append(room->fields, g_strdup(field)); |
| 467 | break; | |
| 15884 | 468 | case PURPLE_ROOMLIST_FIELD_BOOL: |
| 469 | case PURPLE_ROOMLIST_FIELD_INT: | |
| 8113 | 470 | room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); |
| 471 | break; | |
| 472 | } | |
|
35066
f997e5384f79
libpurple: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents:
35058
diff
changeset
|
473 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
474 | g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_FIELDS]); |
| 8113 | 475 | } |
| 476 | ||
| 15884 | 477 | void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8199 | 478 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
479 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8199 | 480 | GHashTable *components; |
| 481 | GList *l, *j; | |
| 15884 | 482 | PurpleConnection *gc; |
| 8199 | 483 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
484 | g_return_if_fail(priv != NULL); |
| 8199 | 485 | g_return_if_fail(room != NULL); |
| 486 | ||
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
487 | gc = purple_account_get_connection(priv->account); |
| 8199 | 488 | if (!gc) |
| 489 | return; | |
| 490 | ||
| 491 | components = g_hash_table_new(g_str_hash, g_str_equal); | |
| 492 | ||
| 493 | g_hash_table_replace(components, "name", room->name); | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
494 | for (l = priv->fields, j = room->fields; l && j; l = l->next, j = j->next) { |
| 15884 | 495 | PurpleRoomlistField *f = l->data; |
| 8199 | 496 | |
| 497 | g_hash_table_replace(components, f->name, j->data); | |
| 498 | } | |
| 499 | ||
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
35486
diff
changeset
|
500 | purple_serv_join_chat(gc, components); |
| 8199 | 501 | |
| 502 | g_hash_table_destroy(components); | |
| 503 | } | |
| 504 | ||
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
35013
diff
changeset
|
505 | PurpleRoomlistRoomType purple_roomlist_room_get_room_type(PurpleRoomlistRoom *room) |
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
506 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
507 | return room->type; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
508 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
509 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
510 | const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
511 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
512 | return room->name; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
513 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
514 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
515 | PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
516 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
517 | return room->parent; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
518 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
519 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
520 | gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
521 | { |
|
32237
d5398bd73913
Fix two compile warnings. Did I do that? I totally didn't notice. My bad.
Mark Doliner <markdoliner@pidgin.im>
parents:
32218
diff
changeset
|
522 | g_return_val_if_fail(room != NULL, FALSE); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
523 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
524 | return room->expanded_once; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
525 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
526 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
527 | void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
528 | { |
|
32237
d5398bd73913
Fix two compile warnings. Did I do that? I totally didn't notice. My bad.
Mark Doliner <markdoliner@pidgin.im>
parents:
32218
diff
changeset
|
529 | g_return_if_fail(room != NULL); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
530 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
531 | room->expanded_once = expanded_once; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
532 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
533 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
534 | GList *purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) |
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
535 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
536 | return room->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
537 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
538 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
539 | static void purple_roomlist_room_destroy(PurpleRoomlist *list, PurpleRoomlistRoom *r) |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
540 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
541 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
542 | GList *l, *j; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
543 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
544 | for (l = priv->fields, j = r->fields; l && j; l = l->next, j = j->next) { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
545 | PurpleRoomlistField *f = l->data; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
546 | if (f->type == PURPLE_ROOMLIST_FIELD_STRING) |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
547 | g_free(j->data); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
548 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
549 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
550 | g_list_free(r->fields); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
551 | g_free(r->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
552 | g_free(r); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
553 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
554 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
555 | /**************************************************************************/ |
| 35472 | 556 | /* Room GBoxed code */ |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
557 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
558 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
559 | static PurpleRoomlistRoom *purple_roomlist_room_copy(PurpleRoomlistRoom *r) |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
560 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
561 | g_return_val_if_fail(r != NULL, NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
562 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
563 | return purple_roomlist_room_new(r->type, r->name, r->parent); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
564 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
565 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
566 | static void purple_roomlist_room_free(PurpleRoomlistRoom *r) |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
567 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
568 | g_return_if_fail(r != NULL); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
569 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
570 | g_list_free(r->fields); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
571 | g_free(r->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
572 | g_free(r); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
573 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
574 | |
|
35022
f223dd325f3a
Renamed roomlist *_get_gtype functions to *_get_type so that gtk-doc can find them
Ankit Vani <a@nevitus.org>
parents:
35021
diff
changeset
|
575 | GType purple_roomlist_room_get_type(void) |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
576 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
577 | static GType type = 0; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
578 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
579 | if (type == 0) { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
580 | type = g_boxed_type_register_static("PurpleRoomlistRoom", |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
581 | (GBoxedCopyFunc)purple_roomlist_room_copy, |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
582 | (GBoxedFreeFunc)purple_roomlist_room_free); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
583 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
584 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
585 | return type; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
586 | } |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
587 | |
| 8113 | 588 | /**************************************************************************/ |
| 35472 | 589 | /* Room Field API */ |
| 8113 | 590 | /**************************************************************************/ |
| 591 | ||
| 15884 | 592 | PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, |
| 8113 | 593 | const gchar *label, const gchar *name, |
| 594 | gboolean hidden) | |
| 595 | { | |
| 15884 | 596 | PurpleRoomlistField *f; |
| 8113 | 597 | |
| 598 | g_return_val_if_fail(label != NULL, NULL); | |
| 599 | g_return_val_if_fail(name != NULL, NULL); | |
| 600 | ||
| 15884 | 601 | f = g_new0(PurpleRoomlistField, 1); |
| 8113 | 602 | |
| 603 | f->type = type; | |
| 604 | f->label = g_strdup(label); | |
| 605 | f->name = g_strdup(name); | |
| 606 | f->hidden = hidden; | |
| 607 | ||
| 608 | return f; | |
| 609 | } | |
| 610 | ||
|
35021
eaf8156d3c5e
Renamed purple_roomlist_room_get_type to *_get_room_type, purple_roomlist_field_get_type to *_get_field_type
Ankit Vani <a@nevitus.org>
parents:
35013
diff
changeset
|
611 | PurpleRoomlistFieldType purple_roomlist_field_get_field_type(PurpleRoomlistField *field) |
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
612 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
613 | return field->type; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
614 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
615 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
616 | const char * purple_roomlist_field_get_label(PurpleRoomlistField *field) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
617 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
618 | return field->label; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
619 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
620 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
621 | gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field) |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
622 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
623 | return field->hidden; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
624 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
625 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
626 | /**************************************************************************/ |
| 35472 | 627 | /* Room Field GBoxed code */ |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
628 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
629 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
630 | static PurpleRoomlistField *purple_roomlist_field_copy(PurpleRoomlistField *f) |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
631 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
632 | g_return_val_if_fail(f != NULL, NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
633 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
634 | return purple_roomlist_field_new(f->type, f->label, f->name, f->hidden); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
635 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
636 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
637 | static void purple_roomlist_field_free(PurpleRoomlistField *f) |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
638 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
639 | g_return_if_fail(f != NULL); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
640 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
641 | g_free(f->label); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
642 | g_free(f->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
643 | g_free(f); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
644 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
645 | |
|
35022
f223dd325f3a
Renamed roomlist *_get_gtype functions to *_get_type so that gtk-doc can find them
Ankit Vani <a@nevitus.org>
parents:
35021
diff
changeset
|
646 | GType purple_roomlist_field_get_type(void) |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
647 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
648 | static GType type = 0; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
649 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
650 | if (type == 0) { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
651 | type = g_boxed_type_register_static("PurpleRoomlistField", |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
652 | (GBoxedCopyFunc)purple_roomlist_field_copy, |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
653 | (GBoxedFreeFunc)purple_roomlist_field_free); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
654 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
655 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
656 | return type; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
657 | } |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
658 | |
| 8113 | 659 | /**************************************************************************/ |
| 35472 | 660 | /* UI Registration Functions */ |
| 8113 | 661 | /**************************************************************************/ |
| 662 | ||
| 15884 | 663 | void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) |
| 8113 | 664 | { |
| 665 | ops = ui_ops; | |
| 666 | } | |
| 667 | ||
| 15884 | 668 | PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) |
| 8113 | 669 | { |
| 670 | return ops; | |
| 671 | } | |
| 672 | ||
| 35572 | 673 | /************************************************************************** |
| 674 | * UI Ops GBoxed code | |
| 675 | **************************************************************************/ | |
| 676 | ||
| 677 | static PurpleRoomlistUiOps * | |
| 678 | purple_roomlist_ui_ops_copy(PurpleRoomlistUiOps *ops) | |
| 679 | { | |
| 680 | PurpleRoomlistUiOps *ops_new; | |
| 681 | ||
| 682 | g_return_val_if_fail(ops != NULL, NULL); | |
| 683 | ||
| 684 | ops_new = g_new(PurpleRoomlistUiOps, 1); | |
| 685 | *ops_new = *ops; | |
| 686 | ||
| 687 | return ops_new; | |
| 688 | } | |
| 689 | ||
| 690 | static void | |
| 691 | purple_roomlist_ui_ops_free(PurpleRoomlistUiOps *ops) | |
| 692 | { | |
| 693 | g_return_if_fail(ops != NULL); | |
| 694 | ||
| 695 | g_free(ops); | |
| 696 | } | |
| 697 | ||
| 698 | GType | |
| 699 | purple_roomlist_ui_ops_get_type(void) | |
| 700 | { | |
| 701 | static GType type = 0; | |
| 702 | ||
| 703 | if (type == 0) { | |
| 704 | type = g_boxed_type_register_static("PurpleRoomlistUiOps", | |
| 705 | (GBoxedCopyFunc)purple_roomlist_ui_ops_copy, | |
| 706 | (GBoxedFreeFunc)purple_roomlist_ui_ops_free); | |
| 707 | } | |
| 708 | ||
| 709 | return type; | |
| 710 | } |