libpurple/purplecontact.c

changeset 41771
c5877e2c93f2
parent 41759
1ecc0512e714
child 41918
106ae46b290b
equal deleted inserted replaced
41770:64287dd40326 41771:c5877e2c93f2
148 purple_contact_set_alias(contact, g_value_get_string(value)); 148 purple_contact_set_alias(contact, g_value_get_string(value));
149 break; 149 break;
150 case PROP_AVATAR: 150 case PROP_AVATAR:
151 purple_contact_set_avatar(contact, g_value_get_object(value)); 151 purple_contact_set_avatar(contact, g_value_get_object(value));
152 break; 152 break;
153 case PROP_PRESENCE:
154 purple_contact_set_presence(contact, g_value_get_object(value));
155 break;
156 case PROP_PERSON: 153 case PROP_PERSON:
157 purple_contact_set_person(contact, g_value_get_object(value)); 154 purple_contact_set_person(contact, g_value_get_object(value));
158 break; 155 break;
159 default: 156 default:
160 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); 157 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
200 } 197 }
201 198
202 static void 199 static void
203 purple_contact_init(PurpleContact *contact) { 200 purple_contact_init(PurpleContact *contact) {
204 contact->tags = purple_tags_new(); 201 contact->tags = purple_tags_new();
202 contact->presence = g_object_new(PURPLE_TYPE_PRESENCE, NULL);
205 } 203 }
206 204
207 static void 205 static void
208 purple_contact_class_init(PurpleContactClass *klass) { 206 purple_contact_class_init(PurpleContactClass *klass) {
209 GObjectClass *obj_class = G_OBJECT_CLASS(klass); 207 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
306 */ 304 */
307 properties[PROP_PRESENCE] = g_param_spec_object( 305 properties[PROP_PRESENCE] = g_param_spec_object(
308 "presence", "presence", 306 "presence", "presence",
309 "The presence of the contact", 307 "The presence of the contact",
310 PURPLE_TYPE_PRESENCE, 308 PURPLE_TYPE_PRESENCE,
311 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); 309 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
312 310
313 /** 311 /**
314 * PurpleContact:tags: 312 * PurpleContact:tags:
315 * 313 *
316 * The [class@Purple.Tags] for this contact. 314 * The [class@Purple.Tags] for this contact.
441 g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); 439 g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL);
442 440
443 return contact->presence; 441 return contact->presence;
444 } 442 }
445 443
446 void
447 purple_contact_set_presence(PurpleContact *contact, PurplePresence *presence) {
448 g_return_if_fail(PURPLE_IS_CONTACT(contact));
449
450 if(g_set_object(&contact->presence, presence)) {
451 g_object_notify_by_pspec(G_OBJECT(contact), properties[PROP_PRESENCE]);
452 }
453 }
454
455 PurpleTags * 444 PurpleTags *
456 purple_contact_get_tags(PurpleContact *contact) { 445 purple_contact_get_tags(PurpleContact *contact) {
457 g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL); 446 g_return_val_if_fail(PURPLE_IS_CONTACT(contact), NULL);
458 447
459 return contact->tags; 448 return contact->tags;

mercurial