[Gnucash-changes] More HBCI work.

Christian Stimming cstim at cvs.gnucash.org
Sat Sep 25 06:09:53 EDT 2004


Log Message:
-----------
More HBCI work.

Modified Files:
--------------
    gnucash/src/import-export/hbci:
        gnc-hbci-utils.c
        hbci-interaction.c

Revision Data
-------------
Index: hbci-interaction.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interaction.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -Lsrc/import-export/hbci/hbci-interaction.c -Lsrc/import-export/hbci/hbci-interaction.c -u -r1.44 -r1.45
--- src/import-export/hbci/hbci-interaction.c
+++ src/import-export/hbci/hbci-interaction.c
@@ -544,6 +544,8 @@
 			       0.0);
   data->action_max = total;
   GNCInteractor_setRunning(data);
+  printf("progressStartCB: Action \"%s\" started, total %d.\n",
+	 text, total);
 
   /* Show the dialog */
   GNCInteractor_show(data);
@@ -563,13 +565,15 @@
   g_assert(data);
 
   if ((id != 0) && (id != progress_id)) {
-    printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id);
+/*     printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); */
   }
 
   if (progress != AB_BANKING_PROGRESS_NONE) {
-    printf("progressLogCB: Setting progress to %d out of %f.\n", progress, data->action_max);
-    gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), 
-				 progress/data->action_max);
+    printf("progressLogCB: Progress set to %d out of %f.\n", 
+	   progress, data->action_max);
+    if (progress <= data->action_max) 
+      gtk_progress_set_percentage (GTK_PROGRESS (data->action_progress), 
+				   progress/data->action_max);
   }
 
   keepAlive(data);
@@ -590,7 +594,7 @@
   text = gnc_hbci_utf8ToLatin1(data, utf8text);
 
   if ((id != 0) && (id != progress_id)) {
-    printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id);
+/*     printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); */
   }
 
   printf("progressLogCB: Logging msg: %s\n", text);
@@ -609,7 +613,7 @@
   g_assert(data);
 
   if ((id != 0) && (id != progress_id)) {
-    printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id);
+/*     printf("progressLogCB: Oops, wrong progress id %d -- ignored.\n", id); */
   }
 
   GNCInteractor_setFinished(data);
Index: gnc-hbci-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -Lsrc/import-export/hbci/gnc-hbci-utils.c -Lsrc/import-export/hbci/gnc-hbci-utils.c -u -r1.43 -r1.44
--- src/import-export/hbci/gnc-hbci-utils.c
+++ src/import-export/hbci/gnc-hbci-utils.c
@@ -460,6 +460,7 @@
   gchar **res = user_data;
   gchar *tmp1, *tmp2;
 
+  if (!string) return NULL;
   tmp1 = g_strdup (string);
   g_strstrip (tmp1);
 
@@ -487,17 +488,21 @@
   char *h_descr = NULL;
   char *othername = NULL;
   char *g_descr;
+  const GWEN_STRINGLIST *h_purpose = AB_Transaction_GetPurpose (h_trans);
+  const GWEN_STRINGLIST *h_remotename = AB_Transaction_GetRemoteName (h_trans);
 
   /* 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. */
-  GWEN_StringList_ForEach (AB_Transaction_GetPurpose (h_trans), 
-			   &gnc_list_string_cb,
-			   &h_descr);
-  GWEN_StringList_ForEach (AB_Transaction_GetRemoteName (h_trans), 
-			   &gnc_list_string_cb,
-			   &othername);
+  if (h_purpose)
+    GWEN_StringList_ForEach (h_purpose,
+			     &gnc_list_string_cb,
+			     &h_descr);
+  if (h_remotename)
+    GWEN_StringList_ForEach (h_remotename,
+			     &gnc_list_string_cb,
+			     &othername);
   /*DEBUG("HBCI Description '%s'", h_descr);*/
 
   if (othername && (strlen (othername) > 0))
@@ -524,10 +529,14 @@
    * "STANDING ORDER", "UEBERWEISUNGSGUTSCHRIFT", etc.  */
   /*   char *h_transactionText =  */
   /*     g_strdup (AB_TRANSACTION_transactionText (h_trans)); */
+  const char *h_remoteAccountNumber = 
+    AB_Transaction_GetRemoteAccountNumber (h_trans);
+  const char *h_remoteBankCode = 
+    AB_Transaction_GetRemoteBankCode (h_trans);
   char *h_otherAccountId =
-    g_strdup (AB_Transaction_GetRemoteAccountNumber (h_trans));
+    g_strdup (h_remoteAccountNumber ? h_remoteAccountNumber : _("unknown"));
   char *h_otherBankCode =
-    g_strdup (AB_Transaction_GetRemoteBankCode (h_trans));
+    g_strdup (h_remoteBankCode ? h_remoteBankCode : _("unknown"));
   char *g_memo;
 
   /*   g_strstrip (h_transactionText); */


More information about the gnucash-changes mailing list