mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/gnome/window-main.c: Kevin Finn's patch to shutdown gnucash
when the main window is deleted. Handle remove_child events to prevent accessing deleted windows. * src/engine/sixtp-dom-parsers.c (string_to_integer): same as below * src/engine/sixtp-dom-generators.c (add_kvp_value_node): same as below * src/engine/sixtp-xml-write-utils.c: same as below * src/engine/sixtp-utils.c: same as below * src/engine/gnc-numeric.c: same as below * src/engine/TransLog.c: same as below * src/engine/kvp_frame.c: same as below * src/engine/sql/kvp-sql.c: same as below * src/engine/sql/builder.c (sqlBuild_Set_Int64): don't assume long long int == gint64 * src/gnome/window-main.c: take out devel menu * src/gnome/dialog-price-editor.c (price_ok_clicked): fix bug git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3976 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
41745f6690
commit
528118cc99
25
ChangeLog
25
ChangeLog
@ -1,5 +1,30 @@
|
||||
2001-04-15 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/gnome/window-main.c: Kevin Finn's patch to shutdown gnucash
|
||||
when the main window is deleted. Handle remove_child events to
|
||||
prevent accessing deleted windows.
|
||||
|
||||
* src/engine/sixtp-dom-parsers.c (string_to_integer): same as
|
||||
below
|
||||
|
||||
* src/engine/sixtp-dom-generators.c (add_kvp_value_node): same as
|
||||
below
|
||||
|
||||
* src/engine/sixtp-xml-write-utils.c: same as below
|
||||
|
||||
* src/engine/sixtp-utils.c: same as below
|
||||
|
||||
* src/engine/gnc-numeric.c: same as below
|
||||
|
||||
* src/engine/TransLog.c: same as below
|
||||
|
||||
* src/engine/kvp_frame.c: same as below
|
||||
|
||||
* src/engine/sql/kvp-sql.c: same as below
|
||||
|
||||
* src/engine/sql/builder.c (sqlBuild_Set_Int64): don't assume
|
||||
long long int == gint64
|
||||
|
||||
* src/gnome/window-main.c: take out devel menu
|
||||
|
||||
* src/gnome/dialog-price-editor.c (price_ok_clicked): fix bug
|
||||
|
@ -224,10 +224,10 @@ xaccTransWriteLog (Transaction *trans, char flag)
|
||||
split->memo ? split->memo : "",
|
||||
split->action ? split->action : "",
|
||||
split->reconciled,
|
||||
gnc_numeric_num(split->damount),
|
||||
gnc_numeric_denom(split->damount),
|
||||
gnc_numeric_num(split->value),
|
||||
gnc_numeric_denom(split->value),
|
||||
(long long int) gnc_numeric_num(split->damount),
|
||||
(long long int) gnc_numeric_denom(split->damount),
|
||||
(long long int) gnc_numeric_num(split->value),
|
||||
(long long int) gnc_numeric_denom(split->value),
|
||||
drecn ? drecn : "");
|
||||
|
||||
g_free (drecn);
|
||||
|
@ -1042,9 +1042,11 @@ gnc_numeric_check(gnc_numeric in) {
|
||||
gchar *
|
||||
gnc_numeric_to_string(gnc_numeric n) {
|
||||
gchar *result;
|
||||
long long tmpnum = n.num;
|
||||
long long tmpdenom = n.denom;
|
||||
long long int tmpnum = n.num;
|
||||
long long int tmpdenom = n.denom;
|
||||
|
||||
result = g_strdup_printf("%lld/%lld", tmpnum, tmpdenom);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1054,8 +1056,8 @@ string_to_gnc_numeric(const gchar* str, gnc_numeric *n) {
|
||||
returning a pointer to just past the last byte read. Return NULL
|
||||
on error. */
|
||||
int num_read;
|
||||
long long tmpnum;
|
||||
long long tmpdenom;
|
||||
long long int tmpnum;
|
||||
long long int tmpdenom;
|
||||
|
||||
if(!str) return NULL;
|
||||
|
||||
@ -1074,10 +1076,14 @@ static char *
|
||||
gnc_numeric_print(gnc_numeric in) {
|
||||
char * retval;
|
||||
if(gnc_numeric_check(in)) {
|
||||
retval = g_strdup_printf("<ERROR> [%lld / %lld]", in.num, in.denom);
|
||||
retval = g_strdup_printf("<ERROR> [%lld / %lld]",
|
||||
(long long int) in.num,
|
||||
(long long int) in.denom);
|
||||
}
|
||||
else {
|
||||
retval = g_strdup_printf("[%lld / %lld]", in.num, in.denom);
|
||||
retval = g_strdup_printf("[%lld / %lld]",
|
||||
(long long int) in.num,
|
||||
(long long int) in.denom);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
@ -991,7 +991,7 @@ kvp_value_to_string(const kvp_value *val)
|
||||
{
|
||||
case KVP_TYPE_GINT64:
|
||||
return g_strdup_printf("KVP_VALUE_GINT64(%lld)",
|
||||
kvp_value_get_gint64(val));
|
||||
(long long int) kvp_value_get_gint64(val));
|
||||
break;
|
||||
|
||||
case KVP_TYPE_DOUBLE:
|
||||
|
@ -244,7 +244,9 @@ add_kvp_value_node(xmlNodePtr node, gchar *tag, kvp_value* val)
|
||||
{
|
||||
case KVP_TYPE_GINT64:
|
||||
add_text_to_node(val_node, "integer",
|
||||
g_strdup_printf("%lld", kvp_value_get_gint64(val)));
|
||||
g_strdup_printf("%lld",
|
||||
(long long int)
|
||||
kvp_value_get_gint64(val)));
|
||||
break;
|
||||
case KVP_TYPE_DOUBLE:
|
||||
add_text_to_node(val_node,"double",
|
||||
|
@ -727,8 +727,13 @@ dom_tree_generic_parse(xmlNodePtr node, struct dom_tree_handler *handlers,
|
||||
gboolean
|
||||
string_to_integer(const char *content, gint64 *to)
|
||||
{
|
||||
if(sscanf(content, "%lld", to) == 1)
|
||||
long long int to_in;
|
||||
|
||||
if(sscanf(content, "%lld", &to_in) == 1)
|
||||
{
|
||||
if (to)
|
||||
*to = to_in;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -197,13 +197,17 @@ string_to_double(const char *str, double *result)
|
||||
gboolean
|
||||
string_to_gint64(const gchar *str, gint64 *v) {
|
||||
/* convert a string to a gint64. only whitespace allowed before and after. */
|
||||
long long int v_in;
|
||||
int num_read;
|
||||
|
||||
/* must use "<" here because %n's effects aren't well defined */
|
||||
if(sscanf(str, " %lld %n", v, &num_read) < 1) {
|
||||
if(sscanf(str, " %lld %n", &v_in, &num_read) < 1) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if (v)
|
||||
*v = v_in;
|
||||
|
||||
if(!isspace_str(str + num_read, -1)) return(FALSE);
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ xml_add_gint64(xmlNodePtr p, const char *tag, const gint64 value) {
|
||||
g_return_val_if_fail(p, FALSE);
|
||||
g_return_val_if_fail(tag, FALSE);
|
||||
|
||||
g_snprintf(num_string, sizeof (num_string), "%lld", value);
|
||||
g_snprintf(num_string, sizeof (num_string), "%lld", (long long int) value);
|
||||
|
||||
val_xml = xmlNewTextChild(p, NULL, tag, num_string);
|
||||
g_return_val_if_fail(val_xml, FALSE);
|
||||
@ -183,13 +183,9 @@ xml_add_gnc_numeric(xmlNodePtr p, const char *tag, const gnc_numeric n) {
|
||||
g_return_val_if_fail(p, FALSE);
|
||||
g_return_val_if_fail(tag, FALSE);
|
||||
|
||||
/* fprintf(stderr, "WRITE GNUM S: %lld/%lld -> ", n.num, n.denom); */
|
||||
|
||||
numstr = gnc_numeric_to_string(n);
|
||||
g_return_val_if_fail(numstr, FALSE);
|
||||
|
||||
/* fprintf(stderr, "%s\n", numstr); */
|
||||
|
||||
child = xmlNewTextChild(p, NULL, tag, numstr);
|
||||
g_free(numstr); numstr = FALSE;
|
||||
g_return_val_if_fail(child, FALSE);
|
||||
|
@ -299,7 +299,7 @@ sqlBuild_Set_Int64 (sqlBuilder *b, const char *tag, gint64 nval)
|
||||
char val[100];
|
||||
if (!b || !tag) return;
|
||||
|
||||
snprintf (val, 100, "%lld", nval);
|
||||
snprintf (val, 100, "%lld", (long long int) nval);
|
||||
if (b->tag_need_comma) b->ptag = stpcpy(b->ptag, ", ");
|
||||
b->tag_need_comma = 1;
|
||||
|
||||
|
@ -208,7 +208,9 @@ store_cb (const char *key, kvp_value *val, gpointer p)
|
||||
case KVP_TYPE_GINT64:
|
||||
{
|
||||
gint64 ival = kvp_value_get_gint64 (val);
|
||||
PINFO ("path=%s type=gint64 val=%lld", cb_data->path, ival);
|
||||
PINFO ("path=%s type=gint64 val=%lld",
|
||||
cb_data->path,
|
||||
(long long int) ival);
|
||||
|
||||
cb_data->stype = "int8";
|
||||
cb_data->u.ival = ival;
|
||||
@ -230,8 +232,10 @@ store_cb (const char *key, kvp_value *val, gpointer p)
|
||||
case KVP_TYPE_NUMERIC:
|
||||
{
|
||||
gnc_numeric ival = kvp_value_get_numeric (val);
|
||||
PINFO ("path=%s type=numeric val=%lld/%lld", cb_data->path,
|
||||
ival.num, ival.denom);
|
||||
PINFO ("path=%s type=numeric val=%lld/%lld",
|
||||
cb_data->path,
|
||||
(long long int) ival.num,
|
||||
(long long int) ival.denom);
|
||||
|
||||
cb_data->stype = "frac";
|
||||
cb_data->u.numeric = ival;
|
||||
|
@ -922,7 +922,7 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
|
||||
}
|
||||
|
||||
/* print the integer part without separators */
|
||||
sprintf(temp_buf, "%lld", (long long) whole.num);
|
||||
sprintf(temp_buf, "%lld", (long long int) whole.num);
|
||||
num_whole_digits = strlen (temp_buf);
|
||||
|
||||
if (!info->use_separators)
|
||||
@ -997,8 +997,8 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
|
||||
val = gnc_numeric_reduce (val);
|
||||
|
||||
sprintf (temp_buf, " + %lld / %lld",
|
||||
(long long) val.num,
|
||||
(long long) val.denom);
|
||||
(long long int) val.num,
|
||||
(long long int) val.denom);
|
||||
|
||||
strcat (buf, temp_buf);
|
||||
}
|
||||
@ -1252,9 +1252,9 @@ typedef enum
|
||||
|
||||
#define done_state(state) (((state) == DONE_ST) || ((state) == NO_NUM_ST))
|
||||
|
||||
G_INLINE_FUNC long long multiplier (int num_decimals);
|
||||
G_INLINE_FUNC long long int multiplier (int num_decimals);
|
||||
|
||||
G_INLINE_FUNC long long
|
||||
G_INLINE_FUNC long long int
|
||||
multiplier (int num_decimals)
|
||||
{
|
||||
switch (num_decimals)
|
||||
@ -1308,8 +1308,8 @@ xaccParseAmount (const char * in_str, gboolean monetary, gnc_numeric *result,
|
||||
gboolean got_decimal;
|
||||
gboolean need_paren;
|
||||
GList * group_data;
|
||||
long long numer;
|
||||
long long denom;
|
||||
long long int numer;
|
||||
long long int denom;
|
||||
int group_count;
|
||||
|
||||
ParseState state;
|
||||
@ -1669,7 +1669,7 @@ xaccParseAmount (const char * in_str, gboolean monetary, gnc_numeric *result,
|
||||
if (got_decimal && (*out_str != '\0'))
|
||||
{
|
||||
size_t len;
|
||||
long long fraction;
|
||||
long long int fraction;
|
||||
|
||||
len = strlen(out_str);
|
||||
|
||||
|
@ -69,7 +69,7 @@ static void gnc_main_window_create_menus(GNCMainInfo * maininfo);
|
||||
|
||||
static void
|
||||
gnc_main_window_destroy_cb(GtkObject * w) {
|
||||
gnc_ui_destroy();
|
||||
gnc_shutdown (0);
|
||||
}
|
||||
|
||||
|
||||
@ -136,7 +136,8 @@ gnc_main_window_app_created_cb(GnomeMDI * mdi, GnomeApp * app,
|
||||
|
||||
/* add a signal to preserve the toolbar on destroy */
|
||||
gtk_signal_connect(GTK_OBJECT(app), "destroy",
|
||||
gnc_main_window_app_destroyed_cb, mainwin);
|
||||
GTK_SIGNAL_FUNC (gnc_main_window_app_destroyed_cb),
|
||||
mainwin);
|
||||
|
||||
/* set up extensions menu and hints */
|
||||
gnc_extensions_menu_setup(app);
|
||||
@ -207,6 +208,23 @@ gnc_refresh_main_window_titles (void)
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_main_window_child_remove_cb()
|
||||
* called when a child is removed
|
||||
********************************************************************/
|
||||
|
||||
static gboolean
|
||||
gnc_main_window_child_remove_cb(GnomeMDI * mdi, GnomeMDIChild * child,
|
||||
gpointer data) {
|
||||
GNCMainInfo * mainwin = data;
|
||||
|
||||
if(mainwin->last_active == child) {
|
||||
mainwin->last_active = NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_main_window_child_changed_cb()
|
||||
* called when the active child changes. Not sure what this means
|
||||
@ -412,6 +430,9 @@ gnc_main_window_new(void) {
|
||||
gtk_signal_connect(GTK_OBJECT(retval->mdi), "app_created",
|
||||
GTK_SIGNAL_FUNC(gnc_main_window_app_created_cb),
|
||||
retval);
|
||||
gtk_signal_connect(GTK_OBJECT(retval->mdi), "remove_child",
|
||||
GTK_SIGNAL_FUNC(gnc_main_window_child_remove_cb),
|
||||
retval);
|
||||
gtk_signal_connect(GTK_OBJECT(retval->mdi), "child_changed",
|
||||
GTK_SIGNAL_FUNC(gnc_main_window_child_changed_cb),
|
||||
retval);
|
||||
@ -885,4 +906,3 @@ gnc_main_window_create_child_toolbar(GNCMainInfo * mi,
|
||||
gnome_app_fill_toolbar(tb, tbinfo, NULL);
|
||||
|
||||
}
|
||||
|
||||
|
@ -84,11 +84,10 @@
|
||||
|
||||
(cond ((gnc:ui-is-running?)
|
||||
(if (not (gnc:ui-is-terminating?))
|
||||
(begin
|
||||
(if (gnc:file-query-save)
|
||||
(begin
|
||||
(gnc:hook-run-danglers gnc:*ui-shutdown-hook*)
|
||||
(gnc:ui-shutdown))))))
|
||||
(gnc:ui-shutdown)))))
|
||||
(else
|
||||
(gnc:ui-destroy)
|
||||
(gnc:hook-run-danglers gnc:*shutdown-hook*)
|
||||
|
Loading…
Reference in New Issue
Block a user