mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Guile 2: replace deprecated SCM_SYMBOL_CHARS function
The replacements require guile 1.8 or above git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22651 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
5b03182435
commit
37b65abff1
@ -41,6 +41,7 @@
|
||||
#include "glib-helpers.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-glib-utils.h"
|
||||
#include "gnc-guile-utils.h"
|
||||
#include "guile-util.h"
|
||||
#include "guile-mappings.h"
|
||||
|
||||
@ -163,7 +164,7 @@ gnc_guile_call1_to_string(SCM func, SCM arg)
|
||||
|
||||
if (scm_is_string(value))
|
||||
{
|
||||
return gnc_scm_to_locale_string(value);
|
||||
return scm_to_locale_string(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -192,18 +193,12 @@ gnc_guile_call1_to_string(SCM func, SCM arg)
|
||||
char *
|
||||
gnc_guile_call1_symbol_to_string(SCM func, SCM arg)
|
||||
{
|
||||
SCM value;
|
||||
SCM symbol_value;
|
||||
|
||||
if (scm_is_procedure(func))
|
||||
{
|
||||
value = scm_call_1(func, arg);
|
||||
|
||||
if (scm_is_symbol(value))
|
||||
return g_strdup(SCM_SYMBOL_CHARS(value));
|
||||
else
|
||||
{
|
||||
PERR("bad value\n");
|
||||
}
|
||||
symbol_value = scm_call_1(func, arg);
|
||||
return gnc_scm_symbol_to_locale_string (symbol_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -662,7 +657,7 @@ gnc_split_scm_get_memo(SCM split_scm)
|
||||
if (!scm_is_string(result))
|
||||
return NULL;
|
||||
|
||||
return gnc_scm_to_locale_string(result);
|
||||
return scm_to_locale_string(result);
|
||||
}
|
||||
|
||||
|
||||
@ -687,7 +682,7 @@ gnc_split_scm_get_action(SCM split_scm)
|
||||
if (!scm_is_string(result))
|
||||
return NULL;
|
||||
|
||||
return gnc_scm_to_locale_string(result);
|
||||
return scm_to_locale_string(result);
|
||||
}
|
||||
|
||||
|
||||
@ -1116,7 +1111,7 @@ gnc_get_debit_string(GNCAccountType account_type)
|
||||
if (!scm_is_string(result))
|
||||
return NULL;
|
||||
|
||||
return gnc_scm_to_locale_string(result);
|
||||
return scm_to_locale_string(result);
|
||||
}
|
||||
|
||||
|
||||
@ -1147,7 +1142,7 @@ gnc_get_credit_string(GNCAccountType account_type)
|
||||
if (!scm_is_string(result))
|
||||
return NULL;
|
||||
|
||||
return gnc_scm_to_locale_string(result);
|
||||
return scm_to_locale_string(result);
|
||||
}
|
||||
|
||||
|
||||
@ -1316,18 +1311,3 @@ gnc_parse_time_to_time64 (const gchar *s, const gchar *format)
|
||||
|
||||
return gnc_mktime(&tm);
|
||||
}
|
||||
|
||||
gchar *gnc_scm_to_locale_string(SCM scm_string)
|
||||
{
|
||||
gchar* s;
|
||||
char * str;
|
||||
|
||||
scm_dynwind_begin (0);
|
||||
str = scm_to_locale_string(scm_string);
|
||||
|
||||
/* prevent memory leaks in scm_to_locale_string() per guile manual; see 'http://www.gnu.org/software/guile/manual/html_node/Dynamic-Wind.html#Dynamic-Wind' */
|
||||
s = g_strdup(str);
|
||||
scm_dynwind_free (str);
|
||||
scm_dynwind_end ();
|
||||
return s;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include "qof.h"
|
||||
#include "Account.h"
|
||||
#include "gnc-guile-utils.h"
|
||||
|
||||
|
||||
/* Helpful functions for calling functions that return
|
||||
@ -41,11 +42,6 @@ SCM gnc_guile_call1_to_list(SCM func, SCM arg);
|
||||
SCM gnc_guile_list_ref(SCM list, int index);
|
||||
SCM gnc_guile_call1_to_vector(SCM func, SCM arg);
|
||||
|
||||
/** Wrapper around scm_to_locale_string() that returns a newly
|
||||
* allocated string (even for guile-1.6 version). The caller must
|
||||
* g_free() the returned string later. */
|
||||
gchar * gnc_scm_to_locale_string(SCM scm_string);
|
||||
|
||||
/* Don't use this to get hold of symbols that are considered private
|
||||
* to a given module unless the C code you're writing is considered
|
||||
* part of that module. */
|
||||
|
@ -2102,7 +2102,7 @@ gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb,
|
||||
{
|
||||
value = scm_call_0(getter);
|
||||
if (scm_is_symbol(value))
|
||||
return g_strdup(SCM_SYMBOL_CHARS(value));
|
||||
return gnc_scm_symbol_to_locale_string (value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2196,7 +2196,7 @@ gnc_option_db_lookup_date_option(GNCOptionDB *odb,
|
||||
*is_relative = TRUE;
|
||||
|
||||
if (set_rel_value != NULL)
|
||||
*set_rel_value = g_strdup(SCM_SYMBOL_CHARS (relative));
|
||||
*set_rel_value = gnc_scm_symbol_to_locale_string (relative);
|
||||
}
|
||||
|
||||
g_free (symbol);
|
||||
@ -2356,7 +2356,7 @@ gnc_option_db_lookup_list_option(GNCOptionDB *odb,
|
||||
return default_value;
|
||||
}
|
||||
|
||||
list = g_slist_prepend(list, g_strdup(SCM_SYMBOL_CHARS(item)));
|
||||
list = g_slist_prepend(list, gnc_scm_symbol_to_locale_string (item));
|
||||
}
|
||||
|
||||
if (!scm_is_list(value) || !scm_is_null(value))
|
||||
@ -2615,12 +2615,7 @@ gnc_option_date_option_get_subtype(GNCOption *option)
|
||||
|
||||
initialize_getters();
|
||||
|
||||
value = scm_call_1(getters.date_option_subtype, option->guile_option);
|
||||
|
||||
if (scm_is_symbol(value))
|
||||
return g_strdup(SCM_SYMBOL_CHARS(value));
|
||||
else
|
||||
return NULL;
|
||||
return gnc_guile_call1_symbol_to_string(getters.date_option_subtype, option->guile_option);
|
||||
}
|
||||
|
||||
/*******************************************************************\
|
||||
@ -2637,11 +2632,7 @@ gnc_date_option_value_get_type (SCM option_value)
|
||||
|
||||
initialize_getters();
|
||||
|
||||
value = scm_call_1 (getters.date_option_value_type, option_value);
|
||||
if (!scm_is_symbol (value))
|
||||
return NULL;
|
||||
|
||||
return g_strdup(SCM_SYMBOL_CHARS (value));
|
||||
return gnc_guile_call1_symbol_to_string (getters.date_option_value_type, option_value);
|
||||
}
|
||||
|
||||
/*******************************************************************\
|
||||
@ -2717,7 +2708,7 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format,
|
||||
gboolean *years, char **custom)
|
||||
{
|
||||
SCM val;
|
||||
const char *str;
|
||||
gchar *str;
|
||||
|
||||
if (!scm_is_list(value) || scm_is_null(value))
|
||||
return TRUE;
|
||||
@ -2730,7 +2721,7 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format,
|
||||
value = SCM_CDR(value);
|
||||
if (!scm_is_symbol(val))
|
||||
break;
|
||||
str = SCM_SYMBOL_CHARS (val);
|
||||
str = gnc_scm_symbol_to_locale_string (val);
|
||||
if (!str)
|
||||
break;
|
||||
|
||||
@ -2738,16 +2729,18 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format,
|
||||
{
|
||||
if (gnc_date_string_to_dateformat(str, format))
|
||||
{
|
||||
g_free (str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_free (str);
|
||||
|
||||
/* parse the months */
|
||||
val = SCM_CAR(value);
|
||||
value = SCM_CDR(value);
|
||||
if (!scm_is_symbol(val))
|
||||
break;
|
||||
str = SCM_SYMBOL_CHARS (val);
|
||||
str = gnc_scm_symbol_to_locale_string (val);
|
||||
if (!str)
|
||||
break;
|
||||
|
||||
@ -2755,9 +2748,11 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format,
|
||||
{
|
||||
if (gnc_date_string_to_monthformat(str, months))
|
||||
{
|
||||
g_free (str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_free (str);
|
||||
|
||||
/* parse the years */
|
||||
val = SCM_CAR(value);
|
||||
@ -2780,11 +2775,9 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format,
|
||||
{
|
||||
char * tmp_str;
|
||||
char * string;
|
||||
scm_dynwind_begin (0);
|
||||
tmp_str = scm_to_locale_string (val);
|
||||
string = g_strdup (tmp_str);
|
||||
scm_dynwind_free (tmp_str);
|
||||
scm_dynwind_end ();
|
||||
free (tmp_str);
|
||||
*custom = string;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ libgnc_core_utils_la_SOURCES = \
|
||||
gnc-gdate-utils.c \
|
||||
gnc-gkeyfile-utils.c \
|
||||
gnc-glib-utils.c \
|
||||
gnc-guile-utils.c \
|
||||
gnc-jalali.c \
|
||||
gnc-locale-utils.c \
|
||||
gnc-main.c \
|
||||
@ -35,6 +36,7 @@ noinst_HEADERS = \
|
||||
gnc-gdate-utils.h \
|
||||
gnc-gkeyfile-utils.h \
|
||||
gnc-glib-utils.h \
|
||||
gnc-guile-utils.h \
|
||||
gnc-jalali.h \
|
||||
gnc-locale-utils.h \
|
||||
gnc-path.h \
|
||||
|
62
src/core-utils/gnc-guile-utils.c
Normal file
62
src/core-utils/gnc-guile-utils.c
Normal file
@ -0,0 +1,62 @@
|
||||
/********************************************************************\
|
||||
* gnc-guile-utils.c -- basic guile extensions *
|
||||
* Copyright (C) 2012 Geert Janssens *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include "swig-runtime.h"
|
||||
#include <libguile.h>
|
||||
|
||||
#include "qof.h"
|
||||
#include "gnc-guile-utils.h"
|
||||
#include "guile-mappings.h"
|
||||
|
||||
/* This static indicates the debugging module this .o belongs to. */
|
||||
static QofLogModule log_module = G_LOG_DOMAIN;
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_guile_symbol_to_locale_string *
|
||||
* returns the string representation of the scm symbol in *
|
||||
* a newly allocated gchar * or NULL if it can't be retrieved. *
|
||||
* *
|
||||
* Args: symbol_value - the scm symbol *
|
||||
* Returns: newly allocated gchar * or NULL, should be freed with *
|
||||
* g_free by the caller *
|
||||
\********************************************************************/
|
||||
gchar *
|
||||
gnc_scm_symbol_to_locale_string(SCM symbol_value)
|
||||
{
|
||||
|
||||
if (scm_is_symbol(symbol_value))
|
||||
{
|
||||
SCM string_value = scm_symbol_to_string (symbol_value);
|
||||
if (scm_is_string (string_value))
|
||||
{
|
||||
char *tmp = scm_to_locale_string (string_value);
|
||||
gchar *str = g_strdup (tmp);
|
||||
free (tmp);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
/* Unable to extract string from the symbol...*/
|
||||
PERR("bad value\n");
|
||||
return NULL;
|
||||
}
|
34
src/core-utils/gnc-guile-utils.h
Normal file
34
src/core-utils/gnc-guile-utils.h
Normal file
@ -0,0 +1,34 @@
|
||||
/********************************************************************\
|
||||
* gnc-guile-utils.h -- basic guile extensions *
|
||||
* Copyright (C) 2012 Geert Janssens *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef GNC_GUILE_UTILS_H
|
||||
#define GNC_GUILE_UTILS_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <libguile.h>
|
||||
|
||||
/** Helper function to get the string representation of
|
||||
* a guile symbol. */
|
||||
gchar * gnc_scm_symbol_to_locale_string(SCM scm_string);
|
||||
|
||||
#endif
|
@ -34,6 +34,7 @@
|
||||
#include "gnc-date.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "guile-mappings.h"
|
||||
#include "gnc-guile-utils.h"
|
||||
#include "qof.h"
|
||||
/** \todo Code dependent on the private query headers
|
||||
qofquery-p.h and qofquerycore-p.h may need to be modified.
|
||||
@ -248,7 +249,7 @@ static QofGuidMatch
|
||||
gnc_scm2acct_match_how (SCM how_scm)
|
||||
{
|
||||
QofGuidMatch res;
|
||||
const gchar *how = SCM_SYMBOL_CHARS (how_scm);
|
||||
gchar *how = gnc_scm_symbol_to_locale_string (how_scm);
|
||||
|
||||
if (!g_strcmp0 (how, "acct-match-all"))
|
||||
res = QOF_GUID_MATCH_ALL;
|
||||
@ -261,6 +262,8 @@ gnc_scm2acct_match_how (SCM how_scm)
|
||||
PINFO ("invalid account match: %s", how);
|
||||
res = QOF_GUID_MATCH_NULL;
|
||||
}
|
||||
|
||||
g_free (how);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -268,7 +271,7 @@ static QofQueryCompare
|
||||
gnc_scm2amt_match_how (SCM how_scm)
|
||||
{
|
||||
QofQueryCompare res;
|
||||
const gchar *how = SCM_SYMBOL_CHARS (how_scm);
|
||||
gchar *how = gnc_scm_symbol_to_locale_string (how_scm);
|
||||
|
||||
if (!g_strcmp0 (how, "amt-match-atleast"))
|
||||
res = QOF_COMPARE_GTE;
|
||||
@ -282,6 +285,7 @@ gnc_scm2amt_match_how (SCM how_scm)
|
||||
res = QOF_COMPARE_EQUAL;
|
||||
}
|
||||
|
||||
g_free (how);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -289,7 +293,7 @@ static QofQueryCompare
|
||||
gnc_scm2kvp_match_how (SCM how_scm)
|
||||
{
|
||||
QofQueryCompare res;
|
||||
const gchar *how = SCM_SYMBOL_CHARS (how_scm);
|
||||
gchar *how = gnc_scm_symbol_to_locale_string (how_scm);
|
||||
|
||||
if (!g_strcmp0 (how, "kvp-match-lt"))
|
||||
res = QOF_COMPARE_LT;
|
||||
@ -306,6 +310,8 @@ gnc_scm2kvp_match_how (SCM how_scm)
|
||||
PINFO ("invalid kvp match: %s", how);
|
||||
res = QOF_COMPARE_EQUAL;
|
||||
}
|
||||
|
||||
g_free (how);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -341,7 +347,7 @@ gnc_scm2cleared_match_how (SCM how_scm)
|
||||
static gboolean
|
||||
gnc_scm2balance_match_how (SCM how_scm, gboolean *resp)
|
||||
{
|
||||
const gchar *how;
|
||||
gchar *how;
|
||||
|
||||
if (!scm_is_list (how_scm))
|
||||
return FALSE;
|
||||
@ -353,13 +359,14 @@ gnc_scm2balance_match_how (SCM how_scm, gboolean *resp)
|
||||
if (!scm_is_null (SCM_CDR (how_scm)))
|
||||
return FALSE;
|
||||
|
||||
how = SCM_SYMBOL_CHARS (SCM_CAR(how_scm));
|
||||
how = gnc_scm_symbol_to_locale_string (SCM_CAR(how_scm));
|
||||
|
||||
if (!g_strcmp0 (how, "balance-match-balanced"))
|
||||
*resp = TRUE;
|
||||
else
|
||||
*resp = FALSE;
|
||||
|
||||
g_free (how);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -367,12 +374,12 @@ static QofIdType
|
||||
gnc_scm2kvp_match_where (SCM where_scm)
|
||||
{
|
||||
QofIdType res;
|
||||
const gchar *where;
|
||||
gchar *where;
|
||||
|
||||
if (!scm_is_list (where_scm))
|
||||
return NULL;
|
||||
|
||||
where = SCM_SYMBOL_CHARS (SCM_CAR(where_scm));
|
||||
where = gnc_scm_symbol_to_locale_string (SCM_CAR(where_scm));
|
||||
|
||||
if (!g_strcmp0 (where, "kvp-match-split"))
|
||||
res = GNC_ID_SPLIT;
|
||||
@ -385,6 +392,8 @@ gnc_scm2kvp_match_where (SCM where_scm)
|
||||
PINFO ("Unknown kvp-match-where: %s", where);
|
||||
res = NULL;
|
||||
}
|
||||
|
||||
g_free (where);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -914,7 +923,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
QofQuery *q = NULL;
|
||||
QofQueryPredData *pd = NULL;
|
||||
SCM scm;
|
||||
const gchar *type = NULL;
|
||||
gchar *type = NULL;
|
||||
GSList *path = NULL;
|
||||
gboolean inverted = FALSE;
|
||||
QofQueryCompare compare_how;
|
||||
@ -943,7 +952,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
qt_scm = SCM_CDR (qt_scm);
|
||||
if (!scm_is_symbol (scm))
|
||||
break;
|
||||
type = SCM_SYMBOL_CHARS (scm);
|
||||
type = gnc_scm_symbol_to_locale_string (scm);
|
||||
|
||||
/* QofCompareFunc */
|
||||
scm = SCM_CAR (qt_scm);
|
||||
@ -1136,6 +1145,8 @@ gnc_scm2query_term_query_v2 (SCM qt_scm)
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (type);
|
||||
|
||||
}
|
||||
while (FALSE);
|
||||
|
||||
@ -1162,8 +1173,8 @@ static QofQuery *
|
||||
gnc_scm2query_term_query_v1 (SCM query_term_scm)
|
||||
{
|
||||
gboolean ok = FALSE;
|
||||
const gchar * pd_type = NULL;
|
||||
const gchar * pr_type = NULL;
|
||||
gchar * pd_type = NULL;
|
||||
gchar * pr_type = NULL;
|
||||
gboolean sense = FALSE;
|
||||
QofQuery *q = NULL;
|
||||
SCM scm;
|
||||
@ -1180,7 +1191,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
|
||||
/* pd_type */
|
||||
scm = SCM_CAR (query_term_scm);
|
||||
query_term_scm = SCM_CDR (query_term_scm);
|
||||
pd_type = SCM_SYMBOL_CHARS (scm);
|
||||
pd_type = gnc_scm_symbol_to_locale_string (scm);
|
||||
|
||||
/* pr_type */
|
||||
if (scm_is_null (query_term_scm))
|
||||
@ -1190,7 +1201,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
|
||||
}
|
||||
scm = SCM_CAR (query_term_scm);
|
||||
query_term_scm = SCM_CDR (query_term_scm);
|
||||
pr_type = SCM_SYMBOL_CHARS (scm);
|
||||
pr_type = gnc_scm_symbol_to_locale_string (scm);
|
||||
|
||||
/* sense */
|
||||
if (scm_is_null (query_term_scm))
|
||||
@ -1516,6 +1527,9 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm)
|
||||
PINFO ("Unknown Predicate: %s", pd_type);
|
||||
}
|
||||
|
||||
g_free (pd_type);
|
||||
g_free (pr_type);
|
||||
|
||||
}
|
||||
while (FALSE);
|
||||
|
||||
@ -1884,9 +1898,9 @@ gnc_scm2query_v1 (SCM query_scm)
|
||||
{
|
||||
QofQuery *q = NULL;
|
||||
gboolean ok = TRUE;
|
||||
const gchar * primary_sort = NULL;
|
||||
const gchar * secondary_sort = NULL;
|
||||
const gchar * tertiary_sort = NULL;
|
||||
gchar * primary_sort = NULL;
|
||||
gchar * secondary_sort = NULL;
|
||||
gchar * tertiary_sort = NULL;
|
||||
gboolean primary_increasing = TRUE;
|
||||
gboolean secondary_increasing = TRUE;
|
||||
gboolean tertiary_increasing = TRUE;
|
||||
@ -1894,7 +1908,7 @@ gnc_scm2query_v1 (SCM query_scm)
|
||||
|
||||
while (!scm_is_null (query_scm))
|
||||
{
|
||||
const gchar *symbol;
|
||||
gchar *symbol;
|
||||
SCM sym_scm;
|
||||
SCM value;
|
||||
SCM pair;
|
||||
@ -1919,7 +1933,7 @@ gnc_scm2query_v1 (SCM query_scm)
|
||||
break;
|
||||
}
|
||||
|
||||
symbol = SCM_SYMBOL_CHARS (sym_scm);
|
||||
symbol = gnc_scm_symbol_to_locale_string (sym_scm);
|
||||
if (!symbol)
|
||||
{
|
||||
PERR ("No string found");
|
||||
@ -1950,7 +1964,7 @@ gnc_scm2query_v1 (SCM query_scm)
|
||||
break;
|
||||
}
|
||||
|
||||
primary_sort = SCM_SYMBOL_CHARS (value);
|
||||
primary_sort = gnc_scm_symbol_to_locale_string (value);
|
||||
|
||||
}
|
||||
else if (g_strcmp0 ("secondary-sort", symbol) == 0)
|
||||
@ -1962,7 +1976,7 @@ gnc_scm2query_v1 (SCM query_scm)
|
||||
break;
|
||||
}
|
||||
|
||||
secondary_sort = SCM_SYMBOL_CHARS (value);
|
||||
secondary_sort = gnc_scm_symbol_to_locale_string (value);
|
||||
|
||||
}
|
||||
else if (g_strcmp0 ("tertiary-sort", symbol) == 0)
|
||||
@ -1974,7 +1988,7 @@ gnc_scm2query_v1 (SCM query_scm)
|
||||
break;
|
||||
}
|
||||
|
||||
tertiary_sort = SCM_SYMBOL_CHARS (value);
|
||||
tertiary_sort = gnc_scm_symbol_to_locale_string (value);
|
||||
|
||||
}
|
||||
else if (g_strcmp0 ("primary-increasing", symbol) == 0)
|
||||
@ -2010,6 +2024,8 @@ gnc_scm2query_v1 (SCM query_scm)
|
||||
ok = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (symbol);
|
||||
}
|
||||
|
||||
if (ok)
|
||||
@ -2023,12 +2039,18 @@ gnc_scm2query_v1 (SCM query_scm)
|
||||
qof_query_set_sort_increasing (q, primary_increasing, secondary_increasing,
|
||||
tertiary_increasing);
|
||||
qof_query_set_max_results (q, max_splits);
|
||||
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
qof_query_destroy (q);
|
||||
q = NULL;
|
||||
}
|
||||
|
||||
qof_query_destroy (q);
|
||||
return NULL;
|
||||
g_free (primary_sort);
|
||||
g_free (secondary_sort);
|
||||
g_free (tertiary_sort);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static QofQuery *
|
||||
@ -2036,7 +2058,7 @@ gnc_scm2query_v2 (SCM query_scm)
|
||||
{
|
||||
QofQuery *q = NULL;
|
||||
gboolean ok = TRUE;
|
||||
const gchar * search_for = NULL;
|
||||
gchar * search_for = NULL;
|
||||
GSList *sp1 = NULL, *sp2 = NULL, *sp3 = NULL;
|
||||
gint so1 = 0, so2 = 0, so3 = 0;
|
||||
gboolean si1 = TRUE, si2 = TRUE, si3 = TRUE;
|
||||
@ -2044,7 +2066,7 @@ gnc_scm2query_v2 (SCM query_scm)
|
||||
|
||||
while (!scm_is_null (query_scm))
|
||||
{
|
||||
const gchar *symbol;
|
||||
gchar *symbol;
|
||||
SCM sym_scm;
|
||||
SCM value;
|
||||
SCM pair;
|
||||
@ -2067,7 +2089,7 @@ gnc_scm2query_v2 (SCM query_scm)
|
||||
break;
|
||||
}
|
||||
|
||||
symbol = SCM_SYMBOL_CHARS (sym_scm);
|
||||
symbol = gnc_scm_symbol_to_locale_string (sym_scm);
|
||||
if (!symbol)
|
||||
{
|
||||
ok = FALSE;
|
||||
@ -2094,7 +2116,7 @@ gnc_scm2query_v2 (SCM query_scm)
|
||||
ok = FALSE;
|
||||
break;
|
||||
}
|
||||
search_for = SCM_SYMBOL_CHARS (value);
|
||||
search_for = gnc_scm_symbol_to_locale_string (value);
|
||||
|
||||
}
|
||||
else if (g_strcmp0 ("primary-sort", symbol) == 0)
|
||||
@ -2140,6 +2162,8 @@ gnc_scm2query_v2 (SCM query_scm)
|
||||
ok = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (symbol);
|
||||
}
|
||||
|
||||
if (ok && search_for)
|
||||
@ -2149,19 +2173,23 @@ gnc_scm2query_v2 (SCM query_scm)
|
||||
qof_query_set_sort_options (q, so1, so2, so3);
|
||||
qof_query_set_sort_increasing (q, si1, si2, si3);
|
||||
qof_query_set_max_results (q, max_results);
|
||||
|
||||
return q;
|
||||
}
|
||||
else
|
||||
{
|
||||
qof_query_destroy (q);
|
||||
q = NULL;
|
||||
}
|
||||
|
||||
qof_query_destroy (q);
|
||||
return NULL;
|
||||
g_free (search_for);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
QofQuery *
|
||||
gnc_scm2query (SCM query_scm)
|
||||
{
|
||||
SCM q_type;
|
||||
const gchar *type;
|
||||
gchar *type;
|
||||
QofQuery *q = NULL;
|
||||
|
||||
/* Not a list or NULL? No need to go further */
|
||||
@ -2185,13 +2213,14 @@ gnc_scm2query (SCM query_scm)
|
||||
}
|
||||
|
||||
/* Ok, the LHS is the version and the RHS is the actual query list */
|
||||
type = SCM_SYMBOL_CHARS (q_type);
|
||||
type = gnc_scm_symbol_to_locale_string (q_type);
|
||||
if (!type)
|
||||
return NULL;
|
||||
|
||||
if (!g_strcmp0 (type, "query-v2"))
|
||||
q = gnc_scm2query_v2 (SCM_CDR (query_scm));
|
||||
|
||||
g_free (type);
|
||||
return q;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <libguile.h>
|
||||
#include "guile-mappings.h"
|
||||
#include "guile-util.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "gnc-ui-util.h"
|
||||
@ -299,7 +300,7 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog)
|
||||
scm = scm_call_3 (getters.payer_name_source, category, code_scm,
|
||||
tax_entity_type);
|
||||
if (scm_is_symbol(scm))
|
||||
str = g_strdup (SCM_SYMBOL_CHARS (scm));
|
||||
str = gnc_scm_symbol_to_locale_string (scm);
|
||||
else
|
||||
str = g_strdup ("");
|
||||
if (g_strcmp0 (str, "not-impl") == 0)
|
||||
@ -317,7 +318,7 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog)
|
||||
g_free (str);
|
||||
|
||||
if (scm_is_symbol(code_scm))
|
||||
str = g_strdup (SCM_SYMBOL_CHARS (code_scm));
|
||||
str = gnc_scm_symbol_to_locale_string (code_scm);
|
||||
else
|
||||
str = g_strdup ("");
|
||||
txf_info->code = g_strdup (str);
|
||||
@ -504,7 +505,7 @@ load_tax_entity_type_list (TaxInfoDialog *ti_dialog)
|
||||
tax_type_info = g_new0 (TaxTypeInfo, 1);
|
||||
|
||||
if (scm_is_symbol(type_scm))
|
||||
str = g_strdup (SCM_SYMBOL_CHARS (type_scm));
|
||||
str = gnc_scm_symbol_to_locale_string (type_scm);
|
||||
else
|
||||
str = g_strdup ("");
|
||||
tax_type_info->type_code = g_strdup (str);
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "gnc-plugin-page-account-tree.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "guile-mappings.h"
|
||||
#include "guile-util.h"
|
||||
|
||||
#include "swig-runtime.h"
|
||||
|
||||
@ -1910,7 +1911,7 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
|
||||
while (scm_is_list(date_formats) && !scm_is_null(date_formats))
|
||||
{
|
||||
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, SCM_SYMBOL_CHARS(SCM_CAR(date_formats)), -1);
|
||||
gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, gnc_scm_symbol_to_locale_string(SCM_CAR(date_formats)), -1);
|
||||
|
||||
date_formats = SCM_CDR(date_formats);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user