Commit 57d3f6f1 authored by Jody Goldberg's avatar Jody Goldberg

yet more renaming

A first pass at rationalizing the methods in CmdContext
it still seems a triffle bulky.
parent cea2802f
......@@ -153,12 +153,12 @@ wbcc_error (GnmCmdContext *ctxt, GError *gerr)
err->msg = CORBA_string_dup (gerr->message);
CORBA_exception_set (wbcc->ev, CORBA_USER_EXCEPTION,
ex_GNOME_Gnumeric_ErrorSystem, err);
} else if (gerr->domain == gnm_error_read ()) {
} else if (gerr->domain == gnm_error_import ()) {
GNOME_Gnumeric_ErrorRead *err = GNOME_Gnumeric_ErrorRead__alloc();
err->msg = CORBA_string_dup (gerr->message);
CORBA_exception_set (wbcc->ev, CORBA_USER_EXCEPTION,
ex_GNOME_Gnumeric_ErrorRead, err);
} else if (gerr->domain == gnm_error_write ()) {
} else if (gerr->domain == gnm_error_export ()) {
GNOME_Gnumeric_ErrorSave *err = GNOME_Gnumeric_ErrorSave__alloc();
err->msg = CORBA_string_dup (gerr->message);
CORBA_exception_set (wbcc->ev, CORBA_USER_EXCEPTION,
......
......@@ -105,7 +105,7 @@ excel_read_metadata (GsfInfileMSOle *ole, char const *name, GnmCmdContext *conte
if (stream != NULL) {
gsf_msole_metadata_read (stream, &err);
if (err != NULL) {
gnumeric_error_read (context, err->message);
gnm_cmd_context_error_import (context, err->message);
g_error_free (err);
}
g_object_unref (G_OBJECT (stream));
......@@ -153,7 +153,7 @@ excel_file_open (GnmFileOpener const *fo, IOContext *context,
/* OK, it really isn't an Excel file */
g_return_if_fail (err != NULL);
gnumeric_error_read (GNM_CMD_CONTEXT (context),
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context),
err->message);
g_error_free (err);
return;
......@@ -163,7 +163,7 @@ excel_file_open (GnmFileOpener const *fo, IOContext *context,
stream = gsf_infile_child_by_name (GSF_INFILE (ole), content[i++]);
} while (stream == NULL && i < G_N_ELEMENTS (content));
if (stream == NULL) {
gnumeric_error_read (GNM_CMD_CONTEXT (context),
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context),
_("No Workbook or Book streams found."));
g_object_unref (G_OBJECT (ole));
return;
......
......@@ -5415,7 +5415,7 @@ excel_read_workbook (IOContext *context, WorkbookView *wb_view,
break;
do {
char const *filename = workbook_get_filename (ewb->gnum_wb);
char *passwd = cmd_context_get_password (GNM_CMD_CONTEXT (ewb->context), filename);
char *passwd = gnm_cmd_context_get_password (GNM_CMD_CONTEXT (ewb->context), filename);
if (passwd == NULL) {
problem_loading = _("No password supplied");
break;
......@@ -5517,11 +5517,11 @@ excel_read_workbook (IOContext *context, WorkbookView *wb_view,
/* If we were forced to stop then the load failed */
if (problem_loading != NULL)
gnumeric_error_read (GNM_CMD_CONTEXT (context), problem_loading);
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context), problem_loading);
return;
}
gnumeric_error_read (GNM_CMD_CONTEXT (context),
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context),
_("Unable to locate valid MS Excel workbook"));
}
......
......@@ -4205,7 +4205,7 @@ excel_write_v7 (ExcelWriteState *ewb, GsfOutfile *outfile)
ms_biff_put_destroy (ewb->bp);
ewb->bp = NULL;
} else
gnumeric_error_save (GNM_CMD_CONTEXT (ewb->io_context),
gnm_cmd_context_error_export (GNM_CMD_CONTEXT (ewb->io_context),
_("Couldn't open stream 'Book' for writing\n"));
}
......@@ -4225,7 +4225,7 @@ excel_write_v8 (ExcelWriteState *ewb, GsfOutfile *outfile)
ms_biff_put_destroy (ewb->bp);
ewb->bp = NULL;
} else
gnumeric_error_save (GNM_CMD_CONTEXT (ewb->io_context),
gnm_cmd_context_error_export (GNM_CMD_CONTEXT (ewb->io_context),
_("Couldn't open stream 'Workbook' for writing\n"));
}
......
......@@ -926,7 +926,7 @@ openoffice_file_open (GnmFileOpener const *fo, IOContext *io_context,
zip = gsf_infile_zip_new (input, &err);
if (zip == NULL) {
g_return_if_fail (err != NULL);
gnumeric_error_read (GNM_CMD_CONTEXT (io_context),
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (io_context),
err->message);
g_error_free (err);
return;
......@@ -935,7 +935,7 @@ openoffice_file_open (GnmFileOpener const *fo, IOContext *io_context,
content = gsf_infile_child_by_name (GSF_INFILE (zip),
"content.xml");
if (content == NULL) {
gnumeric_error_read (GNM_CMD_CONTEXT (io_context),
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (io_context),
_("No stream named content.xml found."));
g_object_unref (G_OBJECT (zip));
return;
......
......@@ -151,7 +151,7 @@ show_python_console (WorkbookControlGUI *wbcg)
sel = gnm_py_interpreter_selector_new (&err);
if (err != NULL) {
gnumeric_error_error_info (GNM_CMD_CONTEXT (wbcg), err);
gnm_cmd_context_error_info (GNM_CMD_CONTEXT (wbcg), err);
error_info_free (err);
return;
}
......
......@@ -297,7 +297,7 @@ clipboard_paste_region (CellRegion const *content,
}
if (content->not_as_content && (pt->paste_flags & PASTE_CONTENT)) {
gnumeric_error_invalid (cc,
gnm_cmd_context_error_invalid (cc,
_("Unable to paste"),
_("Content can only be pasted by value or by link."));
return TRUE;
......@@ -310,7 +310,7 @@ clipboard_paste_region (CellRegion const *content,
_("destination does not have an even multiple of source columns (%d vs %d)\n\n"
"Try selecting a single cell or an area of the same shape and size."),
dst_cols, src_cols);
gnumeric_error_invalid (cc, _("Unable to paste"), msg);
gnm_cmd_context_error_invalid (cc, _("Unable to paste"), msg);
g_free (msg);
return TRUE;
}
......@@ -321,14 +321,14 @@ clipboard_paste_region (CellRegion const *content,
_("destination does not have an even multiple of source rows (%d vs %d)\n\n"
"Try selecting a single cell or an area of the same shape and size."),
dst_rows, src_rows);
gnumeric_error_invalid (cc, _("Unable to paste"), msg);
gnm_cmd_context_error_invalid (cc, _("Unable to paste"), msg);
g_free (msg);
return TRUE;
}
if ((pt->range.start.col + dst_cols) > SHEET_MAX_COLS ||
(pt->range.start.row + dst_rows) > SHEET_MAX_ROWS) {
gnumeric_error_invalid (cc,
gnm_cmd_context_error_invalid (cc,
_("Unable to paste"),
_("result passes the sheet boundary"));
return TRUE;
......
......@@ -303,7 +303,7 @@ cmd_paste (WorkbookControl *wbc, PasteTarget const *pt)
(dst.end.row - dst.start.row)+1,
(dst.end.col - dst.start.col)+1,
rows+1, cols+1);
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc),
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc),
_("Unable to paste into selection"), msg);
g_free (msg);
return;
......
......@@ -24,61 +24,61 @@ format_message (GQuark id, char const *message)
}
void
cmd_context_error (GnmCmdContext *context, GError *err)
gnm_cmd_context_error (GnmCmdContext *context, GError *err)
{
g_return_if_fail (IS_GNM_CMD_CONTEXT (context));
CC_CLASS (context)->error.error (context, err);
}
void
gnumeric_error_error_info (GnmCmdContext *context, ErrorInfo *error)
gnm_cmd_context_error_info (GnmCmdContext *context, ErrorInfo *error)
{
g_return_if_fail (IS_GNM_CMD_CONTEXT (context));
CC_CLASS (context)->error.error_info (context, error);
}
void
gnumeric_error_system (GnmCmdContext *context, char const *message)
gnm_cmd_context_error_system (GnmCmdContext *context, char const *message)
{
GError *err = format_message (gnm_error_system (), message);
cmd_context_error (context, err);
gnm_cmd_context_error (context, err);
g_error_free (err);
}
void
gnumeric_error_read (GnmCmdContext *context, char const *message)
gnm_cmd_context_error_import (GnmCmdContext *context, char const *message)
{
GError *err = format_message (gnm_error_read (), message);
cmd_context_error (context, err);
GError *err = format_message (gnm_error_import (), message);
gnm_cmd_context_error (context, err);
g_error_free (err);
}
void
gnumeric_error_save (GnmCmdContext *context, char const *message)
gnm_cmd_context_error_export (GnmCmdContext *context, char const *message)
{
GError *err = format_message (gnm_error_write (), message);
cmd_context_error (context, err);
GError *err = format_message (gnm_error_export (), message);
gnm_cmd_context_error (context, err);
g_error_free (err);
}
void
gnumeric_error_invalid (GnmCmdContext *context, char const *msg, char const *val)
gnm_cmd_context_error_invalid (GnmCmdContext *context, char const *msg, char const *val)
{
GError *err = g_error_new (gnm_error_invalid(), 0, "Invalid %s : '%s'", msg, val);
cmd_context_error (context, err);
gnm_cmd_context_error (context, err);
g_error_free (err);
}
void
gnumeric_error_calc (GnmCmdContext *context, char const *msg)
gnm_cmd_context_error_calc (GnmCmdContext *context, char const *msg)
{
GError *err = format_message (gnm_error_calc (), msg);
cmd_context_error (context, err);
gnm_cmd_context_error (context, err);
g_error_free (err);
}
void
gnumeric_error_splits_array (GnmCmdContext *context,
gnm_cmd_context_error_splits_array (GnmCmdContext *context,
G_GNUC_UNUSED char const *cmd,
GnmRange const *array)
{
......@@ -90,7 +90,7 @@ gnumeric_error_splits_array (GnmCmdContext *context,
else
err = g_error_new (gnm_error_array(), 0,
_("Would split an array"));
cmd_context_error (context, err);
gnm_cmd_context_error (context, err);
}
GQuark
......@@ -102,19 +102,19 @@ gnm_error_system (void)
return quark;
}
GQuark
gnm_error_read (void)
gnm_error_import (void)
{
static GQuark quark;
if (!quark)
quark = g_quark_from_static_string ("gnm_error_read");
quark = g_quark_from_static_string ("gnm_error_import");
return quark;
}
GQuark
gnm_error_write (void)
gnm_error_export (void)
{
static GQuark quark;
if (!quark)
quark = g_quark_from_static_string ("gnm_error_write");
quark = g_quark_from_static_string ("gnm_error_export");
return quark;
}
GQuark
......@@ -161,7 +161,7 @@ cmd_context_progress_message_set (GnmCmdContext *context, gchar const *msg)
}
char *
cmd_context_get_password (GnmCmdContext *cc, char const *filename)
gnm_cmd_context_get_password (GnmCmdContext *cc, char const *filename)
{
g_return_val_if_fail (IS_GNM_CMD_CONTEXT (cc), NULL);
......@@ -169,7 +169,7 @@ cmd_context_get_password (GnmCmdContext *cc, char const *filename)
}
void
cmd_context_set_sensitive (GnmCmdContext *cc, gboolean sensitive)
gnm_cmd_context_set_sensitive (GnmCmdContext *cc, gboolean sensitive)
{
g_return_if_fail (IS_GNM_CMD_CONTEXT (cc));
......
......@@ -10,29 +10,31 @@
GType gnm_cmd_context_get_type (void);
void cmd_context_error (GnmCmdContext *cc, GError *err);
char *cmd_context_get_password (GnmCmdContext *cc, char const *filename);
void cmd_context_set_sensitive (GnmCmdContext *cc, gboolean sensitive);
void gnm_cmd_context_error (GnmCmdContext *cc, GError *err);
char *gnm_cmd_context_get_password (GnmCmdContext *cc, char const *fname);
void gnm_cmd_context_set_sensitive (GnmCmdContext *cc, gboolean flag);
/* utility routines for common errors */
void gnumeric_error_system (GnmCmdContext *cc, char const *msg);
void gnumeric_error_read (GnmCmdContext *cc, char const *msg);
void gnumeric_error_save (GnmCmdContext *cc, char const *msg);
void gnumeric_error_calc (GnmCmdContext *cc, char const *msg);
void gnumeric_error_invalid (GnmCmdContext *cc,
char const *msg, char const *val);
void gnumeric_error_error_info (GnmCmdContext *cc, ErrorInfo *error);
/* some gnumeric specific utility routines */
void gnumeric_error_splits_array (GnmCmdContext *cc, char const *cmd,
GnmRange const *array);
void gnm_cmd_context_error_system (GnmCmdContext *cc, char const *msg);
void gnm_cmd_context_error_import (GnmCmdContext *cc, char const *msg);
void gnm_cmd_context_error_export (GnmCmdContext *cc, char const *msg);
void gnm_cmd_context_error_invalid (GnmCmdContext *cc,
char const *msg, char const *val);
void gnm_cmd_context_error_info (GnmCmdContext *cc, ErrorInfo *error);
/* An initial set of std errors */
GQuark gnm_error_system (void);
GQuark gnm_error_read (void);
GQuark gnm_error_write (void);
GQuark gnm_error_import (void);
GQuark gnm_error_export (void);
GQuark gnm_error_invalid (void);
/***************************************************************************/
/* some gnumeric specific utility routines */
void gnm_cmd_context_error_calc (GnmCmdContext *cc, char const *msg);
void gnm_cmd_context_error_splits_array (GnmCmdContext *cc, char const *cmd,
GnmRange const *array);
GQuark gnm_error_array (void);
GQuark gnm_error_calc (void);
GQuark gnm_error_invalid (void);
#endif /* GNM_CMD_CONTEXT_H */
......@@ -255,7 +255,7 @@ cmd_cell_range_is_locked_effective (Sheet *sheet, GnmRange *range,
_("%s is locked. Unprotect the sheet to enable editing."),
undo_global_range_name (
sheet, range));
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc), cmd_name,
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc), cmd_name,
text);
g_free (text);
return TRUE;
......@@ -884,7 +884,7 @@ cmd_set_text (WorkbookControl *wbc,
/* Ensure that we are not splitting up an array */
cell = sheet_cell_get (sheet, pos->col, pos->row);
if (cell_is_partial_array (cell)) {
gnumeric_error_splits_array (GNM_CMD_CONTEXT (wbc),
gnm_cmd_context_error_splits_array (GNM_CMD_CONTEXT (wbc),
_("Set Text"), NULL);
return TRUE;
}
......@@ -2339,7 +2339,7 @@ cmd_selection_group (WorkbookControl *wbc,
/* Check if this really is possible and display an error if it's not */
if (sheet_colrow_can_group (sv->sheet, &r, is_cols) != group) {
if (group) {
gnumeric_error_system (GNM_CMD_CONTEXT (wbc), is_cols
gnm_cmd_context_error_system (GNM_CMD_CONTEXT (wbc), is_cols
? _("Those columns are already grouped")
: _("Those rows are already grouped"));
return TRUE;
......@@ -2363,7 +2363,7 @@ cmd_selection_group (WorkbookControl *wbc,
}
if (sheet_colrow_can_group (sv->sheet, &r, is_cols) != group) {
gnumeric_error_system (GNM_CMD_CONTEXT (wbc), is_cols
gnm_cmd_context_error_system (GNM_CMD_CONTEXT (wbc), is_cols
? _("Those columns are not grouped, you can't ungroup them")
: _("Those rows are not grouped, you can't ungroup them"));
return TRUE;
......@@ -2595,7 +2595,7 @@ cmd_paste_cut (WorkbookControl *wbc, GnmExprRelocateInfo const *info,
r = info->origin;
if (range_translate (&r, info->col_offset, info->row_offset)) {
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc), descriptor,
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc), descriptor,
_("is beyond sheet boundaries"));
g_free (descriptor);
return TRUE;
......@@ -2804,7 +2804,7 @@ cmd_paste_copy (WorkbookControl *wbc,
/* Use translate to do a quiet sanity check */
if (range_translate (&me->dst.range, 0, 0)) {
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc),
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc),
me->cmd.cmd_descriptor,
_("is beyond sheet boundaries"));
g_object_unref (G_OBJECT (me));
......@@ -5700,7 +5700,7 @@ cmd_define_name_redo (GnmCommand *cmd, WorkbookControl *wbc)
char *err = NULL;
nexpr = expr_name_add (&me->pp, me->name, me->expr, &err, TRUE);
if (nexpr == NULL) {
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc), _("Name"), err);
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc), _("Name"), err);
g_free (err);
return TRUE;
}
......@@ -5756,7 +5756,7 @@ cmd_define_name (WorkbookControl *wbc, char const *name,
g_return_val_if_fail (expr != NULL, TRUE);
if (expr_name_check_for_loop (name, expr)) {
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc), name,
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc), name,
_("has a circular reference"));
gnm_expr_unref (expr);
return TRUE;
......
......@@ -181,7 +181,7 @@ cb_pm_button_rescan_directories_clicked (PluginManagerGUI *pm_gui)
plugins_rescan (&error, &new_plugins);
if (error != NULL) {
gnumeric_error_error_info (GNM_CMD_CONTEXT (pm_gui->wbcg), error);
gnm_cmd_context_error_info (GNM_CMD_CONTEXT (pm_gui->wbcg), error);
error_info_free (error);
}
GNM_SLIST_SORT (new_plugins, plugin_compare_name);
......@@ -621,7 +621,7 @@ cb_active_toggled (G_GNUC_UNUSED GtkCellRendererToggle *celltoggle,
gnm_plugin_get_name (plugin));
}
error_info_add_details (new_error, error);
gnumeric_error_error_info (GNM_CMD_CONTEXT (pm_gui->wbcg), new_error);
gnm_cmd_context_error_info (GNM_CMD_CONTEXT (pm_gui->wbcg), new_error);
}
}
......
......@@ -463,7 +463,7 @@ format_template_new_from_file (char const *filename, GnmCmdContext *cc)
doc = xmlParseFile (filename);
if (doc == NULL) {
gnumeric_error_read (cc,
gnm_cmd_context_error_import (cc,
_("Error while trying to load autoformat template"));
return NULL;
}
......@@ -480,16 +480,16 @@ format_template_new_from_file (char const *filename, GnmCmdContext *cc)
} else {
format_template_free (ft);
ft = NULL;
gnumeric_error_read (cc,
gnm_cmd_context_error_import (cc,
_("Error while trying to build tree from autoformat template file"));
}
xml_parse_ctx_destroy (ctxt);
} else
gnumeric_error_read (cc,
gnm_cmd_context_error_import (cc,
_("Is not an autoformat template file"));
} else
gnumeric_error_read (cc,
gnm_cmd_context_error_import (cc,
_("Invalid xml file. Tree is empty?"));
xmlFreeDoc (doc);
......@@ -602,7 +602,7 @@ format_template_save (FormatTemplate const *ft, GnmCmdContext *cc)
success = TRUE;
} else
gnumeric_error_save (cc, "");
gnm_cmd_context_error_export (cc, "");
fclose (file);
}
......@@ -839,7 +839,7 @@ format_template_range_check (FormatTemplate *ft, GnmRange const *r,
}
if (errmsg != NULL) {
gnumeric_error_system (optional_cc, errmsg);
gnm_cmd_context_error_system (optional_cc, errmsg);
g_free (errmsg);
}
}
......
......@@ -95,7 +95,7 @@ gui_file_read (WorkbookControlGUI *wbcg, char const *file_name,
IOContext *io_context;
WorkbookView *wbv;
cmd_context_set_sensitive (GNM_CMD_CONTEXT (wbcg), FALSE);
gnm_cmd_context_set_sensitive (GNM_CMD_CONTEXT (wbcg), FALSE);
io_context = gnumeric_io_context_new (GNM_CMD_CONTEXT (wbcg));
wbv = wb_view_new_from_file (file_name, optional_format, io_context,
optional_encoding);
......@@ -105,7 +105,7 @@ gui_file_read (WorkbookControlGUI *wbcg, char const *file_name,
gnumeric_io_error_display (io_context);
g_object_unref (G_OBJECT (io_context));
cmd_context_set_sensitive (GNM_CMD_CONTEXT (wbcg), TRUE);
gnm_cmd_context_set_sensitive (GNM_CMD_CONTEXT (wbcg), TRUE);
if (wbv != NULL) {
Workbook *tmp_wb = wb_control_workbook (WORKBOOK_CONTROL (wbcg));
......
......@@ -803,7 +803,7 @@ gnm_glade_xml_new (GnmCmdContext *cc, char const *gladefile,
gui = glade_xml_new (f, root, domain);
if (gui == NULL && cc != NULL) {
char *msg = g_strdup_printf (_("Unable to open file '%s'"), f);
gnumeric_error_system (cc, msg);
gnm_cmd_context_error_system (cc, msg);
g_free (msg);
}
g_free (f);
......
......@@ -167,7 +167,7 @@ gnm_hlink_cur_wb_activate (GnmHLink *lnk, WorkbookControl *wbc)
target = gnm_expr_get_range (nexpr->expr);
}
if (target == NULL) {
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc),
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc),
_("Link target"),
lnk->target);
return FALSE;
......@@ -219,7 +219,7 @@ gnm_hlink_url_activate (GnmHLink *lnk, WorkbookControl *wbc)
if (err != NULL) {
char *msg = g_strdup_printf(_("Unable to activate the url '%s'"), lnk->target);
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc), msg, err->message);
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc), msg, err->message);
g_free (msg);
g_error_free (err);
}
......@@ -269,7 +269,7 @@ gnm_hlink_external_activate (GnmHLink *lnk, WorkbookControl *wbc)
#warning TODO
if (err != NULL) {
char *msg = g_strdup_printf(_("Unable to open '%s'"), lnk->target);
gnumeric_error_invalid (GNM_CMD_CONTEXT (wbc), msg, err->message);
gnm_cmd_context_error_invalid (GNM_CMD_CONTEXT (wbc), msg, err->message);
g_free (msg);
g_error_free (err);
}
......
......@@ -69,7 +69,7 @@ static char *
ioc_get_password (GnmCmdContext *cc, char const *filename)
{
IOContext *ioc = (IOContext *)cc;
return cmd_context_get_password (ioc->impl, filename);
return gnm_cmd_context_get_password (ioc->impl, filename);
}
static void
......@@ -178,7 +178,7 @@ gnumeric_io_error_display (IOContext *context)
cc = context->impl;
else
cc = GNM_CMD_CONTEXT (context);
gnumeric_error_error_info (cc, context->info);
gnm_cmd_context_error_info (cc, context->info);
}
}
......
......@@ -109,7 +109,7 @@ warn_about_ancient_gnumerics (const char *binary, IOContext *ioc)
now - buf.st_mtime > days * 24 * 60 * 60) {
handle_paint_events ();
gnumeric_error_system (GNM_CMD_CONTEXT (ioc),
gnm_cmd_context_error_system (GNM_CMD_CONTEXT (ioc),
_("Thank you for using Gnumeric!\n"
"\n"
"The version of Gnumeric you are using is quite old\n"
......
......@@ -60,9 +60,9 @@ gnumeric_fopen (IOContext *context, const char *path, const char *mode)
return f;
if (mode != NULL && (*mode == 'r' || *mode == 'R'))
gnumeric_error_read (GNM_CMD_CONTEXT (context), g_strerror (errno));
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context), g_strerror (errno));
else
gnumeric_error_save (GNM_CMD_CONTEXT (context), g_strerror (errno));
gnm_cmd_context_error_export (GNM_CMD_CONTEXT (context), g_strerror (errno));
return NULL;
}
......@@ -94,9 +94,9 @@ gnumeric_open (IOContext *context, const char *pathname, int flags)
* has been set. if O_WRONLY report as write error
*/
if (flags & O_WRONLY)
gnumeric_error_save (GNM_CMD_CONTEXT (context), g_strerror (errno));
gnm_cmd_context_error_export (GNM_CMD_CONTEXT (context), g_strerror (errno));
else
gnumeric_error_read (GNM_CMD_CONTEXT (context), g_strerror (errno));
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context), g_strerror (errno));
return -1;
}
......@@ -125,7 +125,7 @@ gnumeric_mmap_close (IOContext *context, const unsigned char *data, int fdesc, i
char *message;
message = g_strdup_printf (_("Unable to unmap the file, error : %s"), g_strerror (errno));
gnumeric_error_read (GNM_CMD_CONTEXT (context), message);
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context), message);
g_free (message);
}
......@@ -134,7 +134,7 @@ gnumeric_mmap_close (IOContext *context, const unsigned char *data, int fdesc, i
char *message;
message = g_strdup_printf (_("Error while closing file, error : %s"), g_strerror (errno));
gnumeric_error_read (GNM_CMD_CONTEXT (context), message);
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context), message);
g_free (message);
}
......@@ -176,7 +176,7 @@ gnumeric_mmap_open (IOContext *context, const char *filename, int *fdesc, int *f
if (fstat(fd, &sbuf) < 0) {
close (fd);
gnumeric_error_read (GNM_CMD_CONTEXT (context), g_strerror (errno));
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context), g_strerror (errno));
return NULL;
}
......@@ -188,7 +188,7 @@ gnumeric_mmap_open (IOContext *context, const char *filename, int *fdesc, int *f
close (fd);
message = g_strdup_printf (_("Unable to mmap the file, error : %s"), g_strerror (errno));
gnumeric_error_read (GNM_CMD_CONTEXT (context), message);
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context), message);
g_free (message);
return NULL;
......
......@@ -1756,7 +1756,7 @@ plugins_init (GnmCmdContext *context)
_("Errors while initializing plugin system."),
error_list);
gnumeric_error_error_info (context, error);
gnm_cmd_context_error_info (context, error);
error_info_free (error);
}
......
......@@ -343,7 +343,7 @@ selection_first_range (SheetView const *sv,
r = l->data;
if (cc != NULL && l->next != NULL) {
gnumeric_error_invalid (cc, cmd_name,
gnm_cmd_context_error_invalid (cc, cmd_name,
_("cannot be performed with multiple ranges selected"));
return NULL;
}
......
......@@ -76,7 +76,7 @@ sheet_merge_add (Sheet *sheet, GnmRange const *r, gboolean clear,
test = sheet_merge_get_overlap (sheet, r);
if (test != NULL) {
if (cc != NULL)
cmd_context_error (cc, g_error_new (gnm_error_invalid(), 0,
gnm_cmd_context_error (cc, g_error_new (gnm_error_invalid(), 0,
_("There is already a merged region that intersects\n%s!%s"),
sheet->name_unquoted, range_name (r)));
g_slist_free (test);
......
......@@ -292,7 +292,7 @@ sheet_object_bonobo_write_xml (SheetObject const *so,
if (BONOBO_EX (&ev)) {
/* TODO : Generate a decent message when sheetobjects
* get user visible ids */
gnumeric_error_save (GNM_CMD_CONTEXT (ctxt)->io_context,
gnm_cmd_context_error_export (GNM_CMD_CONTEXT (ctxt)->io_context,
bonobo_exception_get_text (&ev));
} else
res = TRUE;
......
......@@ -201,7 +201,7 @@ cb_save_as (GtkWidget *widget, GObject *obj_view)
}
if (!ret)
cmd_context_error (GNM_CMD_CONTEXT (wbcg), err);
gnm_cmd_context_error (GNM_CMD_CONTEXT (wbcg), err);
if (extension == NULL)
g_free ((char *)fname);
}
......
......@@ -1885,7 +1885,7 @@ sheet_range_splits_array (Sheet const *sheet,
colrow_foreach (&sheet->cols, r->start.col, r->end.col,
&cb_check_array_horizontal, &closure)) {
if (cc)
gnumeric_error_splits_array (cc,
gnm_cmd_context_error_splits_array (cc,
cmd, &closure.error);
return TRUE;
}
......@@ -1907,7 +1907,7 @@ sheet_range_splits_array (Sheet const *sheet,
colrow_foreach (&sheet->rows, r->start.row, r->end.row,
&cb_check_array_vertical, &closure)) {
if (cc)
gnumeric_error_splits_array (cc,
gnm_cmd_context_error_splits_array (cc,
cmd, &closure.error);
return TRUE;
}
......@@ -1952,7 +1952,7 @@ sheet_range_splits_region (Sheet const *sheet,
g_slist_free (merged);
if (cc != NULL && ptr != NULL) {
gnumeric_error_invalid (cc, cmd_name,
gnm_cmd_context_error_invalid (cc, cmd_name,
_("Target region contains merged cells"));
return TRUE;
}
......@@ -2014,7 +2014,7 @@ sheet_range_contains_region (Sheet const *sheet, GnmRange const *r,
merged = sheet_merge_get_overlap (sheet, r);
if (merged != NULL) {
if (cc != NULL)
gnumeric_error_invalid (cc, cmd,
gnm_cmd_context_error_invalid (cc, cmd,
_("cannot operate on merged cells"));
g_slist_free (merged);
return TRUE;
......@@ -2024,7 +2024,7 @@ sheet_range_contains_region (Sheet const *sheet, GnmRange const *r,
r->start.col, r->start.row, r->end.col, r->end.row,
cb_cell_is_array, NULL)) {
if (cc != NULL)
gnumeric_error_invalid (cc, cmd,
gnm_cmd_context_error_invalid (cc, cmd,
_("cannot operate on array formulae"));
return TRUE;
}
......
......@@ -108,7 +108,7 @@ stf_preparse (GnmCmdContext *context, GsfInput *input, size_t *data_len)
if (!data) {
if (context)
gnumeric_error_read (context,
gnm_cmd_context_error_import (context,
_("Error while trying to read file"));
return NULL;
}
......@@ -269,7 +269,7 @@ stf_text_to_columns (WorkbookControl *wbc, GnmCmdContext *cc)
if (src == NULL)
return;
if (range_width (src) > 1) {
cmd_context_error (cc, g_error_new (gnm_error_invalid (), 0,
gnm_cmd_context_error (cc, g_error_new (gnm_error_invalid (), 0,
_("Only 1 one column of <b>input</b> data can be parsed at a time, not %d"),
range_width (src)));
return;
......@@ -295,7 +295,7 @@ stf_text_to_columns (WorkbookControl *wbc, GnmCmdContext *cc)
data = gsf_output_memory_get_bytes (buf);
data_len = (size_t)gsf_output_size (GSF_OUTPUT (buf));
if (data_len == 0) {
gnumeric_error_read (GNM_CMD_CONTEXT (cc),
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (cc),
_("There is no data "
"to convert"));
} else {
......@@ -315,7 +315,7 @@ stf_text_to_columns (WorkbookControl *wbc, GnmCmdContext *cc)
if (cr == NULL ||