libpurple/blistnode.c

Thu, 25 Jul 2013 02:22:35 +0530

author
Ankit Vani <a@nevitus.org>
date
Thu, 25 Jul 2013 02:22:35 +0530
branch
soc.2013.gobjectification
changeset 34864
0e292d8887de
parent 34852
0e01a98b2ef7
child 34865
764a33b41ac7
permissions
-rw-r--r--

Renamed PurpleBListNode back to PurpleBlistNode

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 */
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
23 #include "blistnodetypes.h"
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
24 #include "internal.h"
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
25
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
26 #define PURPLE_BLIST_NODE_GET_PRIVATE(obj) \
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
27 (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
28
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
29 /** @copydoc _PurpleBlistNodePrivate */
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 /** @copydoc _PurpleCountingNodePrivate */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
36 typedef struct _PurpleCountingNodePrivate PurpleCountingNodePrivate;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
37
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
38 /** Private data of a buddy list node */
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
39 struct _PurpleBlistNodePrivate {
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
40 GHashTable *settings; /**< per-node 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
41 gboolean dont_save; /**< 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
42 };
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
43
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
44 /* 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
45 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
46 {
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
47 BLNODE_PROP_0,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
48 BLNODE_PROP_DONT_SAVE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
49 BLNODE_PROP_LAST
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
50 };
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
51
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
52 /** Private data of a counting node */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
53 struct _PurpleCountingNodePrivate {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
54 int totalsize; /**< The number of children under this node */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
55 int currentsize; /**< The number of children under this node
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
56 corresponding to online accounts */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
57 int onlinecount; /**< The number of children under this contact who are
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
58 currently online */
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
61 /* Counting node property enums */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
62 enum
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
63 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
64 CNODE_PROP_0,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
65 CNODE_PROP_TOTAL_SIZE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
66 CNODE_PROP_CURRENT_SIZE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
67 CNODE_PROP_ONLINE_COUNT,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
68 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
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
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 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
72
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
73 /**************************************************************************/
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
74 /* Buddy list node API */
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
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
77 static PurpleBlistNode *get_next_node(PurpleBlistNode *node, gboolean godeep)
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
78 {
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
79 if (node == NULL)
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
80 return NULL;
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
81
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
82 if (godeep && node->child)
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
83 return node->child;
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
84
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
85 if (node->next)
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
86 return node->next;
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
87
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
88 return get_next_node(node->parent, FALSE);
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
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
91 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
92 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
93 PurpleBlistNode *ret = node;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
94
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
95 if (offline)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
96 return get_next_node(ret, TRUE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
97 do
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
98 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
99 ret = get_next_node(ret, TRUE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
100 } while (ret && PURPLE_IS_BUDDY(ret) &&
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
101 !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
102
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
103 return 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
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
106 PurpleBlistNode *purple_blist_node_get_parent(PurpleBlistNode *node)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
107 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
108 return node ? node->parent : NULL;
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
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
111 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
112 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
113 return node ? node->child : NULL;
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
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
116 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
117 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
118 return node? node->next : NULL;
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
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
121 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
122 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
123 return node? node->prev : NULL;
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
126 void *
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
127 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
128 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
129 g_return_val_if_fail(node, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
130
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
131 return node->ui_data;
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
134 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
135 purple_blist_node_set_ui_data(PurpleBlistNode *node, void *ui_data) {
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
136 g_return_if_fail(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
137
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
138 node->ui_data = ui_data;
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
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
141 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
142 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
143 PurpleBlistUiOps *ops;
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
144 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
145
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
146 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
147 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
148 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
149
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
150 g_hash_table_remove(priv->settings, key);
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 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
153 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
154 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
155 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
156
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
157 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
158 purple_blist_node_set_dont_save(PurpleBlistNode *node, gboolean dont_save)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
159 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
160 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
161
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
162 g_return_if_fail(priv != NULL);
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 priv->dont_save = dont_save;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
165 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
166
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
167 gboolean
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
168 purple_blist_node_get_dont_save(PurpleBlistNode *node)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
169 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
170 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
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 g_return_val_if_fail(priv != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
173
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
174 return priv->dont_save;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
175 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
176
34730
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
177 GHashTable *
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
178 purple_blist_node_get_settings(PurpleBlistNode *node)
34730
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
179 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
180 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34730
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
181
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
182 g_return_val_if_fail(priv != NULL, NULL);
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
183
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
184 return priv->settings;
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
185 }
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
186
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
187 gboolean
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
188 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
189 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
190 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
191
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
192 g_return_val_if_fail(priv != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
193 g_return_val_if_fail(priv->settings != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
194 g_return_val_if_fail(key != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
195
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
196 /* 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
197 return (g_hash_table_lookup(priv->settings, key) != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
198 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
199
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
200 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
201 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
202 {
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
203 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
204 PurpleBlistUiOps *ops;
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
205 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
206
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
207 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
208 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
209 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
210
34809
06ea98f6632b Used purple_g_value_new() and purple_g_value_free() for values in PurpleBListNode settings
Ankit Vani <a@nevitus.org>
parents: 34730
diff changeset
211 value = purple_g_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
212 g_value_set_boolean(value, data);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
213
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
214 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
215
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
216 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
217 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
218 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
219 }
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 gboolean
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
222 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
223 {
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
224 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
225 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
226
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
227 g_return_val_if_fail(priv != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
228 g_return_val_if_fail(priv->settings != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
229 g_return_val_if_fail(key != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
230
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
231 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
232
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
233 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
234 return FALSE;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
235
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
236 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
237
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
238 return g_value_get_boolean(value);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
239 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
240
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
241 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
242 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
243 {
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
244 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
245 PurpleBlistUiOps *ops;
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
246 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
247
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
248 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
249 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
250 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
251
34809
06ea98f6632b Used purple_g_value_new() and purple_g_value_free() for values in PurpleBListNode settings
Ankit Vani <a@nevitus.org>
parents: 34730
diff changeset
252 value = purple_g_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
253 g_value_set_int(value, data);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
254
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
255 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
256
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
257 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
258 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
259 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
260 }
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 int
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
263 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
264 {
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
265 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
266 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
267
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
268 g_return_val_if_fail(priv != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
269 g_return_val_if_fail(priv->settings != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
270 g_return_val_if_fail(key != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
271
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
272 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
273
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
274 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
275 return 0;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
276
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
277 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
278
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
279 return g_value_get_int(value);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
280 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
281
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
282 void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
283 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
284 {
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
285 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
286 PurpleBlistUiOps *ops;
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
287 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
288
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
289 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
290 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
291 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
292
34809
06ea98f6632b Used purple_g_value_new() and purple_g_value_free() for values in PurpleBListNode settings
Ankit Vani <a@nevitus.org>
parents: 34730
diff changeset
293 value = purple_g_value_new(G_TYPE_STRING);
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
294 g_value_set_string(value, data);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
295
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
296 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
297
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
298 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
299 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
300 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
301 }
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 const char *
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
304 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
305 {
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
306 GValue *value;
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
307 PurpleBlistNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
308
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
309 g_return_val_if_fail(priv != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
310 g_return_val_if_fail(priv->settings != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
311 g_return_val_if_fail(key != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
312
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
313 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
314
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
315 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
316 return NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
317
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
318 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
319
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
320 return g_value_get_string(value);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
321 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
322
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
323 GList *
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
324 purple_blist_node_get_extended_menu(PurpleBlistNode *n)
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
325 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
326 GList *menu = NULL;
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 g_return_val_if_fail(n != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
329
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
330 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
331 n, &menu);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
332 return menu;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
333 }
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
334
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
335 /**************************************************************************
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
336 * GObject code for PurpleBlistNode
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
337 **************************************************************************/
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
338
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 /* GObject Property names */
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
340 #define BLNODE_PROP_DONT_SAVE_S "dont-save"
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
341
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
342 /* 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
343 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
344 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
345 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
346 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
347 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
348
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
349 switch (param_id) {
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
350 case BLNODE_PROP_DONT_SAVE:
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
351 purple_blist_node_set_dont_save(node, g_value_get_boolean(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
352 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
353 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
354 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
355 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
356 }
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 }
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 /* 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
360 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
361 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
362 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
363 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
364 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
365
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
366 switch (param_id) {
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
367 case BLNODE_PROP_DONT_SAVE:
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
368 g_value_set_boolean(value, purple_blist_node_get_dont_save(node));
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
369 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
370 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
371 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
372 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
373 }
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 }
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 /* 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
377 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
378 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
379 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
380 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
381
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
382 priv->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
34809
06ea98f6632b Used purple_g_value_new() and purple_g_value_free() for values in PurpleBListNode settings
Ankit Vani <a@nevitus.org>
parents: 34730
diff changeset
383 (GDestroyNotify)purple_g_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
384 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
385
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 /* 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
387 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
388 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
389 {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
390 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
391
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
392 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
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 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
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
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 /* 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
398 static void
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
399 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
400 {
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
401 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
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 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
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 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
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 /* 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
408 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
409 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
410
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
411 g_object_class_install_property(obj_class, BLNODE_PROP_DONT_SAVE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
412 g_param_spec_boolean(BLNODE_PROP_DONT_SAVE_S, _("Do not save"),
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
413 _("Whether node should not be saved with the buddy list."),
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
414 FALSE, G_PARAM_READWRITE)
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
415 );
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
416
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
417 g_type_class_add_private(klass, sizeof(PurpleBlistNodePrivate));
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
418 }
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
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
420 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
421 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
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 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
424
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 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
426 static const GTypeInfo info = {
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
427 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
428 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
429 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
430 (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
431 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
432 NULL,
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
433 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
434 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
435 (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
436 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
437 };
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
34864
0e292d8887de Renamed PurpleBListNode back to PurpleBlistNode
Ankit Vani <a@nevitus.org>
parents: 34852
diff changeset
439 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
440 &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
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
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
443 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
444 }
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
445
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
446 /**************************************************************************/
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
447 /* Counting node API */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
448 /**************************************************************************/
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 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
451 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
452 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
453 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
454
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
455 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
456
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
457 return priv->totalsize;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
460 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
461 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
462 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
463 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
464
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
465 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
466
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
467 return priv->currentsize;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
470 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
471 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
472 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
473 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
474
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
475 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
476
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
477 return priv->onlinecount;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
480 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
481 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
482 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
483 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
484
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
485 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
486
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
487 priv->totalsize += delta;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
490 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
491 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
492 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
493 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
494
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
495 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
496
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
497 priv->currentsize += delta;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
500 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
501 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
502 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
503 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
504
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
505 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
506
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
507 priv->onlinecount += delta;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
510 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
511 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
512 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
513 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
514
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
515 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
516
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
517 priv->totalsize = totalsize;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
520 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
521 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
522 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
523 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
524
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
525 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
526
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
527 priv->currentsize = currentsize;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
528 }
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 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
531 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
532 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
533 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
534
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
535 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
536
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
537 priv->onlinecount = onlinecount;
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 /**************************************************************************
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
541 * GObject code for PurpleCountingNode
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
544 /* GObject Property names */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
545 #define CNODE_PROP_TOTAL_SIZE_S "total-size"
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
546 #define CNODE_PROP_CURRENT_SIZE_S "current-size"
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
547 #define CNODE_PROP_ONLINE_COUNT_S "online-count"
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
548
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
549 /* 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
550 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
551 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
552 GParamSpec *pspec)
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 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
555
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
556 switch (param_id) {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
557 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
558 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
559 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
560 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
561 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
562 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
563 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
564 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
565 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
566 default:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
567 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
568 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
569 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
570 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
571
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
572 /* 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
573 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
574 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
575 GParamSpec *pspec)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
576 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
577 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
578
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
579 switch (param_id) {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
580 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
581 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
582 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
583 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
584 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
585 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
586 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
587 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
588 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
589 default:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
590 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
591 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
592 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
593 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
594
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
595 /* GObject initialization function */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
596 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
597 purple_counting_node_init(GTypeInstance *instance, gpointer klass)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
598 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
599 PurpleCountingNodePrivate *priv = PURPLE_COUNTING_NODE_GET_PRIVATE(instance);
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 priv->totalsize = 0;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
602 priv->currentsize = 0;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
603 priv->onlinecount = 0;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
604 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
605
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
606 /* Class initializer function */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
607 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
608 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
609 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
610 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
611
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
612 /* Setup properties */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
613 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
614 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
615
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
616 g_object_class_install_property(obj_class, CNODE_PROP_TOTAL_SIZE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
617 g_param_spec_int(CNODE_PROP_TOTAL_SIZE_S, _("Total size"),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
618 _("The number of children under this node."),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
619 G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
620 );
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
621
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
622 g_object_class_install_property(obj_class, CNODE_PROP_CURRENT_SIZE,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
623 g_param_spec_int(CNODE_PROP_CURRENT_SIZE_S, _("Current size"),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
624 _("The number of children with online accounts."),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
625 G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
626 );
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
627
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
628 g_object_class_install_property(obj_class, CNODE_PROP_ONLINE_COUNT,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
629 g_param_spec_int(CNODE_PROP_ONLINE_COUNT_S, _("Online count"),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
630 _("The number of children that are online."),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
631 G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
632 );
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
633
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
634 g_type_class_add_private(klass, sizeof(PurpleCountingNodePrivate));
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,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
652 (GInstanceInitFunc)purple_counting_node_init,
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