gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Mon Jan 11 15:41:00 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/a3e59e55 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6ea11539 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a8c8debb (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a90b10b1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f17f047a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1bb87789 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/43e122ca (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8a536d41 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/83f2a35e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/87dc25d6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/035bc761 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0311f920 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/82013f73 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9c9dff4f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1cfd8e79 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/54290cd5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/96edb94f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/837e0683 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2e4c957d (commit)
	from  https://github.com/Gnucash/gnucash/commit/079c0c31 (commit)



commit a3e59e557a6e644fafc253f70e4a448b5d1e089a
Merge: 079c0c3 6ea1153
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jan 11 12:40:10 2016 -0800

    Merge branch 'import-map-editor'


commit 6ea11539b678a398de22dee5d19c926070080bfe
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jan 11 12:01:28 2016 -0800

    Add missing static declaration.

diff --git a/src/gnome/dialog-imap-editor.c b/src/gnome/dialog-imap-editor.c
index dc21575..962788f 100644
--- a/src/gnome/dialog-imap-editor.c
+++ b/src/gnome/dialog-imap-editor.c
@@ -266,7 +266,7 @@ gnc_imap_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_
     }
 }
 
-gboolean
+static gboolean
 filter_test_and_move_next (GtkTreeModel *model, GtkTreeIter *iter, ImapDialog *imap_dialog)
 {
     GtkTreePath *tree_path;

commit a8c8debb0a76e64047040c13aee995137afc7b12
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Jan 11 14:32:46 2016 +0000

    New functions to simplify delete and filter parts

diff --git a/src/gnome/dialog-imap-editor.c b/src/gnome/dialog-imap-editor.c
index ec9d068..dc21575 100644
--- a/src/gnome/dialog-imap-editor.c
+++ b/src/gnome/dialog-imap-editor.c
@@ -139,6 +139,80 @@ are_you_sure (ImapDialog *imap_dialog)
 }
 
 static void
+delete_info_bayes (Account *source_account, gchar *match_string, gint depth)
+{
+    gchar *full_category;
+
+    full_category = g_strdup_printf (IMAP_FRAME_BAYES "/%s", match_string);
+    gnc_account_delete_map_entry (source_account, full_category, TRUE);
+
+    full_category = g_strdup_printf (IMAP_FRAME_BAYES);
+    if (depth == 1) // top level, delete all below
+        gnc_account_delete_map_entry (source_account, full_category, FALSE);
+    else
+        gnc_account_delete_map_entry (source_account, full_category, TRUE);
+}
+
+static void
+delete_info_nbayes (Account *source_account, gint depth)
+{
+    gchar *full_category;
+
+    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
+    gnc_account_delete_map_entry (source_account, full_category, TRUE);
+
+    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
+    gnc_account_delete_map_entry (source_account, full_category, TRUE);
+
+    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
+    gnc_account_delete_map_entry (source_account, full_category, TRUE);
+
+    full_category = g_strdup_printf (IMAP_FRAME);
+    if (depth == 1) // top level, delete all below
+        gnc_account_delete_map_entry (source_account, full_category, FALSE);
+    else
+        gnc_account_delete_map_entry (source_account, full_category, TRUE);
+}
+
+static void
+delete_selected_row (GtkTreeModel *model, GtkTreeIter *iter, ImapDialog *imap_dialog)
+{
+    Account     *source_account = NULL;
+    gchar       *full_source_account;
+    gchar       *full_category;
+    gchar       *match_string;
+
+    gtk_tree_model_get (model, iter, SOURCE_ACCOUNT, &source_account, SOURCE_FULL_ACC, &full_source_account,
+                                     FULL_CATEGORY, &full_category, MATCH_STRING, &match_string, -1);
+
+    PINFO("Account is '%s', Full Category is '%s', Match String is '%s'", full_source_account, full_category, match_string);
+
+    if (source_account != NULL)
+    {
+        GtkTreePath *tree_path;
+        gint         depth;
+
+        // Get the level we are at in the tree-model
+        tree_path = gtk_tree_model_get_path (model, iter);
+        depth = gtk_tree_path_get_depth (tree_path);
+        gtk_tree_path_free (tree_path);
+
+        gnc_account_delete_map_entry (source_account, full_category, FALSE);
+
+        if (imap_dialog->type == BAYES)
+            delete_info_bayes (source_account, match_string, depth);
+
+        if (imap_dialog->type == NBAYES)
+            delete_info_nbayes (source_account, depth);
+    }
+    else
+        g_free (full_category);
+
+    g_free (match_string);
+    g_free (full_source_account);
+}
+
+static void
 gnc_imap_dialog_delete (ImapDialog *imap_dialog)
 {
     GList            *list, *row;
@@ -162,64 +236,11 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
     // reverse list
     list = g_list_reverse (list);
 
+    // Walk the list
     for (row = g_list_first (list); row; row = g_list_next (row))
     {
 	if (gtk_tree_model_get_iter (model, &iter, row->data))
-        {
-            GtkTreePath *tree_path;
-            Account     *source_account = NULL;
-            gchar       *full_source_account;
-            gchar       *full_category;
-            gchar       *match_string;
-            gint         depth;
-
-            gtk_tree_model_get (model, &iter, SOURCE_ACCOUNT, &source_account, SOURCE_FULL_ACC, &full_source_account,
-                                              FULL_CATEGORY, &full_category, MATCH_STRING, &match_string, -1);
-
-            PINFO("Account is '%s', Full Category is '%s', Match String is '%s'", full_source_account, full_category, match_string);
-
-            // Get the level we are at in the tree-model
-            tree_path = gtk_tree_model_get_path (model, &iter);
-            depth = gtk_tree_path_get_depth (tree_path);
-            gtk_tree_path_free (tree_path);
-
-            if (source_account != NULL)
-            {
-                gnc_account_delete_map_entry (source_account, full_category, FALSE);
-
-                if (imap_dialog->type == BAYES)
-                {
-                    full_category = g_strdup_printf (IMAP_FRAME_BAYES "/%s", match_string);
-                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
-
-                    full_category = g_strdup_printf (IMAP_FRAME_BAYES);
-                    if (depth == 1) // top level, delete all below
-                       gnc_account_delete_map_entry (source_account, full_category, FALSE);
-                    else
-                        gnc_account_delete_map_entry (source_account, full_category, TRUE);
-                }
-
-                if (imap_dialog->type == NBAYES)
-                {
-                    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
-                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
-
-                    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
-                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
-
-                    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
-                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
-
-                    full_category = g_strdup_printf (IMAP_FRAME);
-                    if (depth == 1) // top level, delete all below
-                        gnc_account_delete_map_entry (source_account, full_category, FALSE);
-                    else
-                        gnc_account_delete_map_entry (source_account, full_category, TRUE);
-                }
-            }
-            g_free (match_string);
-            g_free (full_source_account);
-	}
+            delete_selected_row (model, &iter, imap_dialog);
     }
     g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
     g_list_free (list);
@@ -245,19 +266,70 @@ gnc_imap_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_
     }
 }
 
+gboolean
+filter_test_and_move_next (GtkTreeModel *model, GtkTreeIter *iter, ImapDialog *imap_dialog)
+{
+    GtkTreePath *tree_path;
+    gint         depth;
+    gboolean     valid;
+    const gchar *filter_text;
+    const gchar *match_string;
+    const gchar *map_full_acc;
+
+    // Read the row
+    gtk_tree_model_get (model, iter, MATCH_STRING, &match_string, MAP_FULL_ACC, &map_full_acc, -1);
+
+    filter_text = gtk_entry_get_text (GTK_ENTRY(imap_dialog->filter_text_entry));
+
+    // Get the level we are at in the tree-model
+    tree_path = gtk_tree_model_get_path (model, iter);
+    depth = gtk_tree_path_get_depth (tree_path);
+
+    // Reset filter to TRUE
+    gtk_tree_store_set (GTK_TREE_STORE(model), iter, FILTER, TRUE, -1);
+
+    // Check for a filter_text entry
+    if (g_strcmp0 (filter_text, "") != 0)
+    {
+        if (match_string != NULL) // Check for match_string is not NULL, valid line
+        {
+            if ((g_strrstr (match_string, filter_text) == NULL) &&
+                (g_strrstr (map_full_acc, filter_text) == NULL ))
+                gtk_tree_store_set (GTK_TREE_STORE(model), iter, FILTER, FALSE, -1);
+            else
+                gtk_tree_view_expand_to_path (GTK_TREE_VIEW(imap_dialog->view), tree_path);
+        }
+    }
+    // Select next entry based on path
+    if (depth == 1)
+        gtk_tree_path_down (tree_path);
+    else
+    {
+        gtk_tree_path_next (tree_path);
+        if (!gtk_tree_model_get_iter (model, iter, tree_path))
+        {
+            gtk_tree_path_prev (tree_path);
+            gtk_tree_path_up (tree_path);
+            gtk_tree_path_next (tree_path);
+        }
+    }
+    valid = gtk_tree_model_get_iter (model, iter, tree_path);
+
+    gtk_tree_path_free (tree_path);
+
+    return valid;
+}
+
 static void
 filter_button_cb (GtkButton *button, ImapDialog *imap_dialog)
 {
     GtkTreeModel *model, *filter;
     GtkTreeIter   iter;
-    const gchar  *filter_text;
     gboolean      valid;
 
     filter = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
     model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER(filter));
 
-    filter_text = gtk_entry_get_text (GTK_ENTRY(imap_dialog->filter_text_entry));
-
     // Collapse all nodes
     gtk_tree_view_collapse_all (GTK_TREE_VIEW(imap_dialog->view));
 
@@ -265,49 +337,7 @@ filter_button_cb (GtkButton *button, ImapDialog *imap_dialog)
 
     while (valid)
     {
-        GtkTreePath *tree_path;
-        gint         depth;
-        const gchar *match_string;
-        const gchar *map_full_acc;
-
-        // Walk through the list, reading each row
-        gtk_tree_model_get (model, &iter, MATCH_STRING, &match_string, MAP_FULL_ACC, &map_full_acc, -1);
-
-        // Get the level we are at in the tree-model
-        tree_path = gtk_tree_model_get_path (model, &iter);
-        depth = gtk_tree_path_get_depth (tree_path);
-
-        // Reset filter to TRUE
-        gtk_tree_store_set (GTK_TREE_STORE(model), &iter, FILTER, TRUE, -1);
-
-        // Check for a filter_text entry
-        if (g_strcmp0 (filter_text, "") != 0)
-        {
-            if (match_string != NULL) // Check for match_string is not NULL, valid line
-            {
-                if ((g_strrstr (match_string, filter_text) == NULL) &&
-                    (g_strrstr (map_full_acc, filter_text) == NULL ))
-                    gtk_tree_store_set (GTK_TREE_STORE(model), &iter, FILTER, FALSE, -1);
-                else
-                    gtk_tree_view_expand_to_path (GTK_TREE_VIEW(imap_dialog->view), tree_path);
-            }
-        }
-        // Select next entry based on path
-        if (depth == 1)
-            gtk_tree_path_down (tree_path);
-        else
-        {
-            gtk_tree_path_next (tree_path);
-            if (!gtk_tree_model_get_iter (model, &iter, tree_path))
-            {
-                gtk_tree_path_prev (tree_path);
-                gtk_tree_path_up (tree_path);
-                gtk_tree_path_next (tree_path);
-            }
-        }
-        valid = gtk_tree_model_get_iter (model, &iter, tree_path);
-
-        gtk_tree_path_free (tree_path);
+        valid = filter_test_and_move_next (model, &iter, imap_dialog);
     }
 }
 
@@ -425,9 +455,7 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *model, const g
 
         for (node = imap_list;  node; node = g_list_next (node))
         {
-            struct imap_info *imapInfo;
-
-            imapInfo = node->data;
+            struct imap_info *imapInfo = node->data;
 
             // First add a child entry and pass iter to add_to_store
             gtk_tree_store_append (GTK_TREE_STORE(model), &child, &toplevel);
@@ -469,16 +497,11 @@ get_account_info_bayes (GList *accts, GtkTreeModel *model)
 {
     GList   *ptr;
 
-    struct imap_info imapInfo;
-
     /* Go through list of accounts */
     for (ptr = accts; ptr; ptr = g_list_next (ptr))
     {
         Account *acc = ptr->data;
 
-        // Save source account
-        imapInfo.source_account = acc;
-
         get_imap_info (acc, NULL, model, _("Bayesian"));
     }
 }
@@ -488,16 +511,11 @@ get_account_info_nbayes (GList *accts, GtkTreeModel *model)
 {
     GList   *ptr;
 
-    struct imap_info imapInfo;
-
     /* Go through list of accounts */
     for (ptr = accts; ptr; ptr = g_list_next (ptr))
     {
         Account *acc = ptr->data;
 
-        // Save source account
-        imapInfo.source_account = acc;
-
         // Description
         get_imap_info (acc, IMAP_FRAME_DESC, model, _("Description Field"));
 

commit a90b10b15e838254af5e8ed90e353d184fd0f3be
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Jan 6 13:15:29 2016 +0000

    Add Filter option to tree store

diff --git a/src/gnome/dialog-imap-editor.c b/src/gnome/dialog-imap-editor.c
index 5328c14..ec9d068 100644
--- a/src/gnome/dialog-imap-editor.c
+++ b/src/gnome/dialog-imap-editor.c
@@ -46,7 +46,7 @@
 
 /** Enumeration for the tree-store */
 enum GncImapColumn {SOURCE_FULL_ACC, SOURCE_ACCOUNT, BASED_ON, MATCH_STRING,
-                     MAP_FULL_ACC, MAP_ACCOUNT, FULL_CATEGORY, COUNT};
+                     MAP_FULL_ACC, MAP_ACCOUNT, FULL_CATEGORY, COUNT, FILTER};
 
 typedef enum
 {
@@ -59,7 +59,6 @@ typedef struct
 {
     GtkWidget    *dialog;
     QofSession   *session;
-    GtkWidget    *store;
     GtkWidget    *view;
     GncListType   type;
 
@@ -67,6 +66,12 @@ typedef struct
     GtkWidget    *radio_nbayes;
     GtkWidget    *radio_online;
 
+    GtkWidget    *filter_button;
+    GtkWidget    *filter_text_entry;
+    GtkWidget    *filter_label;
+
+    GtkWidget    *expand_button;
+    GtkWidget    *collapse_button;
 }ImapDialog;
 
 
@@ -162,11 +167,11 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
 	if (gtk_tree_model_get_iter (model, &iter, row->data))
         {
             GtkTreePath *tree_path;
-            Account *source_account = NULL;
-            gchar   *full_source_account;
-            gchar   *full_category;
-            gchar   *match_string;
-            gint     depth;
+            Account     *source_account = NULL;
+            gchar       *full_source_account;
+            gchar       *full_category;
+            gchar       *match_string;
+            gint         depth;
 
             gtk_tree_model_get (model, &iter, SOURCE_ACCOUNT, &source_account, SOURCE_FULL_ACC, &full_source_account,
                                               FULL_CATEGORY, &full_category, MATCH_STRING, &match_string, -1);
@@ -188,7 +193,7 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
                     gnc_account_delete_map_entry (source_account, full_category, TRUE);
 
                     full_category = g_strdup_printf (IMAP_FRAME_BAYES);
-                    if (depth == 1) // top level
+                    if (depth == 1) // top level, delete all below
                        gnc_account_delete_map_entry (source_account, full_category, FALSE);
                     else
                         gnc_account_delete_map_entry (source_account, full_category, TRUE);
@@ -206,7 +211,7 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
                     gnc_account_delete_map_entry (source_account, full_category, TRUE);
 
                     full_category = g_strdup_printf (IMAP_FRAME);
-                    if (depth == 1) // top level
+                    if (depth == 1) // top level, delete all below
                         gnc_account_delete_map_entry (source_account, full_category, FALSE);
                     else
                         gnc_account_delete_map_entry (source_account, full_category, TRUE);
@@ -241,7 +246,95 @@ gnc_imap_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_
 }
 
 static void
-list_type_selected (GtkToggleButton* button, ImapDialog *imap_dialog)
+filter_button_cb (GtkButton *button, ImapDialog *imap_dialog)
+{
+    GtkTreeModel *model, *filter;
+    GtkTreeIter   iter;
+    const gchar  *filter_text;
+    gboolean      valid;
+
+    filter = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
+    model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER(filter));
+
+    filter_text = gtk_entry_get_text (GTK_ENTRY(imap_dialog->filter_text_entry));
+
+    // Collapse all nodes
+    gtk_tree_view_collapse_all (GTK_TREE_VIEW(imap_dialog->view));
+
+    valid = gtk_tree_model_get_iter_first (model, &iter);
+
+    while (valid)
+    {
+        GtkTreePath *tree_path;
+        gint         depth;
+        const gchar *match_string;
+        const gchar *map_full_acc;
+
+        // Walk through the list, reading each row
+        gtk_tree_model_get (model, &iter, MATCH_STRING, &match_string, MAP_FULL_ACC, &map_full_acc, -1);
+
+        // Get the level we are at in the tree-model
+        tree_path = gtk_tree_model_get_path (model, &iter);
+        depth = gtk_tree_path_get_depth (tree_path);
+
+        // Reset filter to TRUE
+        gtk_tree_store_set (GTK_TREE_STORE(model), &iter, FILTER, TRUE, -1);
+
+        // Check for a filter_text entry
+        if (g_strcmp0 (filter_text, "") != 0)
+        {
+            if (match_string != NULL) // Check for match_string is not NULL, valid line
+            {
+                if ((g_strrstr (match_string, filter_text) == NULL) &&
+                    (g_strrstr (map_full_acc, filter_text) == NULL ))
+                    gtk_tree_store_set (GTK_TREE_STORE(model), &iter, FILTER, FALSE, -1);
+                else
+                    gtk_tree_view_expand_to_path (GTK_TREE_VIEW(imap_dialog->view), tree_path);
+            }
+        }
+        // Select next entry based on path
+        if (depth == 1)
+            gtk_tree_path_down (tree_path);
+        else
+        {
+            gtk_tree_path_next (tree_path);
+            if (!gtk_tree_model_get_iter (model, &iter, tree_path))
+            {
+                gtk_tree_path_prev (tree_path);
+                gtk_tree_path_up (tree_path);
+                gtk_tree_path_next (tree_path);
+            }
+        }
+        valid = gtk_tree_model_get_iter (model, &iter, tree_path);
+
+        gtk_tree_path_free (tree_path);
+    }
+}
+
+static void
+expand_button_cb (GtkButton *button, ImapDialog *imap_dialog)
+{
+    // Clear the filter
+    gtk_entry_set_text (GTK_ENTRY(imap_dialog->filter_text_entry), "");
+
+    filter_button_cb (button, imap_dialog);
+
+    gtk_tree_view_expand_all (GTK_TREE_VIEW(imap_dialog->view));
+}
+
+static void
+collapse_button_cb (GtkButton *button, ImapDialog *imap_dialog)
+{
+    // Clear the filter
+    gtk_entry_set_text (GTK_ENTRY(imap_dialog->filter_text_entry), "");
+
+    filter_button_cb (button, imap_dialog);
+
+    gtk_tree_view_collapse_all (GTK_TREE_VIEW(imap_dialog->view));
+}
+
+static void
+list_type_selected_cb (GtkToggleButton* button, ImapDialog *imap_dialog)
 {
     GncListType type;
 
@@ -277,7 +370,7 @@ show_count_column (ImapDialog *imap_dialog, gboolean show)
 }
 
 static void
-add_to_store (GtkTreeModel *store, GtkTreeIter *iter, const gchar *text, gpointer user_data)
+add_to_store (GtkTreeModel *model, GtkTreeIter *iter, const gchar *text, gpointer user_data)
 {
     gchar       *fullname = NULL;
     gchar       *map_fullname = NULL;
@@ -286,23 +379,28 @@ add_to_store (GtkTreeModel *store, GtkTreeIter *iter, const gchar *text, gpointe
 
     fullname = gnc_account_get_full_name (imapInfo->source_account);
 
-    map_fullname = gnc_account_get_full_name (imapInfo->map_account);
+    // Do we have a valid map account
+    if (imapInfo->map_account == NULL)
+        map_fullname = g_strdup (_("Map Account NOT found"));
+    else
+        map_fullname = gnc_account_get_full_name (imapInfo->map_account);
 
     PINFO("Add to Store: Source Acc '%s', Match '%s', Map Acc '%s'", fullname, imapInfo->match_string, map_fullname);
 
-    gtk_tree_store_set (GTK_TREE_STORE(store), iter,
+    gtk_tree_store_set (GTK_TREE_STORE(model), iter,
                         SOURCE_FULL_ACC, fullname, SOURCE_ACCOUNT, imapInfo->source_account,
                         BASED_ON, text,
                         MATCH_STRING, imapInfo->match_string,
                         MAP_FULL_ACC, map_fullname, MAP_ACCOUNT, imapInfo->map_account,
-                        FULL_CATEGORY, imapInfo->full_category, COUNT, imapInfo->count, -1);
+                        FULL_CATEGORY, imapInfo->full_category, COUNT, imapInfo->count,
+                        FILTER, TRUE, -1);
 
     g_free (fullname);
     g_free (map_fullname);
 }
 
 static void
-get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const gchar *text)
+get_imap_info (Account *acc, const gchar *category, GtkTreeModel *model, const gchar *text)
 {
     GtkTreeIter  toplevel, child;
     GList *imap_list, *node;
@@ -320,9 +418,10 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const g
     {
         PINFO("List length is %d", g_list_length (imap_list));
 
-        gtk_tree_store_append (GTK_TREE_STORE(store), &toplevel, NULL);
-        gtk_tree_store_set (GTK_TREE_STORE(store), &toplevel,
-                        SOURCE_ACCOUNT, acc, SOURCE_FULL_ACC, acc_name, BASED_ON, text, -1);
+        // Add top level entry of Source full Account and Based on.
+        gtk_tree_store_append (GTK_TREE_STORE(model), &toplevel, NULL);
+        gtk_tree_store_set (GTK_TREE_STORE(model), &toplevel,
+                        SOURCE_ACCOUNT, acc, SOURCE_FULL_ACC, acc_name, BASED_ON, text, FILTER, TRUE, -1);
 
         for (node = imap_list;  node; node = g_list_next (node))
         {
@@ -330,10 +429,9 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const g
 
             imapInfo = node->data;
 
-            gtk_tree_store_append (GTK_TREE_STORE(store), &child, &toplevel);
-
-            // Add to store
-            add_to_store (store, &child, text, imapInfo);
+            // First add a child entry and pass iter to add_to_store
+            gtk_tree_store_append (GTK_TREE_STORE(model), &child, &toplevel);
+            add_to_store (model, &child, text, imapInfo);
 
             // Free the members and structure
             g_free (imapInfo->category_head);
@@ -350,13 +448,14 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const g
 static void
 show_first_row (ImapDialog *imap_dialog)
 {
-    GtkTreeIter iter;
-    GtkTreeModel *store;
+    GtkTreeModel *model, *filter;
+    GtkTreeIter   iter;
 
-    store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
+    filter = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
+    model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER(filter));
 
     // See if there are any entries
-    if (gtk_tree_model_get_iter_first (store, &iter))
+    if (gtk_tree_model_get_iter_first (model, &iter))
     {
         GtkTreePath *path;
         path = gtk_tree_path_new_first (); // Set Path to first entry
@@ -366,7 +465,7 @@ show_first_row (ImapDialog *imap_dialog)
 }
 
 static void
-get_account_info_bayes (GList *accts, GtkTreeModel *store)
+get_account_info_bayes (GList *accts, GtkTreeModel *model)
 {
     GList   *ptr;
 
@@ -380,12 +479,12 @@ get_account_info_bayes (GList *accts, GtkTreeModel *store)
         // Save source account
         imapInfo.source_account = acc;
 
-        get_imap_info (acc, NULL, store, _("Bayesian"));
+        get_imap_info (acc, NULL, model, _("Bayesian"));
     }
 }
 
 static void
-get_account_info_nbayes (GList *accts, GtkTreeModel *store)
+get_account_info_nbayes (GList *accts, GtkTreeModel *model)
 {
     GList   *ptr;
 
@@ -400,18 +499,18 @@ get_account_info_nbayes (GList *accts, GtkTreeModel *store)
         imapInfo.source_account = acc;
 
         // Description
-        get_imap_info (acc, IMAP_FRAME_DESC, store, _("Description Field"));
+        get_imap_info (acc, IMAP_FRAME_DESC, model, _("Description Field"));
 
         // Memo
-        get_imap_info (acc, IMAP_FRAME_MEMO, store, _("Memo Field"));
+        get_imap_info (acc, IMAP_FRAME_MEMO, model, _("Memo Field"));
 
         // CSV Account Map
-        get_imap_info (acc, IMAP_FRAME_CSV, store, _("CSV Account Map"));
+        get_imap_info (acc, IMAP_FRAME_CSV, model, _("CSV Account Map"));
     }
 }
 
 static void
-get_account_info_online (GList *accts, GtkTreeModel *store)
+get_account_info_online (GList *accts, GtkTreeModel *model)
 {
     GList       *ptr;
     GtkTreeIter  toplevel;
@@ -441,45 +540,78 @@ get_account_info_online (GList *accts, GtkTreeModel *store)
             imapInfo.match_string  = text;
             imapInfo.count = " ";
 
-            gtk_tree_store_append (GTK_TREE_STORE(store), &toplevel, NULL);
-
-            // Add imap data to store
-            add_to_store (store, &toplevel, _("Online Id"), &imapInfo);
+            // Add top level entry and pass iter to add_to_store
+            gtk_tree_store_append (GTK_TREE_STORE(model), &toplevel, NULL);
+            add_to_store (model, &toplevel, _("Online Id"), &imapInfo);
         }
         g_free (text);
     }
 }
 
 static void
+show_filter_option (ImapDialog *imap_dialog, gboolean show)
+{
+    if (show)
+    {
+        gtk_widget_show (imap_dialog->filter_text_entry);
+        gtk_widget_show (imap_dialog->filter_button);
+        gtk_widget_show (imap_dialog->filter_label);
+        gtk_widget_show (imap_dialog->expand_button);
+        gtk_widget_show (imap_dialog->collapse_button);
+    }
+    else
+    {
+        gtk_widget_hide (imap_dialog->filter_text_entry);
+        gtk_widget_hide (imap_dialog->filter_button);
+        gtk_widget_hide (imap_dialog->filter_label);
+        gtk_widget_hide (imap_dialog->expand_button);
+        gtk_widget_hide (imap_dialog->collapse_button);
+    }
+}
+
+static void
 get_account_info (ImapDialog *imap_dialog)
 {
-    Account *root;
-    GList   *accts;
-    GtkTreeIter iter;
-    GtkTreeModel *store;
+    Account      *root;
+    GList        *accts;
+    GtkTreeModel *model, *filter;
+    GtkTreeIter   iter;
 
     /* Get list of Accounts */
     root = gnc_book_get_root_account (gnc_get_current_book());
     accts = gnc_account_get_descendants_sorted (root);
 
-    store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
-    gtk_tree_store_clear (GTK_TREE_STORE(store));
+    filter = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
+
+    model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER(filter));
+
+    // Clear the tree store
+    gtk_tree_store_clear (GTK_TREE_STORE(model));
+
+    // Clear the filter
+    gtk_entry_set_text (GTK_ENTRY(imap_dialog->filter_text_entry), "");
 
     // Hide Count Column
     show_count_column (imap_dialog, FALSE);
 
+    // Show Filter Option
+    show_filter_option (imap_dialog, TRUE);
+
     if (imap_dialog->type == BAYES)
     {
-        get_account_info_bayes (accts, store);
+        get_account_info_bayes (accts, model);
 
         // Show Count Column
         show_count_column (imap_dialog, TRUE);
     }
     else if (imap_dialog->type == NBAYES)
-        get_account_info_nbayes (accts, store);
+        get_account_info_nbayes (accts, model);
     else if (imap_dialog->type == ONLINE)
-        get_account_info_online (accts, store);
-
+    {
+        // Hide Filter Option
+        show_filter_option (imap_dialog, FALSE);
+        get_account_info_online (accts, model);
+    }
     // if there are any entries, show first row
     show_first_row (imap_dialog);
 
@@ -491,11 +623,13 @@ gnc_imap_dialog_create (GtkWidget *parent, ImapDialog *imap_dialog)
 {
     GtkWidget        *dialog;
     GtkBuilder       *builder;
+    GtkTreeModel     *filter;
     GtkTreeSelection *selection;
 
     ENTER(" ");
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-imap-editor.glade", "tree-store");
+    gnc_builder_add_from_file (builder, "dialog-imap-editor.glade", "treemodelfilter");
     gnc_builder_add_from_file (builder, "dialog-imap-editor.glade", "Import Map Dialog");
 
     dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Import Map Dialog"));
@@ -513,12 +647,30 @@ gnc_imap_dialog_create (GtkWidget *parent, ImapDialog *imap_dialog)
     imap_dialog->radio_nbayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-nbayes"));
     imap_dialog->radio_online = GTK_WIDGET(gtk_builder_get_object (builder, "radio-online"));
     g_signal_connect (imap_dialog->radio_bayes, "toggled",
-                      G_CALLBACK(list_type_selected), (gpointer)imap_dialog);
+                      G_CALLBACK(list_type_selected_cb), (gpointer)imap_dialog);
     g_signal_connect (imap_dialog->radio_nbayes, "toggled",
-                      G_CALLBACK(list_type_selected), (gpointer)imap_dialog);
+                      G_CALLBACK(list_type_selected_cb), (gpointer)imap_dialog);
+
+    imap_dialog->filter_text_entry = GTK_WIDGET(gtk_builder_get_object (builder, "filter-text-entry"));
+    imap_dialog->filter_label = GTK_WIDGET(gtk_builder_get_object (builder, "filter-label"));
+    imap_dialog->filter_button = GTK_WIDGET(gtk_builder_get_object (builder, "filter-button"));
+    g_signal_connect (imap_dialog->filter_button, "clicked",
+                      G_CALLBACK(filter_button_cb), (gpointer)imap_dialog);
+
+    imap_dialog->expand_button = GTK_WIDGET(gtk_builder_get_object (builder, "expand-button"));
+    g_signal_connect (imap_dialog->expand_button, "clicked",
+                      G_CALLBACK(expand_button_cb), (gpointer)imap_dialog);
+
+    imap_dialog->collapse_button = GTK_WIDGET(gtk_builder_get_object (builder, "collapse-button"));
+    g_signal_connect (imap_dialog->collapse_button, "clicked",
+                      G_CALLBACK(collapse_button_cb), (gpointer)imap_dialog);
 
     imap_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
 
