Re: [evolution-patches] [Addressbook] Fix for 332136
- From: "simon.zheng" <Simon Zheng Sun COM>
- To: evolution-patches gnome org, Sushma Rai <rsushma novell com>
- Cc:
- Subject: Re: [evolution-patches] [Addressbook] Fix for 332136
- Date: Fri, 03 Mar 2006 20:16:14 +0800
Hi Sush,
Update the patch according to your suggestion.
Please take trouble to review.
Thanks,
-Simon
On Thu, 2006-03-02 at 16:57 +0800, simon.zheng wrote:
> 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
> Evolution-patches gnome org
> http://mail.gnome.org/mailman/listinfo/evolution-patches
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 3 Mar 2006 12:07:26 -0000
@@ -1,3 +1,14 @@
+2006-03-03 Simon Zheng <simon zheng sun com>
+
+ 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 often happened after invoking e_book_open(). Moving the permission
+ checking after e_book_open(). In addition, to import contacts to a new
+ addressbook that is never opened, change only_if_exists to FALSE.
+
2006-02-28 Devashish Sharma <sdevashish novell com>
* 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 3 Mar 2006 12:07:26 -0000
@@ -702,12 +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) {
@@ -732,7 +726,15 @@ ldif_import(EImport *ei, EImportTarget *
fseek(file, 0, SEEK_SET);
gci->dn_contact_hash = g_hash_table_new(g_str_hash, g_str_equal);
- e_book_open(gci->book, TRUE, NULL);
+ e_book_open(gci->book, FALSE, NULL);
+
+ if (!e_book_is_writable (gci->book)) {
+ g_message(G_STRLOC ":Book is readonly");
+ fclose (gci->file);
+ 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 3 Mar 2006 12:07:26 -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);
@@ -503,7 +496,15 @@ vcard_import(EImport *ei, EImportTarget
gci->target = target;
gci->book = book;
- e_book_open (gci->book, TRUE, NULL);
+ e_book_open (gci->book, FALSE, NULL);
+
+ if (!e_book_is_writable (gci->book)) {
+ g_message (G_STRLOC ":Book is readonly.");
+ e_import_complete(ei, target);
+ g_object_unref(book);
+ g_free (contents);
+ return;
+ }
if (encoding == VCARD_ENCODING_UTF16) {
gchar *tmp;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]