r1730 - in trunk/src/target/OM-2007/openmoko-libs: . libmokojournal/src libmokojournal/tests
dodji at sita.openmoko.org
dodji at sita.openmoko.org
Thu Apr 12 11:21:36 CEST 2007
Author: dodji
Date: 2007-04-12 11:21:34 +0200 (Thu, 12 Apr 2007)
New Revision: 1730
Modified:
trunk/src/target/OM-2007/openmoko-libs/ChangeLog
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.c
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.h
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-create.c
Log:
Changed some function names for better legibility
* openmoko-libs/libmokojournal/src/moko-journal.[c|h]:
change moko_j_entry* into moko_journal_entry*,
MokoJEntry, into MokoJournalEntry, etc.
That is for better legibility.
Modified: trunk/src/target/OM-2007/openmoko-libs/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/ChangeLog 2007-04-12 08:53:35 UTC (rev 1729)
+++ trunk/src/target/OM-2007/openmoko-libs/ChangeLog 2007-04-12 09:21:34 UTC (rev 1730)
@@ -1,5 +1,12 @@
2007-04-12 Dodji Seketeli <dodji at openedhand.com>
+ * openmoko-libs/libmokojournal/src/moko-journal.[c|h]:
+ change moko_j_entry* into moko_journal_entry*,
+ MokoJEntry, into MokoJournalEntry, etc.
+ That is for better legibility.
+
+2007-04-12 Dodji Seketeli <dodji at openedhand.com>
+
* openmoko-libs/libmokojournal/src/moko-journal.c:
(moko_j_entry_free_real): fix a leak in here.
(moko_journal_remove_entry_at): make this really remove
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.c 2007-04-12 08:53:35 UTC (rev 1729)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.c 2007-04-12 09:21:34 UTC (rev 1730)
@@ -34,14 +34,14 @@
GArray *entries ;
};
-struct _MokoJEmailInfo
+struct _MokoJournalEmailInfo
{
gboolean was_sent ;
};
-struct _MokoJEntry
+struct _MokoJournalEntry
{
- MokoJEntryType type;
+ MokoJournalEntryType type;
gchar *uid ;
gchar *contact_uid ;
gchar *summary ;
@@ -49,18 +49,18 @@
MokoTime *dtend ;
union
{
- MokoJEmailInfo *email_info ;
+ MokoJournalEmailInfo *email_info ;
} extra_info ;
};
-struct _MokoJEntryInfo
+struct _MokoJournalEntryInfo
{
- MokoJEntryType type;
+ MokoJournalEntryType type;
const gchar *type_as_string ;
};
-typedef struct _MokoJEntryInfo MokoJEntryInfo ;
+typedef struct _MokoJournalEntryInfo MokoJournalEntryInfo ;
-static const MokoJEntryInfo entries_info[] =
+static const MokoJournalEntryInfo entries_info[] =
{
{EMAIL_JOURNAL_ENTRY, "EMAILENTRY"},
{SMS_JOURNAL_ENTRY, "SMSENTRY"},
@@ -72,15 +72,15 @@
static MokoJournal* moko_journal_alloc () ;
static gboolean moko_journal_find_entry_from_uid (MokoJournal *a_journal,
const gchar *a_uid,
- MokoJEntry **a_entry,
+ MokoJournalEntry **a_entry,
int *a_offset) ;
-static const gchar* entry_type_to_string (MokoJEntryType a_type) ;
-static MokoJEntryType entry_type_from_string (const gchar* a_str) ;
-static gboolean moko_j_entry_type_is_valid (MokoJEntryType a_type) ;
-static gboolean moko_j_entry_to_icalcomponent (MokoJEntry *a_entry,
- icalcomponent **a_comp) ;
+static const gchar* entry_type_to_string (MokoJournalEntryType a_type) ;
+static MokoJournalEntryType entry_type_from_string (const gchar* a_str) ;
+static gboolean moko_journal_entry_type_is_valid (MokoJournalEntryType a_type) ;
+static gboolean moko_journal_entry_to_icalcomponent (MokoJournalEntry *a_entry,
+ icalcomponent **a_comp) ;
static gboolean icalcomponent_to_j_entry (icalcomponent *a_comp,
- MokoJEntry **a_entry) ;
+ MokoJournalEntry **a_entry) ;
static gboolean icalcomponent_find_property (const icalcomponent *a_comp,
const gchar *a_name,
icalproperty **a_property) ;
@@ -93,11 +93,11 @@
GList *a_entries,
MokoJournal *a_journal) ;
static const gchar*
-entry_type_to_string (MokoJEntryType a_type)
+entry_type_to_string (MokoJournalEntryType a_type)
{
- MokoJEntryInfo *cur ;
+ MokoJournalEntryInfo *cur ;
- for (cur = (MokoJEntryInfo*)entries_info ; cur ; ++cur)
+ for (cur = (MokoJournalEntryInfo*)entries_info ; cur ; ++cur)
{
if (cur->type == a_type)
return cur->type_as_string ;
@@ -105,12 +105,12 @@
return NULL ;
}
-static MokoJEntryType
+static MokoJournalEntryType
entry_type_from_string (const gchar* a_str)
{
- MokoJEntryInfo *cur ;
+ MokoJournalEntryInfo *cur ;
- for (cur = (MokoJEntryInfo*)entries_info ; cur ; ++cur)
+ for (cur = (MokoJournalEntryInfo*)entries_info ; cur ; ++cur)
{
if (!strcmp (cur->type_as_string, a_str))
{
@@ -126,14 +126,14 @@
{
MokoJournal *result ;
result = g_new0 (MokoJournal, 1) ;
- result->entries = g_array_new (TRUE, TRUE, sizeof (MokoJEntry*)) ;
+ result->entries = g_array_new (TRUE, TRUE, sizeof (MokoJournalEntry*)) ;
return result ;
}
static gboolean
moko_journal_find_entry_from_uid (MokoJournal *a_journal,
const gchar *a_uid,
- MokoJEntry **a_entry,
+ MokoJournalEntry **a_entry,
int *a_offset)
{
int i=0 ;
@@ -149,12 +149,13 @@
for (i = 0 ; i < a_journal->entries->len ; ++i)
{
- if (g_array_index (a_journal->entries, MokoJEntry*, i)
- && g_array_index (a_journal->entries, MokoJEntry*, i)->uid
- && !strcmp (g_array_index (a_journal->entries, MokoJEntry*, i)->uid,
+ if (g_array_index (a_journal->entries, MokoJournalEntry*, i)
+ && g_array_index (a_journal->entries, MokoJournalEntry*, i)->uid
+ && !strcmp (g_array_index (a_journal->entries,
+ MokoJournalEntry*, i)->uid,
a_uid))
{
- *a_entry = g_array_index (a_journal->entries, MokoJEntry*, i) ;
+ *a_entry = g_array_index (a_journal->entries, MokoJournalEntry*, i) ;
*a_offset = i ;
return TRUE ;
}
@@ -181,10 +182,11 @@
int i ;
for (i=0 ; i < a_journal->entries->len ; ++i)
{
- if (g_array_index (a_journal->entries, MokoJEntry*, i))
+ if (g_array_index (a_journal->entries, MokoJournalEntry*, i))
{
- moko_j_entry_free (g_array_index (a_journal->entries, MokoJEntry*, i));
- g_array_index (a_journal->entries, MokoJEntry*, i) = NULL;
+ moko_journal_entry_free (g_array_index (a_journal->entries,
+ MokoJournalEntry*, i));
+ g_array_index (a_journal->entries, MokoJournalEntry*, i) = NULL;
}
}
g_array_free (a_journal->entries, TRUE) ;
@@ -193,30 +195,30 @@
g_free (a_journal) ;
}
-MokoJEmailInfo*
+MokoJournalEmailInfo*
moko_j_email_info_new ()
{
- return g_new0 (MokoJEmailInfo, 1) ;
+ return g_new0 (MokoJournalEmailInfo, 1) ;
}
void
-moko_j_email_info_free (MokoJEmailInfo *a_info)
+moko_j_email_info_free (MokoJournalEmailInfo *a_info)
{
g_return_if_fail (a_info) ;
g_free (a_info) ;
}
-static MokoJEntry*
-moko_j_entry_alloc ()
+static MokoJournalEntry*
+moko_journal_entry_alloc ()
{
- MokoJEntry *result ;
+ MokoJournalEntry *result ;
- result = g_new0 (MokoJEntry, 1) ;
+ result = g_new0 (MokoJournalEntry, 1) ;
return result ;
}
static void
-moko_j_entry_free_real (MokoJEntry *a_entry)
+moko_journal_entry_free_real (MokoJournalEntry *a_entry)
{
g_return_if_fail (a_entry) ;
@@ -269,7 +271,7 @@
}
static gboolean
-moko_j_entry_type_is_valid (MokoJEntryType a_type)
+moko_journal_entry_type_is_valid (MokoJournalEntryType a_type)
{
if (a_type > 0 && a_type < NB_OF_ENTRY_TYPES)
return TRUE ;
@@ -277,8 +279,8 @@
}
static gboolean
-moko_j_entry_to_icalcomponent (MokoJEntry *a_entry,
- icalcomponent **a_comp)
+moko_journal_entry_to_icalcomponent (MokoJournalEntry *a_entry,
+ icalcomponent **a_comp)
{
icalcomponent *comp = NULL ;
icalproperty *prop = NULL ;
@@ -286,7 +288,7 @@
g_return_val_if_fail (a_entry, FALSE) ;
g_return_val_if_fail (a_comp, FALSE) ;
- g_return_val_if_fail (moko_j_entry_type_is_valid (a_entry->type),
+ g_return_val_if_fail (moko_journal_entry_type_is_valid (a_entry->type),
FALSE) ;
comp = icalcomponent_new (ICAL_VJOURNAL_COMPONENT) ;
@@ -299,15 +301,16 @@
}
/*add contact prop*/
- prop = icalproperty_new_contact (moko_j_entry_get_contact_uid (a_entry)) ;
+ prop = icalproperty_new_contact
+ (moko_journal_entry_get_contact_uid (a_entry)) ;
icalcomponent_add_property (comp, prop) ;
/*add summary prop*/
- prop = icalproperty_new_summary (moko_j_entry_get_summary (a_entry)) ;
+ prop = icalproperty_new_summary (moko_journal_entry_get_summary (a_entry)) ;
icalcomponent_add_property (comp, prop) ;
/*add dtstart*/
- const MokoTime *date = moko_j_entry_get_dtstart (a_entry) ;
+ const MokoTime *date = moko_journal_entry_get_dtstart (a_entry) ;
prop = NULL ;
if (!date)
goto out ;
@@ -317,19 +320,19 @@
/*add entry type*/
prop = icalproperty_new_x
- (entry_type_to_string (moko_j_entry_get_type (a_entry))) ;
+ (entry_type_to_string (moko_journal_entry_get_type (a_entry))) ;
icalproperty_set_x_name (prop, "X-OPENMOKO-ENTRY-TYPE") ;
icalcomponent_add_property (comp, prop) ;
- switch (moko_j_entry_get_type (a_entry))
+ switch (moko_journal_entry_get_type (a_entry))
{
case UNDEF_ENTRY:
g_warning ("entry is of undefined type\n") ;
return FALSE ;
case EMAIL_JOURNAL_ENTRY:
{
- MokoJEmailInfo *info=NULL ;
- if (!moko_j_entry_get_email_info (a_entry, &info) || !info)
+ MokoJournalEmailInfo *info=NULL ;
+ if (!moko_journal_entry_get_email_info (a_entry, &info) || !info)
goto out ;
if (moko_j_email_info_get_was_sent (info))
prop = icalproperty_new_x ("YES") ;
@@ -365,17 +368,17 @@
static gboolean
icalcomponent_to_j_entry (icalcomponent *a_comp,
- MokoJEntry **a_entry)
+ MokoJournalEntry **a_entry)
{
icalproperty *prop = NULL ;
gchar *prop_name = NULL ;
- MokoJEntry *entry = NULL;
+ MokoJournalEntry *entry = NULL;
g_return_val_if_fail (a_comp, FALSE) ;
g_return_val_if_fail (icalcomponent_isa (a_comp) == ICAL_VJOURNAL_COMPONENT,
FALSE) ;
- entry = moko_j_entry_alloc () ;
+ entry = moko_journal_entry_alloc () ;
/*iterate through properties to scan core properties*/
for (prop = icalcomponent_get_first_property (a_comp, ICAL_ANY_PROPERTY);
@@ -393,15 +396,16 @@
}
else if (icalproperty_isa (prop) == ICAL_CONTACT_PROPERTY)
{
- moko_j_entry_set_contact_uid (entry, icalproperty_get_contact (prop)) ;
+ moko_journal_entry_set_contact_uid
+ (entry, icalproperty_get_contact (prop)) ;
}
else if (icalproperty_isa (prop) == ICAL_SUMMARY_PROPERTY)
{
- moko_j_entry_set_summary (entry, icalproperty_get_summary (prop)) ;
+ moko_journal_entry_set_summary (entry, icalproperty_get_summary (prop)) ;
}
else if (icalproperty_isa (prop) == ICAL_DTSTART_PROPERTY)
{
- moko_j_entry_set_dtstart
+ moko_journal_entry_set_dtstart
(entry,
moko_time_new_from_icaltimetype (icalproperty_get_dtstart (prop)));
}
@@ -409,7 +413,7 @@
&& !strcmp (icalproperty_get_x_name (prop),
"X-OPENMOKO-ENTRY-TYPE"))
{
- MokoJEntryType entry_type = UNDEF_ENTRY ;
+ MokoJournalEntryType entry_type = UNDEF_ENTRY ;
const char *x_val = icalproperty_get_value_as_string (prop) ;
if (!x_val)
continue ;
@@ -434,9 +438,9 @@
{
case EMAIL_JOURNAL_ENTRY:
{
- MokoJEmailInfo *info=NULL ;
+ MokoJournalEmailInfo *info=NULL ;
gchar *prop_value = NULL ;
- if (!moko_j_entry_get_email_info (entry, &info))
+ if (!moko_journal_entry_get_email_info (entry, &info))
{
g_warning ("failed to get email info") ;
goto out ;
@@ -468,7 +472,7 @@
out:
if (entry)
- moko_j_entry_free (entry) ;
+ moko_journal_entry_free (entry) ;
return TRUE ;
}
@@ -605,7 +609,7 @@
* FALSE otherwise
*/
gboolean
-moko_journal_add_entry (MokoJournal *a_journal, MokoJEntry *a_entry)
+moko_journal_add_entry (MokoJournal *a_journal, MokoJournalEntry *a_entry)
{
g_return_val_if_fail (a_journal, FALSE) ;
g_return_val_if_fail (a_entry, FALSE) ;
@@ -643,14 +647,14 @@
gboolean
moko_journal_get_entry_at (MokoJournal *a_journal,
guint a_index,
- MokoJEntry **a_entry)
+ MokoJournalEntry **a_entry)
{
g_return_val_if_fail (a_journal, FALSE) ;
g_return_val_if_fail (a_entry, FALSE) ;
g_return_val_if_fail (a_journal->entries, FALSE) ;
g_return_val_if_fail (a_index < a_journal->entries->len, FALSE) ;
- *a_entry = g_array_index (a_journal->entries, MokoJEntry*, a_index) ;
+ *a_entry = g_array_index (a_journal->entries, MokoJournalEntry*, a_index) ;
return TRUE ;
}
@@ -669,11 +673,12 @@
g_return_val_if_fail (a_journal->entries, FALSE) ;
g_return_val_if_fail (a_index < a_journal->entries->len, FALSE) ;
- if (g_array_index (a_journal->entries, MokoJEntry*, a_index))
+ if (g_array_index (a_journal->entries, MokoJournalEntry*, a_index))
{
a_journal->entries_to_delete =
g_list_prepend (a_journal->entries_to_delete,
- g_array_index (a_journal->entries, MokoJEntry*, a_index));
+ g_array_index (a_journal->entries,
+ MokoJournalEntry*, a_index));
g_array_remove_index (a_journal->entries, a_index) ;
return TRUE ;
}
@@ -692,7 +697,7 @@
gboolean
moko_journal_write_to_storage (MokoJournal *a_journal)
{
- MokoJEntry *cur_entry=NULL ;
+ MokoJournalEntry *cur_entry=NULL ;
int i=0 ;
GList *ecal_comps=NULL, *cur_elem=NULL ;
ECalComponent *ecal_comp=NULL ;
@@ -704,13 +709,13 @@
g_return_val_if_fail (a_journal, FALSE) ;
g_return_val_if_fail (a_journal->ecal, FALSE) ;
- /*create ECalComponent objects out of the list of MokoJEntry* we have*/
+ /*create ECalComponent objects out of the list of MokoJournalEntry* we have*/
for (i=0; a_journal->entries && i<a_journal->entries->len; ++i)
{
- cur_entry = g_array_index (a_journal->entries, MokoJEntry*, i) ;
+ cur_entry = g_array_index (a_journal->entries, MokoJournalEntry*, i) ;
if (!cur_entry)
break ;
- if (!moko_j_entry_to_icalcomponent (cur_entry, &ical_comp))
+ if (!moko_journal_entry_to_icalcomponent (cur_entry, &ical_comp))
{
if (ical_comp)
{
@@ -794,14 +799,14 @@
if (!cur_elem->data)
continue ;
- if (((MokoJEntry*)cur_elem->data)->uid)
+ if (((MokoJournalEntry*)cur_elem->data)->uid)
{
if (!e_cal_remove_object (a_journal->ecal,
- ((MokoJEntry*)cur_elem->data)->uid,
+ ((MokoJournalEntry*)cur_elem->data)->uid,
&error))
{
g_warning ("failed to remove object of UID %s\n",
- ((MokoJEntry*)cur_elem->data)->uid) ;
+ ((MokoJournalEntry*)cur_elem->data)->uid) ;
}
if (error)
{
@@ -810,7 +815,7 @@
error = NULL ;
}
}
- moko_j_entry_free ((MokoJEntry*)cur_elem->data) ;
+ moko_journal_entry_free ((MokoJournalEntry*)cur_elem->data) ;
cur_elem->data = NULL ;
}
@@ -839,7 +844,7 @@
{
icalcomponent *ical_comp = NULL ;
GList *cur_entry = NULL ;
- MokoJEntry *entry = NULL ;
+ MokoJournalEntry *entry = NULL ;
int offset=0 ;
for (cur_entry = a_entries ; cur_entry ; cur_entry = cur_entry->next)
@@ -879,7 +884,7 @@
{
if (entry)
{
- moko_j_entry_free (entry) ;
+ moko_journal_entry_free (entry) ;
entry = NULL ;
}
continue ;
@@ -954,7 +959,7 @@
if (objs)
{
GList *cur=NULL ;
- MokoJEntry *entry = NULL ;
+ MokoJournalEntry *entry = NULL ;
for (cur = objs ; cur ; cur = cur->next)
{
if (!icalcomponent_isa (cur->data))
@@ -967,7 +972,7 @@
if (entry)
{
g_warning ("entry should be NULL here") ;
- moko_j_entry_free (entry) ;
+ moko_journal_entry_free (entry) ;
entry = NULL ;
}
}
@@ -985,46 +990,46 @@
}
/**
- * moko_j_entry_new:
+ * moko_journal_entry_new:
*
* Create a Journal entry with no properties set.
* Use the JEntry accessors to get/set properties.
*
* Return value: the newly created journal entry object
*/
-MokoJEntry*
-moko_j_entry_new (MokoJEntryType a_type)
+MokoJournalEntry*
+moko_journal_entry_new (MokoJournalEntryType a_type)
{
- MokoJEntry *result ;
- result = moko_j_entry_alloc () ;
+ MokoJournalEntry *result ;
+ result = moko_journal_entry_alloc () ;
result->type = a_type ;
return result ;
}
/**
- * moko_j_entry_free:
+ * moko_journal_entry_free:
* @entry: the entry to free
*
* Deallocate the memory of the journal entry object
*/
void
-moko_j_entry_free (MokoJEntry *a_entry)
+moko_journal_entry_free (MokoJournalEntry *a_entry)
{
g_return_if_fail (a_entry) ;
- moko_j_entry_free_real (a_entry) ;
+ moko_journal_entry_free_real (a_entry) ;
}
/**
- * moko_j_entry_get_type:
+ * moko_journal_entry_get_type:
* @entry: the current journal entry
*
* get the primary type of the journal entry
*
* Return value: the type of the journal entry
*/
-MokoJEntryType
-moko_j_entry_get_type (MokoJEntry *a_entry)
+MokoJournalEntryType
+moko_journal_entry_get_type (MokoJournalEntry *a_entry)
{
g_return_val_if_fail (a_entry, UNDEF_ENTRY) ;
@@ -1033,14 +1038,15 @@
/**
- * moko_j_entry_set_type:
+ * moko_journal_entry_set_type:
* @entry: the current instance of journal entry
* @type: the new type
*
* Set the type of the journal entry
*/
void
-moko_j_entry_set_type (MokoJEntry *a_entry, MokoJEntryType a_type)
+moko_journal_entry_set_type (MokoJournalEntry *a_entry,
+ MokoJournalEntryType a_type)
{
g_return_if_fail (a_entry) ;
g_return_if_fail (a_type != UNDEF_ENTRY) ;
@@ -1049,7 +1055,7 @@
}
/**
- * moko_j_entry_get_contact_uid:
+ * moko_journal_entry_get_contact_uid:
* @entry: the current instance of journal entry
*
* get the contact uid
@@ -1058,7 +1064,7 @@
* must not deallocate or attempt to alter it.
*/
const gchar*
-moko_j_entry_get_contact_uid (MokoJEntry *a_entry)
+moko_journal_entry_get_contact_uid (MokoJournalEntry *a_entry)
{
g_return_val_if_fail (a_entry, NULL) ;
@@ -1066,7 +1072,8 @@
}
void
-moko_j_entry_set_contact_uid (MokoJEntry *a_entry, const gchar *a_uid)
+moko_journal_entry_set_contact_uid (MokoJournalEntry *a_entry,
+ const gchar *a_uid)
{
g_return_if_fail (a_entry) ;
@@ -1083,7 +1090,7 @@
}
/**
- * moko_j_entry_get_summary:
+ * moko_journal_entry_get_summary:
* @entry: the current instance of journal entry
*
* get the summary of the journal entry
@@ -1092,7 +1099,7 @@
* Client code must not deallocate or alter it.
*/
const gchar*
-moko_j_entry_get_summary (MokoJEntry *a_entry)
+moko_journal_entry_get_summary (MokoJournalEntry *a_entry)
{
g_return_val_if_fail (a_entry, NULL) ;
@@ -1100,7 +1107,7 @@
}
/**
- * moko_j_entry_set_summary:
+ * moko_journal_entry_set_summary:
* @entry: the current instance of journal entry
* @summary: the new summary of the journal entry. It is copied
* so client code is reponsible of its lifecyle.
@@ -1108,7 +1115,8 @@
* Set the summary of the journal entry
*/
void
-moko_j_entry_set_summary (MokoJEntry *a_entry, const gchar* a_summary)
+moko_journal_entry_set_summary (MokoJournalEntry *a_entry,
+ const gchar* a_summary)
{
g_return_if_fail (a_entry) ;
@@ -1124,7 +1132,7 @@
}
/**
- * moko_j_entry_get_dtdstart:
+ * moko_journal_entry_get_dtdstart:
* @entry: the current instance of journal entry
*
* get the starting date associated to the journal entry
@@ -1133,7 +1141,7 @@
* It can be NULL. Client code must not deallocate it.
*/
const MokoTime*
-moko_j_entry_get_dtstart (MokoJEntry *a_entry)
+moko_journal_entry_get_dtstart (MokoJournalEntry *a_entry)
{
g_return_val_if_fail (a_entry, NULL) ;
@@ -1144,12 +1152,12 @@
}
/**
- * moko_j_entry_set_dtstart:
+ * moko_journal_entry_set_dtstart:
* @entry: the current instance of journal entry
* @dtstart: the new starting date associated to the journal entry.
*/
void
-moko_j_entry_set_dtstart (MokoJEntry *a_entry, MokoTime* a_dtstart)
+moko_journal_entry_set_dtstart (MokoJournalEntry *a_entry, MokoTime* a_dtstart)
{
g_return_if_fail (a_entry) ;
@@ -1164,18 +1172,18 @@
}
/**
- * moko_j_entry_get_email_info:
+ * moko_journal_entry_get_email_info:
* @entry: the current instance of journal entry
* @info: extra information attached to the email info, or NULL.
* Client code must *NOT* of deallocate the returned info.
- * It is the duty of the MokoJEntry code to deallocate it when
+ * It is the duty of the MokoJournalEntry code to deallocate it when
* necessary
*
* Return value: TRUE if the call succeeded, FALSE otherwise.
*/
gboolean
-moko_j_entry_get_email_info (MokoJEntry *a_entry,
- MokoJEmailInfo **a_info)
+moko_journal_entry_get_email_info (MokoJournalEntry *a_entry,
+ MokoJournalEmailInfo **a_info)
{
g_return_val_if_fail (a_entry->type == EMAIL_JOURNAL_ENTRY, FALSE) ;
@@ -1198,7 +1206,7 @@
* Return value: TRUE if the email was sent, false if it was received
*/
gboolean
-moko_j_email_info_get_was_sent (MokoJEmailInfo *a_info)
+moko_j_email_info_get_was_sent (MokoJournalEmailInfo *a_info)
{
g_return_val_if_fail (a_info, FALSE) ;
return a_info->was_sent ;
@@ -1212,7 +1220,8 @@
* Set a boolean property stating if the email was sent or received
*/
void
-moko_j_email_info_set_was_sent (MokoJEmailInfo *a_info, gboolean a_was_sent)
+moko_j_email_info_set_was_sent (MokoJournalEmailInfo *a_info,
+ gboolean a_was_sent)
{
g_return_if_fail (a_info) ;
a_info->was_sent = a_was_sent ;
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.h 2007-04-12 08:53:35 UTC (rev 1729)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.h 2007-04-12 09:21:34 UTC (rev 1730)
@@ -33,24 +33,24 @@
***********************************************************/
typedef struct _MokoJournal MokoJournal ;
-typedef struct _MokoJEntry MokoJEntry ;
-typedef struct _MokoJEmailInfo MokoJEmailInfo ;
-typedef struct _MokoJSMSInfo MokoJSMSInfo ;
-typedef struct _MokoJMMSInfo MokoJMMSInfo ;
-typedef struct _MokoJCallInfo MokoJCallInfo ;
+typedef struct _MokoJournalEntry MokoJournalEntry ;
+typedef struct _MokoJournalEmailInfo MokoJournalEmailInfo ;
+typedef struct _MokoJournalSMSInfo MokoJournalSMSInfo ;
+typedef struct _MokoJournalMMSInfo MokoJournalMMSInfo ;
+typedef struct _MokoJournalCallInfo MokoJournalCallInfo ;
/**
* this represents the primary type of
* a journal entry.
*/
-typedef enum _MokoJEntryType {
+typedef enum _MokoJournalEntryType {
UNDEF_ENTRY=0,
EMAIL_JOURNAL_ENTRY,
SMS_JOURNAL_ENTRY,
MMS_JOURNAL_ENTRY,
CALL_JOURNAL_ENTRY,
NB_OF_ENTRY_TYPES /*must always be the last*/
-} MokoJEntryType ;
+} MokoJournalEntryType ;
/*<journal management>*/
/**
@@ -83,7 +83,7 @@
* Return value: TRUE if the entry got successfully added to the journal,
* FALSE otherwise
*/
-gboolean moko_journal_add_entry (MokoJournal *journal, MokoJEntry *entry) ;
+gboolean moko_journal_add_entry (MokoJournal *journal, MokoJournalEntry *entry) ;
/**
* moko_journal_get_nb_entries:
@@ -106,7 +106,7 @@
*/
gboolean moko_journal_get_entry_at (MokoJournal *journal,
guint index,
- MokoJEntry **entry) ;
+ MokoJournalEntry **entry) ;
/**
* moko_journal_remove_entry_at:
@@ -149,7 +149,7 @@
/*<journal entries management>*/
/**
- * moko_j_entry_new:
+ * moko_journal_entry_new:
* @type: the type of journal entry
*
* Create a Journal entry with no properties set.
@@ -157,37 +157,38 @@
*
* Return value: the newly created journal entry object
*/
-MokoJEntry* moko_j_entry_new (MokoJEntryType type) ;
+MokoJournalEntry* moko_journal_entry_new (MokoJournalEntryType type) ;
/**
- * moko_j_entry_free:
+ * moko_journal_entry_free:
* @entry: the entry to free
*
* Deallocate the memory of the journal entry object
*/
-void moko_j_entry_free (MokoJEntry *entry) ;
+void moko_journal_entry_free (MokoJournalEntry *entry) ;
/**
- * moko_j_entry_get_type:
+ * moko_journal_entry_get_type:
* @entry: the current journal entry
*
* get the primary type of the journal entry
*
* Return value: the type of the journal entry
*/
-MokoJEntryType moko_j_entry_get_type (MokoJEntry *entry) ;
+MokoJournalEntryType moko_journal_entry_get_type (MokoJournalEntry *entry) ;
/**
- * moko_j_entry_set_type:
+ * moko_journal_entry_set_type:
* @entry: the current instance of journal entry
* @type: the new type
*
* Set the type of the journal entry
*/
-void moko_j_entry_set_type (MokoJEntry *entry, MokoJEntryType type) ;
+void moko_journal_entry_set_type (MokoJournalEntry *entry,
+ MokoJournalEntryType type) ;
/**
- * moko_j_entry_get_contact_uid:
+ * moko_journal_entry_get_contact_uid:
* @entry: the current instance of journal entry
*
* get the contact uid
@@ -195,10 +196,10 @@
* Return value: the UID of the contact. It can be NULL. Client code
* must not deallocate or attempt to alter it.
*/
-const gchar* moko_j_entry_get_contact_uid (MokoJEntry *entry) ;
+const gchar* moko_journal_entry_get_contact_uid (MokoJournalEntry *entry) ;
/**
- * moko_j_entry_set_contact_uid:
+ * moko_journal_entry_set_contact_uid:
* @entry: the current instance of journal entry
* @uid: the uid to set. This string is copied so the client code
* must free it.
@@ -207,10 +208,11 @@
* The UID is copied by this function so the caller is reponsible of
* taking care of the uid string lifecycle.
*/
-void moko_j_entry_set_contact_uid (MokoJEntry *entry, const gchar *uid) ;
+void moko_journal_entry_set_contact_uid (MokoJournalEntry *entry,
+ const gchar *uid) ;
/**
- * moko_j_entry_get_summary:
+ * moko_journal_entry_get_summary:
* @entry: the current instance of journal entry
*
* get the summary of the journal entry
@@ -218,20 +220,21 @@
* Return value: the summary of the journal entry. It can be NULL.
* Client code must not deallocate or alter it.
*/
-const gchar* moko_j_entry_get_summary (MokoJEntry *entry) ;
+const gchar* moko_journal_entry_get_summary (MokoJournalEntry *entry) ;
/**
- * moko_j_entry_set_summary:
+ * moko_journal_entry_set_summary:
* @entry: the current instance of journal entry
* @summary: the new summary of the journal entry. It is copied
* so client code is reponsible of its lifecyle.
*
* Set the summary of the journal entry
*/
-void moko_j_entry_set_summary (MokoJEntry *entry, const gchar* summary) ;
+void moko_journal_entry_set_summary (MokoJournalEntry *entry,
+ const gchar* summary) ;
/**
- * moko_j_entry_get_dtdstart:
+ * moko_journal_entry_get_dtdstart:
* @entry: the current instance of journal entry
*
* get the starting date associated to the journal entry
@@ -239,29 +242,29 @@
* Return value: an icaltimetype representing the starting date expected.
* It can be NULL. Client code must not deallocate it.
*/
-const MokoTime* moko_j_entry_get_dtstart (MokoJEntry *entry) ;
+const MokoTime* moko_journal_entry_get_dtstart (MokoJournalEntry *entry) ;
/**
- * moko_j_entry_set_dtstart:
+ * moko_journal_entry_set_dtstart:
* @entry: the current instance of journal entry
* @dtstart: the new starting date associated to the journal entry.
*/
-void moko_j_entry_set_dtstart (MokoJEntry *entry, MokoTime* dtstart);
+void moko_journal_entry_set_dtstart (MokoJournalEntry *entry, MokoTime* dtstart);
/*<email info>*/
/**
- * moko_j_entry_get_email_info:
+ * moko_journal_entry_get_email_info:
* @entry: the current instance of journal entry
* @info: extra information attached to the email info, or NULL.
* Client code must *NOT* of deallocate the returned info.
- * It is the duty of the MokoJEntry code to deallocate it when
+ * It is the duty of the MokoJournalEntry code to deallocate it when
* necessary
*
* Return value: TRUE if the call succeeded, FALSE otherwise.
*/
-gboolean moko_j_entry_get_email_info (MokoJEntry *entry,
- MokoJEmailInfo **info) ;
+gboolean moko_journal_entry_get_email_info (MokoJournalEntry *entry,
+ MokoJournalEmailInfo **info) ;
/**
* moko_j_email_info_get_was_sent:
@@ -271,7 +274,7 @@
*
* Return value: TRUE if the email was sent, false if it was received
*/
-gboolean moko_j_email_info_get_was_sent (MokoJEmailInfo *info) ;
+gboolean moko_j_email_info_get_was_sent (MokoJournalEmailInfo *info) ;
/**
* moko_j_email_info_set_was_sent:
@@ -280,7 +283,8 @@
*
* Set a boolean property stating if the email was sent or received
*/
-void moko_j_email_info_set_was_sent (MokoJEmailInfo *info, gboolean was_sent) ;
+void moko_j_email_info_set_was_sent (MokoJournalEmailInfo *info,
+ gboolean was_sent) ;
/*</email info>*/
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-create.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-create.c 2007-04-12 08:53:35 UTC (rev 1729)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-create.c 2007-04-12 09:21:34 UTC (rev 1730)
@@ -26,8 +26,8 @@
main ()
{
MokoJournal *journal=NULL ;
- MokoJEntry *entry=NULL ;
- MokoJEmailInfo *email_info=NULL ;
+ MokoJournalEntry *entry=NULL ;
+ MokoJournalEmailInfo *email_info=NULL ;
int result = 1 ;
g_type_init () ;
@@ -47,7 +47,7 @@
moko_journal_get_nb_entries (journal)) ;
/*create a journal entry of type 'email journal entry'*/
- entry = moko_j_entry_new (EMAIL_JOURNAL_ENTRY) ;
+ entry = moko_journal_entry_new (EMAIL_JOURNAL_ENTRY) ;
if (!entry)
{
g_warning ("failed to create journal entry\n") ;
@@ -57,10 +57,10 @@
/*****************************
* <fill the entry with data>
*****************************/
- moko_j_entry_set_contact_uid (entry, "foobarbazuid") ;
- moko_j_entry_set_summary (entry, "back from fostel") ;
- moko_j_entry_set_dtstart (entry, moko_time_new_today ()) ;
- if (!moko_j_entry_get_email_info (entry, &email_info) || !email_info)
+ moko_journal_entry_set_contact_uid (entry, "foobarbazuid") ;
+ moko_journal_entry_set_summary (entry, "back from fostel") ;
+ moko_journal_entry_set_dtstart (entry, moko_time_new_today ()) ;
+ if (!moko_journal_entry_get_email_info (entry, &email_info) || !email_info)
{
g_warning ("failed to get email extra info from journal entry\n") ;
goto out ;
@@ -119,7 +119,7 @@
if (journal)
moko_journal_close (journal) ;
if (entry)
- moko_j_entry_free (entry) ;
+ moko_journal_entry_free (entry) ;
return result ;
}
More information about the commitlog
mailing list