+    // Set filter column
+    filter = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
+    gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER(filter), FILTER);
+
     /* Enable alternative line colors */
     gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(imap_dialog->view), TRUE);
 
diff --git a/src/gnome/gtkbuilder/dialog-imap-editor.glade b/src/gnome/gtkbuilder/dialog-imap-editor.glade
index 7a3e503..fab77a1 100644
--- a/src/gnome/gtkbuilder/dialog-imap-editor.glade
+++ b/src/gnome/gtkbuilder/dialog-imap-editor.glade
@@ -16,12 +16,17 @@
       <column type="gchararray"/>
       <!-- column-name map_account -->
       <column type="gpointer"/>
-      <!-- column-name path -->
+      <!-- column-name full_category -->
       <column type="gchararray"/>
       <!-- column-name count -->
       <column type="gchararray"/>
+      <!-- column-name filter -->
+      <column type="gboolean"/>
     </columns>
   </object>
+  <object class="GtkTreeModelFilter" id="treemodelfilter">
+    <property name="child_model">tree-store</property>
+  </object>
   <object class="GtkDialog" id="Import Map Dialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
@@ -35,18 +40,6 @@
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="can_focus">False</property>
-        <child>
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">What type of information to display?</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child internal-child="action_area">
           <object class="GtkHButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
@@ -90,6 +83,18 @@
           </packing>
         </child>
         <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">What type of information to display?</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
           <object class="GtkHBox" id="hbox1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
@@ -158,7 +163,7 @@
               <object class="GtkTreeView" id="treeview">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="model">tree-store</property>
+                <property name="model">treemodelfilter</property>
                 <child>
                   <object class="GtkTreeViewColumn" id="source_account_name">
                     <property name="resizable">True</property>
@@ -176,7 +181,9 @@
                     <property name="resizable">True</property>
                     <property name="title" translatable="yes">Based On</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext4"/>
+                      <object class="GtkCellRendererText" id="cellrenderertext4">
+                        <property name="xpad">10</property>
+                      </object>
                       <attributes>
                         <attribute name="text">2</attribute>
                       </attributes>
@@ -188,7 +195,9 @@
                     <property name="resizable">True</property>
                     <property name="title" translatable="yes">Match String</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                      <object class="GtkCellRendererText" id="cellrenderertext1">
+                        <property name="xpad">10</property>
+                      </object>
                       <attributes>
                         <attribute name="text">3</attribute>
                       </attributes>
@@ -200,7 +209,9 @@
                     <property name="resizable">True</property>
                     <property name="title" translatable="yes">Mapped to Account Name</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                      <object class="GtkCellRendererText" id="cellrenderertext2">
+                        <property name="xpad">10</property>
+                      </object>
                       <attributes>
                         <attribute name="text">4</attribute>
                       </attributes>
@@ -212,7 +223,10 @@
                     <property name="resizable">True</property>
                     <property name="title" translatable="yes">Count of Match String Usage</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext5"/>
+                      <object class="GtkCellRendererText" id="cellrenderertext5">
+                        <property name="xpad">10</property>
+                        <property name="alignment">center</property>
+                      </object>
                       <attributes>
                         <attribute name="text">7</attribute>
                       </attributes>
@@ -229,11 +243,11 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="label2">
+          <object class="GtkLabel" id="filter-label">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="ypad">5</property>
-            <property name="label" translatable="yes">You may select multiple rows and then press the delete button...</property>
+            <property name="label" translatable="yes">Case sensative filtering is available on 'Match String' and 'Mapped to Account Name'.</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -241,6 +255,111 @@
             <property name="position">4</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkHBox" id="hbox2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="filter-text-entry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">●</property>
+                <property name="invisible_char_set">True</property>
+                <property name="primary_icon_activatable">False</property>
+                <property name="secondary_icon_activatable">False</property>
+                <property name="primary_icon_sensitive">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="filter-button">
+                <property name="label" translatable="yes">_Filter</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="expand-button">
+                <property name="label" translatable="yes">_Expand All</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="collapse-button">
+                <property name="label" translatable="yes">_Collapse All</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">5</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">5</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="ypad">5</property>
+            <property name="label" translatable="yes">Multiple rows can be selected and then deleted by pressing the delete button...</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">6</property>
+          </packing>
+        </child>
       </object>
     </child>
     <action-widgets>

commit f17f047a68d0d84eee4949b776ce2d4278ecf945
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Dec 28 20:07:21 2015 +0000

    Change list store into a tree store

diff --git a/src/gnome/dialog-imap-editor.c b/src/gnome/dialog-imap-editor.c
index 771230c..5328c14 100644
--- a/src/gnome/dialog-imap-editor.c
+++ b/src/gnome/dialog-imap-editor.c
@@ -44,7 +44,7 @@
 #define IMAP_FRAME_MEMO         "memo"
 #define IMAP_FRAME_CSV          "csv-account-map"
 
-/** Enumeration for the liststore */
+/** Enumeration for the tree-store */
 enum GncImapColumn {SOURCE_FULL_ACC, SOURCE_ACCOUNT, BASED_ON, MATCH_STRING,
                      MAP_FULL_ACC, MAP_ACCOUNT, FULL_CATEGORY, COUNT};
 
@@ -161,15 +161,22 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
     {
 	if (gtk_tree_model_get_iter (model, &iter, row->data))
         {
+            GtkTreePath *tree_path;
             Account *source_account = NULL;
             gchar   *full_source_account;
             gchar   *full_category;
             gchar   *match_string;
+            gint     depth;
 
             gtk_tree_model_get (model, &iter, SOURCE_ACCOUNT, &source_account, SOURCE_FULL_ACC, &full_source_account,
                                               FULL_CATEGORY, &full_category, MATCH_STRING, &match_string, -1);
 
-            PINFO("Account is '%s', Path is '%s', Search is '%s'", full_source_account, full_category, match_string);
+            PINFO("Account is '%s', Full Category is '%s', Match String is '%s'", full_source_account, full_category, match_string);
+
+            // Get the level we are at in the tree-model
+            tree_path = gtk_tree_model_get_path (model, &iter);
+            depth = gtk_tree_path_get_depth (tree_path);
+            gtk_tree_path_free (tree_path);
 
             if (source_account != NULL)
             {
@@ -181,7 +188,10 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
                     gnc_account_delete_map_entry (source_account, full_category, TRUE);
 
                     full_category = g_strdup_printf (IMAP_FRAME_BAYES);
-                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
+                    if (depth == 1) // top level
+                       gnc_account_delete_map_entry (source_account, full_category, FALSE);
+                    else
+                        gnc_account_delete_map_entry (source_account, full_category, TRUE);
                 }
 
                 if (imap_dialog->type == NBAYES)
@@ -196,7 +206,10 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
                     gnc_account_delete_map_entry (source_account, full_category, TRUE);
 
                     full_category = g_strdup_printf (IMAP_FRAME);
-                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
+                    if (depth == 1) // top level
+                        gnc_account_delete_map_entry (source_account, full_category, FALSE);
+                    else
+                        gnc_account_delete_map_entry (source_account, full_category, TRUE);
                 }
             }
             g_free (match_string);
@@ -264,23 +277,20 @@ show_count_column (ImapDialog *imap_dialog, gboolean show)
 }
 
 static void
-add_to_store (GtkTreeModel *store, const gchar *text, gpointer user_data)
+add_to_store (GtkTreeModel *store, GtkTreeIter *iter, const gchar *text, gpointer user_data)
 {
-    GtkTreeIter  iter;
     gchar       *fullname = NULL;
     gchar       *map_fullname = NULL;
 
     struct imap_info *imapInfo = (struct imap_info*)user_data;
 
-    gtk_list_store_append (GTK_LIST_STORE(store), &iter);
-
     fullname = gnc_account_get_full_name (imapInfo->source_account);
 
     map_fullname = gnc_account_get_full_name (imapInfo->map_account);
 
     PINFO("Add to Store: Source Acc '%s', Match '%s', Map Acc '%s'", fullname, imapInfo->match_string, map_fullname);
 
-    gtk_list_store_set (GTK_LIST_STORE(store), &iter,
+    gtk_tree_store_set (GTK_TREE_STORE(store), iter,
                         SOURCE_FULL_ACC, fullname, SOURCE_ACCOUNT, imapInfo->source_account,
                         BASED_ON, text,
                         MATCH_STRING, imapInfo->match_string,
@@ -294,12 +304,12 @@ add_to_store (GtkTreeModel *store, const gchar *text, gpointer user_data)
 static void
 get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const gchar *text)
 {
+    GtkTreeIter  toplevel, child;
     GList *imap_list, *node;
     gchar *acc_name = NULL;
 
     acc_name = gnc_account_get_full_name (acc);
     PINFO("Source Acc '%s', Based on '%s', Path Head '%s'", acc_name, text, category);
-    g_free (acc_name);
 
     if (category == NULL) // For Bayesian, category is NULL
         imap_list = gnc_account_imap_get_info_bayes (acc);
@@ -310,14 +320,20 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const g
     {
         PINFO("List length is %d", g_list_length (imap_list));
 
+        gtk_tree_store_append (GTK_TREE_STORE(store), &toplevel, NULL);
+        gtk_tree_store_set (GTK_TREE_STORE(store), &toplevel,
+                        SOURCE_ACCOUNT, acc, SOURCE_FULL_ACC, acc_name, BASED_ON, text, -1);
+
         for (node = imap_list;  node; node = g_list_next (node))
         {
             struct imap_info *imapInfo;
 
             imapInfo = node->data;
 
+            gtk_tree_store_append (GTK_TREE_STORE(store), &child, &toplevel);
+
             // Add to store
-            add_to_store (store, text, imapInfo);
+            add_to_store (store, &child, text, imapInfo);
 
             // Free the members and structure
             g_free (imapInfo->category_head);
@@ -327,8 +343,8 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const g
             g_free (imapInfo);
         }
     }
-    // Free the list
-    g_list_free (imap_list);
+    g_free (acc_name);
+    g_list_free (imap_list); // Free the List
 }
 
 static void
@@ -397,7 +413,8 @@ get_account_info_nbayes (GList *accts, GtkTreeModel *store)
 static void
 get_account_info_online (GList *accts, GtkTreeModel *store)
 {
-    GList   *ptr;
+    GList       *ptr;
+    GtkTreeIter  toplevel;
 
     struct imap_info imapInfo;
 
@@ -424,8 +441,10 @@ get_account_info_online (GList *accts, GtkTreeModel *store)
             imapInfo.match_string  = text;
             imapInfo.count = " ";
 
+            gtk_tree_store_append (GTK_TREE_STORE(store), &toplevel, NULL);
+
             // Add imap data to store
-            add_to_store (store, _("Online Id"), &imapInfo);
+            add_to_store (store, &toplevel, _("Online Id"), &imapInfo);
         }
         g_free (text);
     }
@@ -444,7 +463,7 @@ get_account_info (ImapDialog *imap_dialog)
     accts = gnc_account_get_descendants_sorted (root);
 
     store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
-    gtk_list_store_clear (GTK_LIST_STORE(store));
+    gtk_tree_store_clear (GTK_TREE_STORE(store));
 
     // Hide Count Column
     show_count_column (imap_dialog, FALSE);
@@ -476,7 +495,7 @@ gnc_imap_dialog_create (GtkWidget *parent, ImapDialog *imap_dialog)
 
     ENTER(" ");
     builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-imap-editor.glade", "list-view");
+    gnc_builder_add_from_file (builder, "dialog-imap-editor.glade", "tree-store");
     gnc_builder_add_from_file (builder, "dialog-imap-editor.glade", "Import Map Dialog");
 
     dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Import Map Dialog"));
diff --git a/src/gnome/gtkbuilder/dialog-imap-editor.glade b/src/gnome/gtkbuilder/dialog-imap-editor.glade
index be54802..7a3e503 100644
--- a/src/gnome/gtkbuilder/dialog-imap-editor.glade
+++ b/src/gnome/gtkbuilder/dialog-imap-editor.glade
@@ -2,7 +2,7 @@
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkListStore" id="list-view">
+  <object class="GtkTreeStore" id="tree-store">
     <columns>
       <!-- column-name source_account_name -->
       <column type="gchararray"/>
@@ -158,7 +158,7 @@
               <object class="GtkTreeView" id="treeview">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="model">list-view</property>
+                <property name="model">tree-store</property>
                 <child>
                   <object class="GtkTreeViewColumn" id="source_account_name">
                     <property name="resizable">True</property>

commit 1bb87789895554dd509cb1bc86f63c648ae20e88
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Dec 28 12:13:47 2015 +0000

    Some more name changes

diff --git a/src/engine/Account.c b/src/engine/Account.c
index 8710537..5871cd4 100644
--- a/src/engine/Account.c
+++ b/src/engine/Account.c
@@ -5508,7 +5508,7 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
 
     count = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (value));
 
-    kvp_path = g_strconcat (imapInfo->kvp_path_head, "/", key, NULL);
+    kvp_path = g_strconcat (imapInfo->category_head, "/", key, NULL);
 
     PINFO("build_bayes_layer_two: kvp_path is '%s'", kvp_path);
 
@@ -5516,9 +5516,9 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
 
     imapInfo_node->source_account = imapInfo->source_account;
     imapInfo_node->map_account    = gnc_account_lookup_by_full_name (root, key);
-    imapInfo_node->kvp_path       = g_strdup (kvp_path);
+    imapInfo_node->full_category  = g_strdup (kvp_path);
     imapInfo_node->match_string   = g_strdup (imapInfo->match_string);
-    imapInfo_node->kvp_path_head  = g_strdup (imapInfo->kvp_path_head);
+    imapInfo_node->category_head  = g_strdup (imapInfo->category_head);
     imapInfo_node->count          = g_strdup (count);
 
     imapInfo->list = g_list_append (imapInfo->list, imapInfo_node);
@@ -5546,7 +5546,7 @@ build_bayes (const char *key, const GValue *value, gpointer user_data)
 
             imapInfol2.source_account = imapInfo->source_account;
             imapInfol2.match_string   = g_strdup (key);
-            imapInfol2.kvp_path_head  = g_strdup (kvp_path);
+            imapInfol2.category_head  = g_strdup (kvp_path);
             imapInfol2.list           = imapInfo->list;
 
             qof_instance_foreach_slot (QOF_INSTANCE(imapInfo->source_account), kvp_path,
@@ -5554,7 +5554,7 @@ build_bayes (const char *key, const GValue *value, gpointer user_data)
 
             imapInfo->list = imapInfol2.list;
             g_free (imapInfol2.match_string);
-            g_free (imapInfol2.kvp_path_head);
+            g_free (imapInfol2.category_head);
         }
         g_free (kvp_path);
     }
@@ -5584,7 +5584,7 @@ build_non_bayes (const char *key, const GValue *value, gpointer user_data)
         PINFO("build_non_bayes: account '%s', match account guid: '%s'",
                                 (char*)key, guid_string);
 
-        kvp_path = g_strconcat (imapInfo->kvp_path_head, "/", key, NULL);
+        kvp_path = g_strconcat (imapInfo->category_head, "/", key, NULL);
 
         PINFO("build_non_bayes: kvp_path is '%s'", kvp_path);
 
@@ -5592,9 +5592,9 @@ build_non_bayes (const char *key, const GValue *value, gpointer user_data)
 
         imapInfo_node->source_account = imapInfo->source_account;
         imapInfo_node->map_account    = xaccAccountLookup (guid, book);
-        imapInfo_node->kvp_path       = g_strdup (kvp_path);
+        imapInfo_node->full_category  = g_strdup (kvp_path);
         imapInfo_node->match_string   = g_strdup (key);
