[gnumeric] Handle sheet resize errors from attempted splitting of arrays, etc.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Handle sheet resize errors from attempted splitting of arrays, etc.
- Date: Wed, 22 Apr 2009 10:31:55 -0400 (EDT)
commit 13e4e109c19cec8cc5d6493e24d1941ce4334279
Author: Morten Welinder <terra gnome org>
Date: Wed Apr 22 09:29:23 2009 -0400
Handle sheet resize errors from attempted splitting of arrays, etc.
---
ChangeLog | 2 ++
src/sheet.c | 20 +++++++++++++++++---
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 37bbaf8..144b343 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
* src/sheet.c (gnm_sheet_resize_main): Change container size too.
Unlink, re-link, and recalculate all dependencies.
+ (gnm_sheet_resize_main): Handle errors from attempted splitting of
+ arrays, etc.
2009-04-21 Morten Welinder <terra gnome org>
diff --git a/src/sheet.c b/src/sheet.c
index c0e8e9c..9fa03eb 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -1119,9 +1119,10 @@ gnm_sheet_resize_main (Sheet *sheet, int cols, int rows,
err = sheet_delete_cols (sheet, cols, old_cols - cols,
pundo ? &u : NULL, cc);
- /* FIXME: handle err */
if (pundo)
*pundo = go_undo_combine (*pundo, u);
+ if (err)
+ goto handle_error;
}
if (rows < old_rows) {
@@ -1130,9 +1131,10 @@ gnm_sheet_resize_main (Sheet *sheet, int cols, int rows,
err = sheet_delete_rows (sheet, rows, old_rows - rows,
pundo ? &u : NULL, cc);
- /* FIXME: handle err */
if (pundo)
*pundo = go_undo_combine (*pundo, u);
+ if (err)
+ goto handle_error;
}
/* ---------------------------------------- */
@@ -1187,17 +1189,29 @@ gnm_sheet_resize_main (Sheet *sheet, int cols, int rows,
}
sheet_redraw_all (sheet, TRUE);
+ return;
+
+ handle_error:
+ if (pundo) {
+ go_undo_undo_with_data (*pundo, cc);
+ g_object_unref (*pundo);
+ *pundo = NULL;
+ }
}
GOUndo *
gnm_sheet_resize (Sheet *sheet, int cols, int rows, GOCmdContext *cc)
{
+ static gboolean warned = FALSE;
GOUndo *undo = NULL;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (gnm_sheet_valid_size (cols, rows), NULL);
- g_warning ("Changing sheet size is experimental.");
+ if (!warned) {
+ g_warning ("Changing sheet size is experimental.");
+ warned = TRUE;
+ }
gnm_sheet_resize_main (sheet, cols, rows, cc, &undo);
return undo;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]