[balsa/gtk3] Add transition code to read old header choices



commit e44f8e57b0323c019e3eb1ba47276dd03b0db313
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Aug 13 17:59:50 2013 -0400

    Add transition code to read old header choices
    
        * src/sendmsg-window.c (init_menus): add transition code to read
        old message header choices.

 ChangeLog            |    5 +++++
 src/sendmsg-window.c |   27 ++++++++++++++++++++++++---
 2 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a3c402b..27138cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 
        * src/sendmsg-window.c: compile without gpgme.
 
+2013-08-13  Peter Bloomfield
+
+       * src/sendmsg-window.c (init_menus): add transition code to read
+       old message header choices.
+
 2013-08-10  Peter Bloomfield
 
        * src/main-window.c (bw_action_set_boolean): use
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 80bc1f4..c8eaced 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -6111,9 +6111,30 @@ init_menus(BalsaSendmsg * bsmsg)
         gboolean found =
             libbalsa_find_word(header_action_names[i],
                                balsa_app.compose_headers);
-        /* This action is initially active, so if found is FALSE,
-         * setting it inactive will trigger the callback, which will
-         * hide the address line. */
+        if (!found) {
+            /* Be compatible with old action-names */
+            struct {
+                const gchar *old_action_name;
+                const gchar *new_action_name;
+            } name_map[] = {
+                {"From",       "from"},
+                {"Recipients", "recips"},
+#if !defined(ENABLE_TOUCH_UI)
+                {"ReplyTo",    "reply-to"},
+#endif                          /* ENABLE_TOUCH_UI */
+                {"Fcc",        "fcc"}
+            };
+            guint j;
+
+            for (j = 0; j < G_N_ELEMENTS(name_map); j++) {
+                if (strcmp(header_action_names[i],
+                           name_map[j].new_action_name) == 0) {
+                    found =
+                        libbalsa_find_word(name_map[j].old_action_name,
+                                           balsa_app.compose_headers);
+                }
+            }
+        }
         sw_action_set_active(bsmsg, header_action_names[i], found);
     }
 


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