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.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12068 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2005-11-30 00:25:59 +00:00
parent 43aec898b9
commit 29dc69b3de
12 changed files with 67 additions and 29 deletions
+15
View File
@@ -1,3 +1,18 @@
2005-11-29 David Hampton <hampton@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@employees.org>
* src/import-export/qif-import/qif-to-gnc.scm:
+3
View File
@@ -142,6 +142,9 @@ else
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)
+12 -12
View File
@@ -642,13 +642,13 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
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 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
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 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
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 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
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 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
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 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
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);
+8 -3
View File
@@ -855,7 +855,7 @@ gnc_sxed_check_consistent( SchedXactionEditorDialog *sxed )
/* 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 @@ gnc_sxed_check_consistent( SchedXactionEditorDialog *sxed )
}
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_sxed_check_consistent( SchedXactionEditorDialog *sxed )
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 @@ gnc_sxed_check_consistent( SchedXactionEditorDialog *sxed )
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 );
}
+3 -1
View File
@@ -618,6 +618,7 @@ sxftd_advanced_clicked(SXFromTransInfo *sxfti)
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 @@ sxftd_advanced_clicked(SXFromTransInfo *sxfti)
}
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 =
+2 -2
View File
@@ -1029,8 +1029,8 @@ movedown_template_cb(GtkButton *button,
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));
}
@@ -217,7 +217,6 @@ update_accountlist (HBCIInitialInfo *info)
/* 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 @@ update_accountlist (HBCIInitialInfo *info)
/* 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 */
+1 -1
View File
@@ -163,7 +163,7 @@ gnc_verify_exist_or_new_file (GtkWidget *parent, const char *filename)
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) {
@@ -30,6 +30,7 @@ struct _trans_data
{
/* Name of this Template */
gchar *name;
gchar *name_key; /* Collation key */
/* Recipient */
gchar *recp_name;
@@ -61,6 +62,7 @@ GNCTransTempl *gnc_trans_templ_new_full(const char *name,
{
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 @@ void gnc_trans_templ_delete(GNCTransTempl *t)
{
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 @@ GNCTransTempl *gnc_trans_templ_from_kvp(kvp_frame *k)
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 @@ const char *gnc_trans_templ_get_name(const GNCTransTempl *t)
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 @@ void gnc_trans_templ_set_name(GNCTransTempl *t, const char *c)
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)
{
@@ -60,6 +60,7 @@ GList *gnc_trans_templ_kvp_glist_from_glist(GList *k);
/** @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);
+7 -2
View File
@@ -473,11 +473,14 @@ static int getTanCB(AB_BANKING *ab,
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 @@ on_button_clicked (GtkButton *button,
gpointer user_data)
{
GNCInteractor *data = user_data;
GMainContext *context;
const char *name;
g_assert(data);
@@ -762,7 +766,8 @@ on_button_clicked (GtkButton *button,
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)
+3 -6
View File
@@ -256,9 +256,8 @@ qif_parse_bangtype(QifContext ctx, const char *line)
* - 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 @@ QifAction qif_parse_action(QifLine line)
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 @@ GList * qif_parse_acct_type(const char *str, gint lineno)
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);