* mu-msg-contact.[ch]: add _new, _destroy functions

This commit is contained in:
Dirk-Jan C. Binnema
2010-11-20 20:28:54 +02:00
parent 7f3ac08ad0
commit 5f84cb5025
2 changed files with 62 additions and 4 deletions

View File

@ -30,6 +30,37 @@
#include "mu-msg-contact.h"
#include "mu-util.h"
MuMsgContact *
mu_msg_contact_new (const char *name, const char *address,
MuMsgContactType type)
{
MuMsgContact *contact;
g_return_val_if_fail (name, NULL);
g_return_val_if_fail (address, NULL);
g_return_val_if_fail (!mu_msg_contact_type_is_valid(type),
NULL);
contact = g_slice_new (MuMsgContact);
contact->name = g_strdup(name);
contact->address = g_strdup(address);
contact->type = type;
return contact;
}
void
mu_msg_contact_destroy (MuMsgContact *contacts)
{
if (contacts) {
g_free ((gchar*)contacts->name);
g_free ((gchar*)contacts->address);
g_slice_free (MuMsgContact, contacts);
}
}
static gboolean