[Gnucash-changes] r12068 - gnucash/trunk - Eliminate all remaining use of deprecated glib functions. Enable the

David Hampton hampton at cvs.gnucash.org
Tue Nov 29 19:26:01 EST 2005


Author: hampton
Date: 2005-11-29 19:25:59 -0500 (Tue, 29 Nov 2005)
New Revision: 12068
Trac: http://svn.gnucash.org/trac/changeset/12068

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/configure.in
   gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c
   gnucash/trunk/src/gnome/dialog-scheduledxaction.c
   gnucash/trunk/src/gnome/dialog-sx-from-trans.c
   gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c
   gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
   gnucash/trunk/src/import-export/hbci/druid-hbci-utils.c
   gnucash/trunk/src/import-export/hbci/gnc-hbci-trans-templ.c
   gnucash/trunk/src/import-export/hbci/gnc-hbci-trans-templ.h
   gnucash/trunk/src/import-export/hbci/hbci-interaction.c
   gnucash/trunk/src/import-export/qif/qif-parse.c
Log:
Eliminate all remaining use of deprecated glib functions.  Enable the
compile time flag to prevent any of these deprecated routines from
creeping back into the source.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/ChangeLog	2005-11-30 00:25:59 UTC (rev 12068)
@@ -1,3 +1,18 @@
+2005-11-29  David Hampton  <hampton at employees.org>
+
+	* src/import-export/qif/qif-parse.c:
+	* src/import-export/hbci/druid-hbci-initial.c:
+	* src/import-export/hbci/hbci-interaction.c:
+	* src/import-export/hbci/druid-hbci-utils.c:
+	* src/import-export/hbci/dialog-hbcitrans.c:
+	* src/import-export/hbci/gnc-hbci-trans-templ.[ch]:
+	* src/gnome-utils/gnc-tree-model-account.c:
+	* src/gnome/dialog-sx-from-trans.c:
+	* src/gnome/dialog-scheduledxaction.c:
+	* configure.in: Eliminate all remaining use of deprecated glib
+	functions.  Enable the compile time flag to prevent any of these
+	deprecated routines from creeping back into the source.
+
 2005-11-28  David Hampton  <hampton at employees.org>
 
 	* src/import-export/qif-import/qif-to-gnc.scm:

Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/configure.in	2005-11-30 00:25:59 UTC (rev 12068)
@@ -142,6 +142,9 @@
   AC_MSG_RESULT(no)
 fi
 AM_CONDITIONAL(HAVE_GLIB26, test "x$HAVE_GLIB26" = "xyes" )
