soylent r228 - trunk/libsoylent



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

Log:
person creation now works

Modified:
   trunk/libsoylent/sl-entity.c
   trunk/libsoylent/sl-entity.h
   trunk/libsoylent/sl-person.c
   trunk/libsoylent/sl-person.h

Modified: trunk/libsoylent/sl-entity.c
==============================================================================
--- trunk/libsoylent/sl-entity.c	(original)
+++ trunk/libsoylent/sl-entity.c	Mon Jul 21 16:54:04 2008
@@ -31,6 +31,7 @@
 struct _SlEntityPriv
 {
   SlEntityHandler *entity_handler;
+  EContact *econtact;
   GList *attributes;
 };
 
@@ -145,12 +146,12 @@
   obj_class->get_property = (void (*)(GObject *, guint, GValue *, GParamSpec *))
                               sl_entity_get_property;
   
-  GParamSpec *pspec = NULL;
+  /*GParamSpec *pspec = NULL;
   pspec = g_param_spec_pointer ("entity-handler", "entity-handler",
             "Entity handler", G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
   
   g_object_class_install_property (obj_class, SL_ENTITY_PROPERTY_ENTITY_HANDLER,
-    pspec);
+    pspec);*/
 }
 
 static void
@@ -181,9 +182,9 @@
 {
   switch (property_id)
     {
-      case SL_ENTITY_PROPERTY_ENTITY_HANDLER:
-        self->priv->entity_handler = g_object_ref (g_value_get_pointer (value));
-        break;
+      //case SL_ENTITY_PROPERTY_ENTITY_HANDLER:
+        //self->priv->entity_handler = g_object_ref (g_value_get_pointer (value));
+        //break;
       default:
         g_assert_not_reached();
     }
@@ -196,8 +197,26 @@
 	g_warning("%s not implemented", __FUNCTION__);
 }
 
-/* ABSTRACT */
-/*SlEntity *
+void
+sl_entity_constr (SlEntity *self)
+{
+  self->priv->econtact = e_contact_new ();
+}
+
+void
+sl_entity_constr_with_econtact (SlEntity *self, EContact *econtact)
+{
+  self->priv->econtact = g_object_ref (econtact);
+}
+
+EContact
+*sl_entity_get_econtact (SlEntity *self)
+{
+  return self->priv->econtact;
+}
+
+/* ABSTRACT
+SlEntity *
 sl_entity_new (SlEntityHandler *entity_handler)
 {
   g_return_val_if_fail (entity_handler != NULL &&
@@ -205,13 +224,15 @@
   
 	SlEntity *self = g_object_new (SL_ENTITY_TYPE, "entity-handler",
                       entity_handler, NULL);
+  self->priv->econtact = e_contact_new ();
+  
 	return self;
 }*/
 
-SlEntityHandler *sl_entity_get_handler (SlEntity *self)
+/*SlEntityHandler *sl_entity_get_handler (SlEntity *self)
 {
   return self->priv->entity_handler;
-}
+}*/
 
 SlAttribute *sl_entity_get_attribute (SlEntity *self, gchar *attrname)
 {

Modified: trunk/libsoylent/sl-entity.h
==============================================================================
--- trunk/libsoylent/sl-entity.h	(original)
+++ trunk/libsoylent/sl-entity.h	Mon Jul 21 16:54:04 2008
@@ -31,6 +31,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
+#include <libebook/e-book.h>
 
 #define SL_ENTITY_TYPE			 	    (sl_entity_get_type ())
 #define SL_ENTITY(obj)				    (G_TYPE_CHECK_INSTANCE_CAST (obj, \
@@ -114,7 +115,10 @@
 void sl_entity_remove_attribute_handler (const gchar *attrname);
 
 /*SlEntity *sl_entity_new (SlEntityHandler *entity_handler);*/
-SlEntityHandler *sl_entity_get_handler (SlEntity *self);
+/*SlEntityHandler *sl_entity_get_handler (SlEntity *self);*/
+void sl_entity_constr (SlEntity *self);
+void sl_entity_constr_with_econtact (SlEntity *self, EContact *econtact);
+EContact *sl_entity_get_econtact (SlEntity *self);
 SlAttribute *sl_entity_get_attribute (SlEntity *self, gchar *attrname);
 GList *sl_entity_get_attributes (SlEntity *self);
 

Modified: trunk/libsoylent/sl-person.c
==============================================================================
--- trunk/libsoylent/sl-person.c	(original)
+++ trunk/libsoylent/sl-person.c	Mon Jul 21 16:54:04 2008
@@ -114,9 +114,16 @@
 SlPerson *
 sl_person_new (const gchar *name)
 {
-  SlEntityHandlerEDS *entity_handler_eds = sl_entity_handler_eds_new ();
-  SlPerson *self = g_object_new (SL_PERSON_TYPE, "entity-handler", 
-    entity_handler_eds, NULL);
-  /* TODO: set name */
+  SlPerson *self = g_object_new (SL_PERSON_TYPE, NULL);
+  sl_person_constr (self, name);
   return self;
 }
+
+void
+sl_person_constr (SlPerson *self, const gchar *name)
+{
+  sl_entity_constr (SL_ENTITY (self));
+  /* temporary, this will be moved to SlAttributes */
+  EContact *econtact = sl_entity_get_econtact (SL_ENTITY (self));
+  e_contact_set (econtact, E_CONTACT_NICKNAME, (const gpointer) name);
+}

Modified: trunk/libsoylent/sl-person.h
==============================================================================
--- trunk/libsoylent/sl-person.h	(original)
+++ trunk/libsoylent/sl-person.h	Mon Jul 21 16:54:04 2008
@@ -59,5 +59,6 @@
 GType sl_person_get_type (void);
 
 SlPerson *sl_person_new (const gchar *name);
+void sl_person_constr (SlPerson *self, const gchar *name);
 
 #endif



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