Skip to content
  • Jon K Hellan's avatar
    Megacommit. · 333a8167
    Jon K Hellan authored
    2000-01-29  Jon K Hellan  <hellan@acm.org>
    
    	Megacommit.
    
    	The purpose of the changeset is twofold:
    
    	1. Use CommandContexts for error reporting for file read/save.
    	2. This allows us to let FileFormatOpen return 0 on success, -1 on
    	   failure, same as FileFormatSave. The convention to return NULL
    	   on success was highly ideosyncratic.
    
    	* src/file.h (FileFormatOpen, FileFormatSave, workbook_load_from,
    	workbook_import): Add CommandContext
    	(FileFormatOpen, workbook_load_from): Return int instead of char*.
    
    	* src/file.c (workbook_load_from, workbook_try_read,
    	workbook_read, workbook_import, workbook_save_as, workbook_save)
    	(file_error_message): Remove function
    	(workbook_read, workbook_load_from, workbook_save_as,
    	workbook_save): Do not display message, message, plugin does -
    	using CommandContext.
    	(workbook_load_from): Return int instead of char*.
    	(workbook_load_from, workbook_import): fo->open returns int
    	instead of char*.
    	(workbook_try_read): Remove msg paramenter
    
    	* src/workbook.c (workbook_persist_file_load,
    	workbook_persist_file_save): Use workbook_command_context_gui.
    	(file_import_cmd): ditto
    	(file_open_cmd): ditto
    
    	* src/gnumeric-sheet.c (gnumeric_sheet_filenames_dropped): Use
    	workbook_command_context_gui. Call workbook_try_read without msg
    	argument.
    
    	* src/workbook.h (workbook_try_read, workbook_read,
    	workbook_save_as, workbook_save): Add command context
    	(workbook_try_read): Remove msg paramenter
    
    	* src/dialogs/dialog-autosave.c (dialog_autosave_callback):
    	ditto
    
    	* src/command-context.[ch] (gnumeric_error_read,
    	gnumeric_error_save): New functions.
    
    	* src/command-context-corba.c (ccc_error_read, ccc_error_save):
    	Ditto.
    	(ccc_init_class): Initialize error_read, error_save.
    
    	* src/command-context-gui.c (ccg_error_read, ccg_error_save):
    	Ditto.
    	(ccg_init_class): Initialize error_read, error_save.
    
    	* src/main.c (gnumeric_main): Make a CommandContext for use before
    	we make first workbook. Unref it when no longer needed. Call
    	plugins_init and workbook_read with CommandContext.
    
    	* src/plugin-manager.c (add_cb): Use gnumeric_error_plugin_problem.
    	(remove_cb): Ditto.
    
    	* src/plugin.c (plugin_load, plugin_unload): CommandContext
    	instead of workbook.
    	(plugins_init): Add CommandContext.
    
    	* src/plugin.c (plugin_load, plugin_unload): CommandContext
    	instead of workbook.
    	(plugin_unload): Use gnumeric_error_plugin_problem.
    	(plugin_load_plugins_in_dir, load_all_plugins, plugins_init): Add
    	CommandContext.
    
    	* src/xml-io.h:  ditto
    
    	* src/xml-io.c (gnumeric_xml_read_workbook,
    	gnumeric_xml_write_workbook):  ditto
    
    In plugins/dif:
    
    	* dif.c (dif_read_workbook, dif_write_workbook): Add
    	CommandContext.
    	(dif_read_workbook): Return 0 on success, -1 on failure.
    	 Use gnumeric_error_read to report errors.
    
    In plugins/excel:
    
    	* excel.h (ms_excel_read_workbook, ms_excel_write_workbook) Add
    	CommandContext. Return int.
    
    	* ms-excel-read.c (ms_excel_read_workbook): Add
    	CommandContext. Return 0 on success, -1 on failure. Use
    	gnumeric_error_read to display messages.
    
    	* ms-excel-write.c (write_sheet): Check max no. of rows for the
    	format.
    	(new_sheet): Return the ExcelSheet. Let caller add it to
    	wb->sheets.
    	(pre_pass): Add CommandContext.
    	(free_workbook): New function, previously in write_workbook.
    	(write_workbook): Change parameter from Workbook to ExcelWorkbook.
    	Move deallocation to free_workbook.
    	(check_sheet): New function. Check if we are able to save the
    	sheet.
    	(ms_excel_check_write): New function. Check if we are able to save
    	to the file. Do initialization previously in
    	ms_excel_write_workbook.
    	(ms_excel_write_workbook): Add CommandContext. Add state. Change
    	wb from Workbook to ExcelWorkbook. Use gnumeric_error_save to
    	report problems. Return 0 on success, -1 on failure.
    
    	* ms-excel-biff.h: Define enum for max no. of rows. Fix typo.
    
    	* boot.c (excel_load, excel_save, excel_save_98, excel_save_95):
    	Add CommandContext.
    	(excel_load): Return 0 on success, -1 on failure.
    	Use gnumeric_error_read to display messages. Remove "Opening .. "
    	message on stdout.
    	(excel_probe_write): New function. Check if we are able to save to
    	the file.
    	(excel_save): Use gnumeric_error_save to display messages.
    	Return 0 on success, -1 on failure.
    
    In plugins/ff-csv:
    
    	* csv-io.c (csv_read_workbook, csv_write_workbook,
    	csv_parse_sheet, csv_parse_field): Add CommandContext. Return 0 on
    	success, -1 on failure. Use gnumeric_error_read to report errors.
    
    In plugins/ff-stf:
    
    	* dialog-stf.h: Add CommandContext. Return int.
    
    	* dialog-stf.c (dialog_stf) : Add CommandContext. Return 0 on success,
    	-1 on failure. Use gnumeric_error_read to report errors.
    
    	* stf.c (stf_read_workbook): Ditto.
    
    In plugins/html:
    
    	* epsf.h (epsf_write_wb): Add CommandContext.
    
    	* epsf.c (epsf_write_wb): ditto.
    
    	* latex.h (html_write_wb_latex, html_write_wb_latex2e): ditto
    
    	* latex.c (html_write_wb_latex, html_write_wb_latex2e): ditto
    
    	* roff.c (html_write_wb_roff_ps, html_write_wb_roff_dvi,
    	html_write_wb_roff_pdf, html_write_wb_roff): ditto
    
    	* roff.c (html_write_wb_roff_ps, html_write_wb_roff_dvi,
    	html_write_wb_roff_pdf, html_write_wb_roff): ditto
    
    	* html.h (html_read, html_write_wb_html40, html_write_wb_html32):
    	ditto.
    	(html_read): Return int.
    
    	* html.c (html_read, html_write_wb_html40, html_write_wb_html32):
    	ditto
    	(html_read): Return 0 on success, -1 on failure. Use
    	gnumeric_error_read to report errors.
    
    In plugins/lotus-123:
    
    	* lotus.c (lotus_read): Add CommandContext. Return 0 on success,
    	-1 on failure. Use gnumeric_error_read to report errors. Close
    	file unconditionally.
    	(read_workbook): Return 0 on success, -1 on failure. Remove unused
    	panic_message variable.
    
    	* lotus.h (lotus_read): Add CommandContext. Return int.
    
    	* boot.c (lotus_load): Ditto
    
    In plugins/oleo:
    
    	* oleo.c (oleo_read): Add CommandContext. Return 0 on success,
    	-1 on failure. Use gnumeric_error_read to report errors.
    
    	* oleo.h (oleo_read): Add CommandContext. Return int.
    
    	* boot.c (oleo_load): Ditto.
    
    In plugins/plan-perfect:
    
    	* pln.c (pln_parse_sheet, pln_read_workbook): Add
    	CommandContext. Return 0 on success, -1 on failure. Use
    	gnumeric_error_read to report errors.
    
    In plugins/sc:
    
    	* sc.c (sc_read_workbook, sc_parse_sheet): Add
    	CommandContext. Return 0 on success, -1 on failure.  Use
    	gnumeric_error_read to report errors.
    
    In plugins/sylk:
    
    	* sylk.c (sylk_read_workbook, sylk_parse_sheet): Add
    	CommandContext. Return 0 on success, -1 on failure. Use
    	gnumeric_error_read to report errors.
    
    In plugins/text:
    
    	* text-io.c (text_read_workbook, text_write_workbook,
    	readTextWorkbook): Add CommandContext.
    	(text_read_workbook, readTextWorkbook): Return 0 on success, -1 on
    	failure.
    	(readTextWorkbook): Use gnumeric_error_read to report errors.
    
    In plugins/xbase:
    
    	* xbase.h (xbase_open): Add CommandContext.
    
    	* xbase.c (xbase_open): Add CommandContext. Remove progress
    	message to stdout. Use gnumeric_error_read to report errors.
    
    	* boot.c (xbase_load): Add CommandContext. Return 0 on success, -1
    	on failure.
    333a8167