mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Rename some functions and structures based on imap
This commit is contained in:
parent
8a536d4152
commit
43e122ca9c
@ -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))
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -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,46 +304,143 @@ 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
|
||||
show_first_row (ImapDialog *imap_dialog)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *store;
|
||||
|
||||
store = gtk_tree_view_get_model (GTK_TREE_VIEW(imap_dialog->view));
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_account_info_bayes (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;
|
||||
|
||||
get_imap_info (acc, NULL, store, _("Bayesian"));
|
||||
}
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (g_strcmp0 (text, "") == 0)
|
||||
imapInfo.map_account = NULL;
|
||||
else
|
||||
imapInfo.map_account = imapInfo.source_account;
|
||||
|
||||
imapInfo.match_string = text;
|
||||
imapInfo.count = " ";
|
||||
|
||||
// Add imap data to store
|
||||
add_to_store (store, _("Online Id"), &imapInfo);
|
||||
}
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_account_info (ImapDialog *imap_dialog)
|
||||
{
|
||||
Account *root;
|
||||
Account *acc;
|
||||
GList *accts, *ptr;
|
||||
GList *accts;
|
||||
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);
|
||||
@ -352,58 +451,21 @@ get_account_info (ImapDialog *imap_dialog)
|
||||
// Hide Count Column
|
||||
show_count_column (imap_dialog, FALSE);
|
||||
|
||||
/* Go through list of accounts */
|
||||
for (ptr = accts; ptr; ptr = g_list_next (ptr))
|
||||
if (imap_dialog->type == BAYES)
|
||||
{
|
||||
Account *acc = ptr->data;
|
||||
get_account_info_bayes (accts, store);
|
||||
|
||||
// Save source account
|
||||
kvpInfo.source_account = acc;
|
||||
|
||||
if (imap_dialog->type == BAYES)
|
||||
{
|
||||
get_imap_info (acc, NULL, store, _("Bayesian"));
|
||||
|
||||
// Show Count Column
|
||||
show_count_column (imap_dialog, TRUE);
|
||||
}
|
||||
|
||||
if (imap_dialog->type == NBAYES)
|
||||
{
|
||||
// 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 == ONLINE)
|
||||
{
|
||||
gchar *text = NULL;
|
||||
|
||||
kvpInfo.kvp_path = "online_id";
|
||||
|
||||
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 = text;
|
||||
kvpInfo.count = " ";
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user