[balsa] Do not break user's config



commit 4247912ec769e68bc3d315dbe783aea554ead4f5
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu May 16 08:54:59 2019 -0400

    Do not break user's config
    
    * libbalsa/address-book.c
      (libbalsa_address_book_new_from_config): if the type is
      LibBalsaAddressBookExtern, it is no longer recognized, so we use
      LibBalsaAddressBookExternq instead.

 ChangeLog               |  9 +++++++++
 libbalsa/address-book.c | 15 ++++++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ffe082855..dc9942f76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-05-16  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Do not break user's config
+
+       * libbalsa/address-book.c
+       (libbalsa_address_book_new_from_config): if the type is
+       LibBalsaAddressBookExtern, it is no longer recognized, so we use
+       LibBalsaAddressBookExternq instead.
+
 2019-05-15  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Use G_DECLARE_FINAL_TYPE to declare LibBalsaAddressBookOsmo
diff --git a/libbalsa/address-book.c b/libbalsa/address-book.c
index e36f04892..5c884965a 100644
--- a/libbalsa/address-book.c
+++ b/libbalsa/address-book.c
@@ -110,7 +110,7 @@ libbalsa_address_book_new_from_config(const gchar * group)
     libbalsa_conf_push_group(group);
     type_str = libbalsa_conf_get_string_with_default("Type", &got_default);
 
-    if (got_default == TRUE) {
+    if (got_default) {
         /* type entry missing, skip it */
        libbalsa_conf_pop_group();
        return ab;
@@ -118,10 +118,15 @@ libbalsa_address_book_new_from_config(const gchar * group)
 
     type = g_type_from_name(type_str);
     if (type == 0) {
-        /* type unknown, skip it */
-       g_free(type_str);
-       libbalsa_conf_pop_group();
-       return ab;
+        /* Legacy: */
+        if (strcmp(type_str, "LibBalsaAddressBookExtern") == 0) {
+            type = g_type_from_name("LibBalsaAddressBookExternq");
+        } else {
+            /* type unknown, skip it */
+            g_free(type_str);
+            libbalsa_conf_pop_group();
+            return ab;
+        }
     }
 
     ab = g_object_new(type, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]