libpurple/blistnodes.c

Sat, 13 Jul 2013 22:31:27 +0530

author
Ankit Vani <a@nevitus.org>
date
Sat, 13 Jul 2013 22:31:27 +0530
branch
soc.2013.gobjectification
changeset 34766
33722e7cda18
parent 34730
2406671e3c44
child 34809
06ea98f6632b
permissions
-rw-r--r--

Added purple_connection_disable_reconnection() for protocols to handle user registration queries.

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) \
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
27 (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_BLIST_NODE, PurpleBListNodePrivate))
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
28
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
29 /** @copydoc _PurpleBListNodePrivate */
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
30 typedef struct _PurpleBListNodePrivate PurpleBListNodePrivate;
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 */
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
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
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
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
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
77 static PurpleBListNode *get_next_node(PurpleBListNode *node, gboolean godeep)
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
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
91 PurpleBListNode *purple_blist_node_next(PurpleBListNode *node, gboolean offline)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
92 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
93 PurpleBListNode *ret = node;
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
106 PurpleBListNode *purple_blist_node_get_parent(PurpleBListNode *node)
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
111 PurpleBListNode *purple_blist_node_get_first_child(PurpleBListNode *node)
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
116 PurpleBListNode *purple_blist_node_get_sibling_next(PurpleBListNode *node)
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
121 PurpleBListNode *purple_blist_node_get_sibling_prev(PurpleBListNode *node)
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 *
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
127 purple_blist_node_get_ui_data(const PurpleBListNode *node)
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
135 purple_blist_node_set_ui_data(PurpleBListNode *node, void *ui_data) {
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
141 void purple_blist_node_remove_setting(PurpleBListNode *node, const char *key)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
142 {
34709
3484aac07f02 Replaced PurpleBlistUiOps with PurpleBListUiOps for uniform naming
Ankit Vani <a@nevitus.org>
parents: 34707
diff changeset
143 PurpleBListUiOps *ops;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
144 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
158 purple_blist_node_set_dont_save(PurpleBListNode *node, gboolean dont_save)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
159 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
160 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
168 purple_blist_node_get_dont_save(PurpleBListNode *node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
169 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
170 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
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 *
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
178 purple_blist_node_get_settings(PurpleBListNode *node)
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
179 {
2406671e3c44 Buddy list now compiles.
Ankit Vani <a@nevitus.org>
parents: 34727
diff changeset
180 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
188 purple_blist_node_has_setting(PurpleBListNode* node, const char *key)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
189 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
190 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
201 purple_blist_node_set_bool(PurpleBListNode* node, const char *key, gboolean data)
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;
34709
3484aac07f02 Replaced PurpleBlistUiOps with PurpleBListUiOps for uniform naming
Ankit Vani <a@nevitus.org>
parents: 34707
diff changeset
204 PurpleBListUiOps *ops;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
205 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
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
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
211 value = g_new0(GValue, 1);
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_init(value, G_TYPE_BOOLEAN);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
213 g_value_set_boolean(value, data);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
214
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
215 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
216
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
217 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
218 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
219 ops->save_node(node);
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
222 gboolean
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
223 purple_blist_node_get_bool(PurpleBListNode* node, const char *key)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
224 {
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
225 GValue *value;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
226 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
227
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
228 g_return_val_if_fail(priv != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
229 g_return_val_if_fail(priv->settings != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
230 g_return_val_if_fail(key != NULL, FALSE);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
231
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
232 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
233
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
234 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
235 return FALSE;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
236
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
237 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
238
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
239 return g_value_get_boolean(value);
34707
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
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
242 void
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
243 purple_blist_node_set_int(PurpleBListNode* node, const char *key, int data)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
244 {
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
245 GValue *value;
34709
3484aac07f02 Replaced PurpleBlistUiOps with PurpleBListUiOps for uniform naming
Ankit Vani <a@nevitus.org>
parents: 34707
diff changeset
246 PurpleBListUiOps *ops;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
247 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
248
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
249 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
250 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
251 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
252
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 value = g_new0(GValue, 1);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
254 g_value_init(value, G_TYPE_INT);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
255 g_value_set_int(value, data);
34707
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 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
258
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
259 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
260 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
261 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
262 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
263
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
264 int
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
265 purple_blist_node_get_int(PurpleBListNode* node, const char *key)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
266 {
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
267 GValue *value;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
268 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
269
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
270 g_return_val_if_fail(priv != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
271 g_return_val_if_fail(priv->settings != NULL, 0);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
272 g_return_val_if_fail(key != NULL, 0);
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 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
275
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
276 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
277 return 0;
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 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
280
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
281 return g_value_get_int(value);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
282 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
283
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
284 void
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
285 purple_blist_node_set_string(PurpleBListNode* node, const char *key, const char *data)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
286 {
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
287 GValue *value;
34709
3484aac07f02 Replaced PurpleBlistUiOps with PurpleBListUiOps for uniform naming
Ankit Vani <a@nevitus.org>
parents: 34707
diff changeset
288 PurpleBListUiOps *ops;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
289 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
290
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
291 g_return_if_fail(priv != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
292 g_return_if_fail(priv->settings != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
293 g_return_if_fail(key != NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
294
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
295 value = g_new0(GValue, 1);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
296 g_value_init(value, G_TYPE_STRING);
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
297 g_value_set_string(value, data);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
298
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
299 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
300
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
301 ops = purple_blist_get_ui_ops();
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
302 if (ops && ops->save_node)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
303 ops->save_node(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
304 }
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
305
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
306 const char *
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
307 purple_blist_node_get_string(PurpleBListNode* node, const char *key)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
308 {
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
309 GValue *value;
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
310 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
311
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
312 g_return_val_if_fail(priv != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
313 g_return_val_if_fail(priv->settings != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
314 g_return_val_if_fail(key != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
315
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
316 value = g_hash_table_lookup(priv->settings, key);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
317
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
318 if (value == NULL)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
319 return NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
320
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
321 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
322
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
323 return g_value_get_string(value);
34707
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
324 }
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 *
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
327 purple_blist_node_get_extended_menu(PurpleBListNode *n)
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
328 {
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
329 GList *menu = NULL;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
330
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
331 g_return_val_if_fail(n != NULL, NULL);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
332
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
333 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
334 n, &menu);
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
335 return menu;
d433bf40792a Added blistnode.[ch] and blistnodetypes.[ch]
Ankit Vani <a@nevitus.org>
parents:
diff changeset
336 }
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
337
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 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
339 purple_blist_node_setting_free(gpointer data)
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
340 {
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 GValue *value = (GValue *)data;
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
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 g_value_unset(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
344 g_free(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 }
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
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
347 /**************************************************************************
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
348 * GObject code for PurpleBListNode
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
349 **************************************************************************/
34712
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
350
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
351 /* GObject Property names */
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
352 #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
353
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 /* 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
355 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
356 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
357 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
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 PurpleBListNode *node = PURPLE_BLIST_NODE(obj);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
360
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
361 switch (param_id) {
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
362 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
363 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
364 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
365 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
366 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
367 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
368 }
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 }
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
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 /* 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
372 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
373 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
374 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
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 PurpleBListNode *node = PURPLE_BLIST_NODE(obj);
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
377
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
378 switch (param_id) {
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
379 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
380 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
381 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
382 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
383 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
384 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
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 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
387
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
388 /* GObject 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
389 static void
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
390 purple_blist_node_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
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 PurpleBListNodePrivate *priv = PURPLE_BLIST_NODE_GET_PRIVATE(instance);
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 priv->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
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 (GDestroyNotify)purple_blist_node_setting_free);
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
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 /* 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
399 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
400 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
401 {
34713
e4fc06261814 GObjectified PurpleBListNode source
Ankit Vani <a@nevitus.org>
parents: 34712
diff changeset
402 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
403
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 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
405
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 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
407 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
408
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
409 /* 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
410 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
411 purple_blist_node_class_init(PurpleBListNodeClass *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
412 {
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 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
414
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 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
416
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
417 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
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 /* 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
420 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
421 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
422
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
423 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
424 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
425 _("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
426 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
427 );
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
428
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
429 g_type_class_add_private(klass, sizeof(PurpleBListNodePrivate));
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 }
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
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 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
433 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
434 {
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 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
436
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 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
438 static const GTypeInfo info = {
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
439 sizeof(PurpleBListNodeClass),
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
440 NULL,
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
441 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
442 (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
443 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
444 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
445 sizeof(PurpleBListNode),
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
446 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
447 (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
448 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
449 };
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
450
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
451 type = g_type_register_static(G_TYPE_OBJECT, "PurpleBListNode",
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
452 &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
453 }
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
454
caeb3904c991 Added GObject code to PurpleBListNode. Changed blist node setting value from PurpleValue to GValue.
Ankit Vani <a@nevitus.org>
parents: 34709
diff changeset
455 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
456 }
34722
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
457
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 /* Counting node API */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
460 /**************************************************************************/
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
461
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
462 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
463 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
464 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
465 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
466
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
467 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
468
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
469 return priv->totalsize;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
470 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
471
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
472 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
473 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
474 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
475 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
476
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
477 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
478
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
479 return priv->currentsize;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
480 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
481
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
482 int
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
483 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
484 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
485 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
486
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
487 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
488
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
489 return priv->onlinecount;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
490 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
491
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
492 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
493 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
494 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
495 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
496
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
497 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
498
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
499 priv->totalsize += delta;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
500 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
501
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
502 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
503 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
504 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
505 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
506
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
507 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
508
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
509 priv->currentsize += delta;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
510 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
511
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
512 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
513 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
514 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
515 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
516
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
517 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
518
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
519 priv->onlinecount += delta;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
520 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
521
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
522 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
523 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
524 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
525 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
526
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
527 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
528
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
529 priv->totalsize = totalsize;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
530 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
531
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
532 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
533 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
534 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
535 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
536
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
537 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
538
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
539 priv->currentsize = currentsize;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
542 void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
543 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
544 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
545 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
546
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
547 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
548
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
549 priv->onlinecount = onlinecount;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
550 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
551
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
552 /**************************************************************************
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
553 * GObject code for PurpleCountingNode
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
554 **************************************************************************/
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 /* GObject Property names */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
557 #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
558 #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
559 #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
560
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
561 /* 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
562 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
563 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
564 GParamSpec *pspec)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
565 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
566 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
567
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
568 switch (param_id) {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
569 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
570 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
571 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
572 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
573 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
574 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
575 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
576 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
577 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
578 default:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
579 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
580 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
581 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
582 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
583
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
584 /* 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
585 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
586 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
587 GParamSpec *pspec)
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
588 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
589 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
590
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
591 switch (param_id) {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
592 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
593 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
594 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
595 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
596 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
597 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
598 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
599 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
600 break;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
601 default:
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
602 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
603 break;
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
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
607 /* GObject initialization function */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
608 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
609 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
610 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
611 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
612
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
613 priv->totalsize = 0;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
614 priv->currentsize = 0;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
615 priv->onlinecount = 0;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
616 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
617
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
618 /* Class initializer function */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
619 static void
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
620 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
621 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
622 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
623
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
624 /* Setup properties */
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
625 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
626 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
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_TOTAL_SIZE,
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_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
630 _("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
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_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
635 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
636 _("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
637 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
638 );
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 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
641 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
642 _("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
643 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
644 );
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
645
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
646 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
647 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
648
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
649 GType
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
650 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
651 {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
652 static GType type = 0;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
653
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
654 if(type == 0) {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
655 static const GTypeInfo info = {
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
656 sizeof(PurpleCountingNodeClass),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
657 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
658 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
659 (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
660 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
661 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
662 sizeof(PurpleCountingNode),
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
663 0,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
664 (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
665 NULL,
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
666 };
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
667
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
668 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
669 "PurpleCountingNode",
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
670 &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
671 }
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
672
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
673 return type;
32e636146d3f Added PurpleCountingNode to blistnodes.[ch]. PurpleContact and PurpleGroup inherit PurpleCountingNode.
Ankit Vani <a@nevitus.org>
parents: 34713
diff changeset
674 }

mercurial