libpurple/purpleroomlistroom.c

Wed, 08 Feb 2023 08:59:47 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Wed, 08 Feb 2023 08:59:47 -0600
changeset 42049
16d2e16bd24f
parent 41942
013f54f8f035
child 42584
687260353985
permissions
-rw-r--r--

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/

41349
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * Lesser General Public License for more details.
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public License
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * along with this library; if not, see <https://www.gnu.org/licenses/>.
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 */
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 #include "purpleroomlistroom.h"
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 typedef struct {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 gchar *name;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 gchar *description;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 gchar *category;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 guint user_count;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 GHashTable *components;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 } PurpleRoomlistRoomPrivate;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 enum {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 PROP_0,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PROP_NAME,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 PROP_DESCRIPTION,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 PROP_CATEGORY,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 PROP_USER_COUNT,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 N_PROPERTIES
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 };
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 G_DEFINE_TYPE_WITH_PRIVATE(PurpleRoomlistRoom, purple_roomlist_room,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 G_TYPE_OBJECT)
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 /******************************************************************************
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 * Helpers
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 *****************************************************************************/
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 static void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 purple_roomlist_room_set_name(PurpleRoomlistRoom *room, const gchar *name) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 g_return_if_fail(PURPLE_IS_ROOMLIST_ROOM(room));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 g_clear_pointer(&priv->name, g_free);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 priv->name = g_strdup(name);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 g_object_notify_by_pspec(G_OBJECT(room), properties[PROP_NAME]);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 static void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 purple_roomlist_room_set_description(PurpleRoomlistRoom *room,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 const gchar *description)
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 g_return_if_fail(PURPLE_IS_ROOMLIST_ROOM(room));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 g_clear_pointer(&priv->description, g_free);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 priv->description = g_strdup(description);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 g_object_notify_by_pspec(G_OBJECT(room), properties[PROP_DESCRIPTION]);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 /******************************************************************************
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 * GObject Implementation
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 *****************************************************************************/
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 static void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 purple_roomlist_room_get_property(GObject *obj, guint param_id, GValue *value,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 GParamSpec *pspec)
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 PurpleRoomlistRoom *room = PURPLE_ROOMLIST_ROOM(obj);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 switch(param_id) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 case PROP_NAME:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 g_value_set_string(value, 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:
diff changeset
88 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 case PROP_DESCRIPTION:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 g_value_set_string(value,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 purple_roomlist_room_get_description(room));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 case PROP_CATEGORY:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 g_value_set_string(value, purple_roomlist_room_get_category(room));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 case PROP_USER_COUNT:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 g_value_set_uint(value, purple_roomlist_room_get_user_count(room));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 default:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 static void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 purple_roomlist_room_set_property(GObject *obj, guint param_id,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 const GValue *value, GParamSpec *pspec)
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 PurpleRoomlistRoom *room = PURPLE_ROOMLIST_ROOM(obj);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 switch(param_id) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 case PROP_NAME:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 purple_roomlist_room_set_name(room, g_value_get_string(value));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 case PROP_DESCRIPTION:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 purple_roomlist_room_set_description(room,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 g_value_get_string(value));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 case PROP_CATEGORY:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 purple_roomlist_room_set_category(room, g_value_get_string(value));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 case PROP_USER_COUNT:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 purple_roomlist_room_set_user_count(room, g_value_get_uint(value));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 default:
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 break;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 static void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 purple_roomlist_room_finalize(GObject *obj) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 PurpleRoomlistRoom *room = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 PurpleRoomlistRoomPrivate *priv = NULL;;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 room = PURPLE_ROOMLIST_ROOM(obj);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 g_clear_pointer(&priv->name, g_free);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 g_clear_pointer(&priv->description, g_free);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 g_clear_pointer(&priv->category, g_free);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 g_clear_pointer(&priv->components, g_hash_table_destroy);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 G_OBJECT_CLASS(purple_roomlist_room_parent_class)->finalize(obj);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 static void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 purple_roomlist_room_init(PurpleRoomlistRoom *room) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 priv->components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 g_free);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 static void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 purple_roomlist_room_class_init(PurpleRoomlistRoomClass *klass) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 obj_class->get_property = purple_roomlist_room_get_property;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 obj_class->set_property = purple_roomlist_room_set_property;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 obj_class->finalize = purple_roomlist_room_finalize;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 properties[PROP_NAME] = g_param_spec_string(
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 "name", "name",
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 "The name of the room",
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 NULL,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 properties[PROP_DESCRIPTION] = g_param_spec_string(
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 "description", "description",
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 "The description of the room",
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 NULL,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 properties[PROP_CATEGORY] = g_param_spec_string(
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 "category", "category",
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 "The category of the room",
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 NULL,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 properties[PROP_USER_COUNT] = g_param_spec_uint(
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 "user-count", "user-count",
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 "The user count of the room",
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 0, G_MAXUINT, 0,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 /******************************************************************************
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 * Public API
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 *****************************************************************************/
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 PurpleRoomlistRoom *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 purple_roomlist_room_new(const gchar *name, const gchar *description) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 return g_object_new(
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 PURPLE_TYPE_ROOMLIST_ROOM,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 "name", name,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 "description", description,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 const gchar *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 purple_roomlist_room_get_name(PurpleRoomlistRoom *room) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 g_return_val_if_fail(PURPLE_IS_ROOMLIST_ROOM(room), NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 return priv->name;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 const gchar *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 purple_roomlist_room_get_description(PurpleRoomlistRoom *room) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 g_return_val_if_fail(PURPLE_IS_ROOMLIST_ROOM(room), NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 return priv->description;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 const gchar *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 purple_roomlist_room_get_category(PurpleRoomlistRoom *room) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 g_return_val_if_fail(PURPLE_IS_ROOMLIST_ROOM(room), NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 return priv->category;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 purple_roomlist_room_set_category(PurpleRoomlistRoom *room,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 const gchar *category)
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 g_return_if_fail(PURPLE_IS_ROOMLIST_ROOM(room));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 g_clear_pointer(&priv->category, g_free);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 priv->category = g_strdup(category);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 g_object_notify_by_pspec(G_OBJECT(room), properties[PROP_CATEGORY]);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253
41942
013f54f8f035 Fix extra const in libpurple header
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41351
diff changeset
254 guint
41349
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 purple_roomlist_room_get_user_count(PurpleRoomlistRoom *room) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 g_return_val_if_fail(PURPLE_IS_ROOMLIST_ROOM(room), 0);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 return priv->user_count;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 purple_roomlist_room_set_user_count(PurpleRoomlistRoom *room,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 guint user_count)
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271 g_return_if_fail(PURPLE_IS_ROOMLIST_ROOM(room));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 priv->user_count = user_count;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 g_object_notify_by_pspec(G_OBJECT(room), properties[PROP_USER_COUNT]);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 void
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 purple_roomlist_room_add_field(PurpleRoomlistRoom *room, const gchar *field,
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 const gchar *value)
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 g_return_if_fail(PURPLE_IS_ROOMLIST_ROOM(room));
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 g_return_if_fail(field != NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 g_return_if_fail(value != NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291
41351
a2cd8d6d9483 Fix new warnings in room list
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41349
diff changeset
292 g_hash_table_replace(priv->components, (gpointer)field, g_strdup(value));
41349
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 const gchar *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 purple_roomlist_room_get_field(PurpleRoomlistRoom *room, const gchar *field) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 g_return_val_if_fail(PURPLE_IS_ROOMLIST_ROOM(room), NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 g_return_val_if_fail(field != NULL, NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 return g_hash_table_lookup(priv->components, field);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 }
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 GHashTable *
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 purple_roomlist_room_get_components(PurpleRoomlistRoom *room) {
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 PurpleRoomlistRoomPrivate *priv = NULL;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311 g_return_val_if_fail(PURPLE_IS_ROOMLIST_ROOM(room), NULL);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 priv = purple_roomlist_room_get_instance_private(room);
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 return priv->components;
15aeaa1e84ec Rework the way roomlists work so we can more easily port them to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 }

mercurial