-        imapInfo_node->kvp_path_head  = g_strdup (imapInfo->kvp_path_head);
+        imapInfo_node->category_head  = g_strdup (imapInfo->category_head);
         imapInfo_node->count          = g_strdup (" ");
 
         imapInfo->list = g_list_append (imapInfo->list, imapInfo_node);
@@ -5627,21 +5627,21 @@ GList *
 gnc_account_imap_get_info (Account *acc, const char *category)
 {
     GList *list = NULL;
-    gchar *kvp_path_head = NULL;
+    gchar *category_head = NULL;
 
     struct imap_info imapInfo;
 
     imapInfo.source_account = acc;
     imapInfo.list = list;
 
-    kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", category);
-    imapInfo.kvp_path_head = kvp_path_head;
+    category_head = g_strdup_printf (IMAP_FRAME "/%s", category);
+    imapInfo.category_head = category_head;
 
-    if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
-        qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head,
+    if (qof_instance_has_slot (QOF_INSTANCE(acc), category_head))
+        qof_instance_foreach_slot (QOF_INSTANCE(acc), category_head,
                                    build_non_bayes, &imapInfo);
 
-    g_free (kvp_path_head);
+    g_free (category_head);
 
     return imapInfo.list;
 }
@@ -5649,10 +5649,11 @@ gnc_account_imap_get_info (Account *acc, const char *category)
 /*******************************************************************************/
 
 gchar *
-gnc_account_get_map_entry (Account *acc, const char *kvp_path)
+gnc_account_get_map_entry (Account *acc, const char *full_category)
 {
     GValue v = G_VALUE_INIT;
     gchar *text = NULL;
+    gchar *kvp_path = g_strdup (full_category);
 
     if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path))
     {
@@ -5665,13 +5666,16 @@ gnc_account_get_map_entry (Account *acc, const char *kvp_path)
             text = g_strdup (string);
         }
     }
+    g_free (kvp_path);
     return text;
 }
 
 
 void
-gnc_account_delete_map_entry (Account *acc, char *kvp_path, gboolean empty)
+gnc_account_delete_map_entry (Account *acc, char *full_category, gboolean empty)
 {
+    gchar *kvp_path = g_strdup (full_category);
+
     if ((acc != NULL) && qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path))
     {
         xaccAccountBeginEdit (acc);
@@ -5687,6 +5691,7 @@ gnc_account_delete_map_entry (Account *acc, char *kvp_path, gboolean empty)
         xaccAccountCommitEdit (acc);
     }
     g_free (kvp_path);
+    g_free (full_category);
 }
 
 
diff --git a/src/engine/Account.h b/src/engine/Account.h
index e26925d..067d015 100644
--- a/src/engine/Account.h
+++ b/src/engine/Account.h
@@ -1411,8 +1411,8 @@ struct imap_info
     Account        *source_account;
     Account        *map_account;
     GList          *list;
-    char           *kvp_path_head;
-    char           *kvp_path;
+    char           *category_head;
+    char           *full_category;
     char           *match_string;
     char           *count;
 };
@@ -1427,15 +1427,15 @@ GList *gnc_account_imap_get_info_bayes (Account *acc);
  */
 GList *gnc_account_imap_get_info (Account *acc, const char *category);
 
-/** Returns the text string pointed to by path for the Account, free
+/** Returns the text string pointed to by full_category for the Account, free
  *  the returned text
  */
-gchar *gnc_account_get_map_entry (Account *acc, const char *path);
+gchar *gnc_account_get_map_entry (Account *acc, const char *full_category);
 
-/** Delete the entry for Account pointed to by path, if empty is TRUE then use
- *  delete if empty, path is freed
+/** Delete the entry for Account pointed to by full_category, if empty is TRUE then use
+ *  delete if empty, full_category is freed
  */
-void gnc_account_delete_map_entry (Account *acc, char *path, gboolean empty);
+void gnc_account_delete_map_entry (Account *acc, char *full_category, gboolean empty);
 
 /** @} */
 
diff --git a/src/gnome/dialog-imap-editor.c b/src/gnome/dialog-imap-editor.c
index 4d3891b..771230c 100644
--- a/src/gnome/dialog-imap-editor.c
+++ b/src/gnome/dialog-imap-editor.c
@@ -46,7 +46,7 @@
 
 /** Enumeration for the liststore */
 enum GncImapColumn {SOURCE_FULL_ACC, SOURCE_ACCOUNT, BASED_ON, MATCH_STRING,
-                     MAP_FULL_ACC, MAP_ACCOUNT, KVP_PATH, COUNT};
+                     MAP_FULL_ACC, MAP_ACCOUNT, FULL_CATEGORY, COUNT};
 
 typedef enum
 {
@@ -163,40 +163,40 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
         {
             Account *source_account = NULL;
             gchar   *full_source_account;
-            gchar   *kvp_path;
+            gchar   *full_category;
             gchar   *match_string;
 
             gtk_tree_model_get (model, &iter, SOURCE_ACCOUNT, &source_account, SOURCE_FULL_ACC, &full_source_account,
-                                              KVP_PATH, &kvp_path, MATCH_STRING, &match_string, -1);
+                                              FULL_CATEGORY, &full_category, MATCH_STRING, &match_string, -1);
 
-            PINFO("Account is '%s', Path is '%s', Search is '%s'", full_source_account, kvp_path, match_string);
+            PINFO("Account is '%s', Path is '%s', Search is '%s'", full_source_account, full_category, match_string);
 
             if (source_account != NULL)
             {
-                gnc_account_delete_map_entry (source_account, kvp_path, FALSE);
+                gnc_account_delete_map_entry (source_account, full_category, FALSE);
 
                 if (imap_dialog->type == BAYES)
                 {
-                    kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", match_string);
-                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
+                    full_category = g_strdup_printf (IMAP_FRAME_BAYES "/%s", match_string);
+                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
 
-                    kvp_path = g_strdup_printf (IMAP_FRAME_BAYES);
-                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
+                    full_category = g_strdup_printf (IMAP_FRAME_BAYES);
+                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
                 }
 
                 if (imap_dialog->type == NBAYES)
                 {
-                    kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
-                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
+                    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
+                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
 
-                    kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
-                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
+                    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
+                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
 
-                    kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
-                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
+                    full_category = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
+                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
 
-                    kvp_path = g_strdup_printf (IMAP_FRAME);
-                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
+                    full_category = g_strdup_printf (IMAP_FRAME);
+                    gnc_account_delete_map_entry (source_account, full_category, TRUE);
                 }
             }
             g_free (match_string);
@@ -280,14 +280,12 @@ add_to_store (GtkTreeModel *store, const gchar *text, gpointer user_data)
 
     PINFO("Add to Store: Source Acc '%s', Match '%s', Map Acc '%s'", fullname, imapInfo->match_string, map_fullname);
 
-g_print("Add to Store: Source Acc '%s', Match '%s', Map Acc '%s'\n Path is '%s', Path Head is '%s'\n\n", fullname, imapInfo->match_string, map_fullname, imapInfo->kvp_path, imapInfo->kvp_path_head);
-
     gtk_list_store_set (GTK_LIST_STORE(store), &iter,
                         SOURCE_FULL_ACC, fullname, SOURCE_ACCOUNT, imapInfo->source_account,
                         BASED_ON, text,
                         MATCH_STRING, imapInfo->match_string,
                         MAP_FULL_ACC, map_fullname, MAP_ACCOUNT, imapInfo->map_account,
-                        KVP_PATH, imapInfo->kvp_path, COUNT, imapInfo->count, -1);
+                        FULL_CATEGORY, imapInfo->full_category, COUNT, imapInfo->count, -1);
 
     g_free (fullname);
     g_free (map_fullname);
@@ -322,8 +320,8 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const g
             add_to_store (store, text, imapInfo);
 
             // Free the members and structure
-            g_free (imapInfo->kvp_path_head);
-            g_free (imapInfo->kvp_path);
+            g_free (imapInfo->category_head);
+            g_free (imapInfo->full_category);
             g_free (imapInfo->match_string);
             g_free (imapInfo->count);
             g_free (imapInfo);
@@ -412,9 +410,9 @@ get_account_info_online (GList *accts, GtkTreeModel *store)
         // Save source account
         imapInfo.source_account = acc;
 
-        imapInfo.kvp_path = "online_id";
+        imapInfo.full_category = "online_id";
 
-        text = gnc_account_get_map_entry (acc, imapInfo.kvp_path);
+        text = gnc_account_get_map_entry (acc, imapInfo.full_category);
 
         if (text != NULL)
         {

commit 43e122ca9c875e1962833f976d0cf6bad396b710
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Dec 28 10:49:18 2015 +0000

    Rename some functions and structures based on imap

diff --git a/src/engine/Account.c b/src/engine/Account.c
index c3c5ca8..8710537 100644
--- a/src/engine/Account.c
+++ b/src/engine/Account.c
@@ -5495,12 +5495,12 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
     gchar       *kvp_path;
     gchar       *count;
 
-    struct kvp_info *kvpInfo_node;
+    struct imap_info *imapInfo_node;
 
-    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
+    struct imap_info *imapInfo = (struct imap_info*)user_data;
 
     // Get the book
-    book = qof_instance_get_book (kvpInfo->source_account);
+    book = qof_instance_get_book (imapInfo->source_account);
     root = gnc_book_get_root_account (book);
 
     PINFO("build_bayes_layer_two: account '%s', token_count: '%" G_GINT64_FORMAT "'",
@@ -5508,20 +5508,20 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
 
     count = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (value));
 
-    kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
+    kvp_path = g_strconcat (imapInfo->kvp_path_head, "/", key, NULL);
 
     PINFO("build_bayes_layer_two: kvp_path is '%s'", kvp_path);
 
-    kvpInfo_node = g_malloc(sizeof(*kvpInfo_node));
+    imapInfo_node = g_malloc(sizeof(*imapInfo_node));
 
-    kvpInfo_node->source_account = kvpInfo->source_account;
-    kvpInfo_node->map_account    = gnc_account_lookup_by_full_name (root, key);
-    kvpInfo_node->kvp_path       = g_strdup (kvp_path);
-    kvpInfo_node->match_string   = g_strdup (kvpInfo->match_string);
-    kvpInfo_node->kvp_path_head  = g_strdup (kvpInfo->kvp_path_head);
-    kvpInfo_node->count          = g_strdup (count);
+    imapInfo_node->source_account = imapInfo->source_account;
+    imapInfo_node->map_account    = gnc_account_lookup_by_full_name (root, key);
+    imapInfo_node->kvp_path       = g_strdup (kvp_path);
+    imapInfo_node->match_string   = g_strdup (imapInfo->match_string);
+    imapInfo_node->kvp_path_head  = g_strdup (imapInfo->kvp_path_head);
+    imapInfo_node->count          = g_strdup (count);
 
-    kvpInfo->list = g_list_append (kvpInfo->list, kvpInfo_node);
+    imapInfo->list = g_list_append (imapInfo->list, imapInfo_node);
 
     g_free (kvp_path);
     g_free (count);
@@ -5531,8 +5531,8 @@ static void
 build_bayes (const char *key, const GValue *value, gpointer user_data)
 {
     gchar *kvp_path;
-    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
-    struct kvp_info  kvpInfol2;
+    struct imap_info *imapInfo = (struct imap_info*)user_data;
+    struct imap_info  imapInfol2;
 
     PINFO("build_bayes: match string '%s'", (char*)key);
 
@@ -5540,21 +5540,21 @@ build_bayes (const char *key, const GValue *value, gpointer user_data)
     {
         kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", key);
 
-        if (qof_instance_has_slot (QOF_INSTANCE(kvpInfo->source_account), kvp_path))
+        if (qof_instance_has_slot (QOF_INSTANCE(imapInfo->source_account), kvp_path))
         {
             PINFO("build_bayes: kvp_path is '%s', key '%s'", kvp_path, key);
 
-            kvpInfol2.source_account = kvpInfo->source_account;
-            kvpInfol2.match_string   = g_strdup (key);
-            kvpInfol2.kvp_path_head  = g_strdup (kvp_path);
-            kvpInfol2.list           = kvpInfo->list;
+            imapInfol2.source_account = imapInfo->source_account;
+            imapInfol2.match_string   = g_strdup (key);
+            imapInfol2.kvp_path_head  = g_strdup (kvp_path);
+            imapInfol2.list           = imapInfo->list;
 
-            qof_instance_foreach_slot (QOF_INSTANCE(kvpInfo->source_account), kvp_path,
-                                       build_bayes_layer_two, &kvpInfol2);
+            qof_instance_foreach_slot (QOF_INSTANCE(imapInfo->source_account), kvp_path,
+                                       build_bayes_layer_two, &imapInfol2);
 
-            kvpInfo->list = kvpInfol2.list;
-            g_free (kvpInfol2.match_string);
-            g_free (kvpInfol2.kvp_path_head);
+            imapInfo->list = imapInfol2.list;
+            g_free (imapInfol2.match_string);
+            g_free (imapInfol2.kvp_path_head);
         }
         g_free (kvp_path);
     }
@@ -5571,12 +5571,12 @@ build_non_bayes (const char *key, const GValue *value, gpointer user_data)
         gchar       *kvp_path;
         gchar       *guid_string = NULL;
 
-        struct kvp_info *kvpInfo_node;
+        struct imap_info *imapInfo_node;
 
-        struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
+        struct imap_info *imapInfo = (struct imap_info*)user_data;
 
         // Get the book
-        book = qof_instance_get_book (kvpInfo->source_account);
+        book = qof_instance_get_book (imapInfo->source_account);
 
         guid = (GncGUID*)g_value_get_boxed (value);
         guid_string = guid_to_string (guid);
@@ -5584,20 +5584,20 @@ build_non_bayes (const char *key, const GValue *value, gpointer user_data)
         PINFO("build_non_bayes: account '%s', match account guid: '%s'",
                                 (char*)key, guid_string);
 
-        kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
+        kvp_path = g_strconcat (imapInfo->kvp_path_head, "/", key, NULL);
 
         PINFO("build_non_bayes: kvp_path is '%s'", kvp_path);
 
-        kvpInfo_node = g_malloc(sizeof(*kvpInfo_node));
+        imapInfo_node = g_malloc(sizeof(*imapInfo_node));
 
-        kvpInfo_node->source_account = kvpInfo->source_account;
-        kvpInfo_node->map_account    = xaccAccountLookup (guid, book);
-        kvpInfo_node->kvp_path       = g_strdup (kvp_path);
-        kvpInfo_node->match_string   = g_strdup (key);
-        kvpInfo_node->kvp_path_head  = g_strdup (kvpInfo->kvp_path_head);
-        kvpInfo_node->count          = g_strdup (" ");
+        imapInfo_node->source_account = imapInfo->source_account;
+        imapInfo_node->map_account    = xaccAccountLookup (guid, book);
+        imapInfo_node->kvp_path       = g_strdup (kvp_path);
+        imapInfo_node->match_string   = g_strdup (key);
+        imapInfo_node->kvp_path_head  = g_strdup (imapInfo->kvp_path_head);
+        imapInfo_node->count          = g_strdup (" ");
 
-        kvpInfo->list = g_list_append (kvpInfo->list, kvpInfo_node);
+        imapInfo->list = g_list_append (imapInfo->list, imapInfo_node);
 
         g_free (kvp_path);
         g_free (guid_string);
@@ -5606,20 +5606,20 @@ build_non_bayes (const char *key, const GValue *value, gpointer user_data)
 
 
 GList *
-gnc_account_imap_get_info_bayes (Account *acc, const char *category)
+gnc_account_imap_get_info_bayes (Account *acc)
 {
     GList *list = NULL;
 
-    struct kvp_info kvpInfo;
+    struct imap_info imapInfo;
 
-    kvpInfo.source_account = acc;
-    kvpInfo.list = list;
+    imapInfo.source_account = acc;
+    imapInfo.list = list;
 
     if (qof_instance_has_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES))
         qof_instance_foreach_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES,
-                                   build_bayes, &kvpInfo);
+                                   build_bayes, &imapInfo);
 
-    return kvpInfo.list;
+    return imapInfo.list;
 }
 
 
@@ -5629,27 +5629,27 @@ gnc_account_imap_get_info (Account *acc, const char *category)
     GList *list = NULL;
     gchar *kvp_path_head = NULL;
 
-    struct kvp_info kvpInfo;
+    struct imap_info imapInfo;
 
-    kvpInfo.source_account = acc;
-    kvpInfo.list = list;
+    imapInfo.source_account = acc;
+    imapInfo.list = list;
 
     kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", category);
-    kvpInfo.kvp_path_head = kvp_path_head;
+    imapInfo.kvp_path_head = kvp_path_head;
 
     if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
         qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head,
-                                   build_non_bayes, &kvpInfo);
+                                   build_non_bayes, &imapInfo);
 
     g_free (kvp_path_head);
 
-    return kvpInfo.list;
+    return imapInfo.list;
 }
 
 /*******************************************************************************/
 
 gchar *
-gnc_account_get_kvp_text (Account *acc, const char *kvp_path)
+gnc_account_get_map_entry (Account *acc, const char *kvp_path)
 {
     GValue v = G_VALUE_INIT;
     gchar *text = NULL;
@@ -5670,7 +5670,7 @@ gnc_account_get_kvp_text (Account *acc, const char *kvp_path)
 
 
 void
-gnc_account_delete_kvp (Account *acc, char *kvp_path, gboolean empty)
+gnc_account_delete_map_entry (Account *acc, char *kvp_path, gboolean empty)
 {
     if ((acc != NULL) && qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path))
     {
diff --git a/src/engine/Account.h b/src/engine/Account.h
index 78dab44..e26925d 100644
--- a/src/engine/Account.h
+++ b/src/engine/Account.h
@@ -1406,7 +1406,7 @@ Account* gnc_account_imap_find_account_bayes (GncImportMatchMap *imap, GList* to
 void gnc_account_imap_add_account_bayes (GncImportMatchMap *imap, GList* tokens,
                                          Account *acc);
 
-struct kvp_info
+struct imap_info
 {
     Account        *source_account;
     Account        *map_account;
@@ -1417,25 +1417,25 @@ struct kvp_info
     char           *count;
 };
 
-/** Returns a GList of structure kvp_info of all Bayesian mappings for
+/** Returns a GList of structure imap_info of all Bayesian mappings for
  *  required Account
  */
-GList *gnc_account_imap_get_info_bayes (Account *acc, const char *category);
+GList *gnc_account_imap_get_info_bayes (Account *acc);
 
-/** Returns a GList of structure kvp_info of all Non Bayesian mappings for
+/** Returns a GList of structure imap_info of all Non Bayesian mappings for
  *  required Account
  */
 GList *gnc_account_imap_get_info (Account *acc, const char *category);
 
-/** Returns the text string pointed to by kvp_path for the Account, free
+/** Returns the text string pointed to by path for the Account, free
  *  the returned text
  */
-gchar *gnc_account_get_kvp_text (Account *acc, const char *kvp_path);
+gchar *gnc_account_get_map_entry (Account *acc, const char *path);
 
-/** Delete the kvp_path for the Account, if empty is TRUE then use
- *  delete if empty, kvp_path is freed
+/** Delete the entry for Account pointed to by path, if empty is TRUE then use
+ *  delete if empty, path is freed
  */
-void gnc_account_delete_kvp (Account *acc, char *kvp_path, gboolean empty);
+void gnc_account_delete_map_entry (Account *acc, char *path, gboolean empty);
 
 /** @} */
 
diff --git a/src/gnome/dialog-imap-editor.c b/src/gnome/dialog-imap-editor.c
index 293bcb5..4d3891b 100644
--- a/src/gnome/dialog-imap-editor.c
+++ b/src/gnome/dialog-imap-editor.c
@@ -173,30 +173,30 @@ gnc_imap_dialog_delete (ImapDialog *imap_dialog)
 
             if (source_account != NULL)
             {
-                gnc_account_delete_kvp (source_account, kvp_path, FALSE);
+                gnc_account_delete_map_entry (source_account, kvp_path, FALSE);
 
                 if (imap_dialog->type == BAYES)
                 {
                     kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", match_string);
-                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
+                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
 
                     kvp_path = g_strdup_printf (IMAP_FRAME_BAYES);
-                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
+                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
                 }
 
                 if (imap_dialog->type == NBAYES)
                 {
                     kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
-                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
+                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
 
                     kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
-                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
+                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
 
                     kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
-                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
+                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
 
                     kvp_path = g_strdup_printf (IMAP_FRAME);
-                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
+                    gnc_account_delete_map_entry (source_account, kvp_path, TRUE);
                 }
             }
             g_free (match_string);
@@ -270,22 +270,24 @@ add_to_store (GtkTreeModel *store, const gchar *text, gpointer user_data)
     gchar       *fullname = NULL;
     gchar       *map_fullname = NULL;
 
-    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
+    struct imap_info *imapInfo = (struct imap_info*)user_data;
 
     gtk_list_store_append (GTK_LIST_STORE(store), &iter);
 
-    fullname = gnc_account_get_full_name (kvpInfo->source_account);
+    fullname = gnc_account_get_full_name (imapInfo->source_account);
 
-    map_fullname = gnc_account_get_full_name (kvpInfo->map_account);
+    map_fullname = gnc_account_get_full_name (imapInfo->map_account);
 
-    PINFO("Add to Store: Source Acc '%s', Match '%s', Map Acc '%s'", fullname, kvpInfo->match_string, map_fullname);
+    PINFO("Add to Store: Source Acc '%s', Match '%s', Map Acc '%s'", fullname, imapInfo->match_string, map_fullname);
+
+g_print("Add to Store: Source Acc '%s', Match '%s', Map Acc '%s'\n Path is '%s', Path Head is '%s'\n\n", fullname, imapInfo->match_string, map_fullname, imapInfo->kvp_path, imapInfo->kvp_path_head);
 
     gtk_list_store_set (GTK_LIST_STORE(store), &iter,
-                        SOURCE_FULL_ACC, fullname, SOURCE_ACCOUNT, kvpInfo->source_account,
+                        SOURCE_FULL_ACC, fullname, SOURCE_ACCOUNT, imapInfo->source_account,
                         BASED_ON, text,
-                        MATCH_STRING, kvpInfo->match_string,
-                        MAP_FULL_ACC, map_fullname, MAP_ACCOUNT, kvpInfo->map_account,
-                        KVP_PATH, kvpInfo->kvp_path, COUNT, kvpInfo->count, -1);
+                        MATCH_STRING, imapInfo->match_string,
+                        MAP_FULL_ACC, map_fullname, MAP_ACCOUNT, imapInfo->map_account,
+                        KVP_PATH, imapInfo->kvp_path, COUNT, imapInfo->count, -1);
 
     g_free (fullname);
     g_free (map_fullname);
@@ -294,7 +296,7 @@ add_to_store (GtkTreeModel *store, const gchar *text, gpointer user_data)
 static void
 get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const gchar *text)
 {
-    GList *kvp_list, *node;
+    GList *imap_list, *node;
     gchar *acc_name = NULL;
 
     acc_name = gnc_account_get_full_name (acc);
@@ -302,55 +304,59 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const g
     g_free (acc_name);
 
     if (category == NULL) // For Bayesian, category is NULL
-        kvp_list = gnc_account_imap_get_info_bayes (acc, category);
+        imap_list = gnc_account_imap_get_info_bayes (acc);
     else
-        kvp_list = gnc_account_imap_get_info (acc, category);
+        imap_list = gnc_account_imap_get_info (acc, category);
 
-    if (g_list_length (kvp_list) > 0)
+    if (g_list_length (imap_list) > 0)
     {
-        PINFO("List length is %d", g_list_length (kvp_list));
+        PINFO("List length is %d", g_list_length (imap_list));
 
-        for (node = kvp_list;  node; node = g_list_next (node))
+        for (node = imap_list;  node; node = g_list_next (node))
         {
-            struct kvp_info *kvpInfo;
+            struct imap_info *imapInfo;
 
-            kvpInfo = node->data;
+            imapInfo = node->data;
 
             // Add to store
-            add_to_store (store, text, kvpInfo);
+            add_to_store (store, text, imapInfo);
 
             // Free the members and structure
-            g_free (kvpInfo->kvp_path_head);
-            g_free (kvpInfo->kvp_path);
-            g_free (kvpInfo->match_string);
-            g_free (kvpInfo->count);
-            g_free (kvpInfo);
+            g_free (imapInfo->kvp_path_head);
+            g_free (imapInfo->kvp_path);
+            g_free (imapInfo->match_string);
+            g_free (imapInfo->count);
+            g_free (imapInfo);
         }
     }
     // Free the list
-    g_list_free (kvp_list);
+    g_list_free (imap_list);
 }
 
 static void
-get_account_info (ImapDialog *imap_dialog)
+show_first_row (ImapDialog *imap_dialog)
 {
-    Account *root;
-    Account *acc;
-    GList   *accts, *ptr;
     GtkTreeIter iter;
     GtkTreeModel *store;
 
-    struct kvp_info kvpInfo;
+    store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
 
-    /* Get list of Accounts */
-    root = gnc_book_get_root_account (gnc_get_current_book());
-    accts = gnc_account_get_descendants_sorted (root);
+    // See if there are any entries
+    if (gtk_tree_model_get_iter_first (store, &iter))
+    {
+        GtkTreePath *path;
+        path = gtk_tree_path_new_first (); // Set Path to first entry
+        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(imap_dialog->view), path, NULL, TRUE, 0.0, 0.0);
+        gtk_tree_path_free (path);
+    }
+}
 
