r3217 - in trunk/src/target/OM-2007.2/libraries/libmokojournal2: . mokojournal

thomas at sita.openmoko.org thomas at sita.openmoko.org
Thu Oct 18 12:17:52 CEST 2007


Author: thomas
Date: 2007-10-18 12:17:51 +0200 (Thu, 18 Oct 2007)
New Revision: 3217

Modified:
   trunk/src/target/OM-2007.2/libraries/libmokojournal2/ChangeLog
   trunk/src/target/OM-2007.2/libraries/libmokojournal2/mokojournal/moko-journal.c
   trunk/src/target/OM-2007.2/libraries/libmokojournal2/mokojournal/moko-journal.h
Log:
Patch by: Roman Moravcik <roman.moravcik at gmail.com>

* mokojournal/moko-journal.{c,h}: (moko_journal_entry_get_dtend),
(moko_journal_entry_set_dtend): Added new MokoJournal property
dtend.


Modified: trunk/src/target/OM-2007.2/libraries/libmokojournal2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokojournal2/ChangeLog	2007-10-18 06:35:38 UTC (rev 3216)
+++ trunk/src/target/OM-2007.2/libraries/libmokojournal2/ChangeLog	2007-10-18 10:17:51 UTC (rev 3217)
@@ -1,3 +1,11 @@
+2007-10-18  Thomas Wood  <thomas at openedhand.com>
+
+	Patch by: Roman Moravcik <roman.moravcik at gmail.com>
+
+	* mokojournal/moko-journal.{c,h}: (moko_journal_entry_get_dtend),
+	(moko_journal_entry_set_dtend): Added new MokoJournal property
+	dtend.
+
 2007-10-08  Thomas Wood  <thomas at openedhand.com>
 
 	* doc/reference/Makefile.am: Fix spurious += to single =
@@ -140,3 +148,5 @@
 	* tests/test-delete-uid.c: (main):
 	* tests/test-delete.c: (main):
 	Initial Import from splitting openmoko-libs.
+
+/* vim: set noexpandtab sw=8 sts=8 ts=8: */

Modified: trunk/src/target/OM-2007.2/libraries/libmokojournal2/mokojournal/moko-journal.c
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokojournal2/mokojournal/moko-journal.c	2007-10-18 06:35:38 UTC (rev 3216)
+++ trunk/src/target/OM-2007.2/libraries/libmokojournal2/mokojournal/moko-journal.c	2007-10-18 10:17:51 UTC (rev 3217)
@@ -664,6 +664,13 @@
   prop = icalproperty_new_dtstart (date->t) ;
   icalcomponent_add_property (comp, prop) ;
 
+  /*add dtend*/
+  date = moko_journal_entry_get_dtend (a_entry) ;
+  if (!date)
+    goto out ;
+  prop = icalproperty_new_dtend (date->t) ;
+  icalcomponent_add_property (comp, prop) ;
+
   /*add location start*/
   struct icalgeotype geo;
   if (moko_journal_entry_get_start_location (a_entry, (MokoLocation*)(void*)&geo))
@@ -880,6 +887,12 @@
         (entry,
          moko_time_new_from_icaltimetype (icalproperty_get_dtstart (prop)));
     }
+    else if (icalproperty_isa (prop) == ICAL_DTEND_PROPERTY)
+    {
+      moko_journal_entry_set_dtend
+        (entry,
+         moko_time_new_from_icaltimetype (icalproperty_get_dtend (prop)));
+    }
     else if (icalproperty_isa (prop) == ICAL_GEO_PROPERTY)
     {
       struct icalgeotype geo = icalproperty_get_geo (prop);
@@ -1756,6 +1769,26 @@
 }
 
 /**
+ * moko_journal_entry_get_dtend:
+ * @entry: the current instance of journal entry
+ *
+ * get the ending date associated to the journal entry
+ *
+ * Return value: an icaltimetype representing the ending date expected.
+ * It can be NULL. Client code must not deallocate it.
+ */
+const MokoTime*
+moko_journal_entry_get_dtend (MokoJournalEntry *a_entry)
+{
+  g_return_val_if_fail (a_entry, NULL) ;
+
+  if (!a_entry->dtend)
+    a_entry->dtend = moko_time_new_today () ;
+
+  return a_entry->dtend ;
+}
+
+/**
  * moko_journal_entry_get_start_location:
  * @a_entry: the current instance of journal entry
  * @a_location: the requested location
@@ -1858,6 +1891,26 @@
 }
 
 /**
+ * moko_journal_entry_set_dtend:
+ * @entry: the current instance of journal entry
+ * @dtstart: the new ending date associated to the journal entry.
+ */
+void
+moko_journal_entry_set_dtend (MokoJournalEntry *a_entry, MokoTime* a_dtend)
+{
+  g_return_if_fail (a_entry) ;
+
+  if (a_entry->dtend)
+  {
+    moko_time_free (a_entry->dtend) ;
+    a_entry->dtend = NULL ;
+  }
+
+  if (a_dtend)
+    a_entry->dtend = a_dtend ;
+}
+
+/**
  * moko_journal_entry_get_source:
  * @a_entry: the current instance of journal entry
  *

Modified: trunk/src/target/OM-2007.2/libraries/libmokojournal2/mokojournal/moko-journal.h
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokojournal2/mokojournal/moko-journal.h	2007-10-18 06:35:38 UTC (rev 3216)
+++ trunk/src/target/OM-2007.2/libraries/libmokojournal2/mokojournal/moko-journal.h	2007-10-18 10:17:51 UTC (rev 3217)
@@ -162,6 +162,9 @@
 const MokoTime *      moko_journal_entry_get_dtstart             (MokoJournalEntry     *entry);
 void                  moko_journal_entry_set_dtstart             (MokoJournalEntry     *entry,
                                                                   MokoTime             *dtstart);
+const MokoTime *      moko_journal_entry_get_dtend               (MokoJournalEntry     *entry);
+void                  moko_journal_entry_set_dtend               (MokoJournalEntry     *entry,
+                                                                  MokoTime             *dtend);
 G_CONST_RETURN gchar *moko_journal_entry_get_source              (MokoJournalEntry     *entry);
 void                  moko_journal_entry_set_source              (MokoJournalEntry     *entry,
                                                                   const gchar          *source);





More information about the commitlog mailing list