2002-11-24 Christian Stimming <stimming@tuhh.de>

* src/import-export/hbci/gnc-hbci-gettrans.c: Improve space
	trimming in imported description.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7541 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2002-11-24 22:10:29 +00:00
parent b20a836c69
commit d1a4742dcf
2 changed files with 44 additions and 12 deletions

View File

@ -1,5 +1,8 @@
2002-11-24 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/gnc-hbci-gettrans.c: Improve space
trimming in imported description.
* src/import-export/ofx/gnc-ofx-import.c: As a trial, use new
generic transaction importer GUI. Changes are marked with 'CS:'.

View File

@ -200,6 +200,29 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
}
}
static void *gnc_list_string_cb (const char *string, void *user_data)
{
gchar **res = user_data;
gchar *tmp1, *tmp2;
tmp1 = g_strdup (string);
g_strstrip (tmp1);
if (*res != NULL) {
/* The " " is the separating string in between each two strings. */
tmp2 = g_strjoin (" ", *res, tmp1, NULL);
g_free (tmp1);
g_free (*res);
*res = tmp2;
}
else {
*res = tmp1;
}
return NULL;
}
/* list_HBCI_Transaction_foreach callback */
static void *trans_list_cb (const HBCI_Transaction *h_trans,
@ -254,22 +277,28 @@ static void *trans_list_cb (const HBCI_Transaction *h_trans,
{
/* Description */
char *h_descr =
list_string_concat_delim (HBCI_Transaction_description (h_trans), ";");
char *othername =
list_string_concat_delim (HBCI_Transaction_otherName (h_trans), ", ");
char *h_descr = NULL;
char *othername = NULL;
char *g_descr;
/* Don't use list_string_concat_delim here since we need to
g_strstrip every single element of the string list, which is
only done in our callback gnc_list_string_cb. The separator is
also set there. */
list_string_foreach (HBCI_Transaction_description (h_trans),
&gnc_list_string_cb,
&h_descr);
list_string_foreach (HBCI_Transaction_otherName (h_trans),
&gnc_list_string_cb,
&othername);
DEBUG("HBCI Description '%s'", h_descr);
g_strstrip (h_descr);
g_strstrip (othername);
g_descr =
(strlen (h_descr) > 0) ?
g_strdup_printf ("%s; %s",
h_descr,
othername) :
g_strdup (othername);
((strlen (h_descr) > 0) ?
g_strdup_printf ("%s; %s",
h_descr,
othername) :
g_strdup (othername));
xaccTransSetDescription (gnc_trans, g_descr);