Some more name changes

This commit is contained in:
Robert Fewell 2015-12-28 12:13:47 +00:00 committed by John Ralls
parent 43e122ca9c
commit 1bb8778989
3 changed files with 50 additions and 47 deletions

View File

@ -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);
}

View File

@ -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);
/** @} */

View File

@ -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)
{