From db7cecd7653d88081ea9c89ac7e68b0816961189 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 8 Jun 2007 19:22:39 +0000 Subject: Do not save when closing the dialog. Update information in real-time and 2007-06-08 Xavier Claessens * libempathy-gtk/empathy-contact-dialogs.c: * libempathy-gtk/empathy-contact-widget.c: * libempathy-gtk/empathy-contact-widget.h: Do not save when closing the dialog. Update information in real-time and just provides a "Close" button. That's more GNOME spirite. * libempathy/empathy-tp-contact-list.c: * libempathy/gossip-contact.h: * libempathy/gossip-contact.c: New methods: gossip_contact_add/remove_group(). This fixes leaks when a contact is added/removed from a group. svn path=/trunk/; revision=132 --- libempathy/gossip-contact.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'libempathy/gossip-contact.c') diff --git a/libempathy/gossip-contact.c b/libempathy/gossip-contact.c index 267d86646..86b6ee6e0 100644 --- a/libempathy/gossip-contact.c +++ b/libempathy/gossip-contact.c @@ -592,6 +592,8 @@ gossip_contact_set_handle (GossipContact *contact, { GossipContactPriv *priv; + g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + priv = GET_PRIV (contact); priv->handle = handle; @@ -599,6 +601,43 @@ gossip_contact_set_handle (GossipContact *contact, g_object_notify (G_OBJECT (contact), "handle"); } +void +gossip_contact_add_group (GossipContact *contact, + const gchar *group) +{ + GossipContactPriv *priv; + + g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (group != NULL); + + priv = GET_PRIV (contact); + + if (!g_list_find_custom (priv->groups, group, (GCompareFunc) strcmp)) { + priv->groups = g_list_prepend (priv->groups, g_strdup (group)); + g_object_notify (G_OBJECT (contact), "groups"); + } +} + +void +gossip_contact_remove_group (GossipContact *contact, + const gchar *group) +{ + GossipContactPriv *priv; + GList *l; + + g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (group != NULL); + + priv = GET_PRIV (contact); + + l = g_list_find_custom (priv->groups, group, (GCompareFunc) strcmp); + if (l) { + g_free (l->data); + priv->groups = g_list_delete_link (priv->groups, l); + g_object_notify (G_OBJECT (contact), "groups"); + } +} + gboolean gossip_contact_is_online (GossipContact *contact) { -- cgit v1.2.3