| 223 g_return_val_if_fail(attr_value != NULL, NULL); |
223 g_return_val_if_fail(attr_value != NULL, NULL); |
| 224 |
224 |
| 225 status_type = gaim_status_type_new_full(primitive, id, name, saveable, |
225 status_type = gaim_status_type_new_full(primitive, id, name, saveable, |
| 226 user_settable, independent); |
226 user_settable, independent); |
| 227 |
227 |
| |
228 /* Add the first attribute */ |
| 228 gaim_status_type_add_attr(status_type, attr_id, attr_name, attr_value); |
229 gaim_status_type_add_attr(status_type, attr_id, attr_name, attr_value); |
| 229 |
230 |
| 230 va_start(args, attr_value); |
231 va_start(args, attr_value); |
| 231 gaim_status_type_add_attrs_vargs(status_type, args); |
232 gaim_status_type_add_attrs_vargs(status_type, args); |
| 232 va_end(args); |
233 va_end(args); |
| 284 |
285 |
| 285 status_type->attrs = g_list_append(status_type->attrs, attr); |
286 status_type->attrs = g_list_append(status_type->attrs, attr); |
| 286 } |
287 } |
| 287 |
288 |
| 288 void |
289 void |
| |
290 gaim_status_type_add_attrs_vargs(GaimStatusType *status_type, va_list args) |
| |
291 { |
| |
292 const char *id, *name; |
| |
293 GaimValue *value; |
| |
294 |
| |
295 g_return_if_fail(status_type != NULL); |
| |
296 |
| |
297 while ((id = va_arg(args, const char *)) != NULL) |
| |
298 { |
| |
299 name = va_arg(args, const char *); |
| |
300 g_return_if_fail(name != NULL); |
| |
301 |
| |
302 value = va_arg(args, GaimValue *); |
| |
303 g_return_if_fail(value != NULL); |
| |
304 |
| |
305 gaim_status_type_add_attr(status_type, id, name, value); |
| |
306 } |
| |
307 } |
| |
308 |
| |
309 void |
| 289 gaim_status_type_add_attrs(GaimStatusType *status_type, const char *id, |
310 gaim_status_type_add_attrs(GaimStatusType *status_type, const char *id, |
| 290 const char *name, GaimValue *value, ...) |
311 const char *name, GaimValue *value, ...) |
| 291 { |
312 { |
| 292 va_list args; |
313 va_list args; |
| 293 |
314 |
| 294 g_return_if_fail(status_type != NULL); |
315 g_return_if_fail(status_type != NULL); |
| 295 g_return_if_fail(id != NULL); |
316 g_return_if_fail(id != NULL); |
| 296 g_return_if_fail(name != NULL); |
317 g_return_if_fail(name != NULL); |
| 297 g_return_if_fail(value != NULL); |
318 g_return_if_fail(value != NULL); |
| 298 |
319 |
| 299 /* Add the first. */ |
320 /* Add the first attribute */ |
| 300 gaim_status_type_add_attr(status_type, id, name, value); |
321 gaim_status_type_add_attr(status_type, id, name, value); |
| 301 |
322 |
| 302 va_start(args, value); |
323 va_start(args, value); |
| 303 gaim_status_type_add_attrs_vargs(status_type, args); |
324 gaim_status_type_add_attrs_vargs(status_type, args); |
| 304 va_end(args); |
325 va_end(args); |
| 305 } |
|
| 306 |
|
| 307 void |
|
| 308 gaim_status_type_add_attrs_vargs(GaimStatusType *status_type, va_list args) |
|
| 309 { |
|
| 310 const char *id, *name; |
|
| 311 GaimValue *value; |
|
| 312 |
|
| 313 g_return_if_fail(status_type != NULL); |
|
| 314 |
|
| 315 while ((id = va_arg(args, const char *)) != NULL) |
|
| 316 { |
|
| 317 name = va_arg(args, const char *); |
|
| 318 g_return_if_fail(name != NULL); |
|
| 319 |
|
| 320 value = va_arg(args, GaimValue *); |
|
| 321 g_return_if_fail(value != NULL); |
|
| 322 |
|
| 323 gaim_status_type_add_attr(status_type, id, name, value); |
|
| 324 } |
|
| 325 } |
326 } |
| 326 |
327 |
| 327 GaimStatusPrimitive |
328 GaimStatusPrimitive |
| 328 gaim_status_type_get_primitive(const GaimStatusType *status_type) |
329 gaim_status_type_get_primitive(const GaimStatusType *status_type) |
| 329 { |
330 { |