+AC_DEFINE(G_DISABLE_DEPRECATED,1,[Don't use any deprecated glib functions.])
+#AC_DEFINE(GTK_DISABLE_DEPRECATED,1,[Don't use any deprecated gtk functions.])
+#AC_DEFINE(GNOME_DISABLE_DEPRECATED,1,[Don't use any deprecated gnome functions.])
 
 AC_CHECK_HEADERS(dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
 

Modified: gnucash/trunk/src/gnome/dialog-scheduledxaction.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-scheduledxaction.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/gnome/dialog-scheduledxaction.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -855,7 +855,7 @@
         /* read out data back into SchedXaction object. */
         /* FIXME: this is getting too deep; split out. */
         {
-                char *name;
+                gchar *name, *nameKey;
                 gboolean nameExists, nameHasChanged;
                 GList *sxList;
 
@@ -870,6 +870,7 @@
                 }
 
                 nameExists = FALSE;
+                nameKey = g_utf8_collate_key(name, -1);
                 nameHasChanged =
                         (xaccSchedXactionGetName(sxed->sx) == NULL)
                         || (strcmp( xaccSchedXactionGetName(sxed->sx), name ) != 0);
@@ -877,11 +878,13 @@
                           gnc_book_get_schedxactions( gnc_get_current_book() );
                       nameHasChanged && !nameExists && sxList ;
                       sxList = sxList->next ) {
-                        char *existingName;
+                        char *existingName, *existingNameKey;
                         existingName =
                                 xaccSchedXactionGetName( (SchedXaction*)sxList->
                                                          data );
-                        nameExists |= ( g_strcasecmp(name, existingName) == 0 );
+                        existingNameKey = g_utf8_collate_key(existingName, -1);
+                        nameExists |= ( strcmp(nameKey, existingNameKey) == 0 );
+                        g_free( existingNameKey );
                 }
                 if ( nameHasChanged && nameExists ) {
                         const char *sx_has_existing_name_msg =
@@ -892,10 +895,12 @@
                         if ( ! gnc_verify_dialog( sxed->dialog, FALSE,
 						  sx_has_existing_name_msg,
 						  name) ) {
+                                g_free( nameKey );
                                 g_free( name );
                                 return FALSE;
                         }
                 }
+                g_free( nameKey );
                 g_free( name );
         }
 

Modified: gnucash/trunk/src/gnome/dialog-sx-from-trans.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-from-trans.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/gnome/dialog-sx-from-trans.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -618,6 +618,7 @@
   guint sx_error = sxftd_compute_sx(sxfti);
   SchedXactionDialog *adv_dlg;
   SchedXactionEditorDialog *adv_edit_dlg;
+  GMainContext *context;
 
   if ( sx_error != 0
        && sx_error != SXFTD_ERRNO_UNBALANCED_XACTION )
@@ -629,7 +630,8 @@
   }
   gtk_widget_hide( sxfti->dialog );
   /* force a gui update. */