-    store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
-    gtk_list_store_clear (GTK_LIST_STORE(store));
+static void
+get_account_info_bayes (GList *accts, GtkTreeModel *store)
+{
+    GList   *ptr;
 
-    // Hide Count Column
-    show_count_column (imap_dialog, FALSE);
+    struct imap_info imapInfo;
 
     /* Go through list of accounts */
     for (ptr = accts; ptr; ptr = g_list_next (ptr))
@@ -358,52 +364,108 @@ get_account_info (ImapDialog *imap_dialog)
         Account *acc = ptr->data;
 
         // Save source account
-        kvpInfo.source_account = acc;
+        imapInfo.source_account = acc;
 
-        if (imap_dialog->type == BAYES)
-        {
-            get_imap_info (acc, NULL, store, _("Bayesian"));
+        get_imap_info (acc, NULL, store, _("Bayesian"));
+    }
+}
 
-            // Show Count Column
-            show_count_column (imap_dialog, TRUE);
-        }
+static void
+get_account_info_nbayes (GList *accts, GtkTreeModel *store)
+{
+    GList   *ptr;
+
+    struct imap_info imapInfo;
+
+    /* Go through list of accounts */
+    for (ptr = accts; ptr; ptr = g_list_next (ptr))
+    {
+        Account *acc = ptr->data;
+
+        // Save source account
+        imapInfo.source_account = acc;
+
+        // Description
+        get_imap_info (acc, IMAP_FRAME_DESC, store, _("Description Field"));
+
+        // Memo
+        get_imap_info (acc, IMAP_FRAME_MEMO, store, _("Memo Field"));
+
+        // CSV Account Map
+        get_imap_info (acc, IMAP_FRAME_CSV, store, _("CSV Account Map"));
+    }
+}
 
-        if (imap_dialog->type == NBAYES)
+static void
+get_account_info_online (GList *accts, GtkTreeModel *store)
+{
+    GList   *ptr;
+
+    struct imap_info imapInfo;
+
+    /* Go through list of accounts */
+    for (ptr = accts; ptr; ptr = g_list_next (ptr))
+    {
+        gchar  *text = NULL;
+        Account *acc = ptr->data;
+
+        // Save source account
+        imapInfo.source_account = acc;
+
+        imapInfo.kvp_path = "online_id";
+
+        text = gnc_account_get_map_entry (acc, imapInfo.kvp_path);
+
+        if (text != NULL)
         {
-            // Description
-            get_imap_info (acc, IMAP_FRAME_DESC, store, _("Description Field"));
+            if (g_strcmp0 (text, "") == 0)
+                imapInfo.map_account = NULL;
+            else
+                imapInfo.map_account = imapInfo.source_account;
 
-            // Memo
-            get_imap_info (acc, IMAP_FRAME_MEMO, store, _("Memo Field"));
+            imapInfo.match_string  = text;
+            imapInfo.count = " ";
 
-            // CSV Account Map
-            get_imap_info (acc, IMAP_FRAME_CSV, store, _("CSV Account Map"));
+            // Add imap data to store
+            add_to_store (store, _("Online Id"), &imapInfo);
         }
+        g_free (text);
+    }
+}
 
-        if (imap_dialog->type == ONLINE)
-        {
-            gchar *text = NULL;
+static void
+get_account_info (ImapDialog *imap_dialog)
+{
+    Account *root;
+    GList   *accts;
+    GtkTreeIter iter;
+    GtkTreeModel *store;
 
-            kvpInfo.kvp_path = "online_id";
+    /* Get list of Accounts */
+    root = gnc_book_get_root_account (gnc_get_current_book());
+    accts = gnc_account_get_descendants_sorted (root);
 
-            text = gnc_account_get_kvp_text (acc, kvpInfo.kvp_path);
+    store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
+    gtk_list_store_clear (GTK_LIST_STORE(store));
 
-            if (text != NULL)
-            {
-                if (g_strcmp0 (text, "") == 0)
-                    kvpInfo.map_account = NULL;
-                else
-                    kvpInfo.map_account = kvpInfo.source_account;
+    // Hide Count Column
+    show_count_column (imap_dialog, FALSE);
 
-                kvpInfo.match_string  = text;
-                kvpInfo.count = " ";
+    if (imap_dialog->type == BAYES)
+    {
+        get_account_info_bayes (accts, store);
 
-                // Add kvp data to store
-                add_to_store (store, _("Online Id"), &kvpInfo);
-            }
-            g_free (text);
-        }
+        // Show Count Column
+        show_count_column (imap_dialog, TRUE);
     }
+    else if (imap_dialog->type == NBAYES)
+        get_account_info_nbayes (accts, store);
+    else if (imap_dialog->type == ONLINE)
+        get_account_info_online (accts, store);
+
+    // if there are any entries, show first row
+    show_first_row (imap_dialog);
+
     g_list_free (accts);
 }
 

commit 8a536d41528286dcc90cae8d8e6a416a6db05f17
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Dec 17 16:16:53 2015 +0000

    Rename probability to count.

diff --git a/src/engine/Account.c b/src/engine/Account.c
index b090ecd..c3c5ca8 100644
--- a/src/engine/Account.c
+++ b/src/engine/Account.c
@@ -5493,7 +5493,7 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
     QofBook     *book;
     Account     *root;
     gchar       *kvp_path;
-    gchar       *probability;
+    gchar       *count;
 
     struct kvp_info *kvpInfo_node;
 
@@ -5506,7 +5506,7 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
     PINFO("build_bayes_layer_two: account '%s', token_count: '%" G_GINT64_FORMAT "'",
                                   (char*)key, g_value_get_int64(value));
 
-    probability = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (value));
+    count = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (value));
 
     kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
 
@@ -5519,12 +5519,12 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
     kvpInfo_node->kvp_path       = g_strdup (kvp_path);
     kvpInfo_node->match_string   = g_strdup (kvpInfo->match_string);
     kvpInfo_node->kvp_path_head  = g_strdup (kvpInfo->kvp_path_head);
-    kvpInfo_node->probability    = g_strdup (probability);
+    kvpInfo_node->count          = g_strdup (count);
 
     kvpInfo->list = g_list_append (kvpInfo->list, kvpInfo_node);
 
     g_free (kvp_path);
-    g_free (probability);
+    g_free (count);
 }
 
 static void
@@ -5595,7 +5595,7 @@ build_non_bayes (const char *key, const GValue *value, gpointer user_data)
         kvpInfo_node->kvp_path       = g_strdup (kvp_path);
         kvpInfo_node->match_string   = g_strdup (key);
         kvpInfo_node->kvp_path_head  = g_strdup (kvpInfo->kvp_path_head);
-        kvpInfo_node->probability    = g_strdup (" ");
+        kvpInfo_node->count          = g_strdup (" ");
 
         kvpInfo->list = g_list_append (kvpInfo->list, kvpInfo_node);
 
diff --git a/src/engine/Account.h b/src/engine/Account.h
index 85c92f5..78dab44 100644
--- a/src/engine/Account.h
+++ b/src/engine/Account.h
@@ -1414,7 +1414,7 @@ struct kvp_info
     char           *kvp_path_head;
     char           *kvp_path;
     char           *match_string;
-    char           *probability;
+    char           *count;
 };
 
 /** Returns a GList of structure kvp_info of all Bayesian mappings for
diff --git a/src/gnome/dialog-imap-editor.c b/src/gnome/dialog-imap-editor.c
index 2d8ce41..293bcb5 100644
--- a/src/gnome/dialog-imap-editor.c
+++ b/src/gnome/dialog-imap-editor.c
@@ -46,7 +46,7 @@
 
 /** Enumeration for the liststore */
 enum GncImapColumn {SOURCE_FULL_ACC, SOURCE_ACCOUNT, BASED_ON, MATCH_STRING,
-                     MAP_FULL_ACC, MAP_ACCOUNT, KVP_PATH, PROBABILITY};
+                     MAP_FULL_ACC, MAP_ACCOUNT, KVP_PATH, COUNT};
 
 typedef enum
 {
@@ -248,17 +248,19 @@ list_type_selected (GtkToggleButton* button, ImapDialog *imap_dialog)
 }
 
 static void
-show_probability_column (ImapDialog *imap_dialog, gboolean show)
+show_count_column (ImapDialog *imap_dialog, gboolean show)
 {
     GtkTreeViewColumn *tree_column;
 
-    // Show Probability Column
+    // Show Count Column
     tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW(imap_dialog->view), 4);
     gtk_tree_view_column_set_visible (tree_column, show);
 
     // Hide Based on Column
     tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW(imap_dialog->view), 1);
     gtk_tree_view_column_set_visible (tree_column, !show);
+
+    gtk_tree_view_columns_autosize (GTK_TREE_VIEW(imap_dialog->view));
 }
 
 static void
@@ -283,7 +285,7 @@ add_to_store (GtkTreeModel *store, const gchar *text, gpointer user_data)
                         BASED_ON, text,
                         MATCH_STRING, kvpInfo->match_string,
                         MAP_FULL_ACC, map_fullname, MAP_ACCOUNT, kvpInfo->map_account,
-                        KVP_PATH, kvpInfo->kvp_path, PROBABILITY, kvpInfo->probability, -1);
+                        KVP_PATH, kvpInfo->kvp_path, COUNT, kvpInfo->count, -1);
 
     g_free (fullname);
     g_free (map_fullname);
@@ -321,7 +323,7 @@ get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const g
             g_free (kvpInfo->kvp_path_head);
             g_free (kvpInfo->kvp_path);
             g_free (kvpInfo->match_string);
-            g_free (kvpInfo->probability);
+            g_free (kvpInfo->count);
             g_free (kvpInfo);
         }
     }
@@ -347,8 +349,8 @@ get_account_info (ImapDialog *imap_dialog)
     store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
     gtk_list_store_clear (GTK_LIST_STORE(store));
 
-    // Hide Probability Column
-    show_probability_column (imap_dialog, FALSE);
+    // Hide Count Column
+    show_count_column (imap_dialog, FALSE);
 
     /* Go through list of accounts */
     for (ptr = accts; ptr; ptr = g_list_next (ptr))
@@ -362,8 +364,8 @@ get_account_info (ImapDialog *imap_dialog)
         {
             get_imap_info (acc, NULL, store, _("Bayesian"));
 
-            // Show Probability Column
-            show_probability_column (imap_dialog, TRUE);
+            // Show Count Column
+            show_count_column (imap_dialog, TRUE);
         }
 
         if (imap_dialog->type == NBAYES)
@@ -394,7 +396,7 @@ get_account_info (ImapDialog *imap_dialog)
                     kvpInfo.map_account = kvpInfo.source_account;
 
                 kvpInfo.match_string  = text;
-                kvpInfo.probability = " ";
+                kvpInfo.count = " ";
 
                 // Add kvp data to store
                 add_to_store (store, _("Online Id"), &kvpInfo);
diff --git a/src/gnome/gtkbuilder/dialog-imap-editor.glade b/src/gnome/gtkbuilder/dialog-imap-editor.glade
index 5547c2b..be54802 100644
--- a/src/gnome/gtkbuilder/dialog-imap-editor.glade
+++ b/src/gnome/gtkbuilder/dialog-imap-editor.glade
@@ -16,9 +16,9 @@
       <column type="gchararray"/>
       <!-- column-name map_account -->
       <column type="gpointer"/>
-      <!-- column-name kvp_path -->
+      <!-- column-name path -->
       <column type="gchararray"/>
-      <!-- column-name probability -->
+      <!-- column-name count -->
       <column type="gchararray"/>
     </columns>
   </object>
@@ -208,9 +208,9 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkTreeViewColumn" id="probability">
+                  <object class="GtkTreeViewColumn" id="count">
                     <property name="resizable">True</property>
-                    <property name="title" translatable="yes">Probability Value</property>
+                    <property name="title" translatable="yes">Count of Match String Usage</property>
                     <child>
                       <object class="GtkCellRendererText" id="cellrenderertext5"/>
                       <attributes>

commit 83f2a35e777bb659b0fa0979d566f859ea68ae72
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Dec 17 14:52:16 2015 +0000

    Rename files and functions based on bayes to imap

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8b815da..d17fe3d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -204,11 +204,11 @@ src/gnome/assistant-acct-period.c
 src/gnome/assistant-hierarchy.c
 src/gnome/assistant-loan.c
 src/gnome/assistant-stock-split.c
-src/gnome/dialog-bayes-editor.c
 src/gnome/dialog-commodities.c
 src/gnome/dialog-fincalc.c
 src/gnome/dialog-find-transactions2.c
 src/gnome/dialog-find-transactions.c
+src/gnome/dialog-imap-editor.c
 src/gnome/dialog-lot-viewer.c
 src/gnome/dialog-new-user.c
 src/gnome/dialog-price-edit-db.c
@@ -247,9 +247,9 @@ src/gnome/gtkbuilder/assistant-acct-period.glade
 src/gnome/gtkbuilder/assistant-hierarchy.glade
 src/gnome/gtkbuilder/assistant-loan.glade
 src/gnome/gtkbuilder/assistant-stock-split.glade
-src/gnome/gtkbuilder/dialog-bayes-editor.glade
 src/gnome/gtkbuilder/dialog-commodities.glade
 src/gnome/gtkbuilder/dialog-fincalc.glade
+src/gnome/gtkbuilder/dialog-imap-editor.glade
 src/gnome/gtkbuilder/dialog-lot-viewer.glade
 src/gnome/gtkbuilder/dialog-new-user.glade
 src/gnome/gtkbuilder/dialog-price.glade
diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am
index 4da52dd..e918551 100644
--- a/src/gnome/Makefile.am
+++ b/src/gnome/Makefile.am
@@ -28,11 +28,11 @@ libgnc_gnome_la_SOURCES = \
   assistant-hierarchy.c \
   assistant-loan.c \
   assistant-stock-split.c \
-  dialog-bayes-editor.c \
   dialog-commodities.c \
   dialog-fincalc.c \
   dialog-find-transactions.c \
   dialog-find-transactions2.c \
+  dialog-imap-editor.c \
   dialog-lot-viewer.c \
   dialog-new-user.c \
   dialog-price-editor.c \
@@ -82,10 +82,10 @@ noinst_HEADERS = \
   assistant-hierarchy.h \
   assistant-loan.h \
   assistant-stock-split.h \
-  dialog-bayes-editor.h \
   dialog-fincalc.h \
   dialog-find-transactions.h \
   dialog-find-transactions2.h \
+  dialog-imap-editor.h \
   dialog-lot-viewer.h \
   dialog-new-user.h \
   dialog-print-check.h \
diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-imap-editor.c
similarity index 68%
rename from src/gnome/dialog-bayes-editor.c
rename to src/gnome/dialog-imap-editor.c
index 9be3394..2d8ce41 100644
--- a/src/gnome/dialog-bayes-editor.c
+++ b/src/gnome/dialog-imap-editor.c
@@ -1,5 +1,5 @@
 /********************************************************************\
- * dialog-bayes-editor.c -- Bayesian and Non Bayesian editor dialog *
+ * dialog-imap-editor.c -- Import Map Editor dialog                 *
  * Copyright (C) 2015 Robert Fewell                                 *
  *                                                                  *
  * This program is free software; you can redistribute it and/or    *
@@ -25,7 +25,7 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
-#include "dialog-bayes-editor.h"
+#include "dialog-imap-editor.h"
 
 #include "dialog-utils.h"
 #include "gnc-component-manager.h"
@@ -34,8 +34,8 @@
 #include "gnc-ui-util.h"
 #include "Account.h"
 
-#define DIALOG_BAYES_CM_CLASS   "dialog-bayes-edit"
-#define GNC_PREFS_GROUP         "dialogs.bayes-editor"
+#define DIALOG_IMAP_CM_CLASS    "dialog-imap-edit"
+#define GNC_PREFS_GROUP         "dialogs.imap-editor"
 
 #define IMAP_FRAME_BAYES        "import-map-bayes"
 #define IMAP_FRAME              "import-map"
@@ -45,7 +45,7 @@
 #define IMAP_FRAME_CSV          "csv-account-map"
 
 /** Enumeration for the liststore */
-enum GncBayesColumn {SOURCE_FULL_ACC, SOURCE_ACCOUNT, BASED_ON, MATCH_STRING,
+enum GncImapColumn {SOURCE_FULL_ACC, SOURCE_ACCOUNT, BASED_ON, MATCH_STRING,
                      MAP_FULL_ACC, MAP_ACCOUNT, KVP_PATH, PROBABILITY};
 
 typedef enum
@@ -67,53 +67,53 @@ typedef struct
     GtkWidget    *radio_nbayes;
     GtkWidget    *radio_online;
 
-}BayesDialog;
+}ImapDialog;
 
 
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = GNC_MOD_GUI;
 
-void gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data);
-void gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer user_data);
-void gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data);
+void gnc_imap_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data);
+void gnc_imap_dialog_close_cb (GtkDialog *dialog, gpointer user_data);
+void gnc_imap_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data);
 
-static void get_account_info (BayesDialog *bayes_dialog);
+static void get_account_info (ImapDialog *imap_dialog);
 
 void
-gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
+gnc_imap_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
 {
-    BayesDialog *bayes_dialog = user_data;
+    ImapDialog *imap_dialog = user_data;
 
     ENTER(" ");
-    gnc_unregister_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
+    gnc_unregister_gui_component_by_data (DIALOG_IMAP_CM_CLASS, imap_dialog);
 
-    if (bayes_dialog->dialog)
+    if (imap_dialog->dialog)
     {
-        gtk_widget_destroy (bayes_dialog->dialog);
-        bayes_dialog->dialog = NULL;
+        gtk_widget_destroy (imap_dialog->dialog);
+        imap_dialog->dialog = NULL;
     }
-    g_free (bayes_dialog);
+    g_free (imap_dialog);
     LEAVE(" ");
 }
 
 void
-gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer user_data)
+gnc_imap_dialog_close_cb (GtkDialog *dialog, gpointer user_data)
 {
-    BayesDialog *bayes_dialog = user_data;
+    ImapDialog *imap_dialog = user_data;
 
     ENTER(" ");
-    gnc_close_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
+    gnc_close_gui_component_by_data (DIALOG_IMAP_CM_CLASS, imap_dialog);
     LEAVE(" ");
 }
 
 static gboolean
-are_you_sure (BayesDialog *bayes_dialog)
+are_you_sure (ImapDialog *imap_dialog)
 {
     GtkWidget   *dialog;
     gint         response;
     const char  *title = _("Are you sure you want to delete the entries ?");
 
-    dialog = gtk_message_dialog_new (GTK_WINDOW (bayes_dialog->dialog),
+    dialog = gtk_message_dialog_new (GTK_WINDOW (imap_dialog->dialog),
                                      GTK_DIALOG_DESTROY_WITH_PARENT,
                                      GTK_MESSAGE_QUESTION,
                                      GTK_BUTTONS_CANCEL,
@@ -134,15 +134,15 @@ are_you_sure (BayesDialog *bayes_dialog)
 }
 
 static void
-gnc_bayes_dialog_delete (BayesDialog *bayes_dialog)
+gnc_imap_dialog_delete (ImapDialog *imap_dialog)
 {
     GList            *list, *row;
     GtkTreeModel     *model;
     GtkTreeIter       iter;
     GtkTreeSelection *selection;
 
-    model = gtk_tree_view_get_model (GTK_TREE_VIEW(bayes_dialog->view));
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(bayes_dialog->view));
+    model = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(imap_dialog->view));
 
     list = gtk_tree_selection_get_selected_rows (selection, &model);
 
@@ -151,7 +151,7 @@ gnc_bayes_dialog_delete (BayesDialog *bayes_dialog)
         return;
 
     // Are we sure we want to delete the entries
-    if (are_you_sure (bayes_dialog) == FALSE)
+    if (are_you_sure (imap_dialog) == FALSE)
         return;
 
     // reverse list
@@ -175,7 +175,7 @@ gnc_bayes_dialog_delete (BayesDialog *bayes_dialog)
             {
                 gnc_account_delete_kvp (source_account, kvp_path, FALSE);
 
-                if (bayes_dialog->type == BAYES)
+                if (imap_dialog->type == BAYES)
                 {
                     kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", match_string);
                     gnc_account_delete_kvp (source_account, kvp_path, TRUE);
@@ -184,7 +184,7 @@ gnc_bayes_dialog_delete (BayesDialog *bayes_dialog)
                     gnc_account_delete_kvp (source_account, kvp_path, TRUE);
                 }
 
-                if (bayes_dialog->type == NBAYES)
+                if (imap_dialog->type == NBAYES)
                 {
                     kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
                     gnc_account_delete_kvp (source_account, kvp_path, TRUE);
@@ -206,58 +206,58 @@ gnc_bayes_dialog_delete (BayesDialog *bayes_dialog)
     g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
     g_list_free (list);
 
-    get_account_info (bayes_dialog);
+    get_account_info (imap_dialog);
 }
 
 void
-gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data)
+gnc_imap_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data)
 {
-    BayesDialog *bayes_dialog = user_data;
+    ImapDialog *imap_dialog = user_data;
 
     switch (response_id)
     {
     case GTK_RESPONSE_APPLY:
-        gnc_bayes_dialog_delete (bayes_dialog);
+        gnc_imap_dialog_delete (imap_dialog);
         return;
 
     case GTK_RESPONSE_CLOSE:
     default:
-        gnc_close_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
+        gnc_close_gui_component_by_data (DIALOG_IMAP_CM_CLASS, imap_dialog);
         return;
     }
 }
 
 static void
