comparison src/status.c @ 11187:744c0708d11f

[gaim-migrate @ 13303] gaim-remote.py implements the functionality of standard gaim-remote, but using DBus. It can also call all gaim functions exported via DBus. dbus-analize-function.py can now produce dbus bindings for GHashTable arguments. committer: Tailor Script <tailor@pidgin.im>
author Piotr Zielinski <zielaj>
date Wed, 03 Aug 2005 23:54:37 +0000
parents 50224ac8184d
children b4b1be482b4e
comparison
equal deleted inserted replaced
11186:bbe84acea03a 11187:744c0708d11f
24 */ 24 */
25 #include "internal.h" 25 #include "internal.h"
26 26
27 #include "blist.h" 27 #include "blist.h"
28 #include "core.h" 28 #include "core.h"
29 #include "dbus-maybe.h"
29 #include "debug.h" 30 #include "debug.h"
30 #include "notify.h" 31 #include "notify.h"
31 #include "prefs.h" 32 #include "prefs.h"
32 #include "status.h" 33 #include "status.h"
33 34
219 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL); 220 g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, NULL);
220 g_return_val_if_fail(id != NULL, NULL); 221 g_return_val_if_fail(id != NULL, NULL);
221 g_return_val_if_fail(name != NULL, NULL); 222 g_return_val_if_fail(name != NULL, NULL);
222 223
223 status_type = g_new0(GaimStatusType, 1); 224 status_type = g_new0(GaimStatusType, 1);
225 GAIM_DBUS_REGISTER_POINTER(status_type, GaimStatusType);
224 226
225 status_type->primitive = primitive; 227 status_type->primitive = primitive;
226 status_type->id = g_strdup(id); 228 status_type->id = g_strdup(id);
227 status_type->name = g_strdup(name); 229 status_type->name = g_strdup(name);
228 status_type->saveable = saveable; 230 status_type->saveable = saveable;
294 gaim_status_attr_destroy((GaimStatusAttr *)l->data); 296 gaim_status_attr_destroy((GaimStatusAttr *)l->data);
295 297
296 g_list_free(status_type->attrs); 298 g_list_free(status_type->attrs);
297 } 299 }
298 300
301 GAIM_DBUS_UNREGISTER_POINTER(status_type);
299 g_free(status_type); 302 g_free(status_type);
300 } 303 }
301 304
302 void 305 void
303 gaim_status_type_set_primary_attr(GaimStatusType *status_type, const char *id) 306 gaim_status_type_set_primary_attr(GaimStatusType *status_type, const char *id)
502 g_return_val_if_fail(id != NULL, NULL); 505 g_return_val_if_fail(id != NULL, NULL);
503 g_return_val_if_fail(name != NULL, NULL); 506 g_return_val_if_fail(name != NULL, NULL);
504 g_return_val_if_fail(value_type != NULL, NULL); 507 g_return_val_if_fail(value_type != NULL, NULL);
505 508
506 attr = g_new0(GaimStatusAttr, 1); 509 attr = g_new0(GaimStatusAttr, 1);
510 GAIM_DBUS_REGISTER_POINTER(attr, GaimStatusAttr);
507 511
508 attr->id = g_strdup(id); 512 attr->id = g_strdup(id);
509 attr->name = g_strdup(name); 513 attr->name = g_strdup(name);
510 attr->value_type = value_type; 514 attr->value_type = value_type;
511 515
520 g_free(attr->id); 524 g_free(attr->id);
521 g_free(attr->name); 525 g_free(attr->name);
522 526
523 gaim_value_destroy(attr->value_type); 527 gaim_value_destroy(attr->value_type);
524 528
529 GAIM_DBUS_UNREGISTER_POINTER(attr);
525 g_free(attr); 530 g_free(attr);
526 } 531 }
527 532
528 const char * 533 const char *
529 gaim_status_attr_get_id(const GaimStatusAttr *attr) 534 gaim_status_attr_get_id(const GaimStatusAttr *attr)
561 566
562 g_return_val_if_fail(status_type != NULL, NULL); 567 g_return_val_if_fail(status_type != NULL, NULL);
563 g_return_val_if_fail(presence != NULL, NULL); 568 g_return_val_if_fail(presence != NULL, NULL);
564 569
565 status = g_new0(GaimStatus, 1); 570 status = g_new0(GaimStatus, 1);
571 GAIM_DBUS_REGISTER_POINTER(status, GaimStatus);
566 572
567 status->type = status_type; 573 status->type = status_type;
568 status->presence = presence; 574 status->presence = presence;
569 575
570 status->attr_values = 576 status->attr_values =
597 /* TODO: Don't do this is if the status is exclusive */ 603 /* TODO: Don't do this is if the status is exclusive */
598 gaim_status_set_active(status, FALSE); 604 gaim_status_set_active(status, FALSE);
599 605
600 g_hash_table_destroy(status->attr_values); 606 g_hash_table_destroy(status->attr_values);
601 607
608 GAIM_DBUS_UNREGISTER_POINTER(status);
602 g_free(status); 609 g_free(status);
603 } 610 }
604 611
605 static void 612 static void
606 notify_buddy_status_update(GaimBuddy *buddy, GaimPresence *presence, 613 notify_buddy_status_update(GaimBuddy *buddy, GaimPresence *presence,
1064 GaimPresence *presence; 1071 GaimPresence *presence;
1065 1072
1066 g_return_val_if_fail(context != GAIM_PRESENCE_CONTEXT_UNSET, NULL); 1073 g_return_val_if_fail(context != GAIM_PRESENCE_CONTEXT_UNSET, NULL);
1067 1074
1068 presence = g_new0(GaimPresence, 1); 1075 presence = g_new0(GaimPresence, 1);
1076 GAIM_DBUS_REGISTER_POINTER(presence, GaimPresence);
1069 1077
1070 presence->context = context; 1078 presence->context = context;
1071 1079
1072 presence->status_table = 1080 presence->status_table =
1073 g_hash_table_new_full(g_str_hash, g_str_equal, 1081 g_hash_table_new_full(g_str_hash, g_str_equal,
1172 if (presence->statuses != NULL) 1180 if (presence->statuses != NULL)
1173 g_list_free(presence->statuses); 1181 g_list_free(presence->statuses);
1174 1182
1175 g_hash_table_destroy(presence->status_table); 1183 g_hash_table_destroy(presence->status_table);
1176 1184
1185 GAIM_DBUS_UNREGISTER_POINTER(presence);
1177 g_free(presence); 1186 g_free(presence);
1178 } 1187 }
1179 1188
1180 /* 1189 /*
1181 * TODO: Maybe we should cal gaim_presence_destroy() after we 1190 * TODO: Maybe we should cal gaim_presence_destroy() after we