Commit ae6bbcca authored by Morten Welinder's avatar Morten Welinder

Compilation: Constify GOFormat handling.

parent 0b6f1d6c
2010-11-16 Morten Welinder <terra@gnome.org>
* src/*.c: Constify GOFormat handling.
2010-11-15 Morten Welinder <terra@gnome.org>
* src/gui-file.c (gui_file_save_as): Clear "pristine" flag. Fixes
......
......@@ -28,7 +28,7 @@
typedef struct _BiffXFData {
guint16 font_idx;
guint16 format_idx;
GOFormat *style_format;
GOFormat const *style_format;
gboolean is_simple_format;
gboolean hidden;
......
......@@ -1308,7 +1308,7 @@ odf_write_style_text_properties (GnmOOExport *state, GnmStyle const *style)
static void
odf_write_style_goformat_name (GnmOOExport *state, GOFormat *gof)
odf_write_style_goformat_name (GnmOOExport *state, GOFormat const *gof)
{
char const *name;
......@@ -1447,7 +1447,7 @@ odf_write_style (GnmOOExport *state, GnmStyle const *style, gboolean is_default)
guint i;
if ((!is_default) && gnm_style_is_element_set (style, MSTYLE_FORMAT)) {
GOFormat *format = gnm_style_get_format(style);
GOFormat const *format = gnm_style_get_format(style);
if (format != NULL)
odf_write_style_goformat_name (state, format);
}
......
......@@ -62,9 +62,9 @@
static GnmFuncFlags do_af_suggest_list (int argc,
GnmExprConstPtr const *argv,
GnmEvalPos const *epos,
GOFormat **explicit);
GOFormat const **explicit);
struct cb_af_suggest { GnmFuncFlags typ; GOFormat **explicit; };
struct cb_af_suggest { GnmFuncFlags typ; GOFormat const **explicit; };
static GnmValue *
cb_af_suggest (GnmCellIter const *iter, gpointer user)
......@@ -80,14 +80,14 @@ cb_af_suggest (GnmCellIter const *iter, gpointer user)
}
static gboolean
is_date (GnmFuncFlags typ, GOFormat *explicit)
is_date (GnmFuncFlags typ, GOFormat const *explicit)
{
return (typ == GNM_FUNC_AUTO_DATE ||
(typ == AF_EXPLICIT && go_format_is_date (explicit)));
}
static GnmFuncFlags
do_af_suggest (GnmExpr const *expr, GnmEvalPos const *epos, GOFormat **explicit)
do_af_suggest (GnmExpr const *expr, GnmEvalPos const *epos, GOFormat const **explicit)
{
#if 0
{
......@@ -122,7 +122,7 @@ do_af_suggest (GnmExpr const *expr, GnmEvalPos const *epos, GOFormat **explicit)
case GNM_EXPR_OP_SUB: {
GnmFuncFlags typ1, typ2;
GOFormat *explicit1 = NULL, *explicit2 = NULL;
GOFormat const *explicit1 = NULL, *explicit2 = NULL;
typ1 = do_af_suggest (expr->binary.value_a, epos, &explicit1);
typ2 = do_af_suggest (expr->binary.value_b, epos, &explicit2);
......@@ -231,7 +231,7 @@ do_af_suggest (GnmExpr const *expr, GnmEvalPos const *epos, GOFormat **explicit)
static GnmFuncFlags
do_af_suggest_list (int argc, GnmExprConstPtr const *argv,
GnmEvalPos const *epos, GOFormat **explicit)
GnmEvalPos const *epos, GOFormat const **explicit)
{
int i;
......@@ -247,10 +247,10 @@ do_af_suggest_list (int argc, GnmExprConstPtr const *argv,
/* ------------------------------------------------------------------------- */
GOFormat *
GOFormat const *
auto_style_format_suggest (GnmExprTop const *texpr, GnmEvalPos const *epos)
{
GOFormat *explicit = NULL;
GOFormat const *explicit = NULL;
g_return_val_if_fail (texpr != NULL, NULL);
g_return_val_if_fail (epos != NULL, NULL);
......
......@@ -6,8 +6,8 @@
G_BEGIN_DECLS
GOFormat *auto_style_format_suggest (GnmExprTop const *texpr,
GnmEvalPos const *epos);
GOFormat const *auto_style_format_suggest (GnmExprTop const *texpr,
GnmEvalPos const *epos);
G_END_DECLS
......
......@@ -831,7 +831,7 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
sheet_get_conventions (sheet), NULL);
if (texpr != NULL) {
GOFormat *sf;
GOFormat const *sf;
GnmStyle *new_style = NULL;
gboolean same_texpr = TRUE;
......
......@@ -644,7 +644,7 @@ make_expr_example (Sheet *sheet, const char *text, gboolean localized)
char *etxt = gnm_expr_top_as_string (texpr, &pp, convs);
GnmValue *val = gnm_expr_top_eval
(texpr, &ep, GNM_EXPR_EVAL_PERMIT_NON_SCALAR);
GOFormat *format = auto_style_format_suggest (texpr, &ep);
GOFormat const *format = auto_style_format_suggest (texpr, &ep);
char *vtxt = format_value(format, val, NULL, -1,
workbook_date_conv (sheet->workbook));
......
......@@ -314,7 +314,7 @@ cb_dialog_apply_clicked (G_GNUC_UNUSED GtkWidget *button,
GoalSeekStatus status;
GnmValue *target;
GnmRangeRef const *r;
GOFormat *format;
GOFormat const *format;
if (state->warning_dialog != NULL)
gtk_widget_destroy (state->warning_dialog);
......
......@@ -144,7 +144,7 @@ get_table_float_entry (GtkTable *t, int y, int x, GnmCell *cell, gnm_float *numb
GtkEntry **wp, gboolean with_default, gnm_float default_float)
{
GList *l;
GOFormat *format;
GOFormat const *format;
GList *children = gtk_container_get_children (GTK_CONTAINER (t));
int res = 3;
......
......@@ -48,7 +48,7 @@ struct _GnmStyle {
double size;
} font_detail;
GOFormat *format;
GOFormat const *format;
GnmHAlign h_align;
GnmVAlign v_align;
int indent;
......
......@@ -166,7 +166,7 @@ gnm_go_data_preferred_fmt (GOData const *dat)
eval_pos_init_dep (&ep, dep);
return dep->texpr
? auto_style_format_suggest (dep->texpr, &ep)
? (GOFormat *)auto_style_format_suggest (dep->texpr, &ep)
: NULL;
}
......
......@@ -1030,8 +1030,9 @@ focus_on_entry (GtkEntry *entry)
}
gboolean
entry_to_float_with_format_default (GtkEntry *entry, gnm_float *the_float, gboolean update,
GOFormat *format, gnm_float num)
entry_to_float_with_format_default (GtkEntry *entry, gnm_float *the_float,
gboolean update,
GOFormat const *format, gnm_float num)
{
char const *text = gtk_entry_get_text (entry);
gboolean need_default = (text == NULL);
......@@ -1054,8 +1055,8 @@ entry_to_float_with_format_default (GtkEntry *entry, gnm_float *the_float, gbool
}
gboolean
entry_to_float_with_format (GtkEntry *entry, gnm_float *the_float, gboolean update,
GOFormat *format)
entry_to_float_with_format (GtkEntry *entry, gnm_float *the_float,
gboolean update, GOFormat const *format)
{
GnmValue *value = format_match_number (gtk_entry_get_text (entry), format, NULL);
......
......@@ -91,10 +91,15 @@ void focus_on_entry (GtkEntry *entry);
* We should be passing in a DateConvention */
#define entry_to_float(entry, the_float, update) \
entry_to_float_with_format (entry, the_float, update, NULL)
gboolean entry_to_float_with_format (GtkEntry *entry, gnm_float *the_float, gboolean update,
GOFormat *format);
gboolean entry_to_float_with_format_default (GtkEntry *entry, gnm_float *the_float, gboolean update,
GOFormat *format, gnm_float num);
gboolean entry_to_float_with_format (GtkEntry *entry,
gnm_float *the_float,
gboolean update,
GOFormat const *format);
gboolean entry_to_float_with_format_default (GtkEntry *entry,
gnm_float *the_float,
gboolean update,
GOFormat const *format,
gnm_float num);
gboolean entry_to_int (GtkEntry *entry, gint *the_int, gboolean update);
void float_to_entry (GtkEntry *entry, gnm_float the_float);
void int_to_entry (GtkEntry *entry, gint the_int);
......
......@@ -1312,7 +1312,7 @@ gnm_style_set_format (GnmStyle *style, GOFormat const *format)
go_format_ref (format);
elem_clear_contents (style, MSTYLE_FORMAT);
elem_set (style, MSTYLE_FORMAT);
style->format = (GOFormat *)format;
style->format = format;
}
/*
......@@ -1334,7 +1334,7 @@ gnm_style_set_format_text (GnmStyle *style, char const *format)
go_format_unref (sf);
}
GOFormat *
const GOFormat *
gnm_style_get_format (GnmStyle const *style)
{
g_return_val_if_fail (style != NULL, NULL);
......
......@@ -118,7 +118,7 @@ GnmFont *gnm_style_get_font (GnmStyle const *style,
PangoContext *context);
void gnm_style_set_format (GnmStyle *style, GOFormat const *fmt);
void gnm_style_set_format_text (GnmStyle *style, char const *fmt);
GOFormat *gnm_style_get_format (GnmStyle const *style);
GOFormat const*gnm_style_get_format (GnmStyle const *style);
void gnm_style_set_align_h (GnmStyle *style, GnmHAlign a);
GnmHAlign gnm_style_get_align_h (GnmStyle const *style);
void gnm_style_set_align_v (GnmStyle *style, GnmVAlign a);
......
......@@ -1187,7 +1187,7 @@ stf_cell_set_text (GnmCell *cell, char const *text)
{
GnmExprTop const *texpr;
GnmValue *val;
GOFormat *fmt = gnm_style_get_format (gnm_cell_get_style (cell));
GOFormat const *fmt = gnm_style_get_format (gnm_cell_get_style (cell));
const GODateConventions *date_conv =
workbook_date_conv (cell->base.sheet->workbook);
......
......@@ -517,7 +517,7 @@ wb_view_auto_expr_recalc (WorkbookView *wbv)
if (v) {
GString *str = g_string_new (wbv->auto_expr_descr);
GOFormat const *format = NULL;
GOFormat *tmp_format = NULL;
GOFormat const *tmp_format = NULL;
PangoAttrList *attrs;
g_string_append_c (str, '=');
......
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