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