Sun, 24 Nov 2013 00:33:47 +0530
libpurple: use g_object_notify_by_pspec instead of g_object_notify
| 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. */ |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
62 | 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
|
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 | { |
|
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
|
164 | PurplePlugin *prpl = NULL; |
| 15884 | 165 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 8113 | 166 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
167 | 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
|
168 | g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL); |
| 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 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 171 | |
|
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
|
172 | 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
|
173 | 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
|
174 | |
|
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 | if(prpl_info && prpl_info->roomlist_get_list) |
| 8113 | 176 | 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
|
177 | |
| 8113 | 178 | return NULL; |
| 179 | } | |
| 180 | ||
| 15884 | 181 | void purple_roomlist_cancel_get_list(PurpleRoomlist *list) |
| 8113 | 182 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
183 | 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
|
184 | PurplePlugin *prpl = NULL; |
| 15884 | 185 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 186 | PurpleConnection *gc; | |
| 8113 | 187 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
188 | g_return_if_fail(priv != NULL); |
| 8113 | 189 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
190 | gc = purple_account_get_connection(priv->account); |
| 8113 | 191 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
192 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 8113 | 193 | |
|
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
|
194 | 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
|
195 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 196 | |
|
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
|
197 | 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
|
198 | 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
|
199 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
200 | if(prpl_info && prpl_info->roomlist_cancel) |
| 8113 | 201 | prpl_info->roomlist_cancel(list); |
| 202 | } | |
| 203 | ||
| 15884 | 204 | void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) |
| 8113 | 205 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
206 | 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
|
207 | PurplePlugin *prpl = NULL; |
| 15884 | 208 | PurplePluginProtocolInfo *prpl_info = NULL; |
| 209 | PurpleConnection *gc; | |
| 8113 | 210 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
211 | g_return_if_fail(priv != NULL); |
| 8584 | 212 | g_return_if_fail(category != NULL); |
| 15884 | 213 | g_return_if_fail(category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); |
| 8113 | 214 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
215 | 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
|
216 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 8113 | 217 | |
|
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
|
218 | 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
|
219 | prpl = purple_connection_get_prpl(gc); |
| 8113 | 220 | |
|
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
|
221 | 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
|
222 | 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
|
223 | |
|
d22357d5c7ba
Kill off gc->prpl in the core everywhere but connection.c (when the struct
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22134
diff
changeset
|
224 | if(prpl_info && prpl_info->roomlist_expand_category) |
| 8584 | 225 | prpl_info->roomlist_expand_category(list, category); |
| 8113 | 226 | } |
| 227 | ||
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
228 | 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
|
229 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
230 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
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 | g_return_val_if_fail(priv != NULL, NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
233 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
234 | return priv->fields; |
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
235 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
236 | |
|
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
|
237 | 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
|
238 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
239 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
240 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
241 | g_return_val_if_fail(priv != NULL, NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
242 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
243 | return priv->proto_data; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
244 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
245 | |
|
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
|
246 | 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
|
247 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
248 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
249 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
250 | g_return_if_fail(priv != NULL); |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
251 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
252 | priv->proto_data = proto_data; |
|
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 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
255 | gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
256 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
257 | 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
|
258 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
259 | return list->ui_data; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
260 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
261 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
262 | 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
|
263 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
264 | 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
|
265 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
266 | list->ui_data = ui_data; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
267 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
268 | |
| 8113 | 269 | /*@}*/ |
| 270 | ||
|
34931
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 | /** @name Room List GObject code */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
273 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
274 | /*@{*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
275 | |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
276 | /* Set method for GObject properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
277 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
278 | 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
|
279 | GParamSpec *pspec) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
280 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
281 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
282 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
283 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
284 | switch (param_id) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
285 | case PROP_ACCOUNT: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
286 | priv->account = g_value_get_object(value); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
287 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
288 | case PROP_FIELDS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
289 | 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
|
290 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
291 | case PROP_IN_PROGRESS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
292 | 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
|
293 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
294 | default: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
295 | 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
|
296 | break; |
|
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 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
299 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
300 | /* Get method for GObject properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
301 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
302 | 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
|
303 | GParamSpec *pspec) |
|
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 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
306 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
307 | switch (param_id) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
308 | case PROP_ACCOUNT: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
309 | 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
|
310 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
311 | case PROP_FIELDS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
312 | 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
|
313 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
314 | case PROP_IN_PROGRESS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
315 | 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
|
316 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
317 | default: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
318 | 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
|
319 | break; |
|
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 | } |
|
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 | /* Called when done constructing */ |
|
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_constructed(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 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
329 | parent_class->constructed(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
330 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
331 | if (ops && ops->create) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
332 | ops->create(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
333 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
334 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
335 | /* GObject finalize function */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
336 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
337 | purple_roomlist_finalize(GObject *object) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
338 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
339 | PurpleRoomlist *list = PURPLE_ROOMLIST(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
340 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
341 | GList *l; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
342 | |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
343 | 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
|
344 | |
|
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
345 | 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
|
346 | 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
|
347 | |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
348 | for (l = priv->rooms; l; l = l->next) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
349 | PurpleRoomlistRoom *r = l->data; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
350 | purple_roomlist_room_destroy(list, r); |
|
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 | g_list_free(priv->rooms); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
353 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
354 | 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
|
355 | g_list_free(priv->fields); |
|
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 | parent_class->finalize(object); |
|
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 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
360 | /* Class initializer function */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
361 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
362 | purple_roomlist_class_init(PurpleRoomlistClass *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 | GObjectClass *obj_class = G_OBJECT_CLASS(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 | parent_class = g_type_class_peek_parent(klass); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
367 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
368 | obj_class->finalize = purple_roomlist_finalize; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
369 | obj_class->constructed = purple_roomlist_constructed; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
370 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
371 | /* Setup properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
372 | obj_class->get_property = purple_roomlist_get_property; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
373 | obj_class->set_property = purple_roomlist_set_property; |
|
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_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
|
376 | "The account for the room list.", |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
377 | 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
|
378 | 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
|
379 | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
380 | g_object_class_install_property(obj_class, PROP_ACCOUNT, |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
381 | properties[PROP_ACCOUNT]); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
382 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
383 | 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
|
384 | "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
|
385 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
386 | g_object_class_install_property(obj_class, PROP_FIELDS, |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
387 | properties[PROP_FIELDS]); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
388 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
389 | 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
|
390 | "In progress", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
391 | "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
|
392 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
393 | g_object_class_install_property(obj_class, PROP_IN_PROGRESS, |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
394 | properties[PROP_IN_PROGRESS]); |
|
34933
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 | g_type_class_add_private(klass, sizeof(PurpleRoomlistPrivate)); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
397 | } |
|
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 | GType |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
400 | purple_roomlist_get_type(void) |
|
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 | static GType type = 0; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
403 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
404 | if(type == 0) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
405 | static const GTypeInfo info = { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
406 | sizeof(PurpleRoomlistClass), |
|
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 | (GClassInitFunc)purple_roomlist_class_init, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
410 | NULL, |
|
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 | sizeof(PurpleRoomlist), |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
413 | 0, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
414 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
415 | NULL, |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
416 | }; |
|
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 | 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
|
419 | &info, 0); |
|
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 | return type; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
423 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
424 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
425 | PurpleRoomlist *purple_roomlist_new(PurpleAccount *account) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
426 | { |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
427 | 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
|
428 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
429 | 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
|
430 | "account", account, |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
431 | NULL |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
432 | ); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
433 | } |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
434 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
435 | /*@}*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
436 | |
| 8113 | 437 | /**************************************************************************/ |
| 438 | /** @name Room API */ | |
| 439 | /**************************************************************************/ | |
| 440 | /*@{*/ | |
| 441 | ||
| 15884 | 442 | PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, |
| 443 | PurpleRoomlistRoom *parent) | |
| 8113 | 444 | { |
| 15884 | 445 | PurpleRoomlistRoom *room; |
| 8113 | 446 | |
| 447 | g_return_val_if_fail(name != NULL, NULL); | |
| 448 | ||
| 15884 | 449 | room = g_new0(PurpleRoomlistRoom, 1); |
| 8113 | 450 | room->type = type; |
| 451 | room->name = g_strdup(name); | |
| 452 | room->parent = parent; | |
| 453 | ||
| 454 | return room; | |
| 455 | } | |
| 456 | ||
| 15884 | 457 | void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field) |
| 8113 | 458 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
459 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 15884 | 460 | PurpleRoomlistField *f; |
| 8113 | 461 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
462 | g_return_if_fail(priv != NULL); |
| 8113 | 463 | g_return_if_fail(room != NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
464 | g_return_if_fail(priv->fields != NULL); |
| 8113 | 465 | |
|
24814
9e3c1c3b4123
Add a comment to clarify code I initially thought was broken.
Richard Laager <rlaager@pidgin.im>
parents:
22390
diff
changeset
|
466 | /* 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
|
467 | * 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
|
468 | * 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
|
469 | * (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
|
470 | * g_list_length() is one-indexed.) */ |
| 8113 | 471 | if (!room->fields) |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
472 | f = priv->fields->data; |
| 8113 | 473 | else |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
474 | f = g_list_nth_data(priv->fields, g_list_length(room->fields)); |
| 8113 | 475 | |
| 476 | g_return_if_fail(f != NULL); | |
| 477 | ||
| 478 | switch(f->type) { | |
| 15884 | 479 | case PURPLE_ROOMLIST_FIELD_STRING: |
| 8113 | 480 | room->fields = g_list_append(room->fields, g_strdup(field)); |
| 481 | break; | |
| 15884 | 482 | case PURPLE_ROOMLIST_FIELD_BOOL: |
| 483 | case PURPLE_ROOMLIST_FIELD_INT: | |
| 8113 | 484 | room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); |
| 485 | break; | |
| 486 | } | |
|
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
|
487 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
488 | g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_FIELDS]); |
| 8113 | 489 | } |
| 490 | ||
| 15884 | 491 | void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8199 | 492 | { |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
493 | PurpleRoomlistPrivate *priv = PURPLE_ROOMLIST_GET_PRIVATE(list); |
| 8199 | 494 | GHashTable *components; |
| 495 | GList *l, *j; | |
| 15884 | 496 | PurpleConnection *gc; |
| 8199 | 497 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
498 | g_return_if_fail(priv != NULL); |
| 8199 | 499 | g_return_if_fail(room != NULL); |
| 500 | ||
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
501 | gc = purple_account_get_connection(priv->account); |
| 8199 | 502 | if (!gc) |
| 503 | return; | |
| 504 | ||
| 505 | components = g_hash_table_new(g_str_hash, g_str_equal); | |
| 506 | ||
| 507 | g_hash_table_replace(components, "name", room->name); | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
508 | for (l = priv->fields, j = room->fields; l && j; l = l->next, j = j->next) { |
| 15884 | 509 | PurpleRoomlistField *f = l->data; |
| 8199 | 510 | |
| 511 | g_hash_table_replace(components, f->name, j->data); | |
| 512 | } | |
| 513 | ||
| 514 | serv_join_chat(gc, components); | |
| 515 | ||
| 516 | g_hash_table_destroy(components); | |
| 517 | } | |
| 518 | ||
|
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
|
519 | 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
|
520 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
521 | return room->type; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
524 | 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
|
525 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
526 | return room->name; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
529 | 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
|
530 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
531 | return room->parent; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
532 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
533 | |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
534 | 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
|
535 | { |
|
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
|
536 | 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
|
537 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
538 | return room->expanded_once; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
539 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
540 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
541 | 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
|
542 | { |
|
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
|
543 | g_return_if_fail(room != NULL); |
|
32218
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 | room->expanded_once = expanded_once; |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
546 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
547 | |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
548 | 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
|
549 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
550 | return room->fields; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
551 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
552 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
553 | 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
|
554 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
555 | 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
|
556 | GList *l, *j; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
557 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
558 | 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
|
559 | PurpleRoomlistField *f = l->data; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
560 | 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
|
561 | g_free(j->data); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
562 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
563 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
564 | g_list_free(r->fields); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
565 | g_free(r->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
566 | g_free(r); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
567 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
568 | |
| 8113 | 569 | /*@}*/ |
| 570 | ||
|
34931
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 | /** @name Room GBoxed code */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
573 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
574 | /*@{*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
575 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
576 | 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
|
577 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
578 | g_return_val_if_fail(r != NULL, NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
579 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
580 | 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
|
581 | } |
|
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 | 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
|
584 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
585 | 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
|
586 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
587 | g_list_free(r->fields); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
588 | g_free(r->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
589 | g_free(r); |
|
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 | |
|
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
|
592 | 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
|
593 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
594 | static GType type = 0; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
595 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
596 | if (type == 0) { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
597 | 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
|
598 | (GBoxedCopyFunc)purple_roomlist_room_copy, |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
599 | (GBoxedFreeFunc)purple_roomlist_room_free); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
600 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
601 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
602 | return type; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
603 | } |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
604 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
605 | /*@}*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
606 | |
| 8113 | 607 | /**************************************************************************/ |
| 608 | /** @name Room Field API */ | |
| 609 | /**************************************************************************/ | |
| 610 | /*@{*/ | |
| 611 | ||
| 15884 | 612 | PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, |
| 8113 | 613 | const gchar *label, const gchar *name, |
| 614 | gboolean hidden) | |
| 615 | { | |
| 15884 | 616 | PurpleRoomlistField *f; |
| 8113 | 617 | |
| 618 | g_return_val_if_fail(label != NULL, NULL); | |
| 619 | g_return_val_if_fail(name != NULL, NULL); | |
| 620 | ||
| 15884 | 621 | f = g_new0(PurpleRoomlistField, 1); |
| 8113 | 622 | |
| 623 | f->type = type; | |
| 624 | f->label = g_strdup(label); | |
| 625 | f->name = g_strdup(name); | |
| 626 | f->hidden = hidden; | |
| 627 | ||
| 628 | return f; | |
| 629 | } | |
| 630 | ||
|
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
|
631 | 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
|
632 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
633 | return field->type; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
636 | 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
|
637 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
638 | return field->label; |
|
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 | |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
641 | 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
|
642 | { |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
643 | return field->hidden; |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
644 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
645 | |
| 8113 | 646 | /*@}*/ |
| 647 | ||
|
34931
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 | /** @name Room Field GBoxed code */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
650 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
651 | /*@{*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
652 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
653 | 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
|
654 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
655 | g_return_val_if_fail(f != NULL, NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
656 | |
|
34934
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
657 | 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
|
658 | } |
|
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 | 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
|
661 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
662 | 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
|
663 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
664 | g_free(f->label); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
665 | g_free(f->name); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
666 | g_free(f); |
|
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 | |
|
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
|
669 | 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
|
670 | { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
671 | static GType type = 0; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
672 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
673 | if (type == 0) { |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
674 | 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
|
675 | (GBoxedCopyFunc)purple_roomlist_field_copy, |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
676 | (GBoxedFreeFunc)purple_roomlist_field_free); |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
677 | } |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
678 | |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
679 | return type; |
|
d50c4b767a5e
Added room and field GBoxed code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34933
diff
changeset
|
680 | } |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
681 | |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
682 | /*@}*/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
683 | |
| 8113 | 684 | /**************************************************************************/ |
| 685 | /** @name UI Registration Functions */ | |
| 686 | /**************************************************************************/ | |
| 687 | /*@{*/ | |
| 688 | ||
| 689 | ||
| 15884 | 690 | void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) |
| 8113 | 691 | { |
| 692 | ops = ui_ops; | |
| 693 | } | |
| 694 | ||
| 15884 | 695 | PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) |
| 8113 | 696 | { |
| 697 | return ops; | |
| 698 | } | |
| 699 | ||
| 700 | /*@}*/ |