diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-01-26 09:41:32 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-01-26 09:41:32 +0000 |
commit | af7c0d4c4d5f20cc09dc7f709cd88c43dab567b8 (patch) | |
tree | fa65c5b918669eb161f6367f20fbdbeaea755452 /src/addressbook.c | |
parent | 80ea2c6808e3820773e774d3bca1233bcc9aa87f (diff) |
implemented auto-registration of new recipients.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2442 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/addressbook.c')
-rw-r--r-- | src/addressbook.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/addressbook.c b/src/addressbook.c index f0559f36..e8b1bf2c 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -1267,6 +1267,9 @@ static void addressbook_menuitem_set_sensitive(void) } else #endif canLookup = TRUE; + if (ads->subType == ADDR_BOOK && pobj->name && + !strcmp(pobj->name, ADDR_DS_AUTOREG)) + canEditTree = FALSE; } else if (pobj->type == ADDR_ITEM_FOLDER) { ds = addressbook_find_datasource(&iter); if (ds) { @@ -2900,9 +2903,11 @@ void addressbook_read_file(void) /* Conversion required */ debug_print("Converting...\n"); if (addressbook_convert(addrIndex)) { + addrindex_create_extra_books(addrIndex); _addressIndex_ = addrIndex; } } else if (addrIndex->retVal == MGU_SUCCESS) { + addrindex_create_extra_books(addrIndex); _addressIndex_ = addrIndex; } else { gchar msg[1024]; @@ -3049,6 +3054,7 @@ static gboolean addressbook_add_object(GtkTreeIter *iter, GtkTreeIter *new_iter, AddressObject *pobj; AddressObjectType otype; AddressTypeControlItem *atci = NULL; + const gchar *name; g_return_val_if_fail(iter != NULL, FALSE); g_return_val_if_fail(obj != NULL, FALSE); @@ -3069,9 +3075,13 @@ static gboolean addressbook_add_object(GtkTreeIter *iter, GtkTreeIter *new_iter, if (atci && atci->showInTree) { /* Add object to tree */ debug_print("addressbook_add_object: obj: %s\n", obj->name); + if (otype == ADDR_BOOK && !strcmp(obj->name, ADDR_DS_AUTOREG)) + name = _("Auto-registered address"); + else + name = obj->name; gtk_tree_store_append(GTK_TREE_STORE(model), &added, iter); gtk_tree_store_set(GTK_TREE_STORE(model), &added, - COL_FOLDER_NAME, obj->name, + COL_FOLDER_NAME, name, COL_OBJ, obj, COL_PIXBUF, atci->icon_pixbuf, COL_PIXBUF_OPEN, atci->icon_open_pixbuf, @@ -4001,7 +4011,7 @@ void addrbookctl_build_ifselect(void) */ gboolean addressbook_add_contact(const gchar *name, const gchar *address, const gchar *remarks) { - debug_print("addressbook_add_contact: name/address: %s - %s\n", name, address); + debug_print("addressbook_add_contact: name/address: %s <%s>\n", name ? name : "", address); if (addressadd_selection(_addressIndex_, name, address, remarks)) { debug_print("addressbook_add_contact - added\n"); addressbook_refresh(); @@ -4009,6 +4019,18 @@ gboolean addressbook_add_contact(const gchar *name, const gchar *address, const return TRUE; } +/* + * This function is used by the automatic address registration. + */ +gboolean addressbook_add_contact_autoreg(const gchar *name, const gchar *address, const gchar *remarks) +{ + debug_print("addressbook_add_contact_autoreg: name/address: %s <%s>\n", name ? name : "", address); + if (addressadd_autoreg(_addressIndex_, name, address, remarks)) { + addressbook_refresh(); + } + return TRUE; +} + /* ********************************************************************** * Address completion support. * *********************************************************************** |