* mu-contacts.c: don't use g_key_file_(get|set)_uint64, it's requires a too

new glib
This commit is contained in:
Dirk-Jan C. Binnema 2011-05-04 01:43:01 +03:00
parent e039047e64
commit b15d9a9cf5
1 changed files with 11 additions and 10 deletions

View File

@ -73,8 +73,8 @@ unserialize_cache (MuContacts *self)
* and take care of freeing it */ * and take care of freeing it */
g_key_file_get_string (self->_ccache, groups[i], g_key_file_get_string (self->_ccache, groups[i],
MU_CONTACTS_NAME_KEY, NULL), MU_CONTACTS_NAME_KEY, NULL),
g_key_file_get_uint64 (self->_ccache, groups[i], (time_t)g_key_file_get_integer (self->_ccache, groups[i],
MU_CONTACTS_TIMESTAMP_KEY, NULL)); MU_CONTACTS_TIMESTAMP_KEY, NULL));
/* note, we're using the groups[i], so don't free with g_strfreev */ /* note, we're using the groups[i], so don't free with g_strfreev */
g_hash_table_insert (self->_hash, groups[i], cinfo); g_hash_table_insert (self->_hash, groups[i], cinfo);
} }
@ -125,7 +125,7 @@ mu_contacts_add (MuContacts *self, const char* name, const char *email,
* empty name */ * empty name */
cinfo = (ContactInfo*) g_hash_table_lookup (self->_hash, email); cinfo = (ContactInfo*) g_hash_table_lookup (self->_hash, email);
if (!cinfo || if (!cinfo ||
(cinfo->_tstamp < tstamp && !mu_str_is_empty(name))) { (cinfo->_tstamp < tstamp && !mu_str_is_empty(name))) {
ContactInfo *ci; /* note ci will take care of freeing the first param */ ContactInfo *ci; /* note ci will take care of freeing the first param */
ci = contact_info_new (name ? g_strdup(name) : NULL, tstamp); ci = contact_info_new (name ? g_strdup(name) : NULL, tstamp);
g_hash_table_insert (self->_hash, g_strdup(email), ci); g_hash_table_insert (self->_hash, g_strdup(email), ci);
@ -210,9 +210,9 @@ each_keyval (const char *email, ContactInfo *cinfo, MuContacts *self)
if (cinfo->_name) if (cinfo->_name)
g_key_file_set_string (self->_ccache, email, "name", g_key_file_set_string (self->_ccache, email, "name",
cinfo->_name); cinfo->_name);
g_key_file_set_uint64 (self->_ccache, email, "timestamp", g_key_file_set_integer (self->_ccache, email, "timestamp",
(guint64)cinfo->_tstamp); (int)cinfo->_tstamp);
} }
static gboolean static gboolean
@ -282,9 +282,10 @@ contact_info_new (char *name, time_t tstamp)
static void static void
contact_info_destroy (ContactInfo *cinfo) contact_info_destroy (ContactInfo *cinfo)
{ {
if (cinfo) { if (!cinfo)
g_free (cinfo->_name); return;
g_slice_free (ContactInfo, cinfo);
} g_free (cinfo->_name);
g_slice_free (ContactInfo, cinfo);
} }