Commit b7a61e81 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

remove a pile of deprecated glib functions.


2002-09-04  Jody Goldberg <jody@gnome.org>

	* *.c : remove a pile of deprecated glib functions.

	* src/xml-io.c (xml_probe) : fix test for extension .xml.gz  We only
	  check the last extension.  So foo.xml.gz has extension .gz.
	  Don't rip out quite so much of the sax handler.
parent b9f2b10b
2002-09-04 Jody Goldberg <jody@gnome.org>
* *.c : remove a pile of deprecated glib functions.
* src/xml-io.c (xml_probe) : fix test for extension .xml.gz We only
check the last extension. So foo.xml.gz has extension .gz.
Don't rip out quite so much of the sax handler.
2002-09-04 Jody Goldberg <jody@gnome.org>
* src/cell-draw.c (cell_draw) : fix handling of multiline text.
......
......@@ -8,6 +8,8 @@ Jody:
* Parser support for both sytaxes of 3d reference
* Parser support for row or col only references (A:C or 1:5)
* Fix some drawing issues related to the pango conversion
* remove some deprecated functions
* Fix handling of files named .xml.gz
Morten:
* Leak plugging.
......
2002-09-04 Jody Goldberg <jody@gnome.org>
* *.c : remove a pile of deprecated glib functions.
* src/xml-io.c (xml_probe) : fix test for extension .xml.gz We only
check the last extension. So foo.xml.gz has extension .gz.
Don't rip out quite so much of the sax handler.
2002-09-04 Jody Goldberg <jody@gnome.org>
* src/cell-draw.c (cell_draw) : fix handling of multiline text.
......
2002-09-04 Jody Goldberg <jody@gnome.org>
* *.c : remove a pile of deprecated glib functions.
* src/xml-io.c (xml_probe) : fix test for extension .xml.gz We only
check the last extension. So foo.xml.gz has extension .gz.
Don't rip out quite so much of the sax handler.
2002-09-04 Jody Goldberg <jody@gnome.org>
* src/cell-draw.c (cell_draw) : fix handling of multiline text.
......
......@@ -133,8 +133,7 @@ get_formula_index (ExcelSheet *sheet, const gchar *name)
}
for (i = 0; i < FORMULA_FUNC_DATA_LEN; i++) {
if (!g_strcasecmp (formula_func_data[i].prefix,
name)) {
if (!g_ascii_strcasecmp (formula_func_data[i].prefix, name)) {
fce = formula_cache_new_std (sheet, i);
#if FORMULA_DEBUG > 0
printf ("Caching and returning '%s' as %d\n", name, i);
......
......@@ -189,7 +189,7 @@ translate_cell_format (StyleFormat const *format)
for (i = 0; i < translate_table_count; i++) {
const translate_t *t = &translate_table[i];
if (!g_strcasecmp (fmt, t->format)) {
if (!g_ascii_strcasecmp (fmt, t->format)) {
g_free (fmt);
return value_new_string (t->output);
}
......@@ -218,14 +218,14 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
CellRef const *ref = &argv [1]->v_range.cell.a;
/* from CELL - limited usefulness! */
if (!g_strcasecmp(info_type, "address")) {
if (!g_ascii_strcasecmp(info_type, "address")) {
ParsePos pp;
char *ref_name = cellref_name (ref,
parse_pos_init_evalpos (&pp, ei->pos), TRUE);
return value_new_string_nocopy (ref_name);
/* from later 123 versions - USEFUL! */
} else if (!g_strcasecmp(info_type, "coord")) {
} else if (!g_ascii_strcasecmp(info_type, "coord")) {
ParsePos pp;
CellRef tmp = *ref;
char *ref_name;
......@@ -237,12 +237,12 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
return value_new_string_nocopy (ref_name);
/* from CELL - pointless - use COLUMN instead! */
} else if (!g_strcasecmp (info_type, "col") ||
!g_strcasecmp (info_type, "column")) {
} else if (!g_ascii_strcasecmp (info_type, "col") ||
!g_ascii_strcasecmp (info_type, "column")) {
return value_new_int (ref->col + 1);
/* from CELL - pointless - use ROW instead! */
} else if (!g_strcasecmp (info_type, "row")) {
} else if (!g_ascii_strcasecmp (info_type, "row")) {
return value_new_int (ref->row + 1);
/* from CELL - limited usefulness
......@@ -252,7 +252,7 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
* for format "0;-0;[Green]0"
* Another place where Excel doesn't conform to it's documentation!
*/
} else if (!g_strcasecmp (info_type, "color")) {
} else if (!g_ascii_strcasecmp (info_type, "color")) {
FormatCharacteristics info =
retrieve_format_info (ei->pos->sheet, ref->col, ref->row);
......@@ -261,8 +261,8 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
value_new_int (0);
/* absolutely pointless - compatibility only */
} else if (!g_strcasecmp (info_type, "contents") ||
!g_strcasecmp (info_type, "value")) {
} else if (!g_ascii_strcasecmp (info_type, "contents") ||
!g_ascii_strcasecmp (info_type, "value")) {
Cell const *cell =
sheet_cell_get (ei->pos->sheet, ref->col, ref->row);
if (cell && cell->value)
......@@ -274,7 +274,7 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
* 123R2.2 (it wasn't in 123R2.0x), modify it in Excel 4.0 to include
* the worksheet name, but they can't make any other changes to CELL?!
*/
} else if (!g_strcasecmp (info_type, "filename")) {
} else if (!g_ascii_strcasecmp (info_type, "filename")) {
char const *name = ei->pos->sheet->workbook->filename;
if (name == NULL)
......@@ -284,7 +284,7 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
/* from CELL */
/* Backwards compatibility w/123 - unnecessary */
} else if (!g_strcasecmp (info_type, "format")) {
} else if (!g_ascii_strcasecmp (info_type, "format")) {
MStyle const *mstyle =
sheet_style_get (ei->pos->sheet, ref->col, ref->row);
......@@ -292,7 +292,7 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
/* from CELL */
/* Backwards compatibility w/123 - unnecessary */
} else if (!g_strcasecmp (info_type, "parentheses")) {
} else if (!g_ascii_strcasecmp (info_type, "parentheses")) {
FormatCharacteristics info =
retrieve_format_info (ei->pos->sheet, ref->col, ref->row);
......@@ -302,8 +302,8 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
/* from CELL */
/* Backwards compatibility w/123 - unnecessary */
} else if (!g_strcasecmp (info_type, "prefix") ||
!g_strcasecmp (info_type, "prefixcharacter")) {
} else if (!g_ascii_strcasecmp (info_type, "prefix") ||
!g_ascii_strcasecmp (info_type, "prefixcharacter")) {
MStyle const *mstyle =
sheet_style_get (ei->pos->sheet, ref->col, ref->row);
Cell const *cell =
......@@ -322,8 +322,8 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
return value_new_string ("");
/* from CELL */
} else if (!g_strcasecmp (info_type, "locked") ||
!g_strcasecmp (info_type, "protect")) {
} else if (!g_ascii_strcasecmp (info_type, "locked") ||
!g_ascii_strcasecmp (info_type, "protect")) {
MStyle const *mstyle =
sheet_style_get (ei->pos->sheet, ref->col, ref->row);
return value_new_int (mstyle_get_content_locked (mstyle) ? 1 : 0);
......@@ -352,9 +352,9 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
End If
*/
} else if (!g_strcasecmp (info_type, "type") ||
!g_strcasecmp (info_type, "datatype") ||
!g_strcasecmp (info_type, "formulatype")) {
} else if (!g_ascii_strcasecmp (info_type, "type") ||
!g_ascii_strcasecmp (info_type, "datatype") ||
!g_ascii_strcasecmp (info_type, "formulatype")) {
Cell const *cell =
sheet_cell_get (ei->pos->sheet, ref->col, ref->row);
if (cell && cell->value) {
......@@ -366,8 +366,8 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
return value_new_string ("b");
/* from CELL */
} else if (!g_strcasecmp (info_type, "width") ||
!g_strcasecmp (info_type, "columnwidth")) {
} else if (!g_ascii_strcasecmp (info_type, "width") ||
!g_ascii_strcasecmp (info_type, "columnwidth")) {
ColRowInfo const *info =
sheet_col_get_info (ei->pos->sheet, ref->col);
double charwidth;
......@@ -1308,26 +1308,26 @@ static Value *
gnumeric_info (FunctionEvalInfo *ei, Value **argv)
{
char const * const info_type = value_peek_string (argv[0]);
if (!g_strcasecmp (info_type, "directory")) {
if (!g_ascii_strcasecmp (info_type, "directory")) {
/* Path of the current directory or folder. */
return value_new_error (ei->pos, _("Unimplemented"));
} else if (!g_strcasecmp (info_type, "memavail")) {
} else if (!g_ascii_strcasecmp (info_type, "memavail")) {
/* Amount of memory available, in bytes. */
return value_new_int (15 << 20); /* Good enough... */
} else if (!g_strcasecmp (info_type, "memused")) {
} else if (!g_ascii_strcasecmp (info_type, "memused")) {
/* Amount of memory being used for data. */
return value_new_int (1 << 20); /* Good enough... */
} else if (!g_strcasecmp (info_type, "numfile")) {
} else if (!g_ascii_strcasecmp (info_type, "numfile")) {
/* Number of active worksheets. */
return value_new_int (1); /* Good enough... */
} else if (!g_strcasecmp (info_type, "origin")) {
} else if (!g_ascii_strcasecmp (info_type, "origin")) {
/* Absolute A1-style reference, as text, prepended with "$A:"
* for Lotus 1-2-3 release 3.x compatibility. Returns the cell
* reference of the top and leftmost cell visible in the
* window, based on the current scrolling position.
*/
return value_new_error (ei->pos, _("Unimplemented"));
} else if (!g_strcasecmp (info_type, "osversion")) {
} else if (!g_ascii_strcasecmp (info_type, "osversion")) {
/* Current operating system version, as text. */
struct utsname unamedata;
......@@ -1340,13 +1340,13 @@ gnumeric_info (FunctionEvalInfo *ei, Value **argv)
unamedata.release);
return value_new_string_nocopy (tmp);
}
} else if (!g_strcasecmp (info_type, "recalc")) {
} else if (!g_ascii_strcasecmp (info_type, "recalc")) {
/* Current recalculation mode; returns "Automatic" or "Manual". */
return value_new_string (_("Automatic"));
} else if (!g_strcasecmp (info_type, "release")) {
} else if (!g_ascii_strcasecmp (info_type, "release")) {
/* Version of Gnumeric (Well, Microsoft Excel), as text. */
return value_new_string (GNUMERIC_VERSION);
} else if (!g_strcasecmp (info_type, "system")) {
} else if (!g_ascii_strcasecmp (info_type, "system")) {
/* Name of the operating environment. */
struct utsname unamedata;
......@@ -1354,7 +1354,7 @@ gnumeric_info (FunctionEvalInfo *ei, Value **argv)
return value_new_error (ei->pos, _("Unknown system"));
else
return value_new_string (unamedata.sysname);
} else if (!g_strcasecmp (info_type, "totmem")) {
} else if (!g_ascii_strcasecmp (info_type, "totmem")) {
/* Total memory available, including memory already in use, in
* bytes.
*/
......
......@@ -38,7 +38,7 @@ font_match (MStyle *mstyle, const char **names)
g_return_val_if_fail (font_name != NULL, 0);
for (i = 0; names[i]; i++) {
if (g_strcasecmp (font_name, names[i]) == 0)
if (g_ascii_strcasecmp (font_name, names[i]) == 0)
return 1;
}
return 0;
......
......@@ -249,7 +249,7 @@ html_get_border_style (StyleBorder *border)
r = border->color->color.red >> 8;
g = border->color->color.green >> 8;
b = border->color->color.blue >> 8;
g_string_sprintfa (text, " #%02X%02X%02X", r, g, b);
g_string_append_printf (text, " #%02X%02X%02X", r, g, b);
}
result = text->str;
......
......@@ -203,14 +203,14 @@ mps_write_sheet_labels (MpsInputContext *ctxt, Sheet *sh)
GString *buf;
for (i = 0; i < MAX_COL; i++) {
buf = g_string_new ("");
g_string_sprintfa (buf, "C[%d]", i + 1);
g_string_append_printf (buf, "C[%d]", i + 1);
mps_set_cell (sh, VARIABLE_COL + i, row, buf->str);
g_string_free (buf, FALSE);
}
for (i = 0; i < n_rows_per_fn; i++) {
buf = g_string_new ("");
g_string_sprintfa (buf, "R[%d]", i + 1);
g_string_append_printf (buf, "R[%d]", i + 1);
mps_set_cell (sh, VARIABLE_COL - 1, row + i + 1,
buf->str);
g_string_free (buf, FALSE);
......@@ -260,7 +260,7 @@ mps_write_sheet_labels (MpsInputContext *ctxt, Sheet *sh)
GString *buf;
for (i = 0; i < MAX_COL; i++) {
buf = g_string_new ("");
g_string_sprintfa (buf, "C[%d]", i + 1);
g_string_append_printf (buf, "C[%d]", i + 1);
mps_set_cell (sh, CONSTRAINT_COL + i, row, buf->str);
g_string_free (buf, FALSE);
}
......@@ -332,7 +332,7 @@ mps_write_coefficients (MpsInputContext *ctxt, Sheet *sh,
VARIABLE_ROW + n_rows_per_fn - 1,
(ctxt->n_cols % MAX_COL),
VARIABLE_ROW + n_rows_per_fn - 1);
g_string_sprintfa (var_range [i], "%s", range_name (&v_range));
g_string_append_printf (var_range [i], "%s", range_name (&v_range));
i = 0;
for (current = ctxt->rows; current != NULL; current = current->next) {
......@@ -447,7 +447,7 @@ mps_write_coefficients (MpsInputContext *ctxt, Sheet *sh,
VARIABLE_ROW + 1 + n_rows_per_fn,
ctxt->n_cols,
VARIABLE_ROW + 1 + n_rows_per_fn);
g_string_sprintfa (buf, "=SUMPRODUCT(%s,%s)",
g_string_append_printf (buf, "=SUMPRODUCT(%s,%s)",
var_range[0]->str,
range_name (&range));
......@@ -460,7 +460,7 @@ mps_write_coefficients (MpsInputContext *ctxt, Sheet *sh,
var_range [0] = g_string_new ("");
range_init (&range, VARIABLE_COL, VARIABLE_ROW,
MAX_COL, VARIABLE_ROW + n_rows_per_fn - 1);
g_string_sprintfa (var_range [0], "%s", range_name (&range));
g_string_append_printf (var_range [0], "%s", range_name (&range));
param->input_entry_str = g_strdup (var_range [0]->str);
g_string_free (var_range [0], FALSE);
......@@ -490,7 +490,7 @@ mps_create_sheet (MpsInputContext *ctxt, WorkbookView *wbv)
else {
for (i = 0; i < n_rows_per_fn; i++) {
GString *buf = g_string_new ("");
g_string_sprintfa (buf, "%s (R[%d])",
g_string_append_printf (buf, "%s (R[%d])",
ctxt->objective_row->name, i+1);
mps_set_cell (sh, VARIABLE_COL - 1,
VARIABLE_ROW + 1 + i + n_rows_per_fn,
......
......@@ -388,14 +388,15 @@ sylk_file_open (GnumFileOpener const *fo,
{
SylkReadState state;
char const *input_name;
char *name;
char *name, *base;
Workbook *book = wb_view_workbook (wb_view);
ErrorInfo *sheet_error;
input_name = gsf_input_name (input);
if (input_name == NULL)
input_name = "";
name = g_strdup_printf (_("Imported %s"), g_basename (input_name));
base = g_path_get_basename (input_name);
name = g_strdup_printf (_("Imported %s"), base);
memset (&state, 0, sizeof (state));
state.input = gsf_input_textline_new (input);
......@@ -404,6 +405,7 @@ sylk_file_open (GnumFileOpener const *fo,
workbook_sheet_attach (book, state.sheet, NULL);
g_free (name);
g_free (base);
sylk_parse_sheet (&state, &sheet_error);
if (sheet_error != NULL)
......
......@@ -105,7 +105,7 @@ xml_sax_attr_bool (xmlChar const * const *attrs, char const *name, gboolean *res
if (strcmp (attrs[0], name))
return FALSE;
*res = g_strcasecmp ((gchar *)attrs[1], "false") && strcmp (attrs[1], "0");
*res = g_ascii_strcasecmp ((gchar *)attrs[1], "false") && strcmp (attrs[1], "0");
return TRUE;
}
......@@ -1305,8 +1305,8 @@ xml_not_used_old_array_spec (Cell *cell, char const *content)
#if 0
/* This is the syntax we are trying to parse */
g_string_sprintfa (str, "{%s}(%d,%d)[%d][%d]", expr_text,
array.rows, array.cols, array.y, array.x);
g_string_append_printf (str, "{%s}(%d,%d)[%d][%d]", expr_text,
array.rows, array.cols, array.y, array.x);
#endif
char *end, *expr_end, *ptr;
......
......@@ -333,8 +333,7 @@ cb_tree_free (Value const *key, TreeItem *ti, gpointer user_data)
static void
tree_free (GTree *tree)
{
g_tree_traverse (tree, (GTraverseFunc) cb_tree_free,
G_IN_ORDER, NULL);
g_tree_foreach (tree, (GTraverseFunc) cb_tree_free, NULL);
g_tree_destroy (tree);
}
......@@ -694,8 +693,7 @@ row_consolidate (Consolidate *cs, WorkbookView *wbv)
cc.colrow->range.end.col++;
}
g_tree_traverse (tree, (GTraverseFunc) cb_row_tree,
G_IN_ORDER, &cc);
g_tree_foreach (tree, (GTraverseFunc) cb_row_tree, &cc);
redraw_respan_and_select (cs->dst->sheet, &cs->dst->range.start,
cc.colrow->range.end.col,
......@@ -763,8 +761,7 @@ col_consolidate (Consolidate *cs, WorkbookView *wbv)
cc.colrow->range.end.row++;
}
g_tree_traverse (tree, (GTraverseFunc) cb_col_tree,
G_IN_ORDER, &cc);
g_tree_foreach (tree, (GTraverseFunc) cb_col_tree, &cc);
redraw_respan_and_select (cs->dst->sheet, &cs->dst->range.start,
cc.colrow->range.end.col - 1,
......
......@@ -1322,11 +1322,11 @@ cb_font_underline_changed (GtkWidget *ct, char *new_text, FormatState *state)
return FALSE;
/* There must be a better way than this */
if (!g_strcasecmp (new_text, _("Single")))
if (!g_ascii_strcasecmp (new_text, _("Single")))
res = UNDERLINE_SINGLE;
else if (!g_strcasecmp (new_text, _("Double")))
else if (!g_ascii_strcasecmp (new_text, _("Double")))
res = UNDERLINE_DOUBLE;
else if (g_strcasecmp (new_text, _("None")))
else if (g_ascii_strcasecmp (new_text, _("None")))
g_warning ("Invalid underline style '%s', assuming NONE", new_text);
font_selector_set_underline (state->font.selector, res);
......
......@@ -1396,7 +1396,6 @@ graph_guru_type_selector_new (void)
GraphGuruTypeSelector *typesel;
GtkWidget *tmp, *vbox, *hbox;
guint32 select_color;
GdkColor *color;
typesel = g_new0 (GraphGuruTypeSelector, 1);
typesel->current_major_item = NULL;
......@@ -1485,12 +1484,14 @@ graph_guru_type_selector_new (void)
/* hard code for now until I figure out where to get a decent colour */
select_color = 0xe090f840;
#else
color = typesel->canvas->style->base + GTK_STATE_SELECTED;
{
GdkColor *color = typesel->canvas->style->base + GTK_STATE_SELECTED;
select_color |= ((color->red >> 8) & 0xff) << 24;
select_color |= ((color->green >> 8) & 0xff) << 16;
select_color |= ((color->blue >> 8) & 0xff) << 8;
select_color = 0x40; /* alpha of 25% */
select_color |= ((color->red >> 8) & 0xff) << 24;
select_color |= ((color->green >> 8) & 0xff) << 16;
select_color |= ((color->blue >> 8) & 0xff) << 8;
select_color = 0x40; /* alpha of 25% */
}
#endif
/* The alpha blended selection box */
......
......@@ -174,18 +174,18 @@ update_log (simulation_t *sim)
GString *buf;
buf = g_string_new ("");
g_string_sprintfa (buf, "%s %d\n", t1,
g_string_append_printf (buf, "%s %d\n", t1,
sim->last_round - sim->first_round + 1);
g_string_sprintfa (buf, "%s %d\n", t2, sim->n_iterations);
g_string_sprintfa (buf, "%s %d\n", t3, sim->n_input_vars);
g_string_sprintfa (buf, "%s %d\n", t4, sim->n_output_vars);
g_string_sprintfa (buf, "%s %.2f sec.\n", t5,
g_string_append_printf (buf, "%s %d\n", t2, sim->n_iterations);
g_string_append_printf (buf, "%s %d\n", t3, sim->n_input_vars);
g_string_append_printf (buf, "%s %d\n", t4, sim->n_output_vars);
g_string_append_printf (buf, "%s %.2f sec.\n", t5,
sim->end.tv_sec - sim->start.tv_sec +
(sim->end.tv_usec - sim->start.tv_usec) /
(gnum_float) G_USEC_PER_SEC);
g_string_sprintfa (buf, "%s ", t6);
g_string_append_printf (buf, "%s ", t6);
dao_append_date (buf);
g_string_sprintfa (buf, "\n");
g_string_append_printf (buf, "\n");
gtk_text_buffer_set_text (log_buffer, buf->str, strlen (buf->str));
g_string_free (buf, FALSE);
......@@ -199,11 +199,11 @@ update_results_view (simulation_t *sim)
buf = g_string_new ("");
g_string_sprintfa (buf, "Simulation #%d\n\n", results_sim_index + 1);
g_string_sprintfa (buf, "%-20s %10s %10s %10s\n", _("Variable"),
g_string_append_printf (buf, "Simulation #%d\n\n", results_sim_index + 1);
g_string_append_printf (buf, "%-20s %10s %10s %10s\n", _("Variable"),
_("Min"), _("Average"), _("Max"));
for (i = 0; i < sim->n_vars; i++)
g_string_sprintfa (buf, "%-20s %10g %10g %10g\n",
g_string_append_printf (buf, "%-20s %10g %10g %10g\n",
sim->cellnames [i],
sim->stats [results_sim_index]->min [i],
sim->stats [results_sim_index]->mean [i],
......
......@@ -190,7 +190,7 @@ void
stf_dialog_main_page_init (GladeXML *gui, DruidPageData_t *pagedata)
{
MainInfo_t *info = pagedata->main_info;
char *label;
char *label, *base;
const char *s;
GtkMenu *menu;
int l, lg;
......@@ -266,9 +266,11 @@ stf_dialog_main_page_init (GladeXML *gui, DruidPageData_t *pagedata)
main_page_set_scroll_region_and_prevent_center (pagedata);
label = g_strdup_printf (_("Data (from %s)"), g_basename (pagedata->filename));
base = g_path_get_basename (pagedata->filename);
label = g_strdup_printf (_("Data (from %s)"), base);
gtk_frame_set_label (info->main_frame, label);
g_free (label);
g_free (base);
/* Connect signals */
g_signal_connect (G_OBJECT (info->main_startrow),
......
......@@ -139,7 +139,7 @@ expr_name_lookup_list (GList *p, char const *name)
for (; p ; p = p->next) {
GnmNamedExpr *nexpr = p->data;
g_return_val_if_fail (nexpr != NULL, 0);
if (g_strcasecmp (nexpr->name->str, name) == 0)
if (g_ascii_strcasecmp (nexpr->name->str, name) == 0)
return nexpr;
}
return NULL;
......@@ -223,7 +223,7 @@ name_refer_circular (char const *name, GnmExpr const *expr)
if (nexpr->builtin)
return FALSE;
if (!g_strcasecmp (nexpr->name->str, name))
if (!g_ascii_strcasecmp (nexpr->name->str, name))
return TRUE;
/* And look inside this name tree too */
......
......@@ -526,15 +526,17 @@ gchar *
gnum_file_saver_fix_file_name (GnumFileSaver const *fs, gchar const *file_name)
{
gchar *new_file_name;
gchar *base;
g_return_val_if_fail (IS_GNUM_FILE_SAVER (fs), NULL);
g_return_val_if_fail (file_name != NULL, NULL);
if (fs->extension != NULL && strchr (g_basename (file_name), '.') == NULL) {
base = g_path_get_basename (file_name);
if (fs->extension != NULL && strchr (base, '.') == NULL)
new_file_name = g_strconcat (file_name, ".", fs->extension, NULL);
} else {
else
new_file_name = g_strdup (file_name);
}
g_free (base);
return new_file_name;
}
......
......@@ -624,7 +624,7 @@ lookup_color_by_name (gchar const *str, gchar const *end,
if (translate)
name = _(name);
if (0 == g_strncasecmp (name, str, len) && name[len] == '\0')
if (0 == g_ascii_strncasecmp (name, str, len) && name[len] == '\0')
return format_colors + i;
}
return NULL;
......
......@@ -559,7 +559,7 @@ cell_format_is_number (char const * const fmt, FormatCharacteristics *info)
++ptr;
if (ptr[0] == '[') {
if (g_strncasecmp (_("[Red]"), ptr, 5) != 0)
if (g_ascii_strncasecmp (_("[Red]"), ptr, 5) != 0)
return FMT_UNKNOWN;
ptr += 5;
use_red = 1;
......@@ -618,7 +618,7 @@ cell_format_classify (StyleFormat const *sf, FormatCharacteristics *info)
int j = 0;
char const * const * elem = cell_formats[i];
for (; elem[j] ; ++j)
if (g_strcasecmp (_(elem[j]), fmt) == 0) {
if (g_ascii_strcasecmp (_(elem[j]), fmt) == 0) {
info->list_element = j;
return i;
}
......
......@@ -79,7 +79,7 @@ func_def_cmp (gconstpointer a, gconstpointer b)
FunctionDefinition const *fda = *(FunctionDefinition const **)a ;
FunctionDefinition const *fdb = *(FunctionDefinition const **)b ;
return g_strcasecmp (fda->name, fdb->name);
return g_ascii_strcasecmp (fda->name, fdb->name);
}
void
......@@ -1219,7 +1219,7 @@ tokenized_help_find (TokenizedHelp *tok, char const *token)
for (lp = 0; lp + 1 < (int)tok->sections->len; lp++) {
char const *cmp = g_ptr_array_index (tok->sections, lp);
if (g_strcasecmp (cmp, token) == 0){
if (g_ascii_strcasecmp (cmp, token) == 0){
return g_ptr_array_index (tok->sections, lp + 1);
}
}
......
......@@ -173,7 +173,7 @@ gnumeric_dialog_file_selection (WorkbookControlGUI *wbcg, GtkFileSelection *fsel
wb = wb_control_workbook (WORKBOOK_CONTROL (wbcg));
wb_file_name = (wb != NULL) ? workbook_get_filename (wb) : NULL;
if (wb_file_name != NULL && strchr (wb_file_name, G_DIR_SEPARATOR) != NULL) {
gchar *tmp = g_dirname (wb_file_name);
gchar *tmp = g_path_get_dirname (wb_file_name);
gchar *dir_name = g_strconcat (tmp, G_DIR_SEPARATOR_S, NULL);
gtk_file_selection_set_filename (fsel, dir_name);
g_free (dir_name);
......
......@@ -60,7 +60,7 @@ history_item_label (const gchar *name, const gint accel_number)
char *label, *menuname, *tmp;
/* Translate '_' to '-' so menu will not show underline. */
menuname = g_strdup (g_basename (name));
menuname = g_path_get_basename (name);
for (tmp = menuname; *tmp; tmp++)
if (*tmp == '_')
*tmp = '-';
......
......@@ -225,52 +225,53 @@ mstyle_element_dump (const MStyleElement *e)
switch (e->type) {
case MSTYLE_ELEMENT_UNSET:
g_string_sprintf (ans, "Unset");
g_string_printf (ans, "Unset");
break;
case MSTYLE_COLOR_FORE:
g_string_sprintf (ans, "foregnd col");
g_string_printf (ans, "foregnd col");
break;
case MSTYLE_COLOR_BACK:
g_string_sprintf (ans, "backgnd col");
g_string_printf (ans, "backgnd col");
break;
case MSTYLE_COLOR_PATTERN:
g_string_sprintf (ans, "pattern col");
g_string_printf (ans, "pattern col");
break;
case MSTYLE_FONT_NAME:
g_string_sprintf (ans, "name '%s'", e->u.font.name->str);
g_string_printf (ans, "name '%s'", e->u.font.name->str);
break;
case MSTYLE_FONT_BOLD:
if (e->u.font.bold)
g_string_sprintf (ans, "bold");
g_string_printf (ans, "bold");
else
g_string_sprintf (ans, "not bold");
g_string_printf (ans, "not bold");
break;
case MSTYLE_FONT_ITALIC:
if (e->u.font.italic)
g_string_sprintf (ans, "italic");
g_string_printf (ans, "italic");
else
g_string_sprintf (ans, "not italic");
g_string_printf (ans, "not italic");
break;
case MSTYLE_FONT_UNDERLINE:
switch (e->u.font.underline) {
default :
case UNDERLINE_NONE :
g_string_sprintf (ans, "not underline");
g_string_printf (ans, "not underline");
case UNDERLINE_SINGLE :
g_string_sprintf (ans, "single underline");
g_string_printf (ans, "single underline");
case UNDERLINE_DOUBLE :
g_string_sprintf (ans, "double underline");
g_string_printf (ans, "double underline");
};
break;
case MSTYLE_FONT_STRIKETHROUGH:
if (e->u.font.strikethrough)
g_string_sprintf (ans, "strikethrough");
g_string_printf (ans, "strikethrough");
else
g_string_sprintf (ans, "not strikethrough");
g_string_printf (ans, "not strikethrough");
break;
case MSTYLE_FONT_SIZE:
g_string_sprintf (ans, "size %f", e->u.font.size);
g_string_printf (ans, "size %f", e->u.font.size);
break;
case MSTYLE_BORDER_TOP:
case MSTYLE_BORDER_BOTTOM:
case MSTYLE_BORDER_LEFT:
......@@ -278,32 +279,32 @@ mstyle_element_dump (const MStyleElement *e)
case MSTYLE_BORDER_DIAGONAL:
case MSTYLE_BORDER_REV_DIAGONAL:
if (e->u.border.any)
g_string_sprintf (ans, "%s %d", mstyle_names[e->type], e->u.border.any->line_type);
g_string_printf (ans, "%s %d", mstyle_names[e->type], e->u.border.any->line_type);
else
g_string_sprintf (ans, "%s blank", mstyle_names[e->type]);
g_string_printf (ans, "%s blank", mstyle_names[e->type]);
break;
case MSTYLE_FORMAT:
{
case MSTYLE_FORMAT: {
char *fmt = style_format_as_XL (e->u.format, TRUE);
g_string_sprintf (ans, "format '%s'", fmt);
g_string_printf (ans, "format '%s'", fmt);
g_free (fmt);
break;
}