Wed, 08 Feb 2023 08:59:47 -0600
Export Account::error
I can't think of a good reason why we shouldn't expose the error property on
Accounts. But I would like to be able to set the error from the UI when there
is an error in the settings for example.
Testing Done:
Built the docs, ran the tests, used the prune connection action in the demo protocol plugin and verified everything was still working.
Reviewed at https://reviews.imfreedom.org/r/2216/
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* purple |
| 8113 | 2 | * |
| 15884 | 3 | * Purple is the legal property of its developers, whose names are too numerous |
|
8146
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8113
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
4961c9c5fd61
[gaim-migrate @ 8854]
John Silvestri <john.silvestri@gmail.com>
parents:
8113
diff
changeset
|
5 | * source distribution. |
| 8113 | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18265
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 8113 | 20 | */ |
| 21 | ||
| 22 | #include "account.h" | |
| 23 | #include "connection.h" | |
| 24 | #include "debug.h" | |
| 25 | #include "roomlist.h" | |
| 8199 | 26 | #include "server.h" |
| 8113 | 27 | |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
28 | /* This must be after roomlist.h otherwise you'll get an include cycle. */ |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
29 | #include "purpleprotocolroomlist.h" |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
30 | |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
31 | /* |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
32 | * Private data for a room list. |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
33 | */ |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
34 | typedef struct { |
|
35466
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
35 | PurpleAccount *account; /* The account this list belongs to. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
36 | GList *rooms; /* The list of rooms. */ |
|
e259e75f1c6f
Fix some gtk-doc warnings till xmlnode.h
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
37 | gboolean in_progress; /* The listing is in progress. */ |
|
40977
dd0f04c5d212
Cleanup RoomList UI ops
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40898
diff
changeset
|
38 | } PurpleRoomlistPrivate; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
39 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
40 | /* Room list property enums */ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
41 | enum |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
42 | { |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
43 | PROP_0, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
44 | PROP_ACCOUNT, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
45 | PROP_IN_PROGRESS, |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
46 | PROP_LAST |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
47 | }; |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
48 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
49 | static GParamSpec *properties[PROP_LAST]; |
| 15884 | 50 | static PurpleRoomlistUiOps *ops = NULL; |
| 8113 | 51 | |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
52 | G_DEFINE_TYPE_WITH_PRIVATE(PurpleRoomlist, purple_roomlist, G_TYPE_OBJECT); |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
53 | |
| 8113 | 54 | /**************************************************************************/ |
| 35472 | 55 | /* Room List API */ |
| 8113 | 56 | /**************************************************************************/ |
| 57 | ||
| 15884 | 58 | void purple_roomlist_show_with_account(PurpleAccount *account) |
| 8352 | 59 | { |
| 60 | if (ops && ops->show_with_account) | |
| 61 | ops->show_with_account(account); | |
| 62 | } | |
| 63 | ||
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
64 | PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list) |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
65 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
66 | PurpleRoomlistPrivate *priv = NULL; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
67 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
68 | g_return_val_if_fail(PURPLE_IS_ROOMLIST(list), NULL); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
69 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
70 | priv = purple_roomlist_get_instance_private(list); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
71 | return priv->account; |
|
32218
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
72 | } |
|
f27b05250351
Some struct hiding. What a pain.
Mark Doliner <markdoliner@pidgin.im>
parents:
28981
diff
changeset
|
73 | |
| 15884 | 74 | void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress) |
| 8113 | 75 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
76 | PurpleRoomlistPrivate *priv = NULL; |
| 8113 | 77 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
78 | g_return_if_fail(PURPLE_IS_ROOMLIST(list)); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
79 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
80 | priv = purple_roomlist_get_instance_private(list); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
81 | priv->in_progress = in_progress; |
| 8199 | 82 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
83 | g_object_notify_by_pspec(G_OBJECT(list), properties[PROP_IN_PROGRESS]); |
| 8113 | 84 | } |
| 85 | ||
| 15884 | 86 | gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list) |
| 8199 | 87 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
88 | PurpleRoomlistPrivate *priv = NULL; |
| 8199 | 89 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
90 | g_return_val_if_fail(PURPLE_IS_ROOMLIST(list), FALSE); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
91 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
92 | priv = purple_roomlist_get_instance_private(list); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
93 | return priv->in_progress; |
| 8199 | 94 | } |
| 95 | ||
| 15884 | 96 | void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room) |
| 8113 | 97 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
98 | PurpleRoomlistPrivate *priv = NULL; |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
99 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
100 | g_return_if_fail(PURPLE_IS_ROOMLIST(list)); |
| 8113 | 101 | g_return_if_fail(room != NULL); |
| 102 | ||
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
103 | priv = purple_roomlist_get_instance_private(list); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
104 | priv->rooms = g_list_append(priv->rooms, room); |
| 8113 | 105 | |
| 106 | if (ops && ops->add_room) | |
| 107 | ops->add_room(list, room); | |
| 108 | } | |
| 109 | ||
| 15884 | 110 | PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc) |
| 8113 | 111 | { |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
112 | PurpleProtocol *protocol = NULL; |
| 8113 | 113 | |
|
34983
81638be26f41
Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents:
34942
diff
changeset
|
114 | 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
|
115 | g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL); |
| 8113 | 116 | |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
117 | protocol = purple_connection_get_protocol(gc); |
| 8113 | 118 | |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
119 | if(PURPLE_IS_PROTOCOL_ROOMLIST(protocol)) { |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
120 | return purple_protocol_roomlist_get_list(PURPLE_PROTOCOL_ROOMLIST(protocol), |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
121 | gc); |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
122 | } |
|
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
|
123 | |
| 8113 | 124 | return NULL; |
| 125 | } | |
| 126 | ||
| 15884 | 127 | void purple_roomlist_cancel_get_list(PurpleRoomlist *list) |
| 8113 | 128 | { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
129 | PurpleRoomlistPrivate *priv = NULL; |
|
36544
1bf8b6ef5aea
Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents:
36376
diff
changeset
|
130 | PurpleProtocol *protocol = NULL; |
| 15884 | 131 | PurpleConnection *gc; |
| 8113 | 132 | |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
133 | g_return_if_fail(PURPLE_IS_ROOMLIST(list)); |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
134 | |
|
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
135 | priv = purple_roomlist_get_instance_private(list); |
| 8113 | 136 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
137 | 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
|
138 | g_return_if_fail(PURPLE_IS_CONNECTION(gc)); |
| 8113 | 139 | |
|
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
|
140 | if(gc) |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36606
diff
changeset
|
141 | protocol = purple_connection_get_protocol(gc); |
| 8113 | 142 | |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
143 | if(PURPLE_IS_PROTOCOL_ROOMLIST(protocol)) { |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
144 | purple_protocol_roomlist_cancel(PURPLE_PROTOCOL_ROOMLIST(protocol), list); |
|
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
145 | } |
| 8113 | 146 | } |
| 147 | ||
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
148 | void |
|
41351
a2cd8d6d9483
Fix new warnings in room list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
149 | purple_roomlist_join_room(PurpleRoomlist *list, PurpleRoomlistRoom *room) { |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
150 | PurpleRoomlistPrivate *priv = NULL; |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
151 | PurpleConnection *connection = NULL; |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
152 | GHashTable *components = NULL, *adjusted = NULL; |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
153 | GHashTableIter iter; |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
154 | const gchar *name = NULL; |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
155 | gpointer key, value; |
| 8113 | 156 | |
|
41351
a2cd8d6d9483
Fix new warnings in room list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
157 | g_return_if_fail(PURPLE_IS_ROOMLIST(list)); |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
158 | g_return_if_fail(PURPLE_IS_ROOMLIST_ROOM(room)); |
|
39782
db027c5e1463
Fix broken `priv != NULL` checks in libpurple.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39759
diff
changeset
|
159 | |
|
41351
a2cd8d6d9483
Fix new warnings in room list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41349
diff
changeset
|
160 | priv = purple_roomlist_get_instance_private(list); |
| 8113 | 161 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
162 | connection = purple_account_get_connection(priv->account); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
163 | if(connection == NULL) { |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
164 | return; |
|
41028
943b2cb45314
Separate PurpleProtocolRoomlist into its own file and modernize it.
Gary Kramlich <grim@reaperworld.com>
parents:
40977
diff
changeset
|
165 | } |
| 8113 | 166 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
167 | components = purple_roomlist_room_get_components(room); |
| 8113 | 168 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
169 | /* Make a copy of the components as we make sure the name is included. */ |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
170 | adjusted = g_hash_table_new(g_str_hash, g_str_equal); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
171 | g_hash_table_iter_init(&iter, components); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
172 | while(g_hash_table_iter_next(&iter, &key, &value)) { |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
173 | g_hash_table_insert(adjusted, key, value); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
174 | } |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
175 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
176 | name = purple_roomlist_room_get_name(room); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
177 | g_hash_table_replace(adjusted, "name", (gpointer)name); |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
178 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
179 | purple_serv_join_chat(connection, adjusted); |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
180 | |
|
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
181 | g_hash_table_destroy(adjusted); |
|
22134
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
182 | } |
|
692ceed9d307
A list of accessor functions to the roomlist API.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
183 | |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
184 | /**************************************************************************/ |
| 35472 | 185 | /* Room List GObject code */ |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
186 | /**************************************************************************/ |
|
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
187 | |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
188 | /* Set method for GObject properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
189 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
190 | 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
|
191 | GParamSpec *pspec) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
192 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
193 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
194 | PurpleRoomlistPrivate *priv = |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
195 | purple_roomlist_get_instance_private(list); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
196 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
197 | switch (param_id) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
198 | case PROP_ACCOUNT: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
199 | priv->account = g_value_get_object(value); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
200 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
201 | case PROP_IN_PROGRESS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
202 | 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
|
203 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
204 | default: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
205 | 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
|
206 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
207 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
208 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
209 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
210 | /* Get method for GObject properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
211 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
212 | 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
|
213 | GParamSpec *pspec) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
214 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
215 | PurpleRoomlist *list = PURPLE_ROOMLIST(obj); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
216 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
217 | switch (param_id) { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
218 | case PROP_ACCOUNT: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
219 | 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
|
220 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
221 | case PROP_IN_PROGRESS: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
222 | 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
|
223 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
224 | default: |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
225 | 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
|
226 | break; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
227 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
228 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
229 | |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
230 | static void |
|
41960
c8a4853205e3
Bump C standard to C99 for libpurple files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41719
diff
changeset
|
231 | purple_roomlist_init(G_GNUC_UNUSED PurpleRoomlist *list) |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
232 | { |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
233 | } |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
234 | |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
235 | /* Called when done constructing */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
236 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
237 | purple_roomlist_constructed(GObject *object) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
238 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
239 | PurpleRoomlist *list = PURPLE_ROOMLIST(object); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
240 | |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
241 | G_OBJECT_CLASS(purple_roomlist_parent_class)->constructed(object); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
242 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
243 | if (ops && ops->create) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
244 | ops->create(list); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
245 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
246 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
247 | /* GObject finalize function */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
248 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
249 | purple_roomlist_finalize(GObject *object) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
250 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
251 | PurpleRoomlist *list = PURPLE_ROOMLIST(object); |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
252 | PurpleRoomlistPrivate *priv = |
|
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
253 | purple_roomlist_get_instance_private(list); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
254 | |
|
34986
894c29e33300
Move all object destruction code to finalize() methods and keep unrefs in dispose()
Ankit Vani <a@nevitus.org>
parents:
34983
diff
changeset
|
255 | 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
|
256 | |
|
41349
15aeaa1e84ec
Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41158
diff
changeset
|
257 | g_list_free_full(priv->rooms, g_object_unref); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
258 | |
|
39364
54439db24429
libpurple: Port self-contained code from g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents:
37119
diff
changeset
|
259 | G_OBJECT_CLASS(purple_roomlist_parent_class)->finalize(object); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
260 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
261 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
262 | /* Class initializer function */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
263 | static void |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
264 | purple_roomlist_class_init(PurpleRoomlistClass *klass) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
265 | { |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
266 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
267 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
268 | obj_class->finalize = purple_roomlist_finalize; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
269 | obj_class->constructed = purple_roomlist_constructed; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
270 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
271 | /* Setup properties */ |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
272 | obj_class->get_property = purple_roomlist_get_property; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
273 | obj_class->set_property = purple_roomlist_set_property; |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
274 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
275 | 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
|
276 | "The account for the room list.", |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
277 | 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
|
278 | 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
|
279 | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
280 | |
|
35080
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
281 | 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
|
282 | "In progress", |
|
58bddd91956c
libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents:
35066
diff
changeset
|
283 | "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
|
284 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
285 | |
|
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
|
286 | 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
|
287 | } |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
288 | |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
289 | PurpleRoomlist *purple_roomlist_new(PurpleAccount *account) |
|
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
290 | { |
|
41158
e250a5b59c97
Remove PurpleProtocolFactory->roomlist_new as no one is using it
Gary Kramlich <grim@reaperworld.com>
parents:
41028
diff
changeset
|
291 | return g_object_new(PURPLE_TYPE_ROOMLIST, |
|
e250a5b59c97
Remove PurpleProtocolFactory->roomlist_new as no one is using it
Gary Kramlich <grim@reaperworld.com>
parents:
41028
diff
changeset
|
292 | "account", account, |
|
e250a5b59c97
Remove PurpleProtocolFactory->roomlist_new as no one is using it
Gary Kramlich <grim@reaperworld.com>
parents:
41028
diff
changeset
|
293 | NULL |
|
e250a5b59c97
Remove PurpleProtocolFactory->roomlist_new as no one is using it
Gary Kramlich <grim@reaperworld.com>
parents:
41028
diff
changeset
|
294 | ); |
|
34933
94df3aa56d12
Added GObject code to roomlist.c
Ankit Vani <a@nevitus.org>
parents:
34931
diff
changeset
|
295 | } |
|
34931
6ea8ce77ec34
Started GObjectification of PurpleRoomlist
Ankit Vani <a@nevitus.org>
parents:
32237
diff
changeset
|
296 | |
| 8113 | 297 | /**************************************************************************/ |
| 35472 | 298 | /* UI Registration Functions */ |
| 8113 | 299 | /**************************************************************************/ |
| 300 | ||
| 15884 | 301 | void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) |
| 8113 | 302 | { |
| 303 | ops = ui_ops; | |
| 304 | } | |
| 305 | ||
| 15884 | 306 | PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) |
| 8113 | 307 | { |
| 308 | return ops; | |
| 309 | } | |
| 310 | ||
| 35572 | 311 | /************************************************************************** |
| 312 | * UI Ops GBoxed code | |
| 313 | **************************************************************************/ | |
| 314 | ||
| 315 | static PurpleRoomlistUiOps * | |
| 316 | purple_roomlist_ui_ops_copy(PurpleRoomlistUiOps *ops) | |
| 317 | { | |
| 318 | PurpleRoomlistUiOps *ops_new; | |
| 319 | ||
| 320 | g_return_val_if_fail(ops != NULL, NULL); | |
| 321 | ||
| 322 | ops_new = g_new(PurpleRoomlistUiOps, 1); | |
| 323 | *ops_new = *ops; | |
| 324 | ||
| 325 | return ops_new; | |
| 326 | } | |
| 327 | ||
| 328 | GType | |
| 329 | purple_roomlist_ui_ops_get_type(void) | |
| 330 | { | |
| 331 | static GType type = 0; | |
| 332 | ||
| 333 | if (type == 0) { | |
| 334 | type = g_boxed_type_register_static("PurpleRoomlistUiOps", | |
| 335 | (GBoxedCopyFunc)purple_roomlist_ui_ops_copy, | |
|
35597
7fcfcf147b99
Use g_free as UiOps structures GBoxed free function
Ankit Vani <a@nevitus.org>
parents:
35572
diff
changeset
|
336 | (GBoxedFreeFunc)g_free); |
| 35572 | 337 | } |
| 338 | ||
| 339 | return type; | |
| 340 | } |