-list_type_selected (GtkToggleButton* button, BayesDialog *bayes_dialog)
+list_type_selected (GtkToggleButton* button, ImapDialog *imap_dialog)
 {
     GncListType type;
 
-    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(bayes_dialog->radio_bayes)))
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(imap_dialog->radio_bayes)))
         type = BAYES;
-    else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(bayes_dialog->radio_nbayes)))
+    else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(imap_dialog->radio_nbayes)))
         type = NBAYES;
     else
         type = ONLINE;
 
     // Lets do this only on change of list type
-    if (type != bayes_dialog->type)
+    if (type != imap_dialog->type)
     {
-        bayes_dialog->type = type;
-        get_account_info (bayes_dialog);
+        imap_dialog->type = type;
+        get_account_info (imap_dialog);
     }
 }
 
 static void
-show_probability_column (BayesDialog *bayes_dialog, gboolean show)
+show_probability_column (ImapDialog *imap_dialog, gboolean show)
 {
     GtkTreeViewColumn *tree_column;
 
     // Show Probability Column
-    tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW(bayes_dialog->view), 4);
+    tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW(imap_dialog->view), 4);
     gtk_tree_view_column_set_visible (tree_column, show);
 
     // Hide Based on Column
-    tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW(bayes_dialog->view), 1);
+    tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW(imap_dialog->view), 1);
     gtk_tree_view_column_set_visible (tree_column, !show);
 }
 
@@ -290,7 +290,7 @@ add_to_store (GtkTreeModel *store, const gchar *text, gpointer user_data)
 }
 
 static void
-get_bayes_info (Account *acc, const gchar *category, GtkTreeModel *store, const gchar *text)
+get_imap_info (Account *acc, const gchar *category, GtkTreeModel *store, const gchar *text)
 {
     GList *kvp_list, *node;
     gchar *acc_name = NULL;
@@ -330,7 +330,7 @@ get_bayes_info (Account *acc, const gchar *category, GtkTreeModel *store, const
 }
 
 static void
-get_account_info (BayesDialog *bayes_dialog)
+get_account_info (ImapDialog *imap_dialog)
 {
     Account *root;
     Account *acc;
@@ -344,11 +344,11 @@ get_account_info (BayesDialog *bayes_dialog)
     root = gnc_book_get_root_account (gnc_get_current_book());
     accts = gnc_account_get_descendants_sorted (root);
 
-    store = gtk_tree_view_get_model (GTK_TREE_VIEW(bayes_dialog->view));
+    store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
     gtk_list_store_clear (GTK_LIST_STORE(store));
 
     // Hide Probability Column
-    show_probability_column (bayes_dialog, FALSE);
+    show_probability_column (imap_dialog, FALSE);
 
     /* Go through list of accounts */
     for (ptr = accts; ptr; ptr = g_list_next (ptr))
@@ -358,27 +358,27 @@ get_account_info (BayesDialog *bayes_dialog)
         // Save source account
         kvpInfo.source_account = acc;
 
-        if (bayes_dialog->type == BAYES)
+        if (imap_dialog->type == BAYES)
         {
-            get_bayes_info (acc, NULL, store, _("Bayesian"));
+            get_imap_info (acc, NULL, store, _("Bayesian"));
 
             // Show Probability Column
-            show_probability_column (bayes_dialog, TRUE);
+            show_probability_column (imap_dialog, TRUE);
         }
 
-        if (bayes_dialog->type == NBAYES)
+        if (imap_dialog->type == NBAYES)
         {
             // Description
-            get_bayes_info (acc, IMAP_FRAME_DESC, store, _("Description Field"));
+            get_imap_info (acc, IMAP_FRAME_DESC, store, _("Description Field"));
 
             // Memo
-            get_bayes_info (acc, IMAP_FRAME_MEMO, store, _("Memo Field"));
+            get_imap_info (acc, IMAP_FRAME_MEMO, store, _("Memo Field"));
 
             // CSV Account Map
-            get_bayes_info (acc, IMAP_FRAME_CSV, store, _("CSV Account Map"));
+            get_imap_info (acc, IMAP_FRAME_CSV, store, _("CSV Account Map"));
         }
 
-        if (bayes_dialog->type == ONLINE)
+        if (imap_dialog->type == ONLINE)
         {
             gchar *text = NULL;
 
@@ -406,7 +406,7 @@ get_account_info (BayesDialog *bayes_dialog)
 }
 
 static void
-gnc_bayes_dialog_create (GtkWidget *parent, BayesDialog *bayes_dialog)
+gnc_imap_dialog_create (GtkWidget *parent, ImapDialog *imap_dialog)
 {
     GtkWidget        *dialog;
     GtkBuilder       *builder;
@@ -414,45 +414,45 @@ gnc_bayes_dialog_create (GtkWidget *parent, BayesDialog *bayes_dialog)
 
     ENTER(" ");
     builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-bayes-editor.glade", "list-view");
-    gnc_builder_add_from_file (builder, "dialog-bayes-editor.glade", "Bayesian Dialog");
+    gnc_builder_add_from_file (builder, "dialog-imap-editor.glade", "list-view");
+    gnc_builder_add_from_file (builder, "dialog-imap-editor.glade", "Import Map Dialog");
 
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Bayesian Dialog"));
-    bayes_dialog->dialog = dialog;
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Import Map Dialog"));
+    imap_dialog->dialog = dialog;
 
-    bayes_dialog->session = gnc_get_current_session();
-    bayes_dialog->type = BAYES;
+    imap_dialog->session = gnc_get_current_session();
+    imap_dialog->type = BAYES;
 
     /* parent */
     if (parent != NULL)
         gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));
 
     /* Connect the radio buttons...*/
-    bayes_dialog->radio_bayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-bayes"));
-    bayes_dialog->radio_nbayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-nbayes"));
-    bayes_dialog->radio_online = GTK_WIDGET(gtk_builder_get_object (builder, "radio-online"));
-    g_signal_connect (bayes_dialog->radio_bayes, "toggled",
-                      G_CALLBACK(list_type_selected), (gpointer)bayes_dialog);
-    g_signal_connect (bayes_dialog->radio_nbayes, "toggled",
-                      G_CALLBACK(list_type_selected), (gpointer)bayes_dialog);
+    imap_dialog->radio_bayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-bayes"));
+    imap_dialog->radio_nbayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-nbayes"));
+    imap_dialog->radio_online = GTK_WIDGET(gtk_builder_get_object (builder, "radio-online"));
+    g_signal_connect (imap_dialog->radio_bayes, "toggled",
+                      G_CALLBACK(list_type_selected), (gpointer)imap_dialog);
+    g_signal_connect (imap_dialog->radio_nbayes, "toggled",
+                      G_CALLBACK(list_type_selected), (gpointer)imap_dialog);
 
-    bayes_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
+    imap_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
 
     /* Enable alternative line colors */
-    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(bayes_dialog->view), TRUE);
+    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(imap_dialog->view), TRUE);
 
     /* default to 'close' button */
     gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
 
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(bayes_dialog->view));
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(imap_dialog->view));
     gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
 
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, bayes_dialog);
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, imap_dialog);
 
     g_object_unref (G_OBJECT(builder));
 
-    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(bayes_dialog->dialog));
-    get_account_info (bayes_dialog);
+    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(imap_dialog->dialog));
+    get_account_info (imap_dialog);
 
     LEAVE(" ");
 }
@@ -460,11 +460,11 @@ gnc_bayes_dialog_create (GtkWidget *parent, BayesDialog *bayes_dialog)
 static void
 close_handler (gpointer user_data)
 {
-    BayesDialog *bayes_dialog = user_data;
+    ImapDialog *imap_dialog = user_data;
 
     ENTER(" ");
-    gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(bayes_dialog->dialog));
-    gtk_widget_destroy (GTK_WIDGET(bayes_dialog->dialog));
+    gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(imap_dialog->dialog));
+    gtk_widget_destroy (GTK_WIDGET(imap_dialog->dialog));
     LEAVE(" ");
 }
 
@@ -479,48 +479,48 @@ static gboolean
 show_handler (const char *klass, gint component_id,
               gpointer user_data, gpointer iter_data)
 {
-    BayesDialog *bayes_dialog = user_data;
+    ImapDialog *imap_dialog = user_data;
 
     ENTER(" ");
-    if (!bayes_dialog)
+    if (!imap_dialog)
     {
         LEAVE("No data strucure");
         return(FALSE);
     }
-    gtk_window_present (GTK_WINDOW(bayes_dialog->dialog));
+    gtk_window_present (GTK_WINDOW(imap_dialog->dialog));
     LEAVE(" ");
     return(TRUE);
 }
 
 /********************************************************************\
- * gnc_bayes_dialog                                                 *
- * opens a window showing all Bayesian and Non-Bayesian information *
+ * gnc_imap_dialog                                                  *
+ * opens a window showing Bayesian and Non-Bayesian information     *
  *                                                                  *
  * Args:   parent  - the parent of the window to be created         *
  * Return: nothing                                                  *
 \********************************************************************/
 void
-gnc_bayes_dialog (GtkWidget *parent)
+gnc_imap_dialog (GtkWidget *parent)
 {
-    BayesDialog *bayes_dialog;
+    ImapDialog *imap_dialog;
     gint component_id;
 
     ENTER(" ");
-    if (gnc_forall_gui_components (DIALOG_BAYES_CM_CLASS, show_handler, NULL))
+    if (gnc_forall_gui_components (DIALOG_IMAP_CM_CLASS, show_handler, NULL))
     {
         LEAVE("Existing dialog raised");
         return;
     }
-    bayes_dialog = g_new0 (BayesDialog, 1);
+    imap_dialog = g_new0 (ImapDialog, 1);
 
-    gnc_bayes_dialog_create (parent, bayes_dialog);
+    gnc_imap_dialog_create (parent, imap_dialog);
 
-    component_id = gnc_register_gui_component (DIALOG_BAYES_CM_CLASS,
+    component_id = gnc_register_gui_component (DIALOG_IMAP_CM_CLASS,
                    refresh_handler, close_handler,
-                   bayes_dialog);
+                   imap_dialog);
 
-    gnc_gui_component_set_session (component_id, bayes_dialog->session);
+    gnc_gui_component_set_session (component_id, imap_dialog->session);
 
-    gtk_widget_show (bayes_dialog->dialog);
+    gtk_widget_show (imap_dialog->dialog);
     LEAVE(" ");
 }
diff --git a/src/gnome/dialog-bayes-editor.h b/src/gnome/dialog-imap-editor.h
similarity index 89%
rename from src/gnome/dialog-bayes-editor.h
rename to src/gnome/dialog-imap-editor.h
index a9af184..57e093d 100644
--- a/src/gnome/dialog-bayes-editor.h
+++ b/src/gnome/dialog-imap-editor.h
@@ -1,5 +1,5 @@
 /********************************************************************\
- * dialog-bayes-editor.h -- Bayesian and Non Bayesian editor dialog *
+ * dialog-imap-editor.h -- Import Map Editor dialog                 *
  * Copyright (C) 2015 Robert Fewell                                 *
  *                                                                  *
  * This program is free software; you can redistribute it and/or    *
@@ -20,9 +20,9 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
 
-#ifndef DIALOG_BAYES_EDITOR_H
-#define DIALOG_BAYES_EDITOR_H
+#ifndef DIALOG_IMAP_EDITOR_H
+#define DIALOG_IMAP_EDITOR_H
 
-void gnc_bayes_dialog (GtkWidget *parent);
+void gnc_imap_dialog (GtkWidget *parent);
 
 #endif
diff --git a/src/gnome/gnc-plugin-basic-commands.c b/src/gnome/gnc-plugin-basic-commands.c
index 1f352d1..1d58820 100644
--- a/src/gnome/gnc-plugin-basic-commands.c
+++ b/src/gnome/gnc-plugin-basic-commands.c
@@ -39,12 +39,12 @@
 #include "gnc-plugin-basic-commands.h"
 #include "gnc-ui-util.h"
 
-#include "dialog-bayes-editor.h"
 #include "dialog-book-close.h"
 #include "dialog-file-access.h"
 #include "dialog-fincalc.h"
 #include "dialog-find-transactions.h"
 #include "dialog-find-transactions2.h"
+#include "dialog-imap-editor.h"
 #include "dialog-sx-since-last-run.h"
 #include "dialog-totd.h"
 #include "assistant-acct-period.h"
@@ -89,7 +89,7 @@ static void gnc_main_window_cmd_tools_financial_calculator (GtkAction *action, G
 static void gnc_main_window_cmd_tools_close_book (GtkAction *action, GncMainWindowActionData *data);
 static void gnc_main_window_cmd_tools_find_transactions (GtkAction *action, GncMainWindowActionData *data);
 static void gnc_main_window_cmd_tools_price_editor (GtkAction *action, GncMainWindowActionData *data);
-static void gnc_main_window_cmd_tools_bayes_editor (GtkAction *action, GncMainWindowActionData *data);
+static void gnc_main_window_cmd_tools_imap_editor (GtkAction *action, GncMainWindowActionData *data);
 static void gnc_main_window_cmd_tools_commodity_editor (GtkAction *action, GncMainWindowActionData *data);
 static void gnc_main_window_cmd_help_totd (GtkAction *action, GncMainWindowActionData *data);
 
@@ -204,9 +204,9 @@ static GtkActionEntry gnc_plugin_actions [] =
         G_CALLBACK (gnc_main_window_cmd_tools_close_book)
     },
     {
-        "ToolsBayesEditorAction", NULL, N_("_Bayesian Editor"), NULL,
+        "ToolsImapEditorAction", NULL, N_("_Import Map Editor"), NULL,
         N_("View and Delete Bayesian and Non Bayesian information"),
-        G_CALLBACK (gnc_main_window_cmd_tools_bayes_editor)
+        G_CALLBACK (gnc_main_window_cmd_tools_imap_editor)
     },
 
     /* Help menu */
@@ -610,10 +610,10 @@ gnc_main_window_cmd_actions_close_books (GtkAction *action, GncMainWindowActionD
 #endif /* CLOSE_BOOKS_ACTUALLY_WORKS */
 
 static void
-gnc_main_window_cmd_tools_bayes_editor (GtkAction *action, GncMainWindowActionData *data)
+gnc_main_window_cmd_tools_imap_editor (GtkAction *action, GncMainWindowActionData *data)
 {
     gnc_set_busy_cursor(NULL, TRUE);
-    gnc_bayes_dialog (NULL);
+    gnc_imap_dialog (NULL);
     gnc_unset_busy_cursor(NULL);
 }
 
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in b/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
index 529f6f5..36ab8fc 100644
--- a/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
+++ b/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
@@ -1,7 +1,7 @@
 <schemalist gettext-domain="@GETTEXT_PACKAGE@">
   <schema id="org.gnucash.dialogs" path="/org/gnucash/dialogs/">
     <child name="account" schema="org.gnucash.dialogs.account"/>
-    <child name="bayes-editor" schema="org.gnucash.dialogs.bayes-editor"/>
+    <child name="imap-editor" schema="org.gnucash.dialogs.imap-editor"/>
     <child name="preferences" schema="org.gnucash.dialogs.preferences"/>
     <child name="price-editor" schema="org.gnucash.dialogs.price-editor"/>
     <child name="pricedb-editor" schema="org.gnucash.dialogs.pricedb-editor"/>
@@ -31,7 +31,7 @@
     </key>
   </schema>
 
-  <schema id="org.gnucash.dialogs.bayes-editor" path="/org/gnucash/dialogs/bayes-editor/">
+  <schema id="org.gnucash.dialogs.imap-editor" path="/org/gnucash/dialogs/imap-editor/">
     <key type="(iiii)" name="last-geometry">
       <default>(-1,-1,-1,-1)</default>
       <summary>Last window position and size</summary>
diff --git a/src/gnome/gtkbuilder/Makefile.am b/src/gnome/gtkbuilder/Makefile.am
index 64fd86d..110e324 100644
--- a/src/gnome/gtkbuilder/Makefile.am
+++ b/src/gnome/gtkbuilder/Makefile.am
@@ -4,8 +4,8 @@ gtkbuilder_DATA = \
 	assistant-hierarchy.glade \
 	assistant-loan.glade \
 	assistant-stock-split.glade \
-	dialog-bayes-editor.glade \
 	dialog-commodities.glade \
+	dialog-imap-editor.glade \
 	dialog-fincalc.glade \
 	dialog-lot-viewer.glade \
 	dialog-new-user.glade \
diff --git a/src/gnome/gtkbuilder/dialog-bayes-editor.glade b/src/gnome/gtkbuilder/dialog-imap-editor.glade
similarity index 97%
rename from src/gnome/gtkbuilder/dialog-bayes-editor.glade
rename to src/gnome/gtkbuilder/dialog-imap-editor.glade
index efc432f..5547c2b 100644
--- a/src/gnome/gtkbuilder/dialog-bayes-editor.glade
+++ b/src/gnome/gtkbuilder/dialog-imap-editor.glade
@@ -22,16 +22,16 @@
       <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkDialog" id="Bayesian Dialog">
+  <object class="GtkDialog" id="Import Map Dialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
-    <property name="title" translatable="yes">Bayesian Editor</property>
+    <property name="title" translatable="yes">Import Map Editor</property>
     <property name="modal">True</property>
     <property name="default_width">600</property>
     <property name="default_height">400</property>
     <property name="type_hint">dialog</property>
-    <signal name="destroy" handler="gnc_bayes_dialog_window_destroy_cb" swapped="no"/>
-    <signal name="response" handler="gnc_bayes_dialog_response_cb" swapped="no"/>
+    <signal name="destroy" handler="gnc_imap_dialog_window_destroy_cb" swapped="no"/>
+    <signal name="response" handler="gnc_imap_dialog_response_cb" swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="can_focus">False</property>
diff --git a/src/gnome/ui/gnc-plugin-basic-commands-ui.xml b/src/gnome/ui/gnc-plugin-basic-commands-ui.xml
index 2647408..a6a8cc3 100644
--- a/src/gnome/ui/gnc-plugin-basic-commands-ui.xml
+++ b/src/gnome/ui/gnc-plugin-basic-commands-ui.xml
@@ -56,7 +56,7 @@
         <menuitem name="ToolsCommodityEditor" action="ToolsCommodityEditorAction"/>
         <menuitem name="ToolsFinancialCalculator" action="ToolsFinancialCalculatorAction"/>
         <menuitem name="ToolsBookClose" action="ToolsBookCloseAction"/>
-        <menuitem name="ToolsBayesEditor" action="ToolsBayesEditorAction"/>
+        <menuitem name="ToolsImapEditor" action="ToolsImapEditorAction"/>
       </placeholder>
     </menu>
 

commit 87dc25d65c9ddcae55612075b797bf084c922711
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Dec 17 13:59:20 2015 +0000

    Use Glib G_GINT64_FORMAT to specify correct format
    string for gint64 values.

diff --git a/src/engine/Account.c b/src/engine/Account.c
index 1da0513..b090ecd 100644
--- a/src/engine/Account.c
+++ b/src/engine/Account.c
@@ -5503,10 +5503,10 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
     book = qof_instance_get_book (kvpInfo->source_account);
     root = gnc_book_get_root_account (book);
 
-    PINFO("build_bayes_layer_two: account '%s', token_count: '%ld'",
-                                  (char*)key, (long)g_value_get_int64(value));
+    PINFO("build_bayes_layer_two: account '%s', token_count: '%" G_GINT64_FORMAT "'",
+                                  (char*)key, g_value_get_int64(value));
 
-    probability = g_strdup_printf ("%ld", g_value_get_int64 (value));
+    probability = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (value));
 
     kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
 

commit 035bc761aa5a68321a452f566e32b08185baed86
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Dec 13 10:03:50 2015 +0000

    Moved all KVP handling to Account.c, Added two
    main functions that return a Glist of kvp_info
    for Bayesian and Non Bayesian entries. Also added
    a get and delete function based on kvp path.

diff --git a/src/engine/Account.c b/src/engine/Account.c
index 7235dfe..1da0513 100644
--- a/src/engine/Account.c
+++ b/src/engine/Account.c
@@ -5485,6 +5485,211 @@ gnc_account_imap_add_account_bayes (GncImportMatchMap *imap,
     LEAVE(" ");
 }
 
