soylent r223 - trunk/libsoylent



Author: svenp
Date: Mon Jul 14 21:48:23 2008
New Revision: 223
URL: http://svn.gnome.org/viewvc/soylent?rev=223&view=rev

Log:
added stubs for addressbook people-management
adding people works

Modified:
   trunk/libsoylent/sl-book.c
   trunk/libsoylent/sl-book.h

Modified: trunk/libsoylent/sl-book.c
==============================================================================
--- trunk/libsoylent/sl-book.c	(original)
+++ trunk/libsoylent/sl-book.c	Mon Jul 14 21:48:23 2008
@@ -23,8 +23,8 @@
 
 #include "sl-book.h"
 #include "sl-priv-util.h"
-
-#include <libebook/e-book.h>
+#include "sl-entity.h"
+#include "sl-entity-handler-eds.h"
 
 /* private structs and fields */
 
@@ -359,7 +359,35 @@
   return self;
 }
 
-SlEntity *
+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))
+    {
+      return FALSE;
+    }
+  
+  return TRUE;
+}
+
+gboolean
+sl_book_remove_person (SlBook *self, SlPerson *person, GError **error)
+{
+  g_warning("%s not implemented", __FUNCTION__);
+  return FALSE;
+}
+
+GList *
+sl_book_get_people (SlBook *self)
+{
+  g_warning("%s not implemented", __FUNCTION__);
+  return NULL;
+}
+
+SlPerson *
 sl_book_get_person(SlBook *self, gchar *attrname, gpointer value)
 {
   g_warning("%s not implemented", __FUNCTION__);

Modified: trunk/libsoylent/sl-book.h
==============================================================================
--- trunk/libsoylent/sl-book.h	(original)
+++ trunk/libsoylent/sl-book.h	Mon Jul 14 21:48:23 2008
@@ -29,10 +29,11 @@
 #ifndef SL_BOOK_H
 #define SL_BOOK_H
 
-#include "sl-entity.h"
+#include "sl-person.h"
 
 #include <glib.h>
 #include <glib-object.h>
+//#include <libebook/e-book.h>
 
 #define SL_BOOK_TYPE            (sl_book_get_type ())
 #define SL_BOOK(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, \
@@ -45,7 +46,7 @@
 
 #define SL_BOOK_ERROR sl_book_error_quark ()
 
-#define SL_BOOK_DEFAULT sl_book_default;
+#define SL_BOOK_DEFAULT sl_book_default
 
 typedef struct _SlBook      SlBook;
 typedef struct _SlBookClass SlBookClass;
@@ -92,6 +93,10 @@
 SlBook *sl_book_open_default (GError **error);
 gboolean sl_book_delete (const gchar *name, GError **error);
 
-SlEntity *sl_book_get_person(SlBook *self, gchar *attrname, gpointer value);
+gboolean sl_book_add_person (SlBook *self, SlPerson *person, GError **error);
+gboolean sl_book_remove_person (SlBook *self, SlPerson *person, GError **error);
+/* TODO: more to come, like searching for attributes */
+GList *sl_book_get_people (SlBook *self);
+SlPerson *sl_book_get_person(SlBook *self, gchar *attrname, gpointer value);
 
 #endif



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