| |
1 /* purple |
| |
2 * |
| |
3 * Purple is the legal property of its developers, whose names are too numerous |
| |
4 * to list here. Please refer to the COPYRIGHT file distributed with this |
| |
5 * source distribution. |
| |
6 * |
| |
7 * This program is free software; you can redistribute it and/or modify |
| |
8 * it under the terms of the GNU General Public License as published by |
| |
9 * the Free Software Foundation; either version 2 of the License, or |
| |
10 * (at your option) any later version. |
| |
11 * |
| |
12 * This program is distributed in the hope that it will be useful, |
| |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
15 * GNU General Public License for more details. |
| |
16 * |
| |
17 * You should have received a copy of the GNU General Public License |
| |
18 * along with this program; if not, write to the Free Software |
| |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| |
20 */ |
| |
21 |
| |
22 #ifndef PURPLE_COUNTING_NODE_H |
| |
23 #define PURPLE_COUNTING_NODE_H |
| |
24 /** |
| |
25 * SECTION:blistnode |
| |
26 * @section_id: libpurple-blistnode |
| |
27 * @short_description: <filename>blistnode.h</filename> |
| |
28 * @title: Buddy List Node and Counting Node types |
| |
29 */ |
| |
30 |
| |
31 #include <glib.h> |
| |
32 #include <glib-object.h> |
| |
33 |
| |
34 #include "blistnode.h" |
| |
35 |
| |
36 #define PURPLE_TYPE_COUNTING_NODE (purple_counting_node_get_type()) |
| |
37 #define PURPLE_COUNTING_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_COUNTING_NODE, PurpleCountingNode)) |
| |
38 #define PURPLE_COUNTING_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_COUNTING_NODE, PurpleCountingNodeClass)) |
| |
39 #define PURPLE_IS_COUNTING_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_COUNTING_NODE)) |
| |
40 #define PURPLE_IS_COUNTING_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_COUNTING_NODE)) |
| |
41 #define PURPLE_COUNTING_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_COUNTING_NODE, PurpleCountingNodeClass)) |
| |
42 |
| |
43 typedef struct _PurpleCountingNode PurpleCountingNode; |
| |
44 typedef struct _PurpleCountingNodeClass PurpleCountingNodeClass; |
| |
45 |
| |
46 /** |
| |
47 * PurpleCountingNode: |
| |
48 * |
| |
49 * A node that keeps count of the number of children that it has. It tracks the |
| |
50 * total number of children, the number of children corresponding to online |
| |
51 * accounts, and the number of online children. |
| |
52 * |
| |
53 * The two types of counting nodes are: |
| |
54 * <orderedlist> |
| |
55 * <listitem>Contact: Keeps track of the number of buddies under it.</listitem> |
| |
56 * <listitem>Group: Keeps track of the number of chats and contacts under it. |
| |
57 * </listitem> |
| |
58 * </orderedlist> |
| |
59 * |
| |
60 * See #PurpleContact, #PurpleGroup |
| |
61 */ |
| |
62 struct _PurpleCountingNode { |
| |
63 PurpleBlistNode node; |
| |
64 }; |
| |
65 |
| |
66 /** |
| |
67 * PurpleCountingNodeClass: |
| |
68 * |
| |
69 * The base class for all #PurpleCountingNode's. |
| |
70 */ |
| |
71 struct _PurpleCountingNodeClass { |
| |
72 PurpleBlistNodeClass node_class; |
| |
73 |
| |
74 /*< private >*/ |
| |
75 void (*_purple_reserved1)(void); |
| |
76 void (*_purple_reserved2)(void); |
| |
77 void (*_purple_reserved3)(void); |
| |
78 void (*_purple_reserved4)(void); |
| |
79 }; |
| |
80 |
| |
81 G_BEGIN_DECLS |
| |
82 |
| |
83 /** |
| |
84 * purple_counting_node_get_type: |
| |
85 * |
| |
86 * Returns: The #GType for the #PurpleCountingNode object. |
| |
87 */ |
| |
88 GType purple_counting_node_get_type(void); |
| |
89 |
| |
90 /** |
| |
91 * purple_counting_node_get_total_size: |
| |
92 * @counter: The node |
| |
93 * |
| |
94 * Returns the total number of children of the counting node. |
| |
95 * |
| |
96 * Returns: The total number of children of the node |
| |
97 */ |
| |
98 int purple_counting_node_get_total_size(PurpleCountingNode *counter); |
| |
99 |
| |
100 /** |
| |
101 * purple_counting_node_get_current_size: |
| |
102 * @counter: The node |
| |
103 * |
| |
104 * Returns the number of children of the counting node corresponding to online |
| |
105 * accounts. |
| |
106 * |
| |
107 * Returns: The number of children with online accounts |
| |
108 */ |
| |
109 int purple_counting_node_get_current_size(PurpleCountingNode *counter); |
| |
110 |
| |
111 /** |
| |
112 * purple_counting_node_get_online_count: |
| |
113 * @counter: The node |
| |
114 * |
| |
115 * Returns the number of children of the counting node that are online. |
| |
116 * |
| |
117 * Returns: The total number of online children |
| |
118 */ |
| |
119 int purple_counting_node_get_online_count(PurpleCountingNode *counter); |
| |
120 |
| |
121 /** |
| |
122 * purple_counting_node_change_total_size: |
| |
123 * @counter: The node |
| |
124 * @delta: The value to change the total size by |
| |
125 * |
| |
126 * Changes the total number of children of the counting node. The provided |
| |
127 * delta value is added to the count, or if it's negative, the count is |
| |
128 * decreased. |
| |
129 */ |
| |
130 void purple_counting_node_change_total_size(PurpleCountingNode *counter, int delta); |
| |
131 |
| |
132 /** |
| |
133 * purple_counting_node_change_current_size: |
| |
134 * @counter: The node |
| |
135 * @delta: The value to change the current size by |
| |
136 * |
| |
137 * Changes the number of children of the counting node corresponding to online |
| |
138 * accounts. The provided delta value is added to the count, or if it's |
| |
139 * negative, the count is decreased. |
| |
140 */ |
| |
141 void purple_counting_node_change_current_size(PurpleCountingNode *counter, int delta); |
| |
142 |
| |
143 /** |
| |
144 * purple_counting_node_change_online_count: |
| |
145 * @counter: The node |
| |
146 * @delta: The value to change the online count by |
| |
147 * |
| |
148 * Changes the number of children of the counting node that are online. The |
| |
149 * provided delta value is added to the count, or if it's negative, the count is |
| |
150 * decreased. |
| |
151 */ |
| |
152 void purple_counting_node_change_online_count(PurpleCountingNode *counter, int delta); |
| |
153 |
| |
154 /** |
| |
155 * purple_counting_node_set_total_size: |
| |
156 * @counter: The node |
| |
157 * @totalsize: The total number of children of the node |
| |
158 * |
| |
159 * Sets the total number of children of the counting node. |
| |
160 */ |
| |
161 void purple_counting_node_set_total_size(PurpleCountingNode *counter, int totalsize); |
| |
162 |
| |
163 /** |
| |
164 * purple_counting_node_set_current_size: |
| |
165 * @counter: The node |
| |
166 * @currentsize: The number of children with online accounts |
| |
167 * |
| |
168 * Sets the number of children of the counting node corresponding to online |
| |
169 * accounts. |
| |
170 */ |
| |
171 void purple_counting_node_set_current_size(PurpleCountingNode *counter, int currentsize); |
| |
172 |
| |
173 /** |
| |
174 * purple_counting_node_set_online_count: |
| |
175 * @counter: The node |
| |
176 * @onlinecount: The total number of online children |
| |
177 * |
| |
178 * Sets the number of children of the counting node that are online. |
| |
179 */ |
| |
180 void purple_counting_node_set_online_count(PurpleCountingNode *counter, int onlinecount); |
| |
181 |
| |
182 G_END_DECLS |
| |
183 |
| |
184 #endif /* PURPLE_COUNTING_NODE_H */ |