[Addressbook] Fix for 332136
"simon.zheng" <[email protected]>
| Newsgroups | gmane.comp.gnome.evolution.patches |
|---|---|
| Message-ID | <1141289850.10311.29.camel@fulltime> |
Hi guys, Bug 332136 - Evolution fails to import contacts from a file into an addressbook if the addressbook is never opened. http://bugzilla.gnome.org/show_bug.cgi?id=332136 Property writable is changed only after the corresponding backend source is loaded. This's usually happened after invoking e_book_open(). So Move the permission verfication after e_book_open(). Sending patch for review. Thanks, -Simon _______________________________________________ Evolution-patches mailing list [email protected] http://mail.gnome.org/mailman/listinfo/evolution-patches
evo-332136-writable.diff
(text/x-patch, 3 KB)
Index: ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v retrieving revision 1.2059 diff -u -p -r1.2059 ChangeLog --- ChangeLog 28 Feb 2006 08:20:18 -0000 1.2059 +++ ChangeLog 2 Mar 2006 08:37:03 -0000 @@ -1,3 +1,13 @@ +2006-03-02 Simon Zheng <[email protected]> + + Fix for #332136 + + * importers/evolution-ldif-importer.c: (ldif_import): + * importers/evolution-vcard-importer.c: (vcard_import): + Property Writable is changed only when corresponding backend is loaded. + This's usually happened after invoking e_book_open(). Move the permission + verfication after e_book_open(). + 2006-02-28 Devashish Sharma <[email protected]> * gui/contact-editor/e-contact-editor.c (extract_simple_field): Fix for Bug Index: importers/evolution-ldif-importer.c =================================================================== RCS file: /cvs/gnome/evolution/addressbook/importers/evolution-ldif-importer.c,v retrieving revision 1.17 diff -u -p -r1.17 evolution-ldif-importer.c --- importers/evolution-ldif-importer.c 14 Dec 2005 12:14:51 -0000 1.17 +++ importers/evolution-ldif-importer.c 2 Mar 2006 08:37:03 -0000 @@ -702,13 +702,6 @@ ldif_import(EImport *ei, EImportTarget * return; } - if (!e_book_is_writable (book)) { - g_message(G_STRLOC ":Book is readonly"); - e_import_complete(ei, target); - g_object_unref(book); - return; - } - filename = g_filename_from_uri(s->uri_src, NULL, NULL); if (filename != NULL) { file = g_fopen(filename, "r"); @@ -733,6 +726,13 @@ ldif_import(EImport *ei, EImportTarget * gci->dn_contact_hash = g_hash_table_new(g_str_hash, g_str_equal); e_book_open(gci->book, TRUE, NULL); + + if (!e_book_is_writable (book)) { + g_message(G_STRLOC ":Book is readonly"); + e_import_complete(ei, target); + g_object_unref(book); + return; + } gci->idle_id = g_idle_add(ldif_import_contacts, gci); } Index: importers/evolution-vcard-importer.c =================================================================== RCS file: /cvs/gnome/evolution/addressbook/importers/evolution-vcard-importer.c,v retrieving revision 1.17 diff -u -p -r1.17 evolution-vcard-importer.c --- importers/evolution-vcard-importer.c 17 Dec 2005 12:02:26 -0000 1.17 +++ importers/evolution-vcard-importer.c 2 Mar 2006 08:37:03 -0000 @@ -481,13 +481,6 @@ vcard_import(EImport *ei, EImportTarget return; } - if (!e_book_is_writable (book)) { - g_message (G_STRLOC ":Book is readonly."); - e_import_complete(ei, target); - g_object_unref(book); - return; - } - if (!g_file_get_contents (filename, &contents, NULL, NULL)) { g_message (G_STRLOC ":Couldn't read file."); g_free (filename); @@ -504,6 +497,13 @@ vcard_import(EImport *ei, EImportTarget gci->book = book; e_book_open (gci->book, TRUE, NULL); + + if (!e_book_is_writable (book)) { + g_message (G_STRLOC ":Book is readonly."); + e_import_complete(ei, target); + g_object_unref(book); + return; + } if (encoding == VCARD_ENCODING_UTF16) { gchar *tmp;