]> git.0d.be Git - empathy.git/commitdiff
empathy_contact_set_handle: remove the handle ready flag when the handle is set to 0
authorGuillaume Desmottes <gdesmott@gnome.org>
Fri, 20 Mar 2009 10:14:58 +0000 (10:14 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 20 Mar 2009 10:14:58 +0000 (10:14 +0000)
From: Guillaume Desmottes <gdesmott@gnome.org>

svn path=/trunk/; revision=2719

libempathy/empathy-contact.c

index 59d55fd4d162a912961d34c18b20ce0a8a341925..1cac48513d55969a89a2ef7a6c14ea85caef3346 100644 (file)
@@ -456,6 +456,19 @@ contact_set_ready_flag (EmpathyContact *contact,
     }
 }
 
     }
 }
 
+static void
+contact_remove_ready_flag (EmpathyContact *contact,
+                           EmpathyContactReady flag)
+{
+  EmpathyContactPriv *priv = GET_PRIV (contact);
+
+  if (priv->ready & flag)
+    {
+      priv->ready ^= flag;
+      g_object_notify (G_OBJECT (contact), "ready");
+    }
+}
+
 EmpathyContact *
 empathy_contact_new (McAccount *account)
 {
 EmpathyContact *
 empathy_contact_new (McAccount *account)
 {
@@ -713,7 +726,12 @@ empathy_contact_set_handle (EmpathyContact *contact,
       priv->handle = handle;
       g_object_notify (G_OBJECT (contact), "handle");
     }
       priv->handle = handle;
       g_object_notify (G_OBJECT (contact), "handle");
     }
-  contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE);
+
+  if (handle != 0)
+    contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE);
+  else
+    contact_remove_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE);
+
   g_object_unref (contact);
 }
 
   g_object_unref (contact);
 }