-  while (g_main_iteration(FALSE));
+  context = g_main_context_default();
+  while (g_main_context_iteration(context, FALSE));
 
   adv_dlg = gnc_ui_scheduled_xaction_dialog_create();
   adv_edit_dlg =

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-account.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -642,13 +642,13 @@
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_balance(xaccAccountGetPresentBalanceInCurrency,
 								  account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_PRESENT_REPORT:
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_report_balance(xaccAccountGetPresentBalanceInCurrency,
 									 account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT:
 			g_value_init (value, G_TYPE_STRING);
@@ -662,13 +662,13 @@
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_balance(xaccAccountGetBalanceInCurrency,
 								  account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT:
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_report_balance(xaccAccountGetBalanceInCurrency,
 									 account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE:
 			g_value_init (value, G_TYPE_STRING);
@@ -682,13 +682,13 @@
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_balance(xaccAccountGetClearedBalanceInCurrency,
 								  account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT:
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_report_balance(xaccAccountGetClearedBalanceInCurrency,
 									 account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED:
 			g_value_init (value, G_TYPE_STRING);
@@ -702,13 +702,13 @@
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_balance(xaccAccountGetReconciledBalanceInCurrency,
 								  account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT:
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_report_balance(xaccAccountGetReconciledBalanceInCurrency,
 									 account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED:
 			g_value_init (value, G_TYPE_STRING);
@@ -722,13 +722,13 @@
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_balance(xaccAccountGetProjectedMinimumBalanceInCurrency,
 								  account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN_REPORT:
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_report_balance(xaccAccountGetProjectedMinimumBalanceInCurrency,
 									 account, FALSE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN:
 			g_value_init (value, G_TYPE_STRING);
@@ -742,13 +742,13 @@
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_balance(xaccAccountGetBalanceInCurrency,
 								  account, TRUE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_REPORT:
 			g_value_init (value, G_TYPE_STRING);
 			string = gnc_ui_account_get_print_report_balance(xaccAccountGetBalanceInCurrency,
 									 account, TRUE, &negative);
-			g_value_set_string_take_ownership (value, string);
+			g_value_take_string (value, string);
 			break;
 		case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL:
 			g_value_init (value, G_TYPE_STRING);

Modified: gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/import-export/hbci/dialog-hbcitrans.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -1029,8 +1029,8 @@
 static gint comparefunc(const gconstpointer e1,
                  const gconstpointer e2)
 {
-  return g_strcasecmp(gnc_trans_templ_get_name((GNCTransTempl*)e1),
-        gnc_trans_templ_get_name((GNCTransTempl*)e2));
+  return strcmp(gnc_trans_templ_get_name_key((GNCTransTempl*)e1),
+        gnc_trans_templ_get_name_key((GNCTransTempl*)e2));
   
 }  
                  

Modified: gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/import-export/hbci/druid-hbci-initial.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -217,7 +217,6 @@
   /* Delete old hash with row_number -> hbci_account */
   delete_hash (info->hbci_hash);
   info->hbci_hash = g_hash_table_new (&g_int_hash, &g_int_equal);
-  g_hash_table_freeze (info->hbci_hash);
   
   /* Go through all HBCI accounts */
   acclist = AB_Banking_GetAccounts(banking);
@@ -231,7 +230,6 @@
   /* printf("update_accountlist: HBCI hash has %d entries.\n", g_hash_table_size(info->hbci_hash)); */
   /* printf("update_accountlist: GNC hash has %d entries.\n", g_hash_table_size(info->gnc_hash)); */
   
-  g_hash_table_thaw (info->hbci_hash);
   gtk_clist_thaw (GTK_CLIST (info->accountlist));
 
   /* move to the old selected row */

Modified: gnucash/trunk/src/import-export/hbci/druid-hbci-utils.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/druid-hbci-utils.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/import-export/hbci/druid-hbci-utils.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -163,7 +163,7 @@
 gboolean
 gnc_test_dir_exist_error (GtkWindow *parent, const char *filename) 
 {
-  char *dirname = g_dirname (filename);
+  char *dirname = g_path_get_dirname (filename);
   gboolean dirtest = g_file_test (dirname, G_FILE_TEST_IS_DIR);
   g_free (dirname);
   if (!dirtest) {

Modified: gnucash/trunk/src/import-export/hbci/gnc-hbci-trans-templ.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/gnc-hbci-trans-templ.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/import-export/hbci/gnc-hbci-trans-templ.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -30,6 +30,7 @@
 {
   /* Name of this Template */
   gchar *name;
+  gchar *name_key;	/* Collation key */
   
   /* Recipient */
   gchar *recp_name;
@@ -61,6 +62,7 @@
 {
   GNCTransTempl *r = g_new0(GNCTransTempl, 1);
   r->name = g_strdup(name);
+  r->name_key = g_utf8_collate_key(name, -1);
   r->recp_name = g_strdup(recp_name);
   r->recp_account = g_strdup(recp_account);
   r->recp_bankcode = g_strdup(recp_bankcode);
@@ -74,6 +76,7 @@
 {
   if (!t) return;
   if (t->name) g_free(t->name);
+  if (t->name_key) g_free(t->name_key);
   if (t->recp_name) g_free(t->recp_name);
   if (t->recp_account) g_free(t->recp_account);
   if (t->recp_bankcode) g_free(t->recp_bankcode);
@@ -110,6 +113,7 @@
 
   res->name = g_strdup(kvp_value_get_string
 		       (kvp_frame_get_slot(k, TT_NAME)));
+  res->name_key = g_utf8_collate_key(res->name, -1);
   res->recp_name = g_strdup(kvp_value_get_string
 			    (kvp_frame_get_slot(k, TT_RNAME)));
   res->recp_account = g_strdup(kvp_value_get_string
@@ -192,6 +196,11 @@
   g_assert(t);
   return t->name;
 }
+const char *gnc_trans_templ_get_name_key(const GNCTransTempl *t)
+{
+  g_assert(t);
+  return t->name_key;
+}
 const char *gnc_trans_templ_get_recp_name(const GNCTransTempl *t)
 {
   g_assert(t);
@@ -233,7 +242,10 @@
   g_assert(t);
   if (t->name)
     g_free(t->name);
+  if (t->name_key)
+    g_free(t->name_key);
   t->name = g_strdup(c);
+  t->name_key = g_utf8_collate_key(c, -1);
 }
 void gnc_trans_templ_set_recp_name(GNCTransTempl *t, const char *c)
 {

Modified: gnucash/trunk/src/import-export/hbci/gnc-hbci-trans-templ.h
===================================================================
--- gnucash/trunk/src/import-export/hbci/gnc-hbci-trans-templ.h	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/import-export/hbci/gnc-hbci-trans-templ.h	2005-11-30 00:25:59 UTC (rev 12068)
@@ -60,6 +60,7 @@
 /** @name GNCTransTempl value access */
 /*@{*/
 const char *gnc_trans_templ_get_name(const GNCTransTempl *t);
+const char *gnc_trans_templ_get_name_key(const GNCTransTempl *t);
 const char *gnc_trans_templ_get_recp_name(const GNCTransTempl *t);
 const char *gnc_trans_templ_get_recp_account(const GNCTransTempl *t);
 const char *gnc_trans_templ_get_recp_bankcode(const GNCTransTempl *t);

Modified: gnucash/trunk/src/import-export/hbci/hbci-interaction.c
===================================================================
--- gnucash/trunk/src/import-export/hbci/hbci-interaction.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/import-export/hbci/hbci-interaction.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -473,11 +473,14 @@
 static int keepAlive(void *user_data)
 {
   GNCInteractor *data = user_data;
+  GMainContext *context;
+
   g_assert(data);
   /*fprintf(stdout, "my-keepAlive: returning 1\n");*/
 
   /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
+  context = g_main_context_default();
+  while (g_main_context_iteration(context, FALSE));
 
   return data->keepAlive;
 }
@@ -745,6 +748,7 @@
 		   gpointer user_data)
 {
   GNCInteractor *data = user_data;
+  GMainContext *context;
   const char *name;
   g_assert(data);
   
@@ -762,7 +766,8 @@
 	   name);
   }
   /* Let the widgets be redrawn */
-  while (g_main_iteration (FALSE));
+  context = g_main_context_default();
+  while (g_main_context_iteration(context, FALSE));
 }
 
 GWEN_INHERIT(AB_BANKING, GNCInteractor)

Modified: gnucash/trunk/src/import-export/qif/qif-parse.c
===================================================================
--- gnucash/trunk/src/import-export/qif/qif-parse.c	2005-11-29 21:37:34 UTC (rev 12067)
+++ gnucash/trunk/src/import-export/qif/qif-parse.c	2005-11-30 00:25:59 UTC (rev 12068)
@@ -256,9 +256,8 @@
    * - strip off leading/trailing whitespace
    * - make it all lower case
    */
-  bangtype = g_strdup(line+1);
+  bangtype = g_utf8_strdown(line+1, -1);
   g_strstrip(bangtype);
-  g_strdown(bangtype);
 
   /* In some cases we get "!Type Bank" -- change the space to a colon */
   if (!strncmp(bangtype, "type ", 5))
@@ -405,9 +404,8 @@
     build_action_map();
 
   /* Duplicate the action and force it to lower case and strip any spaces */
-  action = g_strdup(line->line);
+  action = g_utf8_strdown(line->line, -1);
   g_strstrip(action);
-  g_strdown(action);
 
   result = g_hash_table_lookup(qif_action_map, action);
   g_free(action);
@@ -432,9 +430,8 @@
     build_atype_map();
 
   /* Duplicate the type and force it to lower case and strip any spaces */
-  type = g_strdup(str);
+  type = g_utf8_strdown(str, -1);
   g_strstrip(type);
-  g_strdown(type);
 
   result = g_hash_table_lookup(qif_atype_map, type);
   g_free(type);



More information about the gnucash-changes mailing list