Sun, 24 Nov 2013 02:44:39 +0530
Merged soc.2013.gobjectification branch
| 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" |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
27 | #include "glibcompat.h" |
|
18265
9f26190d7f46
Move the define in internal.h instead.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15884
diff
changeset
|
28 | |
| 8113 | 29 | #include "account.h" |
| 30 | #include "connection.h" | |
| 31 | #include "debug.h" | |
| 32 | #include "roomlist.h" | |
| 8199 | 33 | #include "server.h" |
| 8113 | 34 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
35 | #define PURPLE_ROOMLIST_GET_PRIVATE(obj) \ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
36 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_ROOMLIST, PurpleRoomlistPrivate)) |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
37 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
38 | /** @copydoc _PurpleRoomlistPrivate */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
39 | typedef struct _PurpleRoomlistPrivate PurpleRoomlistPrivate; |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
40 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
41 | /** |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
42 | * Private data for a room list. |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
43 | */ |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
44 | struct _PurpleRoomlistPrivate { |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
45 | PurpleAccount *account; /**< The account this list belongs to. */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
46 | GList *fields; /**< The fields. */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
47 | GList *rooms; /**< The list of rooms. */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
48 | gboolean in_progress; /**< The listing is in progress. */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
49 | gpointer proto_data; /** Protocol private data. |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
50 | TODO Remove this, and use |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
51 | protocol-specific subclasses */ |
|
32218
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 | /** |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
55 | * Represents a room. |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
56 | */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
57 | struct _PurpleRoomlistRoom { |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
58 | PurpleRoomlistRoomType type; /**< The type of room. */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
59 | gchar *name; /**< The name of the room. */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
60 | GList *fields; /**< Other fields. */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
61 | PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36630
diff
changeset
|
62 | 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
|
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 | /** |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
66 | * A field a room might have. |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
67 | */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
68 | struct _PurpleRoomlistField { |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
69 | PurpleRoomlistFieldType type; /**< The type of field. */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
70 | 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
|
71 | gchar *name; /**< The internal name of the field. */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
72 | gboolean hidden; /**< Hidden? */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
73 | }; |
| 8113 | 74 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
75 | /* Room list property enums */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
76 | enum |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
77 | { |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
78 | PROP_0, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
79 | PROP_ACCOUNT, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
80 | PROP_FIELDS, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
81 | PROP_IN_PROGRESS, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
82 | PROP_LAST |
|
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 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
85 | 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
|
86 | static GParamSpec *properties[PROP_LAST]; |
| 15884 | 87 | static PurpleRoomlistUiOps *ops = NULL; |
| 8113 | 88 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
89 | 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
|
90 | 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
|
91 | |
| 8113 | 92 | /**************************************************************************/ |
| 93 | /** @name Room List API */ | |
| 94 | /**************************************************************************/ | |
| 95 | /*@{*/ | |
| 96 | ||
| 15884 | 97 | void purple_roomlist_show_with_account(PurpleAccount *account) |
| 8352 | 98 | { |
| 99 | if (ops && ops->show_with_account) | |
| 100 | ops->show_with_account(account); | |
| 101 | } | |
| 102 | ||
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
103 | PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list) |
|
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 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
106 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
107 | g_return_val_if_fail(priv != NULL, NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
108 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
109 | return priv->account; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
110 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
111 | |
| 15884 | 112 | void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) |
| 8113 | 113 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
114 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8113 | 115 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
116 | g_return_if_fail(priv != NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
117 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
118 | priv->fields = fields; |
| 8113 | 119 | |
| 120 | if (ops && ops->set_fields) | |
| 121 | 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
|
122 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
123 | g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_FIELDS]); |
| 8113 | 124 | } |
| 125 | ||
| 15884 | 126 | void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress) |
| 8113 | 127 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
128 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8113 | 129 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
130 | g_return_if_fail(priv != NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
131 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
132 | priv->in_progress = in_progress; |
| 8199 | 133 | |
| 8113 | 134 | if (ops && ops->in_progress) |
| 135 | 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
|
136 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
137 | g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_IN_PROGRESS]); |
| 8113 | 138 | } |
| 139 | ||
| 15884 | 140 | gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list) |
| 8199 | 141 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
142 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8199 | 143 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
144 | g_return_val_if_fail(priv != NULL, FALSE); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
145 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
146 | return priv->in_progress; |
| 8199 | 147 | } |
| 148 | ||
| 15884 | 149 | void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8113 | 150 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
151 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
152 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
153 | g_return_if_fail(priv != NULL); |
| 8113 | 154 | g_return_if_fail(room != NULL); |
| 155 | ||
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
156 | priv->rooms = g_list_append(priv->rooms, room); |
| 8113 | 157 | |
| 158 | if (ops && ops->add_room) | |
| 159 | ops->add_room(list, room); | |
| 160 | } | |
| 161 | ||
| 15884 | 162 | PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc) |
| 8113 | 163 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
164 | PurpleProtocol *protocol = NULL; |
| 8113 | 165 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
166 | 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
|
167 | g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL); |
| 8113 | 168 | |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
169 | protocol = purple_connection_get_protocol(gc); |
| 8113 | 170 | |
|
36630
ff356949df25
Refactored the rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
171 | if(protocol) |
| 36719 | 172 | 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
|
173 | |
| 8113 | 174 | return NULL; |
| 175 | } | |
| 176 | ||
| 15884 | 177 | void purple_roomlist_cancel_get_list(PurpleRoomlist *list) |
| 8113 | 178 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
179 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
180 | PurpleProtocol *protocol = NULL; |
| 15884 | 181 | PurpleConnection *gc; |
| 8113 | 182 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
183 | g_return_if_fail(priv != NULL); |
| 8113 | 184 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
185 | gc = purple_account_get_connection(priv->account); |
| 8113 | 186 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
187 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 8113 | 188 | |
|
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
|
189 | if(gc) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
190 | protocol = purple_connection_get_protocol(gc); |
| 8113 | 191 | |
|
36630
ff356949df25
Refactored the rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
192 | if(protocol) |
| 36719 | 193 | purple_protocol_roomlist_iface_cancel(protocol, list); |
| 8113 | 194 | } |
| 195 | ||
| 15884 | 196 | void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) |
| 8113 | 197 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
198 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
199 | PurpleProtocol *protocol = NULL; |
| 15884 | 200 | PurpleConnection *gc; |
| 8113 | 201 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
202 | g_return_if_fail(priv != NULL); |
| 8584 | 203 | g_return_if_fail(category != NULL); |
| 15884 | 204 | g_return_if_fail(category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); |
| 8113 | 205 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
206 | 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
|
207 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 8113 | 208 | |
|
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
|
209 | if(gc) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
210 | protocol = purple_connection_get_protocol(gc); |
| 8113 | 211 | |
|
36630
ff356949df25
Refactored the rest of libpurple to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36623
diff
changeset
|
212 | if(protocol) |
| 36719 | 213 | purple_protocol_roomlist_iface_expand_category(protocol, list, category); |
| 8113 | 214 | } |
| 215 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
216 | 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
|
217 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
218 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
219 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
220 | g_return_val_if_fail(priv != NULL, NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
221 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
222 | return priv->fields; |
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
223 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
224 | |
|
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
|
225 | 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
|
226 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
227 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
228 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
229 | g_return_val_if_fail(priv != NULL, NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
230 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
231 | return priv->proto_data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
232 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
233 | |
|
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
|
234 | 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
|
235 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
236 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
237 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
238 | g_return_if_fail(priv != NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
239 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
240 | priv->proto_data = proto_data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
241 | } |
|
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 | gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
244 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
245 | 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
|
246 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
247 | return list->ui_data; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
248 | } |
|
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 | 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
|
251 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
252 | 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
|
253 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
254 | list->ui_data = ui_data; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
255 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
256 | |
| 8113 | 257 | /*@}*/ |
| 258 | ||
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
259 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
260 | /** @name Room List GObject code */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
261 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
262 | /*@{*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
263 | |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
264 | /* Set method for GObject properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
265 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
266 | 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
|
267 | GParamSpec *pspec) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
268 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
269 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
270 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
271 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
272 | switch (param_id) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
273 | case PROP_ACCOUNT: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
274 | priv->account = g_value_get_object(value); |
|
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 | case PROP_FIELDS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
277 | 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
|
278 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
279 | case PROP_IN_PROGRESS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
280 | 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
|
281 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
282 | default: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
283 | 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
|
284 | break; |
|
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 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
287 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
288 | /* Get method for GObject properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
289 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
290 | 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
|
291 | GParamSpec *pspec) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
292 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
293 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
294 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
295 | switch (param_id) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
296 | case PROP_ACCOUNT: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
297 | 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
|
298 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
299 | case PROP_FIELDS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
300 | 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
|
301 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
302 | case PROP_IN_PROGRESS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
303 | 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
|
304 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
305 | default: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
306 | 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
|
307 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
308 | } |
|
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 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
311 | /* Called when done constructing */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
312 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
313 | purple_roomlist_constructed(GObject *object) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
314 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
315 | PurpleRoomlist *list = PURPLE_ROOMLIST(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
316 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
317 | parent_class->constructed(object); |
|
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 | if (ops && ops->create) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
320 | ops->create(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
321 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
322 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
323 | /* GObject finalize function */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
324 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
325 | purple_roomlist_finalize(GObject *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 | PurpleRoomlist *list = PURPLE_ROOMLIST(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
328 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
329 | GList *l; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
330 | |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
331 | 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
|
332 | |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
333 | 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
|
334 | 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
|
335 | |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
336 | for (l = priv->rooms; l; l = l->next) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
337 | PurpleRoomlistRoom *r = l->data; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
338 | purple_roomlist_room_destroy(list, r); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
339 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
340 | g_list_free(priv->rooms); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
341 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
342 | 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
|
343 | g_list_free(priv->fields); |
|
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->finalize(object); |
|
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 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
348 | /* Class initializer function */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
349 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
350 | purple_roomlist_class_init(PurpleRoomlistClass *klass) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
351 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
352 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
353 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
354 | parent_class = g_type_class_peek_parent(klass); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
355 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
356 | obj_class->finalize = purple_roomlist_finalize; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
357 | obj_class->constructed = purple_roomlist_constructed; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
358 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
359 | /* Setup properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
360 | obj_class->get_property = purple_roomlist_get_property; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
361 | obj_class->set_property = purple_roomlist_set_property; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
362 | |
|
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
|
363 | 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
|
364 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
365 | 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
|
366 | "The account for the room list.", |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
367 | 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
|
368 | 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
|
369 | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
370 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
371 | 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
|
372 | "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
|
373 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
374 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
375 | 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
|
376 | "In progress", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
377 | "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
|
378 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
379 | |
|
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
|
380 | 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
|
381 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
382 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
383 | GType |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
384 | purple_roomlist_get_type(void) |
|
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 | static GType type = 0; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
387 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
388 | if(type == 0) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
389 | static const GTypeInfo info = { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
390 | sizeof(PurpleRoomlistClass), |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
391 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
392 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
393 | (GClassInitFunc)purple_roomlist_class_init, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
394 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
395 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
396 | sizeof(PurpleRoomlist), |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
397 | 0, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
398 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
399 | NULL, |
|
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 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
402 | 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
|
403 | &info, 0); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
404 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
405 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
406 | return type; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
407 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
408 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
409 | PurpleRoomlist *purple_roomlist_new(PurpleAccount *account) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
410 | { |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
411 | PurpleRoomlist *list; |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
412 | PurpleProtocol *protocol; |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
413 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
414 | 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
|
415 | |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
416 | 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
|
417 | |
|
36844
b62140058cd3
Check for valid PurpleProtocols
Ankit Vani <a@nevitus.org>
parents:
36843
diff
changeset
|
418 | 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
|
419 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
420 | 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
|
421 | 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
|
422 | else |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
423 | list = g_object_new(PURPLE_TYPE_ROOMLIST, |
| 36872 | 424 | "account", account, |
|
36728
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
425 | NULL |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
426 | ); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
427 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
428 | g_return_val_if_fail(list != NULL, NULL); |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
429 | |
|
313d07370a7b
Use the protocol factory interface functions
Ankit Vani <a@nevitus.org>
parents:
36719
diff
changeset
|
430 | return list; |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
431 | } |
|
34931
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 | /*@}*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
434 | |
| 8113 | 435 | /**************************************************************************/ |
| 436 | /** @name Room API */ | |
| 437 | /**************************************************************************/ | |
| 438 | /*@{*/ | |
| 439 | ||
| 15884 | 440 | PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, |
| 441 | PurpleRoomlistRoom *parent) | |
| 8113 | 442 | { |
| 15884 | 443 | PurpleRoomlistRoom *room; |
| 8113 | 444 | |
| 445 | g_return_val_if_fail(name != NULL, NULL); | |
| 446 | ||
| 15884 | 447 | room = g_new0(PurpleRoomlistRoom, 1); |
| 8113 | 448 | room->type = type; |
| 449 | room->name = g_strdup(name); | |
| 450 | room->parent = parent; | |
| 451 | ||
| 452 | return room; | |
| 453 | } | |
| 454 | ||
| 15884 | 455 | void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field) |
| 8113 | 456 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
457 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 15884 | 458 | PurpleRoomlistField *f; |
| 8113 | 459 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
460 | g_return_if_fail(priv != NULL); |
| 8113 | 461 | g_return_if_fail(room != NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
462 | g_return_if_fail(priv->fields != NULL); |
| 8113 | 463 | |
|
24814
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
464 | /* 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
|
465 | * 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
|
466 | * 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
|
467 | * (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
|
468 | * g_list_length() is one-indexed.) */ |
| 8113 | 469 | if (!room->fields) |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
470 | f = priv->fields->data; |
| 8113 | 471 | else |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
472 | f = g_list_nth_data(priv->fields, g_list_length(room->fields)); |
| 8113 | 473 | |
| 474 | g_return_if_fail(f != NULL); | |
| 475 | ||
| 476 | switch(f->type) { | |
| 15884 | 477 | case PURPLE_ROOMLIST_FIELD_STRING: |
| 8113 | 478 | room->fields = g_list_append(room->fields, g_strdup(field)); |
| 479 | break; | |
| 15884 | 480 | case PURPLE_ROOMLIST_FIELD_BOOL: |
| 481 | case PURPLE_ROOMLIST_FIELD_INT: | |
| 8113 | 482 | room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); |
| 483 | break; | |
| 484 | } | |
|
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
|
485 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
486 | g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_FIELDS]); |
| 8113 | 487 | } |
| 488 | ||
| 15884 | 489 | void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8199 | 490 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
491 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8199 | 492 | GHashTable *components; |
| 493 | GList *l, *j; | |
| 15884 | 494 | PurpleConnection *gc; |
| 8199 | 495 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
496 | g_return_if_fail(priv != NULL); |
| 8199 | 497 | g_return_if_fail(room != NULL); |
| 498 | ||
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
499 | gc = purple_account_get_connection(priv->account); |
| 8199 | 500 | if (!gc) |
| 501 | return; | |
| 502 | ||
| 503 | components = g_hash_table_new(g_str_hash, g_str_equal); | |
| 504 | ||
| 505 | g_hash_table_replace(components, "name", room->name); | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
506 | for (l = priv->fields, j = room->fields; l && j; l = l->next, j = j->next) { |
| 15884 | 507 | PurpleRoomlistField *f = l->data; |
| 8199 | 508 | |
| 509 | g_hash_table_replace(components, f->name, j->data); | |
| 510 | } | |
| 511 | ||
| 512 | serv_join_chat(gc, components); | |
| 513 | ||
| 514 | g_hash_table_destroy(components); | |
| 515 | } | |
| 516 | ||
|
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
|
517 | 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
|
518 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
519 | return room->type; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
522 | 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
|
523 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
524 | return room->name; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
527 | 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
|
528 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
529 | return room->parent; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
530 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
531 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
532 | 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
|
533 | { |
|
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
|
534 | 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
|
535 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
536 | return room->expanded_once; |
|
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 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
539 | 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
|
540 | { |
|
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
|
541 | g_return_if_fail(room != NULL); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
542 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
543 | room->expanded_once = expanded_once; |
|
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 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
546 | 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
|
547 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
548 | return room->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
549 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
550 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
551 | 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
|
552 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
553 | 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
|
554 | GList *l, *j; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
555 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
556 | 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
|
557 | PurpleRoomlistField *f = l->data; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
558 | 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
|
559 | g_free(j->data); |
|
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 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
562 | g_list_free(r->fields); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
563 | g_free(r->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
564 | g_free(r); |
|
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 | |
| 8113 | 567 | /*@}*/ |
| 568 | ||
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
569 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
570 | /** @name Room GBoxed code */ |
|
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 | /*@{*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
573 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
574 | 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
|
575 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
576 | g_return_val_if_fail(r != NULL, NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
577 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
578 | 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
|
579 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
580 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
581 | 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
|
582 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
583 | 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
|
584 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
585 | g_list_free(r->fields); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
586 | g_free(r->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
587 | g_free(r); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
588 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
589 | |
|
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
|
590 | 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
|
591 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
592 | static GType type = 0; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
593 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
594 | if (type == 0) { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
595 | 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
|
596 | (GBoxedCopyFunc)purple_roomlist_room_copy, |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
597 | (GBoxedFreeFunc)purple_roomlist_room_free); |
|
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 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
600 | return type; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
601 | } |
|
34931
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 | /*@}*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
604 | |
| 8113 | 605 | /**************************************************************************/ |
| 606 | /** @name Room Field API */ | |
| 607 | /**************************************************************************/ | |
| 608 | /*@{*/ | |
| 609 | ||
| 15884 | 610 | PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, |
| 8113 | 611 | const gchar *label, const gchar *name, |
| 612 | gboolean hidden) | |
| 613 | { | |
| 15884 | 614 | PurpleRoomlistField *f; |
| 8113 | 615 | |
| 616 | g_return_val_if_fail(label != NULL, NULL); | |
| 617 | g_return_val_if_fail(name != NULL, NULL); | |
| 618 | ||
| 15884 | 619 | f = g_new0(PurpleRoomlistField, 1); |
| 8113 | 620 | |
| 621 | f->type = type; | |
| 622 | f->label = g_strdup(label); | |
| 623 | f->name = g_strdup(name); | |
| 624 | f->hidden = hidden; | |
| 625 | ||
| 626 | return f; | |
| 627 | } | |
| 628 | ||
|
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
|
629 | 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
|
630 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
631 | return field->type; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
634 | 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
|
635 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
636 | return field->label; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
639 | 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
|
640 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
641 | return field->hidden; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
642 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
643 | |
| 8113 | 644 | /*@}*/ |
| 645 | ||
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
646 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
647 | /** @name Room Field GBoxed code */ |
|
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 | /*@{*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
650 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
651 | 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
|
652 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
653 | g_return_val_if_fail(f != NULL, NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
654 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
655 | 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
|
656 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
657 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
658 | 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
|
659 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
660 | 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
|
661 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
662 | g_free(f->label); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
663 | g_free(f->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
664 | g_free(f); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
665 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
666 | |
|
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
|
667 | 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
|
668 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
669 | static GType type = 0; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
670 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
671 | if (type == 0) { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
672 | 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
|
673 | (GBoxedCopyFunc)purple_roomlist_field_copy, |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
674 | (GBoxedFreeFunc)purple_roomlist_field_free); |
|
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 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
677 | return type; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
678 | } |
|
34931
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 | /*@}*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
681 | |
| 8113 | 682 | /**************************************************************************/ |
| 683 | /** @name UI Registration Functions */ | |
| 684 | /**************************************************************************/ | |
| 685 | /*@{*/ | |
| 686 | ||
| 687 | ||
| 15884 | 688 | void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) |
| 8113 | 689 | { |
| 690 | ops = ui_ops; | |
| 691 | } | |
| 692 | ||
| 15884 | 693 | PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) |
| 8113 | 694 | { |
| 695 | return ops; | |
| 696 | } | |
| 697 | ||
| 698 | /*@}*/ |