libpurple/blistnode.c

Fri, 04 Apr 2014 21:09:16 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Fri, 04 Apr 2014 21:09:16 +0200
changeset 35755
d91c44b4a8e6
parent 35470
8ee08a41f2f3
child 37945
49ac171ebe26
permissions
-rw-r--r--

Remote smileys: correctly handle failed smileys

34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
1 /*
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
2 * purple
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
3 *
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
6 * source distribution.
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
7 *
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
11 * (at your option) any later version.
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
12 *
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
16 * GNU General Public License for more details.
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
17 *
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
21 *
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
22 */
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
23 #include "internal.h"
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
24 #include "glibcompat.h"
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
25 #include "blistnodetypes.h"
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
26
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
27 #define PURPLE_BLIST_NODE_GET_PRIVATE(obj) \
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
28 (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_BLIST_NODE, PurpleBlistNodePrivate))
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
29
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
30 typedef struct _PurpleBlistNodePrivate PurpleBlistNodePrivate;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
31
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
32 #define PURPLE_COUNTING_NODE_GET_PRIVATE(obj) \
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
33 (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_COUNTING_NODE, PurpleCountingNodePrivate))
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
34
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
35 typedef struct _PurpleCountingNodePrivate PurpleCountingNodePrivate;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
36
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
37 /* Private data of a buddy list node */
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
38 struct _PurpleBlistNodePrivate {
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
39 GHashTable *settings; /* per-node settings */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
40 gboolean transient; /* node should not be saved with the buddy list */
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
41 };
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
42
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
43 /* Blist node property enums */
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
44 enum
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
45 {
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
46 BLNODE_PROP_0,
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
47 BLNODE_PROP_TRANSIENT,
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
48 BLNODE_PROP_LAST
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
49 };
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
50
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
51 /* Private data of a counting node */
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
52 struct _PurpleCountingNodePrivate {
35470
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
53 int totalsize; /* The number of children under this node */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
54 int currentsize; /* The number of children under this node
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
55 corresponding to online accounts */
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
56 int onlinecount; /* The number of children under this contact who are
8ee08a41f2f3 Convert some other doxygen-type comments
Ankit Vani <a@nevitus.org>
parents: 35085
diff changeset
57 currently online */
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
58 };
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
59
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
60 /* Counting node property enums */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
61 enum
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
62 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
63 CNODE_PROP_0,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
64 CNODE_PROP_TOTAL_SIZE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
65 CNODE_PROP_CURRENT_SIZE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
66 CNODE_PROP_ONLINE_COUNT,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
67 CNODE_PROP_LAST
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
68 };
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
69
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
70 static GObjectClass *parent_class;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
71
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
72 static GParamSpec *bn_properties[BLNODE_PROP_LAST];
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
73 static GParamSpec *cn_properties[CNODE_PROP_LAST];
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
74
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
75 /**************************************************************************/
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
76 /* Buddy list node API */
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
77 /**************************************************************************/
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
78
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
79 static PurpleBlistNode *get_next_node(PurpleBlistNode *node, gboolean godeep)
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
80 {
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
81 if (node == NULL)
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
82 return NULL;
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
83
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
84 if (godeep && node->child)
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
85 return node->child;
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
86
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
87 if (node->next)
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
88 return node->next;
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
89
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
90 return get_next_node(node->parent, FALSE);
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
91 }
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
92
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
93 PurpleBlistNode *purple_blist_node_next(PurpleBlistNode *node, gboolean offline)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
94 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
95 PurpleBlistNode *ret = node;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
96
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
97 if (offline)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
98 return get_next_node(ret, TRUE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
99 do
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
100 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
101 ret = get_next_node(ret, TRUE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
102 } while (ret && PURPLE_IS_BUDDY(ret) &&
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
103 !purple_account_is_connected(purple_buddy_get_account((PurpleBuddy *)ret)));
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
104
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
105 return ret;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
106 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
107
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
108 PurpleBlistNode *purple_blist_node_get_parent(PurpleBlistNode *node)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
109 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
110 return node ? node->parent : NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
111 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
112
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
113 PurpleBlistNode *purple_blist_node_get_first_child(PurpleBlistNode *node)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
114 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
115 return node ? node->child : NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
116 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
117
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
118 PurpleBlistNode *purple_blist_node_get_sibling_next(PurpleBlistNode *node)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
119 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
120 return node? node->next : NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
121 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
122
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
123 PurpleBlistNode *purple_blist_node_get_sibling_prev(PurpleBlistNode *node)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
124 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
125 return node? node->prev : NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
126 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
127
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
128 void *
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
129 purple_blist_node_get_ui_data(const PurpleBlistNode *node)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
130 {
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34865
diff changeset
131 g_return_val_if_fail(PURPLE_IS_BLIST_NODE(node), NULL);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
132
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
133 return node->ui_data;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
134 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
135
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
136 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
137 purple_blist_node_set_ui_data(PurpleBlistNode *node, void *ui_data) {
34983
81638be26f41 Check types of GObjects instead of just for NULL values
Ankit Vani <a@nevitus.org>
parents: 34865
diff changeset
138 g_return_if_fail(PURPLE_IS_BLIST_NODE(node));
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
139
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
140 node->ui_data = ui_data;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
141 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
142
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
143 void purple_blist_node_remove_setting(PurpleBlistNode *node, const char *key)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
144 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
145 PurpleBlistUiOps *ops;
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
146 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
147
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
148 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
149 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
150 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
151
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
152 g_hash_table_remove(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
153
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
154 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
155 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
156 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
157 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
158
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
159 void
34865
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
160 purple_blist_node_set_transient(PurpleBlistNode *node, gboolean transient)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
161 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
162 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
163
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
164 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
165
34865
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
166 priv->transient = transient;
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
167
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
168 g_object_notify_by_pspec(G_OBJECT(node),
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
169 bn_properties[BLNODE_PROP_TRANSIENT]);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
170 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
171
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
172 gboolean
34865
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
173 purple_blist_node_is_transient(PurpleBlistNode *node)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
174 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
175 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
176
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
177 g_return_val_if_fail(priv != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
178
34865
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
179 return priv->transient;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
180 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
181
34730
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
182 GHashTable *
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
183 purple_blist_node_get_settings(PurpleBlistNode *node)
34730
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
184 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
185 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34730
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
186
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
187 g_return_val_if_fail(priv != NULL, NULL);
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
188
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
189 return priv->settings;
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
190 }
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
191
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
192 gboolean
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
193 purple_blist_node_has_setting(PurpleBlistNode* node, const char *key)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
194 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
195 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
196
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
197 g_return_val_if_fail(priv != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
198 g_return_val_if_fail(priv->settings != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
199 g_return_val_if_fail(key != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
200
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
201 /* Boxed type, so it won't ever be NULL, so no need for _extended */
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
202 return (g_hash_table_lookup(priv->settings, key) != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
203 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
204
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
205 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
206 purple_blist_node_set_bool(PurpleBlistNode* node, const char *key, gboolean data)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
207 {
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
208 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
209 PurpleBlistUiOps *ops;
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
210 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
211
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
212 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
213 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
214 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
215
35005
bff56dfca65d Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
216 value = purple_value_new(G_TYPE_BOOLEAN);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
217 g_value_set_boolean(value, data);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
218
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
219 g_hash_table_replace(priv->settings, g_strdup(key), value);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
220
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
221 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
222 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
223 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
224 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
225
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
226 gboolean
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
227 purple_blist_node_get_bool(PurpleBlistNode* node, const char *key)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
228 {
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
229 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
230 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
231
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
232 g_return_val_if_fail(priv != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
233 g_return_val_if_fail(priv->settings != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
234 g_return_val_if_fail(key != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
235
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
236 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
237
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
238 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
239 return FALSE;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
240
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
241 g_return_val_if_fail(G_VALUE_HOLDS_BOOLEAN(value), FALSE);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
242
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
243 return g_value_get_boolean(value);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
244 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
245
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
246 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
247 purple_blist_node_set_int(PurpleBlistNode* node, const char *key, int data)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
248 {
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
249 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
250 PurpleBlistUiOps *ops;
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
251 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
252
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
253 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
254 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
255 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
256
35005
bff56dfca65d Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
257 value = purple_value_new(G_TYPE_INT);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
258 g_value_set_int(value, data);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
259
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
260 g_hash_table_replace(priv->settings, g_strdup(key), value);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
261
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
262 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
263 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
264 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
265 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
266
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
267 int
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
268 purple_blist_node_get_int(PurpleBlistNode* node, const char *key)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
269 {
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
270 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
271 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
272
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
273 g_return_val_if_fail(priv != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
274 g_return_val_if_fail(priv->settings != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
275 g_return_val_if_fail(key != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
276
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
277 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
278
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
279 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
280 return 0;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
281
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
282 g_return_val_if_fail(G_VALUE_HOLDS_INT(value), 0);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
283
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
284 return g_value_get_int(value);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
285 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
286
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
287 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
288 purple_blist_node_set_string(PurpleBlistNode* node, const char *key, const char *data)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
289 {
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
290 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
291 PurpleBlistUiOps *ops;
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
292 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
293
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
294 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
295 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
296 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
297
35005
bff56dfca65d Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
298 value = purple_value_new(G_TYPE_STRING);
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
299 g_value_set_string(value, data);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
300
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
301 g_hash_table_replace(priv->settings, g_strdup(key), value);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
302
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
303 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
304 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
305 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
306 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
307
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
308 const char *
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
309 purple_blist_node_get_string(PurpleBlistNode* node, const char *key)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
310 {
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
311 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
312 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
313
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
314 g_return_val_if_fail(priv != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
315 g_return_val_if_fail(priv->settings != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
316 g_return_val_if_fail(key != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
317
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
318 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
319
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
320 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
321 return NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
322
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
323 g_return_val_if_fail(G_VALUE_HOLDS_STRING(value), NULL);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
324
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
325 return g_value_get_string(value);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
326 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
327
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
328 GList *
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
329 purple_blist_node_get_extended_menu(PurpleBlistNode *n)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
330 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
331 GList *menu = NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
332
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
333 g_return_val_if_fail(n != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
334
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
335 purple_signal_emit(purple_blist_get_handle(), "blist-node-extended-menu",
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
336 n, &menu);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
337 return menu;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
338 }
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
339
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
340 /**************************************************************************
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
341 * GObject code for PurpleBlistNode
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
342 **************************************************************************/
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
343
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
344 /* Set method for GObject properties */
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
345 static void
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
346 purple_blist_node_set_property(GObject *obj, guint param_id, const GValue *value,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
347 GParamSpec *pspec)
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
348 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
349 PurpleBlistNode *node = PURPLE_BLIST_NODE(obj);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
350
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
351 switch (param_id) {
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
352 case BLNODE_PROP_TRANSIENT:
34865
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
353 purple_blist_node_set_transient(node, g_value_get_boolean(value));
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
354 break;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
355 default:
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
356 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
357 break;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
358 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
359 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
360
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
361 /* Get method for GObject properties */
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
362 static void
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
363 purple_blist_node_get_property(GObject *obj, guint param_id, GValue *value,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
364 GParamSpec *pspec)
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
365 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
366 PurpleBlistNode *node = PURPLE_BLIST_NODE(obj);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
367
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
368 switch (param_id) {
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
369 case BLNODE_PROP_TRANSIENT:
34865
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
370 g_value_set_boolean(value, purple_blist_node_is_transient(node));
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
371 break;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
372 default:
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
373 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
374 break;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
375 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
376 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
377
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
378 /* GObject initialization function */
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
379 static void
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
380 purple_blist_node_init(GTypeInstance *instance, gpointer klass)
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
381 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
382 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(instance);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
383
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
384 priv->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
35005
bff56dfca65d Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents: 34983
diff changeset
385 (GDestroyNotify)purple_value_free);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
386 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
387
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
388 /* GObject finalize function */
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
389 static void
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
390 purple_blist_node_finalize(GObject *object)
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
391 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
392 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(object);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
393
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
394 g_hash_table_destroy(priv->settings);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
395
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
396 parent_class->finalize(object);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
397 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
398
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
399 /* Class initializer function */
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
400 static void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
401 purple_blist_node_class_init(PurpleBlistNodeClass *klass)
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
402 {
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
403 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
404
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
405 parent_class = g_type_class_peek_parent(klass);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
406
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
407 obj_class->finalize = purple_blist_node_finalize;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
408
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
409 /* Setup properties */
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
410 obj_class->get_property = purple_blist_node_get_property;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
411 obj_class->set_property = purple_blist_node_set_property;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
412
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
413 g_type_class_add_private(klass, sizeof(PurpleBlistNodePrivate));
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
414
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
415 bn_properties[BLNODE_PROP_TRANSIENT] = g_param_spec_boolean("transient",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
416 "Transient",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
417 "Whether node should not be saved with the buddy list.",
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
418 FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
419
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
420 g_object_class_install_properties(obj_class, BLNODE_PROP_LAST,
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
421 bn_properties);
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
422 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
423
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
424 GType
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
425 purple_blist_node_get_type(void)
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
426 {
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
427 static GType type = 0;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
428
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
429 if(type == 0) {
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
430 static const GTypeInfo info = {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
431 sizeof(PurpleBlistNodeClass),
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
432 NULL,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
433 NULL,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
434 (GClassInitFunc)purple_blist_node_class_init,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
435 NULL,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
436 NULL,
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
437 sizeof(PurpleBlistNode),
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
438 0,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
439 (GInstanceInitFunc)purple_blist_node_init,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
440 NULL,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
441 };
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
442
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
443 type = g_type_register_static(G_TYPE_OBJECT, "PurpleBlistNode",
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
444 &info, G_TYPE_FLAG_ABSTRACT);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
445 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
446
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
447 return type;
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
448 }
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
449
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
450 /**************************************************************************/
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
451 /* Counting node API */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
452 /**************************************************************************/
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
453
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
454 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
455 purple_counting_node_get_total_size(PurpleCountingNode *counter)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
456 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
457 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
458
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
459 g_return_val_if_fail(priv != NULL, -1);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
460
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
461 return priv->totalsize;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
462 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
463
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
464 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
465 purple_counting_node_get_current_size(PurpleCountingNode *counter)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
466 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
467 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
468
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
469 g_return_val_if_fail(priv != NULL, -1);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
470
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
471 return priv->currentsize;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
472 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
473
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
474 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
475 purple_counting_node_get_online_count(PurpleCountingNode *counter)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
476 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
477 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
478
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
479 g_return_val_if_fail(priv != NULL, -1);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
480
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
481 return priv->onlinecount;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
482 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
483
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
484 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
485 purple_counting_node_change_total_size(PurpleCountingNode *counter, int delta)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
486 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
487 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
488
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
489 g_return_if_fail(priv != NULL);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
490
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
491 purple_counting_node_set_total_size(counter, priv->totalsize + delta);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
492 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
493
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
494 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
495 purple_counting_node_change_current_size(PurpleCountingNode *counter, int delta)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
496 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
497 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
498
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
499 g_return_if_fail(priv != NULL);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
500
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
501 purple_counting_node_set_current_size(counter, priv->currentsize + delta);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
502 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
503
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
504 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
505 purple_counting_node_change_online_count(PurpleCountingNode *counter, int delta)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
506 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
507 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
508
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
509 g_return_if_fail(priv != NULL);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
510
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
511 purple_counting_node_set_online_count(counter, priv->onlinecount + delta);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
512 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
513
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
514 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
515 purple_counting_node_set_total_size(PurpleCountingNode *counter, int totalsize)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
516 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
517 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
518
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
519 g_return_if_fail(priv != NULL);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
520
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
521 priv->totalsize = totalsize;
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
522
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
523 g_object_notify_by_pspec(G_OBJECT(counter),
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
524 cn_properties[CNODE_PROP_TOTAL_SIZE]);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
525 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
526
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
527 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
528 purple_counting_node_set_current_size(PurpleCountingNode *counter, int currentsize)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
529 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
530 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
531
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
532 g_return_if_fail(priv != NULL);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
533
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
534 priv->currentsize = currentsize;
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
535
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
536 g_object_notify_by_pspec(G_OBJECT(counter),
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
537 cn_properties[CNODE_PROP_CURRENT_SIZE]);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
538 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
539
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
540 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
541 purple_counting_node_set_online_count(PurpleCountingNode *counter, int onlinecount)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
542 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
543 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(counter);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
544
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
545 g_return_if_fail(priv != NULL);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
546
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
547 priv->onlinecount = onlinecount;
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
548
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
549 g_object_notify_by_pspec(G_OBJECT(counter),
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
550 cn_properties[CNODE_PROP_ONLINE_COUNT]);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
551 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
552
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
553 /**************************************************************************
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
554 * GObject code for PurpleCountingNode
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
555 **************************************************************************/
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
556
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
557 /* Set method for GObject properties */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
558 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
559 purple_counting_node_set_property(GObject *obj, guint param_id, const GValue *value,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
560 GParamSpec *pspec)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
561 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
562 PurpleCountingNode *node = PURPLE_COUNTING_NODE(obj);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
563
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
564 switch (param_id) {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
565 case CNODE_PROP_TOTAL_SIZE:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
566 purple_counting_node_set_total_size(node, g_value_get_int(value));
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
567 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
568 case CNODE_PROP_CURRENT_SIZE:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
569 purple_counting_node_set_current_size(node, g_value_get_int(value));
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
570 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
571 case CNODE_PROP_ONLINE_COUNT:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
572 purple_counting_node_set_online_count(node, g_value_get_int(value));
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
573 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
574 default:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
575 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
576 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
577 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
578 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
579
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
580 /* Get method for GObject properties */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
581 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
582 purple_counting_node_get_property(GObject *obj, guint param_id, GValue *value,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
583 GParamSpec *pspec)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
584 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
585 PurpleCountingNode *node = PURPLE_COUNTING_NODE(obj);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
586
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
587 switch (param_id) {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
588 case CNODE_PROP_TOTAL_SIZE:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
589 g_value_set_int(value, purple_counting_node_get_total_size(node));
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
590 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
591 case CNODE_PROP_CURRENT_SIZE:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
592 g_value_set_int(value, purple_counting_node_get_current_size(node));
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
593 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
594 case CNODE_PROP_ONLINE_COUNT:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
595 g_value_set_int(value, purple_counting_node_get_online_count(node));
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
596 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
597 default:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
598 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
599 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
600 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
601 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
602
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
603 /* Class initializer function */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
604 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
605 purple_counting_node_class_init(PurpleCountingNodeClass *klass)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
606 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
607 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
608
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
609 /* Setup properties */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
610 obj_class->get_property = purple_counting_node_get_property;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
611 obj_class->set_property = purple_counting_node_set_property;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
612
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
613 g_type_class_add_private(klass, sizeof(PurpleCountingNodePrivate));
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
614
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
615 cn_properties[CNODE_PROP_TOTAL_SIZE] = g_param_spec_int("total-size",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
616 "Total size",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
617 "The number of children under this node.",
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
618 G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
619 G_PARAM_STATIC_STRINGS);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
620
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
621 cn_properties[CNODE_PROP_CURRENT_SIZE] = g_param_spec_int("current-size",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
622 "Current size",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
623 "The number of children with online accounts.",
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
624 G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
625 G_PARAM_STATIC_STRINGS);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
626
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
627 cn_properties[CNODE_PROP_ONLINE_COUNT] = g_param_spec_int("online-count",
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
628 "Online count",
35058
506740af931c Unmark property names and blurbs from translatable to non-translatable
Ankit Vani <a@nevitus.org>
parents: 35010
diff changeset
629 "The number of children that are online.",
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
630 G_MININT, G_MAXINT, 0, G_PARAM_READWRITE |
35080
58bddd91956c libpurple: use g_object_notify_by_pspec instead of g_object_notify
Ankit Vani <a@nevitus.org>
parents: 35066
diff changeset
631 G_PARAM_STATIC_STRINGS);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
632
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
633 g_object_class_install_properties(obj_class, CNODE_PROP_LAST,
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
634 cn_properties);
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
635 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
636
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
637 GType
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
638 purple_counting_node_get_type(void)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
639 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
640 static GType type = 0;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
641
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
642 if(type == 0) {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
643 static const GTypeInfo info = {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
644 sizeof(PurpleCountingNodeClass),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
645 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
646 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
647 (GClassInitFunc)purple_counting_node_class_init,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
648 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
649 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
650 sizeof(PurpleCountingNode),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
651 0,
35010
9c2d352b1d96 Cleaned up properties and added g_object_notify calls for PurpleAccount and PurpleBlistNodes
Ankit Vani <a@nevitus.org>
parents: 35005
diff changeset
652 NULL,
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
653 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
654 };
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
655
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
656 type = g_type_register_static(PURPLE_TYPE_BLIST_NODE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
657 "PurpleCountingNode",
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
658 &info, G_TYPE_FLAG_ABSTRACT);
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
659 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
660
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
661 return type;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
662 }

mercurial