+/*******************************************************************************/
+
+static void
+build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
+{
+    QofBook     *book;
+    Account     *root;
+    gchar       *kvp_path;
+    gchar       *probability;
+
+    struct kvp_info *kvpInfo_node;
+
+    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
+
+    // Get the book
+    book = qof_instance_get_book (kvpInfo->source_account);
+    root = gnc_book_get_root_account (book);
+
+    PINFO("build_bayes_layer_two: account '%s', token_count: '%ld'",
+                                  (char*)key, (long)g_value_get_int64(value));
+
+    probability = g_strdup_printf ("%ld", g_value_get_int64 (value));
+
+    kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
+
+    PINFO("build_bayes_layer_two: kvp_path is '%s'", kvp_path);
+
+    kvpInfo_node = g_malloc(sizeof(*kvpInfo_node));
+
+    kvpInfo_node->source_account = kvpInfo->source_account;
+    kvpInfo_node->map_account    = gnc_account_lookup_by_full_name (root, key);
+    kvpInfo_node->kvp_path       = g_strdup (kvp_path);
+    kvpInfo_node->match_string   = g_strdup (kvpInfo->match_string);
+    kvpInfo_node->kvp_path_head  = g_strdup (kvpInfo->kvp_path_head);
+    kvpInfo_node->probability    = g_strdup (probability);
+
+    kvpInfo->list = g_list_append (kvpInfo->list, kvpInfo_node);
+
+    g_free (kvp_path);
+    g_free (probability);
+}
+
+static void
+build_bayes (const char *key, const GValue *value, gpointer user_data)
+{
+    gchar *kvp_path;
+    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
+    struct kvp_info  kvpInfol2;
+
+    PINFO("build_bayes: match string '%s'", (char*)key);
+
+    if (G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value) == NULL)
+    {
+        kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", key);
+
+        if (qof_instance_has_slot (QOF_INSTANCE(kvpInfo->source_account), kvp_path))
+        {
+            PINFO("build_bayes: kvp_path is '%s', key '%s'", kvp_path, key);
+
+            kvpInfol2.source_account = kvpInfo->source_account;
+            kvpInfol2.match_string   = g_strdup (key);
+            kvpInfol2.kvp_path_head  = g_strdup (kvp_path);
+            kvpInfol2.list           = kvpInfo->list;
+
+            qof_instance_foreach_slot (QOF_INSTANCE(kvpInfo->source_account), kvp_path,
+                                       build_bayes_layer_two, &kvpInfol2);
+
+            kvpInfo->list = kvpInfol2.list;
+            g_free (kvpInfol2.match_string);
+            g_free (kvpInfol2.kvp_path_head);
+        }
+        g_free (kvp_path);
+    }
+}
+
+
+static void
+build_non_bayes (const char *key, const GValue *value, gpointer user_data)
+{
+    if (G_VALUE_HOLDS_BOXED (value))
+    {
+        QofBook     *book;
+        GncGUID     *guid = NULL;
+        gchar       *kvp_path;
+        gchar       *guid_string = NULL;
+
+        struct kvp_info *kvpInfo_node;
+
+        struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
+
+        // Get the book
+        book = qof_instance_get_book (kvpInfo->source_account);
+
+        guid = (GncGUID*)g_value_get_boxed (value);
+        guid_string = guid_to_string (guid);
+
+        PINFO("build_non_bayes: account '%s', match account guid: '%s'",
+                                (char*)key, guid_string);
+
+        kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
+
+        PINFO("build_non_bayes: kvp_path is '%s'", kvp_path);
+
+        kvpInfo_node = g_malloc(sizeof(*kvpInfo_node));
+
+        kvpInfo_node->source_account = kvpInfo->source_account;
+        kvpInfo_node->map_account    = xaccAccountLookup (guid, book);
+        kvpInfo_node->kvp_path       = g_strdup (kvp_path);
+        kvpInfo_node->match_string   = g_strdup (key);
+        kvpInfo_node->kvp_path_head  = g_strdup (kvpInfo->kvp_path_head);
+        kvpInfo_node->probability    = g_strdup (" ");
+
+        kvpInfo->list = g_list_append (kvpInfo->list, kvpInfo_node);
+
+        g_free (kvp_path);
+        g_free (guid_string);
+    }
+}
+
+
+GList *
+gnc_account_imap_get_info_bayes (Account *acc, const char *category)
+{
+    GList *list = NULL;
+
+    struct kvp_info kvpInfo;
+
+    kvpInfo.source_account = acc;
+    kvpInfo.list = list;
+
+    if (qof_instance_has_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES))
+        qof_instance_foreach_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES,
+                                   build_bayes, &kvpInfo);
+
+    return kvpInfo.list;
+}
+
+
+GList *
+gnc_account_imap_get_info (Account *acc, const char *category)
+{
+    GList *list = NULL;
+    gchar *kvp_path_head = NULL;
+
+    struct kvp_info kvpInfo;
+
+    kvpInfo.source_account = acc;
+    kvpInfo.list = list;
+
+    kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", category);
+    kvpInfo.kvp_path_head = kvp_path_head;
+
+    if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
+        qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head,
+                                   build_non_bayes, &kvpInfo);
+
+    g_free (kvp_path_head);
+
+    return kvpInfo.list;
+}
+
+/*******************************************************************************/
+
+gchar *
+gnc_account_get_kvp_text (Account *acc, const char *kvp_path)
+{
+    GValue v = G_VALUE_INIT;
+    gchar *text = NULL;
+
+    if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path))
+    {
+        qof_instance_get_kvp (QOF_INSTANCE(acc), kvp_path, &v);
+
+        if (G_VALUE_HOLDS_STRING (&v))
+        {
+            gchar const *string;
+            string = g_value_get_string (&v);
+            text = g_strdup (string);
+        }
+    }
+    return text;
+}
+
+
+void
+gnc_account_delete_kvp (Account *acc, char *kvp_path, gboolean empty)
+{
+    if ((acc != NULL) && qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path))
+    {
+        xaccAccountBeginEdit (acc);
+
+        if (empty)
+            qof_instance_slot_delete_if_empty (QOF_INSTANCE(acc), kvp_path);
+        else
+            qof_instance_slot_delete (QOF_INSTANCE(acc), kvp_path);
+
+        PINFO("Account is '%s', path is '%s'", xaccAccountGetName (acc), kvp_path);
+
+        qof_instance_set_dirty (QOF_INSTANCE(acc));
+        xaccAccountCommitEdit (acc);
+    }
+    g_free (kvp_path);
+}
+
+
 /* ================================================================ */
 /* QofObject function implementation and registration */
 
diff --git a/src/engine/Account.h b/src/engine/Account.h
index 6208f0c..85c92f5 100644
--- a/src/engine/Account.h
+++ b/src/engine/Account.h
@@ -1406,6 +1406,37 @@ Account* gnc_account_imap_find_account_bayes (GncImportMatchMap *imap, GList* to
 void gnc_account_imap_add_account_bayes (GncImportMatchMap *imap, GList* tokens,
                                          Account *acc);
 
+struct kvp_info
+{
+    Account        *source_account;
+    Account        *map_account;
+    GList          *list;
+    char           *kvp_path_head;
+    char           *kvp_path;
+    char           *match_string;
+    char           *probability;
+};
+
+/** Returns a GList of structure kvp_info of all Bayesian mappings for
+ *  required Account
+ */
+GList *gnc_account_imap_get_info_bayes (Account *acc, const char *category);
+
+/** Returns a GList of structure kvp_info of all Non Bayesian mappings for
+ *  required Account
+ */
+GList *gnc_account_imap_get_info (Account *acc, const char *category);
+
+/** Returns the text string pointed to by kvp_path for the Account, free
+ *  the returned text
+ */
+gchar *gnc_account_get_kvp_text (Account *acc, const char *kvp_path);
+
+/** Delete the kvp_path for the Account, if empty is TRUE then use
+ *  delete if empty, kvp_path is freed
+ */
+void gnc_account_delete_kvp (Account *acc, char *kvp_path, gboolean empty);
+
 /** @} */
 
 
diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-bayes-editor.c
index f3af843..9be3394 100644
--- a/src/gnome/dialog-bayes-editor.c
+++ b/src/gnome/dialog-bayes-editor.c
@@ -32,7 +32,7 @@
 #include "gnc-session.h"
 
 #include "gnc-ui-util.h"
-#include "qofinstance-p.h"
+#include "Account.h"
 
 #define DIALOG_BAYES_CM_CLASS   "dialog-bayes-edit"
 #define GNC_PREFS_GROUP         "dialogs.bayes-editor"
@@ -63,23 +63,11 @@ typedef struct
     GtkWidget    *view;
     GncListType   type;
 
-    GtkWidget *radio_bayes;
-    GtkWidget *radio_nbayes;
-    GtkWidget *radio_online;
+    GtkWidget    *radio_bayes;
+    GtkWidget    *radio_nbayes;
+    GtkWidget    *radio_online;
 
-} BayesDialog;
-
-struct kvp_info
-{
-    GtkTreeModel *store;
-    Account      *source_account;
-    Account      *map_account;
-    const gchar  *based_on;
-    const gchar  *match_string;
-    const gchar  *kvp_path_head;
-    const gchar  *kvp_path;
-    const gchar  *probability;
-};
+}BayesDialog;
 
 
 /* This static indicates the debugging module that this .o belongs to.  */
@@ -146,16 +134,6 @@ are_you_sure (BayesDialog *bayes_dialog)
 }
 
 static void
-delete_kvp (Account *account, gchar *full_account, gchar *kvp_path)
-{
-    qof_instance_slot_delete_if_empty (QOF_INSTANCE(account), kvp_path);
-
-    PINFO("Delete source account is '%s', path is '%s'", full_account, kvp_path);
-
-    g_free (kvp_path);
-}
-
-static void
 gnc_bayes_dialog_delete (BayesDialog *bayes_dialog)
 {
     GList            *list, *row;
@@ -193,38 +171,33 @@ gnc_bayes_dialog_delete (BayesDialog *bayes_dialog)
 
             PINFO("Account is '%s', Path is '%s', Search is '%s'", full_source_account, kvp_path, match_string);
 
-            if ((source_account != NULL) && qof_instance_has_slot (QOF_INSTANCE(source_account), kvp_path))
+            if (source_account != NULL)
             {
-                xaccAccountBeginEdit (source_account);
-
-                qof_instance_slot_delete (QOF_INSTANCE(source_account), kvp_path);
-                g_free (kvp_path);
+                gnc_account_delete_kvp (source_account, kvp_path, FALSE);
 
                 if (bayes_dialog->type == BAYES)
                 {
                     kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", match_string);
-                    delete_kvp (source_account, full_source_account, kvp_path);
+                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
 
                     kvp_path = g_strdup_printf (IMAP_FRAME_BAYES);
-                    delete_kvp (source_account, full_source_account, kvp_path);
+                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
                 }
 
                 if (bayes_dialog->type == NBAYES)
                 {
                     kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
-                    delete_kvp (source_account, full_source_account, kvp_path);
+                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
 
                     kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
-                    delete_kvp (source_account, full_source_account, kvp_path);
+                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
 
                     kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
-                    delete_kvp (source_account, full_source_account, kvp_path);
+                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
 
                     kvp_path = g_strdup_printf (IMAP_FRAME);
-                    delete_kvp (source_account, full_source_account, kvp_path);
+                    gnc_account_delete_kvp (source_account, kvp_path, TRUE);
                 }
-                qof_instance_set_dirty (QOF_INSTANCE(source_account));
-                xaccAccountCommitEdit (source_account);
             }
             g_free (match_string);
             g_free (full_source_account);
@@ -289,7 +262,7 @@ show_probability_column (BayesDialog *bayes_dialog, gboolean show)
 }
 
 static void
-add_to_store (gpointer user_data)
+add_to_store (GtkTreeModel *store, const gchar *text, gpointer user_data)
 {
     GtkTreeIter  iter;
     gchar       *fullname = NULL;
@@ -297,17 +270,17 @@ add_to_store (gpointer user_data)
 
     struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
 
-    gtk_list_store_append (GTK_LIST_STORE(kvpInfo->store), &iter);
+    gtk_list_store_append (GTK_LIST_STORE(store), &iter);
 
     fullname = gnc_account_get_full_name (kvpInfo->source_account);
 
     map_fullname = gnc_account_get_full_name (kvpInfo->map_account);
 
-    PINFO("Add to Store: Source Acc '%s', Based on '%s', Map Acc '%s'", fullname, kvpInfo->based_on, map_fullname);
+    PINFO("Add to Store: Source Acc '%s', Match '%s', Map Acc '%s'", fullname, kvpInfo->match_string, map_fullname);
 
-    gtk_list_store_set (GTK_LIST_STORE(kvpInfo->store), &iter,
+    gtk_list_store_set (GTK_LIST_STORE(store), &iter,
                         SOURCE_FULL_ACC, fullname, SOURCE_ACCOUNT, kvpInfo->source_account,
-                        BASED_ON, kvpInfo->based_on,
+                        BASED_ON, text,
                         MATCH_STRING, kvpInfo->match_string,
                         MAP_FULL_ACC, map_fullname, MAP_ACCOUNT, kvpInfo->map_account,
                         KVP_PATH, kvpInfo->kvp_path, PROBABILITY, kvpInfo->probability, -1);
@@ -317,122 +290,43 @@ add_to_store (gpointer user_data)
 }
 
 static void
-build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
+get_bayes_info (Account *acc, const gchar *category, GtkTreeModel *store, const gchar *text)
 {
-    QofBook     *book;
-    gchar       *kvp_path;
-    gchar       *probability;
-
-    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
-
-    // Get the book
-    book = gnc_get_current_book();
-
-    PINFO("build_bayes_layer_two: account '%s', token_count: '%ld'", (char*)key, (long)g_value_get_int64(value));
-
-    probability = g_strdup_printf ("%ld", g_value_get_int64 (value));
+    GList *kvp_list, *node;
+    gchar *acc_name = NULL;
 
-    kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
+    acc_name = gnc_account_get_full_name (acc);
+    PINFO("Source Acc '%s', Based on '%s', Path Head '%s'", acc_name, text, category);
+    g_free (acc_name);
 
-    PINFO("build_bayes_layer_two: kvp_path is '%s'", kvp_path);
-
-    kvpInfo->map_account = gnc_account_lookup_by_full_name (gnc_book_get_root_account (book), key);
-
-    kvpInfo->kvp_path = kvp_path;
-    kvpInfo->probability = probability;
-
-    // Add kvp data to store
-    add_to_store (kvpInfo);
-
-    g_free (kvp_path);
-    g_free (probability);
-}
-
-static void
-build_bayes (const char *key, const GValue *value, gpointer user_data)
-{
-    char *kvp_path;
-    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
-    struct kvp_info  kvpInfol2;
-
-    PINFO("build_bayes: match string '%s'", (char*)key);
+    if (category == NULL) // For Bayesian, category is NULL
+        kvp_list = gnc_account_imap_get_info_bayes (acc, category);
+    else
+        kvp_list = gnc_account_imap_get_info (acc, category);
 
-    if (G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value) == NULL)
+    if (g_list_length (kvp_list) > 0)
     {
-        kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", key);
+        PINFO("List length is %d", g_list_length (kvp_list));
 
-        if (qof_instance_has_slot (QOF_INSTANCE(kvpInfo->source_account), kvp_path))
+        for (node = kvp_list;  node; node = g_list_next (node))
         {
-            PINFO("build_bayes: kvp_path is '%s', key '%s'", kvp_path, key);
-
-            kvpInfol2.store = kvpInfo->store;
-            kvpInfol2.source_account = kvpInfo->source_account;
-            kvpInfol2.based_on = _("Bayesian");
-            kvpInfol2.match_string = key;
-            kvpInfol2.kvp_path_head = kvp_path;
-
-            qof_instance_foreach_slot (QOF_INSTANCE(kvpInfo->source_account), kvp_path,
-                                       build_bayes_layer_two, &kvpInfol2);
-        }
-        g_free (kvp_path);
-    }
-}
-
-static void
-build_non_bayes (const char *key, const GValue *value, gpointer user_data)
-{
-    if (G_VALUE_HOLDS_BOXED (value))
-    {
-        QofBook     *book;
-        GncGUID     *guid = NULL;
-        gchar       *kvp_path;
-        gchar       *guid_string = NULL;
-
-        struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
-
-        // Get the book
-        book = gnc_get_current_book();
-
-        guid = (GncGUID*)g_value_get_boxed (value);
-        guid_string = guid_to_string (guid);
+            struct kvp_info *kvpInfo;
 
-        PINFO("build_non_bayes: account '%s', match account guid: '%s'", (char*)key, guid_string);
+            kvpInfo = node->data;
 
-        kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
+            // Add to store
+            add_to_store (store, text, kvpInfo);
 
-        PINFO("build_non_bayes: kvp_path is '%s'", kvp_path);
-
-        kvpInfo->map_account = xaccAccountLookup (guid, book);
-        kvpInfo->match_string = key;
-        kvpInfo->kvp_path = kvp_path;
-        kvpInfo->probability = " ";
-
-        // Add kvp data to store
-        add_to_store (kvpInfo);
-
-        g_free (kvp_path);
-        g_free (guid_string);
+            // Free the members and structure
+            g_free (kvpInfo->kvp_path_head);
+            g_free (kvpInfo->kvp_path);
+            g_free (kvpInfo->match_string);
+            g_free (kvpInfo->probability);
+            g_free (kvpInfo);
+        }
     }
-}
-
-static void
-get_non_bayes_info (Account *acc, const gchar *imap_frame, GtkTreeModel *store, const gchar *text)
-{
-    gchar   *kvp_path_head = NULL;
-
-    struct kvp_info kvpInfo;
-
-    kvpInfo.source_account = acc;
-    kvpInfo.store = store;
-    kvpInfo.based_on = text;
-
-    kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", imap_frame);
-    kvpInfo.kvp_path_head = kvp_path_head;
-
-    if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
-        qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
-
-    g_free (kvp_path_head);
+    // Free the list
+    g_list_free (kvp_list);
 }
 
 static void
@@ -452,7 +346,9 @@ get_account_info (BayesDialog *bayes_dialog)
 
     store = gtk_tree_view_get_model (GTK_TREE_VIEW(bayes_dialog->view));
     gtk_list_store_clear (GTK_LIST_STORE(store));
-    kvpInfo.store = store;
+
+    // Hide Probability Column
+    show_probability_column (bayes_dialog, FALSE);
 
     /* Go through list of accounts */
     for (ptr = accts; ptr; ptr = g_list_next (ptr))
@@ -464,8 +360,7 @@ get_account_info (BayesDialog *bayes_dialog)
 
         if (bayes_dialog->type == BAYES)
         {
-            if (qof_instance_has_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES))
-                qof_instance_foreach_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES, build_bayes, &kvpInfo);
+            get_bayes_info (acc, NULL, store, _("Bayesian"));
 
             // Show Probability Column
             show_probability_column (bayes_dialog, TRUE);
@@ -474,43 +369,37 @@ get_account_info (BayesDialog *bayes_dialog)
         if (bayes_dialog->type == NBAYES)
         {
             // Description
-            get_non_bayes_info (acc, IMAP_FRAME_DESC, store, _("Description Field"));
+            get_bayes_info (acc, IMAP_FRAME_DESC, store, _("Description Field"));
 
             // Memo
-            get_non_bayes_info (acc, IMAP_FRAME_MEMO, store, _("Memo Field"));
+            get_bayes_info (acc, IMAP_FRAME_MEMO, store, _("Memo Field"));
 
             // CSV Account Map
-            get_non_bayes_info (acc, IMAP_FRAME_CSV, store, _("CSV Account Map"));
-
-            // Hide Probability Column
-            show_probability_column (bayes_dialog, FALSE);
+            get_bayes_info (acc, IMAP_FRAME_CSV, store, _("CSV Account Map"));
         }
 
         if (bayes_dialog->type == ONLINE)
         {
-            GValue v = G_VALUE_INIT;
+            gchar *text = NULL;
 
-            kvpInfo.based_on = _("Online Id");
             kvpInfo.kvp_path = "online_id";
 
-            if (qof_instance_has_slot (QOF_INSTANCE(acc), kvpInfo.kvp_path))
-            {
-                qof_instance_get_kvp (QOF_INSTANCE(acc), kvpInfo.kvp_path, &v);
-
-                if (G_VALUE_HOLDS_STRING (&v))
-                {
-                    const gchar *string = g_value_get_string (&v);
+            text = gnc_account_get_kvp_text (acc, kvpInfo.kvp_path);
 
+            if (text != NULL)
+            {
+                if (g_strcmp0 (text, "") == 0)
+                    kvpInfo.map_account = NULL;
+                else
                     kvpInfo.map_account = kvpInfo.source_account;
-                    kvpInfo.match_string  = string;
-                    kvpInfo.probability = " ";
 
-                    // Add kvp data to store
-                    add_to_store (&kvpInfo);
-                }
+                kvpInfo.match_string  = text;
+                kvpInfo.probability = " ";
+
+                // Add kvp data to store
+                add_to_store (store, _("Online Id"), &kvpInfo);
             }
-            // Hide Probability Column
-            show_probability_column (bayes_dialog, FALSE);
+            g_free (text);
         }
     }
     g_list_free (accts);

commit 0311f920e1590f5b5afb25eda6592778e94520ba
Author: Bob-IT <Bob-IT at users.noreply.github.com>
Date:   Sun Nov 22 14:04:08 2015 +0000

    Update POTFILES.in
    
    Add Bayesian Editor files.

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8484bf7..8b815da 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -204,6 +204,7 @@ src/gnome/assistant-acct-period.c
 src/gnome/assistant-hierarchy.c
 src/gnome/assistant-loan.c
 src/gnome/assistant-stock-split.c
+src/gnome/dialog-bayes-editor.c
 src/gnome/dialog-commodities.c
 src/gnome/dialog-fincalc.c
 src/gnome/dialog-find-transactions2.c
@@ -246,6 +247,7 @@ src/gnome/gtkbuilder/assistant-acct-period.glade
 src/gnome/gtkbuilder/assistant-hierarchy.glade
 src/gnome/gtkbuilder/assistant-loan.glade
 src/gnome/gtkbuilder/assistant-stock-split.glade
+src/gnome/gtkbuilder/dialog-bayes-editor.glade
 src/gnome/gtkbuilder/dialog-commodities.glade
 src/gnome/gtkbuilder/dialog-fincalc.glade
 src/gnome/gtkbuilder/dialog-lot-viewer.glade

commit 82013f73a31823557db5bf6e9d3449ef7fce9476
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Nov 22 13:56:28 2015 +0000

    Reduce code duplication for non Bayesian
    information.

diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-bayes-editor.c
index 2d65b61..f3af843 100644
--- a/src/gnome/dialog-bayes-editor.c
+++ b/src/gnome/dialog-bayes-editor.c
@@ -416,6 +416,26 @@ build_non_bayes (const char *key, const GValue *value, gpointer user_data)
 }
 
 static void
+get_non_bayes_info (Account *acc, const gchar *imap_frame, GtkTreeModel *store, const gchar *text)
+{
+    gchar   *kvp_path_head = NULL;
+
+    struct kvp_info kvpInfo;
+
+    kvpInfo.source_account = acc;
+    kvpInfo.store = store;
+    kvpInfo.based_on = text;
+
+    kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", imap_frame);
+    kvpInfo.kvp_path_head = kvp_path_head;
+
+    if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
+        qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
+
+    g_free (kvp_path_head);
+}
+
+static void
 get_account_info (BayesDialog *bayes_dialog)
 {
     Account *root;
@@ -438,7 +458,6 @@ get_account_info (BayesDialog *bayes_dialog)
     for (ptr = accts; ptr; ptr = g_list_next (ptr))
     {
         Account *acc = ptr->data;
-        gchar   *kvp_path_head = NULL;
 
         // Save source account
         kvpInfo.source_account = acc;
@@ -454,33 +473,14 @@ get_account_info (BayesDialog *bayes_dialog)
 
         if (bayes_dialog->type == NBAYES)
         {
-            kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
-
-            kvpInfo.based_on = _("Description Field");
-            kvpInfo.kvp_path_head = kvp_path_head;
-
-            if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
-                qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
-
-            g_free (kvp_path_head);
-            kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
-
-            kvpInfo.based_on = _("Memo Field");
-            kvpInfo.kvp_path_head = kvp_path_head;
-
-            if (qof_instance_has_slot (QOF_INSTANCE (acc), kvp_path_head))
-                qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
-
-            g_free (kvp_path_head);
-            kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
-
-            kvpInfo.based_on = _("CSV Account Map");
-            kvpInfo.kvp_path_head = kvp_path_head;
+            // Description
+            get_non_bayes_info (acc, IMAP_FRAME_DESC, store, _("Description Field"));
 
-            if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
-                qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
+            // Memo
+            get_non_bayes_info (acc, IMAP_FRAME_MEMO, store, _("Memo Field"));
 
-            g_free (kvp_path_head);
+            // CSV Account Map
+            get_non_bayes_info (acc, IMAP_FRAME_CSV, store, _("CSV Account Map"));
 
             // Hide Probability Column
             show_probability_column (bayes_dialog, FALSE);

commit 9c9dff4f84f8af462f2e108af2497177a6003459
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri Nov 20 15:22:56 2015 +0000

    Cosmetic changes.

diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-bayes-editor.c
index 18b6cd5..2d65b61 100644
--- a/src/gnome/dialog-bayes-editor.c
+++ b/src/gnome/dialog-bayes-editor.c
@@ -85,23 +85,23 @@ struct kvp_info
 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = GNC_MOD_GUI;
 
-void gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer data);
-void gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer data);
-void gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data);
+void gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data);
+void gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer user_data);
+void gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data);
 
 static void get_account_info (BayesDialog *bayes_dialog);
 
 void
-gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer data)
+gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
 {
-    BayesDialog *bayes_dialog = data;
+    BayesDialog *bayes_dialog = user_data;
 
     ENTER(" ");
     gnc_unregister_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
 
     if (bayes_dialog->dialog)
     {
-        gtk_widget_destroy(bayes_dialog->dialog);
+        gtk_widget_destroy (bayes_dialog->dialog);
         bayes_dialog->dialog = NULL;
     }
     g_free (bayes_dialog);
@@ -109,9 +109,9 @@ gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer data)
 }
 
 void
-gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer data)
+gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer user_data)
 {
-    BayesDialog *bayes_dialog = data;
+    BayesDialog *bayes_dialog = user_data;
 
     ENTER(" ");
     gnc_close_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
@@ -119,12 +119,11 @@ gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer data)
 }
 
 static gboolean
-are_you_sure (gpointer data)
+are_you_sure (BayesDialog *bayes_dialog)
 {
-    BayesDialog *bayes_dialog = data;
     GtkWidget   *dialog;
     gint         response;
-    const char  *title = _("Are you sure you want to remove entries?");
+    const char  *title = _("Are you sure you want to delete the entries ?");
 
     dialog = gtk_message_dialog_new (GTK_WINDOW (bayes_dialog->dialog),
                                      GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -132,7 +131,7 @@ are_you_sure (gpointer data)
                                      GTK_BUTTONS_CANCEL,
                                      "%s", title);
 
-    gtk_dialog_add_button (GTK_DIALOG(dialog), _("_Remove"), GTK_RESPONSE_ACCEPT);
+    gtk_dialog_add_button (GTK_DIALOG(dialog), _("_Delete"), GTK_RESPONSE_ACCEPT);
 
     gtk_widget_grab_focus (gtk_dialog_get_widget_for_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT));
 
@@ -157,9 +156,8 @@ delete_kvp (Account *account, gchar *full_account, gchar *kvp_path)
 }
 
 static void
-gnc_bayes_dialog_remove (gpointer data)
+gnc_bayes_dialog_delete (BayesDialog *bayes_dialog)
 {
-    BayesDialog      *bayes_dialog = data;
     GList            *list, *row;
     GtkTreeModel     *model;
     GtkTreeIter       iter;
@@ -174,7 +172,7 @@ gnc_bayes_dialog_remove (gpointer data)
     if (g_list_length (list) == 0)
         return;
 
-    // Are we sure we want to remove the entries
+    // Are we sure we want to delete the entries
     if (are_you_sure (bayes_dialog) == FALSE)
         return;
 
@@ -239,14 +237,14 @@ gnc_bayes_dialog_remove (gpointer data)
 }
 
 void
-gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data)
+gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data)
 {
-    BayesDialog *bayes_dialog = data;
+    BayesDialog *bayes_dialog = user_data;
 
     switch (response_id)
     {
     case GTK_RESPONSE_APPLY:
-        gnc_bayes_dialog_remove (bayes_dialog);
+        gnc_bayes_dialog_delete (bayes_dialog);
         return;
 
     case GTK_RESPONSE_CLOSE:
@@ -256,10 +254,6 @@ gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data
     }
 }
 
-/** Event handler for clicking one of the list type radio buttons.
- * @param button The "List Type" radio button
- * @param bayes_dialog The display of the data
- */
 static void
 list_type_selected (GtkToggleButton* button, BayesDialog *bayes_dialog)
 {
@@ -323,13 +317,13 @@ add_to_store (gpointer user_data)
 }
 
 static void
-build_bayes_layer_two (const char *key, const GValue *value, gpointer data)
+build_bayes_layer_two (const char *key, const GValue *value, gpointer user_data)
 {
     QofBook     *book;
     gchar       *kvp_path;
     gchar       *probability;
 
-    struct kvp_info *kvpInfo = (struct kvp_info*)data;
+    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
 
     // Get the book
     book = gnc_get_current_book();
@@ -355,10 +349,10 @@ build_bayes_layer_two (const char *key, const GValue *value, gpointer data)
 }
 
 static void
-build_bayes (const char *key, const GValue *value, gpointer data)
+build_bayes (const char *key, const GValue *value, gpointer user_data)
 {
     char *kvp_path;
-    struct kvp_info *kvpInfo = (struct kvp_info*)data;
+    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
     struct kvp_info  kvpInfol2;
 
     PINFO("build_bayes: match string '%s'", (char*)key);
@@ -385,7 +379,7 @@ build_bayes (const char *key, const GValue *value, gpointer data)
 }
 
 static void
-build_non_bayes (const char *key, const GValue *value, gpointer data)
+build_non_bayes (const char *key, const GValue *value, gpointer user_data)
 {
     if (G_VALUE_HOLDS_BOXED (value))
     {
@@ -394,7 +388,7 @@ build_non_bayes (const char *key, const GValue *value, gpointer data)
         gchar       *kvp_path;
         gchar       *guid_string = NULL;
 
-        struct kvp_info *kvpInfo = (struct kvp_info*)data;
+        struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
 
         // Get the book
         book = gnc_get_current_book();
@@ -452,7 +446,7 @@ get_account_info (BayesDialog *bayes_dialog)
         if (bayes_dialog->type == BAYES)
         {
             if (qof_instance_has_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES))
-                qof_instance_foreach_slot(QOF_INSTANCE(acc), IMAP_FRAME_BAYES, build_bayes, &kvpInfo);
+                qof_instance_foreach_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES, build_bayes, &kvpInfo);
 
             // Show Probability Column
             show_probability_column (bayes_dialog, TRUE);
@@ -556,7 +550,7 @@ gnc_bayes_dialog_create (GtkWidget *parent, BayesDialog *bayes_dialog)
     bayes_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
 
     /* Enable alternative line colors */
-    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(bayes_dialog->view),TRUE);
+    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(bayes_dialog->view), TRUE);
 
     /* default to 'close' button */
     gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
diff --git a/src/gnome/gnc-plugin-basic-commands.c b/src/gnome/gnc-plugin-basic-commands.c
index 9e39c55..1f352d1 100644
--- a/src/gnome/gnc-plugin-basic-commands.c
+++ b/src/gnome/gnc-plugin-basic-commands.c
@@ -205,7 +205,7 @@ static GtkActionEntry gnc_plugin_actions [] =
     },
     {
         "ToolsBayesEditorAction", NULL, N_("_Bayesian Editor"), NULL,
-        N_("View and edit Bayesian and Non Bayesian values"),
+        N_("View and Delete Bayesian and Non Bayesian information"),
         G_CALLBACK (gnc_main_window_cmd_tools_bayes_editor)
     },
 
diff --git a/src/gnome/gtkbuilder/dialog-bayes-editor.glade b/src/gnome/gtkbuilder/dialog-bayes-editor.glade
index b9c8f4f..efc432f 100644
--- a/src/gnome/gtkbuilder/dialog-bayes-editor.glade
+++ b/src/gnome/gtkbuilder/dialog-bayes-editor.glade
@@ -39,7 +39,7 @@
           <object class="GtkLabel" id="label1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="label" translatable="yes">What type of data to display?</property>
+            <property name="label" translatable="yes">What type of information to display?</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -52,8 +52,8 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="remove_button">
-                <property name="label">gtk-remove</property>
+              <object class="GtkButton" id="delete_button">
+                <property name="label">gtk-delete</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
@@ -198,7 +198,7 @@
                 <child>
                   <object class="GtkTreeViewColumn" id="map_account_name">
                     <property name="resizable">True</property>
-                    <property name="title" translatable="yes">Map Account Name</property>
+                    <property name="title" translatable="yes">Mapped to Account Name</property>
                     <child>
                       <object class="GtkCellRendererText" id="cellrenderertext2"/>
                       <attributes>
@@ -233,7 +233,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="ypad">5</property>
-            <property name="label" translatable="yes">You may select multiple rows and then press remove button...</property>
+            <property name="label" translatable="yes">You may select multiple rows and then press the delete button...</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -244,7 +244,7 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-10">remove_button</action-widget>
+      <action-widget response="-10">delete_button</action-widget>
       <action-widget response="-6">close_button</action-widget>
     </action-widgets>
   </object>

commit 1cfd8e798050bc9cf188843ebb1cbcb54879e73a
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri Nov 20 10:28:03 2015 +0000

    Add the remove option.

diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-bayes-editor.c
index 05f08f2..18b6cd5 100644
--- a/src/gnome/dialog-bayes-editor.c
+++ b/src/gnome/dialog-bayes-editor.c
@@ -118,6 +118,126 @@ gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer data)
     LEAVE(" ");
 }
 
+static gboolean
+are_you_sure (gpointer data)
+{
+    BayesDialog *bayes_dialog = data;
+    GtkWidget   *dialog;
+    gint         response;
+    const char  *title = _("Are you sure you want to remove entries?");
+
+    dialog = gtk_message_dialog_new (GTK_WINDOW (bayes_dialog->dialog),
+                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+                                     GTK_MESSAGE_QUESTION,
+                                     GTK_BUTTONS_CANCEL,
+                                     "%s", title);
+
+    gtk_dialog_add_button (GTK_DIALOG(dialog), _("_Remove"), GTK_RESPONSE_ACCEPT);
+
+    gtk_widget_grab_focus (gtk_dialog_get_widget_for_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT));
+
+    response = gtk_dialog_run (GTK_DIALOG(dialog));
+
+    gtk_widget_destroy (dialog);
+
+    if (response == GTK_RESPONSE_ACCEPT)
+        return TRUE;
+    else
+        return FALSE;
+}
+
+static void
+delete_kvp (Account *account, gchar *full_account, gchar *kvp_path)
+{
+    qof_instance_slot_delete_if_empty (QOF_INSTANCE(account), kvp_path);
+
+    PINFO("Delete source account is '%s', path is '%s'", full_account, kvp_path);
+
+    g_free (kvp_path);
+}
+
+static void
+gnc_bayes_dialog_remove (gpointer data)
+{
+    BayesDialog      *bayes_dialog = data;
+    GList            *list, *row;
+    GtkTreeModel     *model;
+    GtkTreeIter       iter;
+    GtkTreeSelection *selection;
+
+    model = gtk_tree_view_get_model (GTK_TREE_VIEW(bayes_dialog->view));
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(bayes_dialog->view));
+
+    list = gtk_tree_selection_get_selected_rows (selection, &model);
+
+    // Make sure we have some rows selected
+    if (g_list_length (list) == 0)
+        return;
+
+    // Are we sure we want to remove the entries
+    if (are_you_sure (bayes_dialog) == FALSE)
+        return;
+
+    // reverse list
+    list = g_list_reverse (list);
+
+    for (row = g_list_first (list); row; row = g_list_next (row))
+    {
+	if (gtk_tree_model_get_iter (model, &iter, row->data))
+        {
+            Account *source_account = NULL;
+            gchar   *full_source_account;
+            gchar   *kvp_path;
+            gchar   *match_string;
+
+            gtk_tree_model_get (model, &iter, SOURCE_ACCOUNT, &source_account, SOURCE_FULL_ACC, &full_source_account,
+                                              KVP_PATH, &kvp_path, MATCH_STRING, &match_string, -1);
+
+            PINFO("Account is '%s', Path is '%s', Search is '%s'", full_source_account, kvp_path, match_string);
+
+            if ((source_account != NULL) && qof_instance_has_slot (QOF_INSTANCE(source_account), kvp_path))
+            {
+                xaccAccountBeginEdit (source_account);
+
+                qof_instance_slot_delete (QOF_INSTANCE(source_account), kvp_path);
+                g_free (kvp_path);
+
+                if (bayes_dialog->type == BAYES)
+                {
+                    kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", match_string);
+                    delete_kvp (source_account, full_source_account, kvp_path);
+
+                    kvp_path = g_strdup_printf (IMAP_FRAME_BAYES);
+                    delete_kvp (source_account, full_source_account, kvp_path);
+                }
+
+                if (bayes_dialog->type == NBAYES)
+                {
+                    kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
+                    delete_kvp (source_account, full_source_account, kvp_path);
+
+                    kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
+                    delete_kvp (source_account, full_source_account, kvp_path);
+
+                    kvp_path = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
+                    delete_kvp (source_account, full_source_account, kvp_path);
+
+                    kvp_path = g_strdup_printf (IMAP_FRAME);
+                    delete_kvp (source_account, full_source_account, kvp_path);
+                }
+                qof_instance_set_dirty (QOF_INSTANCE(source_account));
+                xaccAccountCommitEdit (source_account);
+            }
+            g_free (match_string);
+            g_free (full_source_account);
+	}
+    }
+    g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
+    g_list_free (list);
+
+    get_account_info (bayes_dialog);
+}
+
 void
 gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data)
 {
@@ -125,6 +245,10 @@ gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data
 
     switch (response_id)
     {
+    case GTK_RESPONSE_APPLY:
+        gnc_bayes_dialog_remove (bayes_dialog);
+        return;
+
     case GTK_RESPONSE_CLOSE:
     default:
         gnc_close_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
@@ -268,6 +392,7 @@ build_non_bayes (const char *key, const GValue *value, gpointer data)
         QofBook     *book;
         GncGUID     *guid = NULL;
         gchar       *kvp_path;
+        gchar       *guid_string = NULL;
 
         struct kvp_info *kvpInfo = (struct kvp_info*)data;
 
@@ -275,8 +400,9 @@ build_non_bayes (const char *key, const GValue *value, gpointer data)
         book = gnc_get_current_book();
 
         guid = (GncGUID*)g_value_get_boxed (value);
+        guid_string = guid_to_string (guid);
 
-        PINFO("build_non_bayes: account '%s', match account guid: '%s'", (char*)key, guid_to_string(guid));
+        PINFO("build_non_bayes: account '%s', match account guid: '%s'", (char*)key, guid_string);
 
         kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
 
@@ -291,6 +417,7 @@ build_non_bayes (const char *key, const GValue *value, gpointer data)
         add_to_store (kvpInfo);
 
         g_free (kvp_path);
+        g_free (guid_string);
     }
 }
 

commit 54290cd5f4f7422f79525233c8a5bb10b8dfc984
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 18 12:19:28 2015 +0000

    Hide the probability column where appropriate.

diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-bayes-editor.c
index 89d2863..05f08f2 100644
--- a/src/gnome/dialog-bayes-editor.c
+++ b/src/gnome/dialog-bayes-editor.c
@@ -157,6 +157,20 @@ list_type_selected (GtkToggleButton* button, BayesDialog *bayes_dialog)
 }
 
 static void
+show_probability_column (BayesDialog *bayes_dialog, gboolean show)
+{
+    GtkTreeViewColumn *tree_column;
+
+    // Show Probability Column
+    tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW(bayes_dialog->view), 4);
+    gtk_tree_view_column_set_visible (tree_column, show);
+
+    // Hide Based on Column
+    tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW(bayes_dialog->view), 1);
+    gtk_tree_view_column_set_visible (tree_column, !show);
+}
+
+static void
 add_to_store (gpointer user_data)
 {
     GtkTreeIter  iter;
@@ -312,6 +326,9 @@ get_account_info (BayesDialog *bayes_dialog)
         {
             if (qof_instance_has_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES))
                 qof_instance_foreach_slot(QOF_INSTANCE(acc), IMAP_FRAME_BAYES, build_bayes, &kvpInfo);
+
+            // Show Probability Column
+            show_probability_column (bayes_dialog, TRUE);
         }
 
         if (bayes_dialog->type == NBAYES)
@@ -343,6 +360,9 @@ get_account_info (BayesDialog *bayes_dialog)
                 qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
 
             g_free (kvp_path_head);
+
+            // Hide Probability Column
+            show_probability_column (bayes_dialog, FALSE);
         }
 
         if (bayes_dialog->type == ONLINE)
@@ -368,6 +388,8 @@ get_account_info (BayesDialog *bayes_dialog)
                     add_to_store (&kvpInfo);
                 }
             }
+            // Hide Probability Column
+            show_probability_column (bayes_dialog, FALSE);
         }
     }
     g_list_free (accts);

commit 96edb94f6733c6bef93b5da632986eb4777988d2
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 18 12:10:20 2015 +0000

    Get Bayesian values, needed to change Qof function
    as values are stored under FRAME,FRAME,VALUE so
    changed to test for a FRAME and returns NULL.

diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-bayes-editor.c
index 80f8884..89d2863 100644
--- a/src/gnome/dialog-bayes-editor.c
+++ b/src/gnome/dialog-bayes-editor.c
@@ -185,6 +185,68 @@ add_to_store (gpointer user_data)
 }
 
 static void
+build_bayes_layer_two (const char *key, const GValue *value, gpointer data)
+{
+    QofBook     *book;
+    gchar       *kvp_path;
+    gchar       *probability;
+
+    struct kvp_info *kvpInfo = (struct kvp_info*)data;
+
+    // Get the book
+    book = gnc_get_current_book();
+
+    PINFO("build_bayes_layer_two: account '%s', token_count: '%ld'", (char*)key, (long)g_value_get_int64(value));
+
+    probability = g_strdup_printf ("%ld", g_value_get_int64 (value));
+
+    kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
+
+    PINFO("build_bayes_layer_two: kvp_path is '%s'", kvp_path);
+
+    kvpInfo->map_account = gnc_account_lookup_by_full_name (gnc_book_get_root_account (book), key);
+
+    kvpInfo->kvp_path = kvp_path;
+    kvpInfo->probability = probability;
+
+    // Add kvp data to store
+    add_to_store (kvpInfo);
+
+    g_free (kvp_path);
+    g_free (probability);
+}
+
+static void
+build_bayes (const char *key, const GValue *value, gpointer data)
+{
+    char *kvp_path;
+    struct kvp_info *kvpInfo = (struct kvp_info*)data;
+    struct kvp_info  kvpInfol2;
+
+    PINFO("build_bayes: match string '%s'", (char*)key);
+
+    if (G_VALUE_HOLDS (value, G_TYPE_STRING) && g_value_get_string (value) == NULL)
+    {
+        kvp_path = g_strdup_printf (IMAP_FRAME_BAYES "/%s", key);
+
+        if (qof_instance_has_slot (QOF_INSTANCE(kvpInfo->source_account), kvp_path))
+        {
+            PINFO("build_bayes: kvp_path is '%s', key '%s'", kvp_path, key);
+
+            kvpInfol2.store = kvpInfo->store;
+            kvpInfol2.source_account = kvpInfo->source_account;
+            kvpInfol2.based_on = _("Bayesian");
+            kvpInfol2.match_string = key;
+            kvpInfol2.kvp_path_head = kvp_path;
+
+            qof_instance_foreach_slot (QOF_INSTANCE(kvpInfo->source_account), kvp_path,
+                                       build_bayes_layer_two, &kvpInfol2);
+        }
+        g_free (kvp_path);
+    }
+}
+
+static void
 build_non_bayes (const char *key, const GValue *value, gpointer data)
 {
     if (G_VALUE_HOLDS_BOXED (value))
@@ -246,6 +308,12 @@ get_account_info (BayesDialog *bayes_dialog)
         // Save source account
         kvpInfo.source_account = acc;
 
+        if (bayes_dialog->type == BAYES)
+        {
+            if (qof_instance_has_slot (QOF_INSTANCE(acc), IMAP_FRAME_BAYES))
+                qof_instance_foreach_slot(QOF_INSTANCE(acc), IMAP_FRAME_BAYES, build_bayes, &kvpInfo);
+        }
+
         if (bayes_dialog->type == NBAYES)
         {
             kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
diff --git a/src/libqof/qof/qofinstance.cpp b/src/libqof/qof/qofinstance.cpp
index aec6420..4d988fb 100644
--- a/src/libqof/qof/qofinstance.cpp
+++ b/src/libqof/qof/qofinstance.cpp
@@ -1280,8 +1280,16 @@ struct wrap_param
 static void
 wrap_gvalue_function (const char* key, KvpValue *val, gpointer data)
 {
+    GValue *gv;
     auto param = static_cast<wrap_param*>(data);
-    GValue *gv = gvalue_from_kvp_value(val);
+    if (val->get_type() != KvpValue::Type::FRAME)
+        gv = gvalue_from_kvp_value(val);
+    else
+    {
+        gv = g_slice_new0 (GValue);
+        g_value_init (gv, G_TYPE_STRING);
+        g_value_set_string (gv, nullptr);
+    }
     param->proc(key, gv, param->user_data);
     g_slice_free (GValue, gv);
 }

commit 837e068392139bb6bae73feeab1d279656591a8e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Nov 18 11:34:29 2015 +0000

    Get Non Bayesian and Online ID information

diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-bayes-editor.c
index b095fc1..80f8884 100644
--- a/src/gnome/dialog-bayes-editor.c
+++ b/src/gnome/dialog-bayes-editor.c
@@ -89,6 +89,8 @@ void gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer data);
 void gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer data);
 void gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data);
 
+static void get_account_info (BayesDialog *bayes_dialog);
+
 void
 gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer data)
 {
@@ -130,6 +132,179 @@ gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data
     }
 }
 
