From 7b07c0e18800376ceb3730fd8fa057de77811e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoit=20Gr=C3=A9goire?= Date: Mon, 18 Nov 2002 05:52:05 +0000 Subject: [PATCH] =?UTF-8?q?2002-11-18=20=20Benoit=20Gr=EF=BF=BDgoire=20=20?= =?UTF-8?q?=20=09*=20src/import-export/Transaction-m?= =?UTF-8?q?atcher.c:=20Remove=20constant=20length=20=09strings=20and=20rep?= =?UTF-8?q?lace=20with=20moving=20pointers.=20=20I=20wish=20=5F("string")?= =?UTF-8?q?=20=09could=20be=20used=20as=20a=20could=20initializer=20like?= =?UTF-8?q?=20"string"=20can...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7499 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 5 +++++ src/import-export/Transaction-matcher.c | 25 ++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8811ff39d5..90325a607b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-11-18 Benoit Grégoire + * src/import-export/Transaction-matcher.c: Remove constant length + strings and replace with moving pointers. I wish _("string") + could be used as a could initializer like "string" can... + 2002-11-17 Joshua Sled * src/gnome/dialog-sxsincelast.c: diff --git a/src/import-export/Transaction-matcher.c b/src/import-export/Transaction-matcher.c index c60d8e4a37..c5c73c2bca 100644 --- a/src/import-export/Transaction-matcher.c +++ b/src/import-export/Transaction-matcher.c @@ -84,13 +84,19 @@ struct _transmatcherdialog { GtkCList * downloaded_clist; GtkCList * match_clist; struct _transactioninfo * selected_trans_info; + + char * action_add_text; + char * action_reconcile_text; + char * action_replace_text; + char * action_ignore_text; }; struct _transactioninfo { + Transaction * trans; Split * first_split; - char action_text[10]; + const char * action_text; char date_text[20]; char amount_text[20]; char balance_text[20]; @@ -320,13 +326,13 @@ static void downloaded_transaction_refresh_gui( struct _transmatcherdialog * mat transaction_info); switch(transaction_info->action) { - case ADD: strncpy(transaction_info->action_text,_("ADD"),sizeof(transaction_info->action_text)); + case ADD: transaction_info->action_text = matcher->action_add_text; break; - case RECONCILE: strncpy(transaction_info->action_text,_("RECONCILE"),sizeof(transaction_info->action_text)); + case RECONCILE: transaction_info->action_text= matcher->action_reconcile_text; break; - case REPLACE: strncpy(transaction_info->action_text,_("REPLACE"),sizeof(transaction_info->action_text)); + case REPLACE:transaction_info->action_text=matcher->action_replace_text; break; - case IGNORE: strncpy(transaction_info->action_text,_("IGNORE"),sizeof(transaction_info->action_text)); + case IGNORE: transaction_info->action_text=matcher->action_ignore_text; break; default: PERR("Unknown action"); @@ -610,6 +616,10 @@ on_matcher_cancel_clicked (GtkButton *button, gtk_clist_clear(matcher->downloaded_clist); matcher->initialised=FALSE; gtk_widget_destroy(matcher->transaction_matcher); + g_free (matcher->action_add_text); + g_free (matcher->action_reconcile_text); + g_free (matcher->action_replace_text); + g_free (matcher->action_ignore_text); } static void @@ -692,6 +702,11 @@ init_matcher_gui(struct _transmatcherdialog * matcher) matcher->downloaded_clist = (GtkCList *)glade_xml_get_widget (xml, "downloaded_clist"); matcher->match_clist = (GtkCList *)glade_xml_get_widget (xml, "match_clist"); + matcher->action_add_text = g_strdup(_("ADD")); + matcher->action_reconcile_text = g_strdup(_("RECONCILE")); + matcher->action_replace_text = g_strdup(_("REPLACE")); + matcher->action_ignore_text = g_strdup(_("IGNORE")); + gtk_widget_show(matcher->transaction_matcher); matcher->initialised=TRUE;