soylent r229 - trunk/libsoylent



Author: svenp
Date: Mon Jul 21 16:55:22 2008
New Revision: 229
URL: http://svn.gnome.org/viewvc/soylent?rev=229&view=rev

Log:
people management (adding and removing people to / from books) implemented

Modified:
   trunk/libsoylent/sl-book.c

Modified: trunk/libsoylent/sl-book.c
==============================================================================
--- trunk/libsoylent/sl-book.c	(original)
+++ trunk/libsoylent/sl-book.c	Mon Jul 21 16:55:22 2008
@@ -362,10 +362,12 @@
 gboolean
 sl_book_add_person (SlBook *self, SlPerson *person, GError **error)
 {
-  SlEntityHandlerEDS *entity_handler_eds = SL_ENTITY_HANDLER_EDS (
-    sl_entity_get_handler (SL_ENTITY (person)));
-  if (!e_book_add_contact (self->priv->ebook, sl_entity_handler_eds_get_contact
-    (entity_handler_eds), error))
+  /* TODO: adding a contact to a self-created addressbook kills E-D-S and hangs
+     here... */
+  
+  SlEntity *entity = SL_ENTITY (person);
+  if (!e_book_add_contact (self->priv->ebook, sl_entity_get_econtact (entity),
+    error))
     {
       return FALSE;
     }
@@ -376,8 +378,13 @@
 gboolean
 sl_book_remove_person (SlBook *self, SlPerson *person, GError **error)
 {
-  g_warning("%s not implemented", __FUNCTION__);
-  return FALSE;
+  EContact *econtact = sl_entity_get_econtact (SL_ENTITY (person));
+  const char* id = e_contact_get (econtact, E_CONTACT_UID);
+  if (!e_book_remove_contact (self->priv->ebook, id, error))
+    {
+      return FALSE;
+    }
+  return TRUE;
 }
 
 GList *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]