+/** Event handler for clicking one of the list type radio buttons.
+ * @param button The "List Type" radio button
+ * @param bayes_dialog The display of the data
+ */
+static void
+list_type_selected (GtkToggleButton* button, BayesDialog *bayes_dialog)
+{
+    GncListType type;
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(bayes_dialog->radio_bayes)))
+        type = BAYES;
+    else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(bayes_dialog->radio_nbayes)))
+        type = NBAYES;
+    else
+        type = ONLINE;
+
+    // Lets do this only on change of list type
+    if (type != bayes_dialog->type)
+    {
+        bayes_dialog->type = type;
+        get_account_info (bayes_dialog);
+    }
+}
+
+static void
+add_to_store (gpointer user_data)
+{
+    GtkTreeIter  iter;
+    gchar       *fullname = NULL;
+    gchar       *map_fullname = NULL;
+
+    struct kvp_info *kvpInfo = (struct kvp_info*)user_data;
+
+    gtk_list_store_append (GTK_LIST_STORE(kvpInfo->store), &iter);
+
+    fullname = gnc_account_get_full_name (kvpInfo->source_account);
+
+    map_fullname = gnc_account_get_full_name (kvpInfo->map_account);
+
+    PINFO("Add to Store: Source Acc '%s', Based on '%s', Map Acc '%s'", fullname, kvpInfo->based_on, map_fullname);
+
+    gtk_list_store_set (GTK_LIST_STORE(kvpInfo->store), &iter,
+                        SOURCE_FULL_ACC, fullname, SOURCE_ACCOUNT, kvpInfo->source_account,
+                        BASED_ON, kvpInfo->based_on,
+                        MATCH_STRING, kvpInfo->match_string,
+                        MAP_FULL_ACC, map_fullname, MAP_ACCOUNT, kvpInfo->map_account,
+                        KVP_PATH, kvpInfo->kvp_path, PROBABILITY, kvpInfo->probability, -1);
+
+    g_free (fullname);
+    g_free (map_fullname);
+}
+
+static void
+build_non_bayes (const char *key, const GValue *value, gpointer data)
+{
+    if (G_VALUE_HOLDS_BOXED (value))
+    {
+        QofBook     *book;
+        GncGUID     *guid = NULL;
+        gchar       *kvp_path;
+
+        struct kvp_info *kvpInfo = (struct kvp_info*)data;
+
+        // Get the book
+        book = gnc_get_current_book();
+
+        guid = (GncGUID*)g_value_get_boxed (value);
+
+        PINFO("build_non_bayes: account '%s', match account guid: '%s'", (char*)key, guid_to_string(guid));
+
+        kvp_path = g_strconcat (kvpInfo->kvp_path_head, "/", key, NULL);
+
+        PINFO("build_non_bayes: kvp_path is '%s'", kvp_path);
+
+        kvpInfo->map_account = xaccAccountLookup (guid, book);
+        kvpInfo->match_string = key;
+        kvpInfo->kvp_path = kvp_path;
+        kvpInfo->probability = " ";
+
+        // Add kvp data to store
+        add_to_store (kvpInfo);
+
+        g_free (kvp_path);
+    }
+}
+
+static void
+get_account_info (BayesDialog *bayes_dialog)
+{
+    Account *root;
+    Account *acc;
+    GList   *accts, *ptr;
+    GtkTreeIter iter;
+    GtkTreeModel *store;
+
+    struct kvp_info kvpInfo;
+
+    /* Get list of Accounts */
+    root = gnc_book_get_root_account (gnc_get_current_book());
+    accts = gnc_account_get_descendants_sorted (root);
+
+    store = gtk_tree_view_get_model (GTK_TREE_VIEW(bayes_dialog->view));
+    gtk_list_store_clear (GTK_LIST_STORE(store));
+    kvpInfo.store = store;
+
+    /* Go through list of accounts */
+    for (ptr = accts; ptr; ptr = g_list_next (ptr))
+    {
+        Account *acc = ptr->data;
+        gchar   *kvp_path_head = NULL;
+
+        // Save source account
+        kvpInfo.source_account = acc;
+
+        if (bayes_dialog->type == NBAYES)
+        {
+            kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_DESC);
+
+            kvpInfo.based_on = _("Description Field");
+            kvpInfo.kvp_path_head = kvp_path_head;
+
+            if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
+                qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
+
+            g_free (kvp_path_head);
+            kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_MEMO);
+
+            kvpInfo.based_on = _("Memo Field");
+            kvpInfo.kvp_path_head = kvp_path_head;
+
+            if (qof_instance_has_slot (QOF_INSTANCE (acc), kvp_path_head))
+                qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
+
+            g_free (kvp_path_head);
+            kvp_path_head = g_strdup_printf (IMAP_FRAME "/%s", IMAP_FRAME_CSV);
+
+            kvpInfo.based_on = _("CSV Account Map");
+            kvpInfo.kvp_path_head = kvp_path_head;
+
+            if (qof_instance_has_slot (QOF_INSTANCE(acc), kvp_path_head))
+                qof_instance_foreach_slot (QOF_INSTANCE(acc), kvp_path_head, build_non_bayes, &kvpInfo);
+
+            g_free (kvp_path_head);
+        }
+
+        if (bayes_dialog->type == ONLINE)
+        {
+            GValue v = G_VALUE_INIT;
+
+            kvpInfo.based_on = _("Online Id");
+            kvpInfo.kvp_path = "online_id";
+
+            if (qof_instance_has_slot (QOF_INSTANCE(acc), kvpInfo.kvp_path))
+            {
+                qof_instance_get_kvp (QOF_INSTANCE(acc), kvpInfo.kvp_path, &v);
+
+                if (G_VALUE_HOLDS_STRING (&v))
+                {
+                    const gchar *string = g_value_get_string (&v);
+
+                    kvpInfo.map_account = kvpInfo.source_account;
+                    kvpInfo.match_string  = string;
+                    kvpInfo.probability = " ";
+
+                    // Add kvp data to store
+                    add_to_store (&kvpInfo);
+                }
+            }
+        }
+    }
+    g_list_free (accts);
+}
+
 static void
 gnc_bayes_dialog_create (GtkWidget *parent, BayesDialog *bayes_dialog)
 {
@@ -156,6 +331,10 @@ gnc_bayes_dialog_create (GtkWidget *parent, BayesDialog *bayes_dialog)
     bayes_dialog->radio_bayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-bayes"));
     bayes_dialog->radio_nbayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-nbayes"));
     bayes_dialog->radio_online = GTK_WIDGET(gtk_builder_get_object (builder, "radio-online"));
+    g_signal_connect (bayes_dialog->radio_bayes, "toggled",
+                      G_CALLBACK(list_type_selected), (gpointer)bayes_dialog);
+    g_signal_connect (bayes_dialog->radio_nbayes, "toggled",
+                      G_CALLBACK(list_type_selected), (gpointer)bayes_dialog);
 
     bayes_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
 
@@ -173,6 +352,7 @@ gnc_bayes_dialog_create (GtkWidget *parent, BayesDialog *bayes_dialog)
     g_object_unref (G_OBJECT(builder));
 
     gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(bayes_dialog->dialog));
+    get_account_info (bayes_dialog);
 
     LEAVE(" ");
 }

commit 2e4c957d004cca0141a7c35faa2540ac6a0ecae3
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Nov 15 12:56:57 2015 +0000

    Add Basic framework for Bayesian editor dialog

diff --git a/src/gnome/Makefile.am b/src/gnome/Makefile.am
index a498323..4da52dd 100644
--- a/src/gnome/Makefile.am
+++ b/src/gnome/Makefile.am
@@ -28,6 +28,7 @@ libgnc_gnome_la_SOURCES = \
   assistant-hierarchy.c \
   assistant-loan.c \
   assistant-stock-split.c \
+  dialog-bayes-editor.c \
   dialog-commodities.c \
   dialog-fincalc.c \
   dialog-find-transactions.c \
@@ -81,6 +82,7 @@ noinst_HEADERS = \
   assistant-hierarchy.h \
   assistant-loan.h \
   assistant-stock-split.h \
+  dialog-bayes-editor.h \
   dialog-fincalc.h \
   dialog-find-transactions.h \
   dialog-find-transactions2.h \
diff --git a/src/gnome/dialog-bayes-editor.c b/src/gnome/dialog-bayes-editor.c
new file mode 100644
index 0000000..b095fc1
--- /dev/null
+++ b/src/gnome/dialog-bayes-editor.c
@@ -0,0 +1,246 @@
+/********************************************************************\
+ * dialog-bayes-editor.c -- Bayesian and Non Bayesian editor dialog *
+ * Copyright (C) 2015 Robert Fewell                                 *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include "dialog-bayes-editor.h"
+
+#include "dialog-utils.h"
+#include "gnc-component-manager.h"
+#include "gnc-session.h"
+
+#include "gnc-ui-util.h"
+#include "qofinstance-p.h"
+
+#define DIALOG_BAYES_CM_CLASS   "dialog-bayes-edit"
+#define GNC_PREFS_GROUP         "dialogs.bayes-editor"
+
+#define IMAP_FRAME_BAYES        "import-map-bayes"
+#define IMAP_FRAME              "import-map"
+
+#define IMAP_FRAME_DESC         "desc"
+#define IMAP_FRAME_MEMO         "memo"
+#define IMAP_FRAME_CSV          "csv-account-map"
+
+/** Enumeration for the liststore */
+enum GncBayesColumn {SOURCE_FULL_ACC, SOURCE_ACCOUNT, BASED_ON, MATCH_STRING,
+                     MAP_FULL_ACC, MAP_ACCOUNT, KVP_PATH, PROBABILITY};
+
+typedef enum
+{
+    BAYES,
+    NBAYES,
+    ONLINE
+}GncListType;
+
+typedef struct
+{
+    GtkWidget    *dialog;
+    QofSession   *session;
+    GtkWidget    *store;
+    GtkWidget    *view;
+    GncListType   type;
+
+    GtkWidget *radio_bayes;
+    GtkWidget *radio_nbayes;
+    GtkWidget *radio_online;
+
+} BayesDialog;
+
+struct kvp_info
+{
+    GtkTreeModel *store;
+    Account      *source_account;
+    Account      *map_account;
+    const gchar  *based_on;
+    const gchar  *match_string;
+    const gchar  *kvp_path_head;
+    const gchar  *kvp_path;
+    const gchar  *probability;
+};
+
+
+/* This static indicates the debugging module that this .o belongs to.  */
+static QofLogModule log_module = GNC_MOD_GUI;
+
+void gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer data);
+void gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer data);
+void gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data);
+
+void
+gnc_bayes_dialog_window_destroy_cb (GtkWidget *object, gpointer data)
+{
+    BayesDialog *bayes_dialog = data;
+
+    ENTER(" ");
+    gnc_unregister_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
+
+    if (bayes_dialog->dialog)
+    {
+        gtk_widget_destroy(bayes_dialog->dialog);
+        bayes_dialog->dialog = NULL;
+    }
+    g_free (bayes_dialog);
+    LEAVE(" ");
+}
+
+void
+gnc_bayes_dialog_close_cb (GtkDialog *dialog, gpointer data)
+{
+    BayesDialog *bayes_dialog = data;
+
+    ENTER(" ");
+    gnc_close_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
+    LEAVE(" ");
+}
+
+void
+gnc_bayes_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data)
+{
+    BayesDialog *bayes_dialog = data;
+
+    switch (response_id)
+    {
+    case GTK_RESPONSE_CLOSE:
+    default:
+        gnc_close_gui_component_by_data (DIALOG_BAYES_CM_CLASS, bayes_dialog);
+        return;
+    }
+}
+
+static void
+gnc_bayes_dialog_create (GtkWidget *parent, BayesDialog *bayes_dialog)
+{
+    GtkWidget        *dialog;
+    GtkBuilder       *builder;
+    GtkTreeSelection *selection;
+
+    ENTER(" ");
+    builder = gtk_builder_new();
+    gnc_builder_add_from_file (builder, "dialog-bayes-editor.glade", "list-view");
+    gnc_builder_add_from_file (builder, "dialog-bayes-editor.glade", "Bayesian Dialog");
+
+    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Bayesian Dialog"));
+    bayes_dialog->dialog = dialog;
+
+    bayes_dialog->session = gnc_get_current_session();
+    bayes_dialog->type = BAYES;
+
+    /* parent */
+    if (parent != NULL)
+        gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));
+
+    /* Connect the radio buttons...*/
+    bayes_dialog->radio_bayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-bayes"));
+    bayes_dialog->radio_nbayes = GTK_WIDGET(gtk_builder_get_object (builder, "radio-nbayes"));
+    bayes_dialog->radio_online = GTK_WIDGET(gtk_builder_get_object (builder, "radio-online"));
+
+    bayes_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
+
+    /* Enable alternative line colors */
+    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(bayes_dialog->view),TRUE);
+
+    /* default to 'close' button */
+    gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(bayes_dialog->view));
+    gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, bayes_dialog);
+
+    g_object_unref (G_OBJECT(builder));
+
+    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(bayes_dialog->dialog));
+
+    LEAVE(" ");
+}
+
+static void
+close_handler (gpointer user_data)
+{
+    BayesDialog *bayes_dialog = user_data;
+
+    ENTER(" ");
+    gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(bayes_dialog->dialog));
+    gtk_widget_destroy (GTK_WIDGET(bayes_dialog->dialog));
+    LEAVE(" ");
+}
+
+static void
+refresh_handler (GHashTable *changes, gpointer user_data)
+{
+    ENTER(" ");
+    LEAVE(" ");
+}
+
+static gboolean
+show_handler (const char *klass, gint component_id,
+              gpointer user_data, gpointer iter_data)
+{
+    BayesDialog *bayes_dialog = user_data;
+
+    ENTER(" ");
+    if (!bayes_dialog)
+    {
+        LEAVE("No data strucure");
+        return(FALSE);
+    }
+    gtk_window_present (GTK_WINDOW(bayes_dialog->dialog));
+    LEAVE(" ");
+    return(TRUE);
+}
+
+/********************************************************************\
+ * gnc_bayes_dialog                                                 *
+ * opens a window showing all Bayesian and Non-Bayesian information *
+ *                                                                  *
+ * Args:   parent  - the parent of the window to be created         *
+ * Return: nothing                                                  *
+\********************************************************************/
+void
+gnc_bayes_dialog (GtkWidget *parent)
+{
+    BayesDialog *bayes_dialog;
+    gint component_id;
+
+    ENTER(" ");
+    if (gnc_forall_gui_components (DIALOG_BAYES_CM_CLASS, show_handler, NULL))
+    {
+        LEAVE("Existing dialog raised");
+        return;
+    }
+    bayes_dialog = g_new0 (BayesDialog, 1);
+
+    gnc_bayes_dialog_create (parent, bayes_dialog);
+
+    component_id = gnc_register_gui_component (DIALOG_BAYES_CM_CLASS,
+                   refresh_handler, close_handler,
+                   bayes_dialog);
+
+    gnc_gui_component_set_session (component_id, bayes_dialog->session);
+
+    gtk_widget_show (bayes_dialog->dialog);
+    LEAVE(" ");
+}
diff --git a/src/gnome/dialog-bayes-editor.h b/src/gnome/dialog-bayes-editor.h
new file mode 100644
index 0000000..a9af184
--- /dev/null
+++ b/src/gnome/dialog-bayes-editor.h
@@ -0,0 +1,28 @@
+/********************************************************************\
+ * dialog-bayes-editor.h -- Bayesian and Non Bayesian editor dialog *
+ * Copyright (C) 2015 Robert Fewell                                 *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+
+#ifndef DIALOG_BAYES_EDITOR_H
+#define DIALOG_BAYES_EDITOR_H
+
+void gnc_bayes_dialog (GtkWidget *parent);
+
+#endif
diff --git a/src/gnome/gnc-plugin-basic-commands.c b/src/gnome/gnc-plugin-basic-commands.c
index 2e25594..9e39c55 100644
--- a/src/gnome/gnc-plugin-basic-commands.c
+++ b/src/gnome/gnc-plugin-basic-commands.c
@@ -39,6 +39,7 @@
 #include "gnc-plugin-basic-commands.h"
 #include "gnc-ui-util.h"
 
+#include "dialog-bayes-editor.h"
 #include "dialog-book-close.h"
 #include "dialog-file-access.h"
 #include "dialog-fincalc.h"
@@ -88,6 +89,7 @@ static void gnc_main_window_cmd_tools_financial_calculator (GtkAction *action, G
 static void gnc_main_window_cmd_tools_close_book (GtkAction *action, GncMainWindowActionData *data);
 static void gnc_main_window_cmd_tools_find_transactions (GtkAction *action, GncMainWindowActionData *data);
 static void gnc_main_window_cmd_tools_price_editor (GtkAction *action, GncMainWindowActionData *data);
+static void gnc_main_window_cmd_tools_bayes_editor (GtkAction *action, GncMainWindowActionData *data);
 static void gnc_main_window_cmd_tools_commodity_editor (GtkAction *action, GncMainWindowActionData *data);
 static void gnc_main_window_cmd_help_totd (GtkAction *action, GncMainWindowActionData *data);
 
@@ -201,6 +203,11 @@ static GtkActionEntry gnc_plugin_actions [] =
         N_("Close the Book at the end of the Period"),
         G_CALLBACK (gnc_main_window_cmd_tools_close_book)
     },
+    {
+        "ToolsBayesEditorAction", NULL, N_("_Bayesian Editor"), NULL,
+        N_("View and edit Bayesian and Non Bayesian values"),
+        G_CALLBACK (gnc_main_window_cmd_tools_bayes_editor)
+    },
 
     /* Help menu */
 
@@ -603,6 +610,14 @@ gnc_main_window_cmd_actions_close_books (GtkAction *action, GncMainWindowActionD
 #endif /* CLOSE_BOOKS_ACTUALLY_WORKS */
 
 static void
+gnc_main_window_cmd_tools_bayes_editor (GtkAction *action, GncMainWindowActionData *data)
+{
+    gnc_set_busy_cursor(NULL, TRUE);
+    gnc_bayes_dialog (NULL);
+    gnc_unset_busy_cursor(NULL);
+}
+
+static void
 gnc_main_window_cmd_tools_price_editor (GtkAction *action, GncMainWindowActionData *data)
 {
     gnc_set_busy_cursor(NULL, TRUE);
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in b/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
index 7c318dd..529f6f5 100644
--- a/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
+++ b/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in.in
@@ -1,6 +1,7 @@
 <schemalist gettext-domain="@GETTEXT_PACKAGE@">
   <schema id="org.gnucash.dialogs" path="/org/gnucash/dialogs/">
     <child name="account" schema="org.gnucash.dialogs.account"/>
+    <child name="bayes-editor" schema="org.gnucash.dialogs.bayes-editor"/>
     <child name="preferences" schema="org.gnucash.dialogs.preferences"/>
     <child name="price-editor" schema="org.gnucash.dialogs.price-editor"/>
     <child name="pricedb-editor" schema="org.gnucash.dialogs.pricedb-editor"/>
@@ -30,6 +31,16 @@
     </key>
   </schema>
 
+  <schema id="org.gnucash.dialogs.bayes-editor" path="/org/gnucash/dialogs/bayes-editor/">
+    <key type="(iiii)" name="last-geometry">
+      <default>(-1,-1,-1,-1)</default>
+      <summary>Last window position and size</summary>
+      <description>This setting describes the size and position of the window when it was last closed.
+        The numbers are the X and Y coordinates of the top left corner of the window
+        followed by the width and height of the window.</description>
+    </key>
+  </schema>
+
   <schema id="org.gnucash.dialogs.preferences" path="/org/gnucash/dialogs/preferences/">
     <key name="last-geometry" type="(iiii)">
       <default>(-1,-1,-1,-1)</default>
diff --git a/src/gnome/gtkbuilder/Makefile.am b/src/gnome/gtkbuilder/Makefile.am
index 2a2f9b8..64fd86d 100644
--- a/src/gnome/gtkbuilder/Makefile.am
+++ b/src/gnome/gtkbuilder/Makefile.am
@@ -4,6 +4,7 @@ gtkbuilder_DATA = \
 	assistant-hierarchy.glade \
 	assistant-loan.glade \
 	assistant-stock-split.glade \
+	dialog-bayes-editor.glade \
 	dialog-commodities.glade \
 	dialog-fincalc.glade \
 	dialog-lot-viewer.glade \
diff --git a/src/gnome/gtkbuilder/dialog-bayes-editor.glade b/src/gnome/gtkbuilder/dialog-bayes-editor.glade
new file mode 100644
index 0000000..b9c8f4f
--- /dev/null
+++ b/src/gnome/gtkbuilder/dialog-bayes-editor.glade
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkListStore" id="list-view">
+    <columns>
+      <!-- column-name source_account_name -->
+      <column type="gchararray"/>
+      <!-- column-name source_account -->
+      <column type="gpointer"/>
+      <!-- column-name based_on -->
+      <column type="gchararray"/>
+      <!-- column-name match_string -->
+      <column type="gchararray"/>
+      <!-- column-name map_account_name -->
+      <column type="gchararray"/>
+      <!-- column-name map_account -->
+      <column type="gpointer"/>
+      <!-- column-name kvp_path -->
+      <column type="gchararray"/>
+      <!-- column-name probability -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkDialog" id="Bayesian Dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Bayesian Editor</property>
+    <property name="modal">True</property>
+    <property name="default_width">600</property>
+    <property name="default_height">400</property>
+    <property name="type_hint">dialog</property>
+    <signal name="destroy" handler="gnc_bayes_dialog_window_destroy_cb" swapped="no"/>
+    <signal name="response" handler="gnc_bayes_dialog_response_cb" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox2">
+        <property name="can_focus">False</property>
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">What type of data to display?</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="remove_button">
+                <property name="label">gtk-remove</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="close_button">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">5</property>
+            <child>
+              <object class="GtkRadioButton" id="radio-bayes">
+                <property name="label" translatable="yes">Bayesian</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="radio-nbayes">
+                <property name="label" translatable="yes">Non-Bayesian</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">radio-bayes</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="radio-online">
+                <property name="label" translatable="yes">Online ID</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">radio-bayes</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow2">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">automatic</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <child>
+              <object class="GtkTreeView" id="treeview">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="model">list-view</property>
+                <child>
+                  <object class="GtkTreeViewColumn" id="source_account_name">
+                    <property name="resizable">True</property>
+                    <property name="title" translatable="yes">Source Account Name</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext3"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="based_on">
+                    <property name="resizable">True</property>
+                    <property name="title" translatable="yes">Based On</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext4"/>
+                      <attributes>
+                        <attribute name="text">2</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="match">
+                    <property name="resizable">True</property>
+                    <property name="title" translatable="yes">Match String</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                      <attributes>
+                        <attribute name="text">3</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="map_account_name">
+                    <property name="resizable">True</property>
+                    <property name="title" translatable="yes">Map Account Name</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                      <attributes>
+                        <attribute name="text">4</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="probability">
+                    <property name="resizable">True</property>
+                    <property name="title" translatable="yes">Probability Value</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext5"/>
+                      <attributes>
+                        <attribute name="text">7</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="ypad">5</property>
+            <property name="label" translatable="yes">You may select multiple rows and then press remove button...</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-10">remove_button</action-widget>
+      <action-widget response="-6">close_button</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/src/gnome/ui/gnc-plugin-basic-commands-ui.xml b/src/gnome/ui/gnc-plugin-basic-commands-ui.xml
index e60ffce..2647408 100644
--- a/src/gnome/ui/gnc-plugin-basic-commands-ui.xml
+++ b/src/gnome/ui/gnc-plugin-basic-commands-ui.xml
@@ -56,6 +56,7 @@
         <menuitem name="ToolsCommodityEditor" action="ToolsCommodityEditorAction"/>
         <menuitem name="ToolsFinancialCalculator" action="ToolsFinancialCalculatorAction"/>
         <menuitem name="ToolsBookClose" action="ToolsBookCloseAction"/>
+        <menuitem name="ToolsBayesEditor" action="ToolsBayesEditorAction"/>
       </placeholder>
     </menu>
 



Summary of changes:
 po/POTFILES.in                                     |   2 +
 src/engine/Account.c                               | 210 ++++++
 src/engine/Account.h                               |  31 +
 src/gnome/Makefile.am                              |   2 +
 src/gnome/dialog-imap-editor.c                     | 777 +++++++++++++++++++++
 .../mod-baz/baz.h => gnome/dialog-imap-editor.h}   |  12 +-
 src/gnome/gnc-plugin-basic-commands.c              |  15 +
 .../gschemas/org.gnucash.dialogs.gschema.xml.in.in |  11 +
 src/gnome/gtkbuilder/Makefile.am                   |   1 +
 src/gnome/gtkbuilder/dialog-imap-editor.glade      | 370 ++++++++++
 src/gnome/ui/gnc-plugin-basic-commands-ui.xml      |   1 +
 src/libqof/qof/qofinstance.cpp                     |  10 +-
 12 files changed, 1435 insertions(+), 7 deletions(-)
 create mode 100644 src/gnome/dialog-imap-editor.c
 copy src/{gnc-module/test/mod-baz/baz.h => gnome/dialog-imap-editor.h} (84%)
 create mode 100644 src/gnome/gtkbuilder/dialog-imap-editor.glade



More information about the gnucash-changes mailing list