Commit de2dbe8c authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Move ref early. (set_format_category_menu_from_style): Call

2003-06-29  Morten Welinder  <terra@gnome.org>

	* widget-format-selector.c
	(number_format_selector_set_style_format): Move ref early.
	(set_format_category_menu_from_style): Call
	fmt_dialog_enable_widgets to update the display.

2003-06-29  Morten Welinder  <terra@gnome.org>

	* src/formats.c (style_format_percent, style_format_science,
	style_format_account, style_format_number): Simplify using
	g_string_append_len.
parent 161d3879
2003-06-29 Morten Welinder <terra@gnome.org>
* src/formats.c (style_format_percent, style_format_science,
style_format_account, style_format_number): Simplify using
g_string_append_len.
* src/stf.c (stf_store_results): Don't switch locales here.
2003-06-28 Andreas J. Guelzow <aguelzow@taliesin.ca>
......
2003-06-29 Morten Welinder <terra@gnome.org>
* src/formats.c (style_format_percent, style_format_science,
style_format_account, style_format_number): Simplify using
g_string_append_len.
* src/stf.c (stf_store_results): Don't switch locales here.
2003-06-28 Andreas J. Guelzow <aguelzow@taliesin.ca>
......
2003-06-29 Morten Welinder <terra@gnome.org>
* src/formats.c (style_format_percent, style_format_science,
style_format_account, style_format_number): Simplify using
g_string_append_len.
* src/stf.c (stf_store_results): Don't switch locales here.
2003-06-28 Andreas J. Guelzow <aguelzow@taliesin.ca>
......
......@@ -146,8 +146,9 @@ cell_format_text [] = {
NULL,
};
static char const * const zeros = "000000000000000000000000000000";
static char const * const qmarks = "??????????????????????????????";
#define NUM_ZEROS 30
static const char zeros[NUM_ZEROS + 1] = "000000000000000000000000000000";
static const char qmarks[NUM_ZEROS + 1] = "??????????????????????????????";
char const * const * const
cell_formats [] = {
......@@ -735,9 +736,9 @@ style_format_percent (GString *res, FormatCharacteristics const *fmt)
{
g_string_append_c (res, '0');
if (fmt->num_decimals > 0) {
g_return_if_fail (fmt->num_decimals <= 30);
g_return_if_fail (fmt->num_decimals <= NUM_ZEROS);
g_string_append_c (res, '.');
g_string_append (res, zeros + 30-fmt->num_decimals);
g_string_append_len (res, zeros, fmt->num_decimals);
}
g_string_append_c (res, '%');
}
......@@ -747,9 +748,9 @@ style_format_science (GString *res, FormatCharacteristics const *fmt)
{
g_string_append_c (res, '0');
if (fmt->num_decimals > 0) {
g_return_if_fail (fmt->num_decimals <= 30);
g_return_if_fail (fmt->num_decimals <= NUM_ZEROS);
g_string_append_c (res, '.');
g_string_append (res, zeros + 30-fmt->num_decimals);
g_string_append_len (res, zeros, fmt->num_decimals);
}
g_string_append (res, "E+00");
}
......@@ -763,9 +764,9 @@ style_format_account (GString *res, FormatCharacteristics const *fmt)
/* The number with decimals */
num = g_string_new ("#,##0");
if (fmt->num_decimals > 0) {
g_return_if_fail (fmt->num_decimals <= 30);
g_return_if_fail (fmt->num_decimals <= NUM_ZEROS);
g_string_append_c (num, '.');
g_string_append (num, zeros + 30-fmt->num_decimals);
g_string_append_len (res, zeros, fmt->num_decimals);
}
/* The currency symbols with space after or before */
......@@ -782,17 +783,17 @@ style_format_account (GString *res, FormatCharacteristics const *fmt)
g_string_append (sym, currency_symbols[symbol].symbol);
}
/* Finaly build the correct string */
/* Finally build the correct string */
if (currency_symbols[symbol].precedes) {
g_string_printf (res, "_(%s%s_);_(%s(%s);_(%s\"-\"%s_);_(@_)",
sym->str, num->str,
sym->str, num->str,
sym->str, qmarks + 30-fmt->num_decimals);
sym->str, qmarks + NUM_ZEROS-fmt->num_decimals);
} else {
g_string_printf (res, "_(%s%s_);_((%s)%s;_(\"-\"%s%s_);_(@_)",
num->str, sym->str,
num->str, sym->str,
qmarks + 30-fmt->num_decimals, sym->str);
qmarks + NUM_ZEROS-fmt->num_decimals, sym->str);
}
g_string_free (num, TRUE);
......@@ -826,10 +827,10 @@ style_format_number (GString *res, FormatCharacteristics const *fmt)
g_string_append_c (res, '0');
if (fmt->num_decimals > 0) {
g_return_if_fail (fmt->num_decimals <= 30);
g_return_if_fail (fmt->num_decimals <= NUM_ZEROS);
g_string_append_c (res, '.');
g_string_append (res, zeros + 30-fmt->num_decimals);
g_string_append_len (res, zeros, fmt->num_decimals);
}
/* Currency */
......
......@@ -2,6 +2,8 @@
* widget-format-selector.c
(number_format_selector_set_style_format): Move ref early.
(set_format_category_menu_from_style): Call
fmt_dialog_enable_widgets to update the display.
2003-06-24 Morten Welinder <terra@gnome.org>
......
......@@ -191,19 +191,19 @@ generate_format (NumberFormatSelector *nfs)
format.currency_symbol_index = 0;
case FMT_CURRENCY :
style_format_number(new_format, &format);
style_format_number (new_format, &format);
break;
case FMT_ACCOUNT :
style_format_account(new_format, &format);
style_format_account (new_format, &format);
break;
case FMT_PERCENT :
style_format_percent(new_format, &format);
style_format_percent (new_format, &format);
break;
case FMT_SCIENCE :
style_format_science(new_format, &format);
style_format_science (new_format, &format);
break;
default :
......@@ -749,6 +749,7 @@ set_format_category_menu_from_style (NumberFormatSelector *nfs)
page = 11; /* Default to custom */
set_format_category (nfs, page);
fmt_dialog_enable_widgets (nfs, page);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment