soylent r251 - trunk/libsoylent



Author: svenp
Date: Wed Jul 30 16:36:25 2008
New Revision: 251
URL: http://svn.gnome.org/viewvc/soylent?rev=251&view=rev

Log:
setting attributes at a specified index works

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

Modified: trunk/libsoylent/sl-entity.c
==============================================================================
--- trunk/libsoylent/sl-entity.c	(original)
+++ trunk/libsoylent/sl-entity.c	Wed Jul 30 16:36:25 2008
@@ -703,13 +703,17 @@
   
   GList *evalues = e_vcard_attribute_get_values (self->priv->eattr);
   GList *evalue_nth = g_list_nth (evalues, index);
+  GList *value_nth = g_list_nth (self->priv->values, index);
   if (evalue_nth == NULL)
     {
       return FALSE;
     }
-  gchar *evalue = evalue_nth->data;
-  g_free (evalue);
+  g_assert (value_nth != NULL);
+  /* TODO: can I always free this? */
+  g_free (evalue_nth->data);
+  /* TODO: user has to free value, I don't know how */
   
+  value_nth->data = value;
   switch (type)
     {
       case SL_ATTRIBUTE_HANDLER_TYPE_STRING:
@@ -717,6 +721,7 @@
         break;
       case SL_ATTRIBUTE_HANDLER_TYPE_BIN:
         /* TODO: encode in base64 */
+        g_warning ("binary encoding not implemented yet");
         evalue_nth->data = result;
         break;
       default:
@@ -752,6 +757,12 @@
   g_warning("%s not implemented", __FUNCTION__);
 }
 
+gint
+sl_attribute_get_value_count (SlAttribute *self)
+{
+  return g_list_length (self->priv->values);
+}
+
 const gchar *sl_attribute_get_name (SlAttribute *self)
 {
   return self->priv->name;

Modified: trunk/libsoylent/sl-entity.h
==============================================================================
--- trunk/libsoylent/sl-entity.h	(original)
+++ trunk/libsoylent/sl-entity.h	Wed Jul 30 16:36:25 2008
@@ -179,6 +179,9 @@
 void sl_attribute_set_all (SlAttribute *self, GList *values);
 GList *sl_attribute_get_all (SlAttribute *self);
 void sl_attribute_remove_all (SlAttribute *self);
+
+gint sl_attribute_get_value_count (SlAttribute *self);
+
 const gchar *sl_attribute_get_name (SlAttribute *self);
 
 #endif



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