Replace all remaining printfs by correct g_log macros.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15566 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2007-02-11 21:23:51 +00:00
parent 52058f44f1
commit 2240080dcd
8 changed files with 56 additions and 72 deletions

View File

@ -390,7 +390,7 @@ gnc_hbci_dialog_new (GtkWidget *parent,
break;
default:
printf("dialog-hbcitrans: Oops, unknown GNC_HBCI_Transtype %d.\n",
g_critical("dialog-hbcitrans: Oops, unknown GNC_HBCI_Transtype %d.\n",
trans_type);
}
@ -484,7 +484,7 @@ int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td,
{
AB_JOB *job = AB_JobSingleTransfer_new((AB_ACCOUNT *)h_acc);
if (AB_Job_CheckAvailability(job)) {
printf("gnc_hbci_trans_dialog_enqueue: Oops, job not available. Aborting.\n");
g_warning("gnc_hbci_trans_dialog_enqueue: Oops, job not available. Aborting.\n");
return GTK_RESPONSE_CANCEL;
}
#if ((AQBANKING_VERSION_MAJOR > 1) || \
@ -517,7 +517,7 @@ int gnc_hbci_dialog_run_until_ok(HBCITransDialog *td,
/* Now run the dialog until it gets closed by a button press. */
result = gtk_dialog_run (GTK_DIALOG (td->dialog));
/* printf("hbci_trans: result button was %d.\n", result); */
/* g_message("hbci_trans: result button was %d.\n", result); */
/* The dialog gets hidden anyway as soon as any button is pressed. */
gtk_widget_hide_all (td->dialog);
@ -623,11 +623,11 @@ hbci_trans_fill_values(const AB_ACCOUNT *h_acc, HBCITransDialog *td)
AB_Transaction_SetRemoteBankCode
(trans, gtk_entry_get_text (GTK_ENTRY (td->recp_bankcode_entry)));
/* printf("Got otherBankCode %s.\n",
/* g_message("Got otherBankCode %s.\n",
AB_Transaction_otherBankCode (trans)); */
AB_Transaction_SetRemoteAccountNumber
(trans, gtk_entry_get_text (GTK_ENTRY (td->recp_account_entry)));
/* printf("Got otherAccountId %s.\n",
/* g_message("Got otherAccountId %s.\n",
AB_Transaction_otherAccountId (trans)); */
AB_Transaction_SetRemoteCountry (trans, "DE");
@ -758,7 +758,7 @@ gnc_hbci_trans_dialog_enqueue(const AB_TRANSACTION *hbci_trans, AB_BANKING *api,
job = AB_JobSingleTransfer_new(h_acc);
};
if (AB_Job_CheckAvailability(job)) {
printf("gnc_hbci_trans_dialog_enqueue: Oops, job not available. Aborting.\n");
g_warning("gnc_hbci_trans_dialog_enqueue: Oops, job not available. Aborting.\n");
return NULL;
}
@ -895,7 +895,7 @@ void blz_changed_cb(GtkEditable *e, gpointer user_data)
"UTF-8", ktoblzcheck_encoding,
NULL, NULL, &error);
if (error != NULL) {
printf ("Error converting bankname \"%s\" to UTF-8\n", bankname);
g_critical ("Error converting bankname \"%s\" to UTF-8\n", bankname);
g_error_free (error);
/* Conversion was erroneous, so don't use the string */
utf8_bankname = g_strdup (_("(unknown)"));

View File

@ -212,9 +212,9 @@ update_accountlist (HBCIInitialInfo *info)
update_accountlist_acc_cb,
info);
else
printf("update_accountlist: Oops, account list from AB_Banking is NULL.\n");
g_warning("update_accountlist: Oops, account list from AB_Banking is NULL.\n");
/* printf("update_accountlist: GNC hash has %d entries.\n", g_hash_table_size(info->gnc_hash)); */
/* g_message("update_accountlist: GNC hash has %d entries.\n", g_hash_table_size(info->gnc_hash)); */
if (path) {
gtk_tree_selection_select_path(selection, path);
@ -360,7 +360,7 @@ on_accountlist_changed (GtkTreeSelection *selection,
if (hbci_acc) {
old_value = g_hash_table_lookup (info->gnc_hash, hbci_acc);
/* printf("on_accountlist_select_row: Selected hbci_acc id %s; old_value %p \n",
/* g_message("on_accountlist_select_row: Selected hbci_acc id %s; old_value %p \n",
AB_Account_GetAccountNumber(hbci_acc),
old_value); */
@ -574,13 +574,13 @@ on_aqhbci_button (GtkButton *button,
pid = fork();
switch (pid) {
case -1:
printf("Fork call failed. Cannot start AqBanking setup wizard.");
g_critical("Fork call failed. Cannot start AqBanking setup wizard.");
res = -1;
AB_Banking_Init (info->api);
break;
case 0: /* child */
execl(wizard_path, wizard_path, NULL);
printf("Fork call failed. Cannot start AqBanking setup wizard.");
g_critical("Fork call failed. Cannot start AqBanking setup wizard.");
_exit(0);
default: /* parent */
res = 0;
@ -605,12 +605,12 @@ on_aqhbci_button (GtkButton *button,
if ((res == 0) || (res == AB_ERROR_FOUND))
druid_enable_next_button(info);
else {
printf("on_aqhbci_button: Oops, after successful wizard the activation return nonzero value: %d. \n", res);
g_warning("on_aqhbci_button: Oops, after successful wizard the activation return nonzero value: %d. \n", res);
druid_disable_next_button(info);
}
}
else {
printf("on_aqhbci_button: Oops, aqhbci wizard return nonzero value: %d. The called program was \"%s\".\n", res, wizard_path);
g_warning("on_aqhbci_button: Oops, aqhbci wizard return nonzero value: %d. The called program was \"%s\".\n", res, wizard_path);
gnc_error_dialog
(info->window,
_("The external program \"AqBanking Setup Wizard\" failed "
@ -620,7 +620,7 @@ on_aqhbci_button (GtkButton *button,
druid_disable_next_button(info);
}
} else {
printf("on_aqhbci_button: Oops, no aqhbci setup wizard found.");
g_warning("on_aqhbci_button: Oops, no aqhbci setup wizard found.");
gnc_error_dialog
(info->window,
/* Each of the %s is the name of the backend, e.g. "aqhbci". */

View File

@ -111,7 +111,7 @@ void gnc_file_aqbanking_import (const gchar *aqbanking_importername,
/* Get API */
ab = gnc_AB_BANKING_new_currentbook (NULL, &interactor);
if (ab == NULL) {
printf("gnc_file_dtaus_import: Couldn't get HBCI API. Nothing will happen.\n");
g_message("gnc_file_dtaus_import: Couldn't get HBCI API. Nothing will happen.\n");
return;
}
g_assert (interactor);
@ -140,9 +140,7 @@ void gnc_file_aqbanking_import (const gchar *aqbanking_importername,
dbProfile=GWEN_DB_GetNextGroup(dbProfile);
}
if (!dbProfile) {
DEBUG("Profile \"%s\" for importer \"%s\" not found",
profileName, importerName);
printf("Profile \"%s\" for importer \"%s\" not found\n",
g_warning("Profile \"%s\" for importer \"%s\" not found\n",
profileName, importerName);
/* For debugging: Print those available names that have been found. */
dbProfile=GWEN_DB_GetFirstGroup(dbProfiles);
@ -150,7 +148,7 @@ void gnc_file_aqbanking_import (const gchar *aqbanking_importername,
const char *name;
name=GWEN_DB_GetCharValue(dbProfile, "name", 0, 0);
g_assert(name);
printf("Only found profile \"%s\"\n", name);
g_warning("Only found profile \"%s\"\n", name);
dbProfile=GWEN_DB_GetNextGroup(dbProfile);
}
return;

View File

@ -49,7 +49,7 @@ bal_print_debug(const char *name,
const char *time_str)
{
char *str = gnc_AB_VALUE_toReadableString (val);
printf("GetBalance: %s%s %s at date %s %s",
g_message("GetBalance: %s%s %s at date %s %s",
(negative ? "-" : ""), str,
name, date_str, time_str);
free (str);
@ -71,7 +71,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
/* Get API */
api = gnc_AB_BANKING_new_currentbook (parent, &interactor);
if (api == NULL) {
printf("gnc_hbci_getbalance: Couldn't get AB_BANKING API.\n");
g_message("gnc_hbci_getbalance: Couldn't get AB_BANKING API.\n");
return;
}
g_assert (interactor);
@ -79,11 +79,11 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
/* Get HBCI account */
h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
if (h_acc == NULL) {
printf("gnc_hbci_getbalance: No HBCI account found.\n");
g_warning("gnc_hbci_getbalance: No HBCI account found.\n");
/* FIXME: free unneeded data */
return;
}
/* printf("gnc_hbci_getbalance: HBCI account no. %s found.\n",
/* g_message("gnc_hbci_getbalance: HBCI account no. %s found.\n",
AB_ACCOUNT_accountId (h_acc)); */
{
@ -92,7 +92,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
job = AB_JobGetBalance_new((AB_ACCOUNT*)h_acc);
if (AB_Job_CheckAvailability(job)) {
printf("gnc_hbci_getbalance: JobGetBalance not avaiable for this account.\n");
g_message("gnc_hbci_getbalance: JobGetBalance not available for this account.\n");
/* FIXME: free unneeded data */
return;
}
@ -149,7 +149,7 @@ void gnc_hbci_getbalance_debugprint(AB_JOB *job,
noted_val = AB_VALUE_new(GWEN_DB_GetCharValue(noted_grp, "value", 0, "0"),
GWEN_DB_GetCharValue(noted_grp, "currency", 0, "EUR"));
printf("GetBalance: Balances for account %s :\n",
g_message("GetBalance: Balances for account %s :\n",
AB_ACCOUNT_accountId (h_acc));
bal_print_debug("Booked balance",
booked_val,
@ -204,7 +204,7 @@ gnc_hbci_getbalance_finish (GtkWidget *parent,
response = AB_JobGetBalance_GetAccountStatus((AB_JOB*)job);
if (!response) {
printf("gnc_hbci_getbalance_finish: Oops, response == NULL.\n");
g_critical("gnc_hbci_getbalance_finish: Oops, response == NULL.\n");
return TRUE;
}
@ -225,11 +225,11 @@ gnc_hbci_getbalance_finish (GtkWidget *parent,
if (booked_val)
booked_value = AB_Value_GetValue (booked_val);
else {
printf("gnc_hbci_getbalance_finish: Warning: booked_val == NULL. Assuming 0.\n");
g_warning("gnc_hbci_getbalance_finish: Warning: booked_val == NULL. Assuming 0.\n");
booked_value = 0.0;
}
} else {
printf("gnc_hbci_getbalance_finish: Warning: booked_grp == NULL. Assuming 0.\n");
g_warning("gnc_hbci_getbalance_finish: Warning: booked_grp == NULL. Assuming 0.\n");
booked_value = 0.0;
booked_val = NULL;
booked_tt = 0;
@ -241,11 +241,11 @@ gnc_hbci_getbalance_finish (GtkWidget *parent,
if (noted_val)
noted_value = AB_Value_GetValue (noted_val);
else {
printf("gnc_hbci_getbalance_finish: Warning: noted_val == NULL. Assuming 0.\n");
g_warning("gnc_hbci_getbalance_finish: Warning: noted_val == NULL. Assuming 0.\n");
noted_value = 0.0;
}
} else {
printf("gnc_hbci_getbalance_finish: Warning: noted_grp == NULL. Assuming 0.\n");
g_warning("gnc_hbci_getbalance_finish: Warning: noted_grp == NULL. Assuming 0.\n");
noted_value = 0.0;
noted_val = NULL;
}

View File

@ -63,7 +63,7 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
/* Get the api */
api = gnc_AB_BANKING_new_currentbook (parent, &interactor);
if (api == NULL) {
printf("gnc_hbci_gettrans: Couldn't get HBCI API.\n");
g_message("gnc_hbci_gettrans: Couldn't get HBCI API.\n");
return;
}
g_assert (interactor);
@ -71,7 +71,7 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
/* Get HBCI account */
h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
if (h_acc == NULL) {
printf("gnc_hbci_getbalance: No HBCI account found.\n");
g_warning("gnc_hbci_getbalance: No HBCI account found.\n");
/* FIXME: free unneeded data */
return;
}
@ -91,7 +91,7 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
/* Create OutboxJob */
job = AB_JobGetTransactions_new((AB_ACCOUNT*)h_acc);
if (AB_Job_CheckAvailability(job)) {
printf("gnc_hbci_gettrans: Oops, job not available. Aborting.\n");
g_warning("gnc_hbci_gettrans: Oops, job not available. Aborting.\n");
/* FIXME: free unneeded data */
return;
}
@ -281,7 +281,7 @@ AB_TRANSACTION *gnc_hbci_trans_list_cb(AB_TRANSACTION *h_trans, void *user_data)
xaccTransSetDateSecs
(gnc_trans, GWEN_Time_toTime_t (valutaDate));
else
printf("trans_list_cb: Oops, date 'valutaDate' was NULL.\n");
g_warning("trans_list_cb: Oops, date 'valutaDate' was NULL.\n");
current_time = time(NULL);
xaccTransSetDateEnteredSecs(gnc_trans, mktime(localtime(&current_time)));
@ -321,7 +321,7 @@ AB_TRANSACTION *gnc_hbci_trans_list_cb(AB_TRANSACTION *h_trans, void *user_data)
xaccAccountGetCommoditySCU(gnc_acc),
GNC_RND_ROUND);
if (!h_value)
printf("trans_list_cb: Oops, value was NULL. Using 0.\n");
g_warning("trans_list_cb: Oops, value was NULL. Using 0.\n");
xaccSplitSetBaseValue(split, gnc_amount, xaccAccountGetCommodity(gnc_acc));
}

View File

@ -60,7 +60,7 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
/* Get API */
api = gnc_AB_BANKING_new_currentbook (parent, &interactor);
if (api == NULL) {
printf("gnc_hbci_maketrans: Couldn't get HBCI API. Nothing will happen.\n");
g_message("gnc_hbci_maketrans: Couldn't get HBCI API. Nothing will happen.\n");
return;
}
g_assert (interactor);
@ -68,7 +68,7 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
/* Get HBCI account */
h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
if (h_acc == NULL) {
printf("gnc_hbci_maketrans: No HBCI account found. Nothing will happen.\n");
g_warning("gnc_hbci_maketrans: No HBCI account found. Nothing will happen.\n");
return;
}
/*printf("gnc_hbci_maketrans: HBCI account no. %s found.\n",
@ -193,7 +193,7 @@ gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc,
/* If we wanted to do something here with the gnc txn, we could. */
/*if (result >= 0) {
Transaction *gtrans = gnc_hbci_dialog_get_gtrans(td);
printf("gnc-hbci-transfer: Got gnc txn w/ description: %s\n",
g_message("gnc-hbci-transfer: Got gnc txn w/ description: %s\n",
xaccTransGetDescription(gtrans));
}*/

View File

@ -122,7 +122,7 @@ AB_BANKING * gnc_AB_BANKING_new_currentbook (GtkWidget *parent,
{
int r = AB_Banking_Init(api);
if (r != 0)
printf("gnc_AB_BANKING_new: Warning: Error %d on AB_Banking_init\n", r);
g_critical("gnc_AB_BANKING_new: Warning: Error %d on AB_Banking_init\n", r);
}
gnc_hbci_inter = gnc_AB_BANKING_interactors (api, parent);
@ -200,10 +200,10 @@ gnc_hbci_get_hbci_acc (const AB_BANKING *api, Account *gnc_acc)
if (!hbci_acc && bankcode && (strlen(bankcode)>0) &&
accountid && (strlen(accountid) > 0)) {
/* printf("gnc_hbci_get_hbci_acc: No AB_ACCOUNT found for UID %d, trying bank code\n", account_uid); */
g_message("gnc_hbci_get_hbci_acc: No AB_ACCOUNT found for UID %d, trying bank code\n", account_uid);
hbci_acc = AB_Banking_GetAccountByCodeAndNumber(api, bankcode, accountid);
}
/*printf("gnc_hbci_get_hbci_acc: return HBCI_Account %p\n", hbci_acc);*/
/* g_message("gnc_hbci_get_hbci_acc: return HBCI_Account %p\n", hbci_acc); */
return hbci_acc;
} else if (bankcode && (strlen(bankcode)>0) && accountid && (strlen(accountid) > 0)) {
hbci_acc = AB_Banking_GetAccountByCodeAndNumber(api, bankcode, accountid);
@ -217,7 +217,7 @@ gnc_hbci_get_hbci_acc (const AB_BANKING *api, Account *gnc_acc)
static void *
print_list_int_cb (int value, void *user_data)
{
printf("%d, ", value);
g_warning("%d, ", value);
return NULL;
}
static void
@ -225,7 +225,7 @@ print_list_int (const list_int *list)
{
g_assert(list);
list_int_foreach (list, &print_list_int_cb, NULL);
printf ("\n");
g_warning ("\n");
}
static void *
get_resultcode_error_cb (int value, void *user_data)
@ -250,28 +250,22 @@ get_resultcode_error (const list_int *list)
int
gnc_hbci_debug_outboxjob (AB_JOB *job, gboolean verbose)
{
/* list_int *list; */
/* const char *msg; */
int cause = 0;
AB_JOB_STATUS jobstatus;
g_assert (job);
/* if (AB_JOB_status (job) != HBCI_JOB_STATUS_DONE) */
/* return; */
/* if (AB_JOB_result (job) != HBCI_JOB_RESULT_FAILED) */
/* return; */
if (verbose) {
printf("gnc_hbci_debug_outboxjob: Job status: %s", AB_Job_Status2Char(AB_Job_GetStatus(job)));
g_warning("gnc_hbci_debug_outboxjob: Job status: %s", AB_Job_Status2Char(AB_Job_GetStatus(job)));
printf(", result: %s", AB_Job_GetResultText(job));
printf("\n");
g_warning(", result: %s", AB_Job_GetResultText(job));
g_warning("\n");
}
jobstatus = AB_Job_GetStatus (job);
if (jobstatus == AB_Job_StatusError) {
if (!verbose)
printf("gnc_hbci_debug_outboxjob: Job %s had an error: %s\n",
g_warning("gnc_hbci_debug_outboxjob: Job %s had an error: %s\n",
AB_Job_Type2Char(AB_Job_GetType(job)),
AB_Job_GetResultText(job));
cause = 9000;
@ -288,7 +282,7 @@ gnc_hbci_debug_outboxjob (AB_JOB *job, gboolean verbose)
cause = get_resultcode_error (list);
if (verbose) {
printf("OutboxJob resultcodes: ");
g_warning("OutboxJob resultcodes: ");
print_list_int (list);
switch (cause) {
@ -307,11 +301,11 @@ gnc_hbci_debug_outboxjob (AB_JOB *job, gboolean verbose)
default:
msg = "Unknown";
}
printf("Probable cause of error was: code %d, msg: %s\n", cause, msg);
g_warning("Probable cause of error was: code %d, msg: %s\n", cause, msg);
}
} else {
if (verbose)
printf("OutboxJob's resultCodes list has zero length.\n");
g_warning("OutboxJob's resultCodes list has zero length.\n");
}
list_int_delete (list);
#endif
@ -364,7 +358,7 @@ gnc_hbci_Error_retry (GtkWidget *parent, int error,
"Your chip card is therefore destroyed. Aborting."));
return FALSE;
case AB_ERROR_FILE_NOT_FOUND:
/* printf("gnc_hbci_Error_feedback: File not found error.\n"); */
/* g_warning("gnc_hbci_Error_feedback: File not found error.\n"); */
return FALSE;
case AB_ERROR_NO_CARD:
return gnc_verify_dialog (parent,
@ -499,13 +493,6 @@ gnc_AB_BANKING_execute (GtkWidget *parent, AB_BANKING *api,
if (job)
resultcode = gnc_hbci_debug_outboxjob (job, be_verbose);
if (!hbci_Error_isOk(err)) {
/* char *errstr = */
/* g_strdup_printf("gnc_AB_BANKING_execute: Error at executeQueue: %s", */
/* hbci_Error_message (err)); */
/* printf("%s\n", errstr); */
/* HBCI_Interactor_msgStateResponse (HBCI_Hbci_interactor */
/* (AB_BANKING_Hbci (api)), errstr); */
/* g_free (errstr); */
if (job) gnc_hbci_debug_outboxjob (job, TRUE);
if (inter) GNCInteractor_show_nodelete (inter);
return FALSE;
@ -516,11 +503,10 @@ gnc_AB_BANKING_execute (GtkWidget *parent, AB_BANKING *api,
return TRUE;
}
else {
/* printf("gnc_AB_BANKING_execute: Some message at executeQueue: %s", */
/* hbci_Error_message (err)); */
g_message("gnc_AB_BANKING_execute: Some error at executeQueue.");
GNCInteractor_show_nodelete (inter);
return TRUE; /* <- This used to be a FALSE but this was probably
* as wrong as it could get. @§%$! */
* as wrong as it could get. @%$! */
}
}
@ -579,7 +565,7 @@ void multijob_cb (gpointer element, gpointer user_data)
AB_Transaction_GetRemoteAccountNumber (h_trans),
descr_name,
value);
printf ("%s", errortext);
g_warning ("%s", errortext);
gnc_error_dialog (parent, "%s", errortext);
g_free (errortext);
g_free (descr_name);

View File

@ -364,7 +364,7 @@ static int inputBoxCB(AB_BANKING *ab,
if (newPin) {
if (!hideInput)
printf("inputBoxCB: Oops, hideInput==false and newPin==true, i.e. the input is supposed to be readable -- not implemented (since I thought this does not make sense when entering a new PIN).\n");
g_warning("inputBoxCB: Oops, hideInput==false and newPin==true, i.e. the input is supposed to be readable -- not implemented (since I thought this does not make sense when entering a new PIN).\n");
retval = gnc_hbci_get_initial_password (data->parent,
title,
text,
@ -651,7 +651,7 @@ static int messageBoxCB(AB_BANKING *ab, GWEN_TYPE_UINT32 flags,
result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
if (result<1 || result>3) {
printf("messageBoxCB: Bad result %d", result);
g_warning("messageBoxCB: Bad result %d", result);
result = 0;
}
g_free(title);
@ -816,7 +816,7 @@ on_button_clicked (GtkButton *button,
/*GNCInteractor_hide (data);*/
}
} else {
printf("on_button_clicked: Oops, unknown button: %s\n",
g_critical("on_button_clicked: Oops, unknown button: %s\n",
name);
}
/* Let the widgets be redrawn */