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

Quick fix for workbooks exiting (and leaking a bit) when an import

failed.

1999-12-20  Jody Goldberg <jgoldberg@home.com>

	* src/workbook.c (file_open_cmd) : Handle failed opens.
	(file_import_cmd) : Handle failed imports.

	* src/item-bar.c (item_bar_start_resize) : Add resize marker on the
	  other side of the row/col being resized.
	(item_bar_init) : Init the marker to NULL.
	(item_bar_end_resize) : Clear the marker.
parent 9dcab1c0
1999-12-20 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (file_open_cmd) : Handle failed opens.
(file_import_cmd) : Handle failed imports.
* src/item-bar.c (item_bar_start_resize) : Add resize marker on the
other side of the row/col being resized.
(item_bar_init) : Init the marker to NULL.
(item_bar_end_resize) : Clear the marker.
1999-12-19 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_cut) : Fix Typo.
......
1999-12-20 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (file_open_cmd) : Handle failed opens.
(file_import_cmd) : Handle failed imports.
* src/item-bar.c (item_bar_start_resize) : Add resize marker on the
other side of the row/col being resized.
(item_bar_init) : Init the marker to NULL.
(item_bar_end_resize) : Clear the marker.
1999-12-19 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_cut) : Fix Typo.
......
......@@ -229,13 +229,6 @@ Office 2000 and 'explorer' compatibility.
* Internals
* Exceptions.
Currently some code is refusing to make changes when an array
operation is acted on. This code is inside the core, and a CORBA
client might find this problem without being able to do anything
about it, nor knowing about the error condition.
* Hack R[-1]C[3] type references into the parser.
* Internals
......@@ -264,7 +257,7 @@ Office 2000 and 'explorer' compatibility.
* Rework 'Name' dependencies so we can re-express names.
* Think about allowing a formula to specify that it does not depend on the
contents of a reference, only the adress (ie the AREAS function)
* Dependancies for - INDIRECT and CELL functions.
* Dependancies for - CELL functions.
- Sheet objects
* Teach dependencies about implicit intersections
( big speedup (assesed2.xls))
......@@ -277,4 +270,4 @@ Office 2000 and 'explorer' compatibility.
* Import names even if they arn't referenced.
* Html export
* Export style information for blank cells.
\ No newline at end of file
* Export style information for blank cells.
......@@ -64,6 +64,8 @@ GNUMERIC_BASE_SOURCES = \
collect.c \
color.c \
color.h \
command-context.h \
command-context.c \
complex.h \
complex.c \
corba.h \
......
#include <config.h>
#include "command-context.h"
#ifndef GNUMERIC_CMD_CONTEXT_H
#define GNUMERIC_CMD_CONTEXT_H
#include "gnumeric.h"
typedef enum {
CMD_CONTEXT_GUI = 0x11,
CMD_CONTEXT_CORBA = 0x22
} CmdContextType;
struct _CmdContext
{
CmdContextType type;
};
#endif /* GNUMERIC_CMD_CONTEXT_H */
......@@ -361,7 +361,7 @@ item_bar_start_resize (ItemBar *bar)
GnomeCanvasGroup * const group = GNOME_CANVAS_GROUP (canvas->root);
GnomeCanvasPoints * const points =
bar->resize_points = gnome_canvas_points_new (2);
GnomeCanvasItem * const item =
GnomeCanvasItem * item =
gnome_canvas_item_new ( group,
gnome_canvas_line_get_type (),
"fill_color", "black",
......@@ -369,20 +369,36 @@ item_bar_start_resize (ItemBar *bar)
NULL);
bar->resize_guide = GTK_OBJECT (item);
/* NOTE : Do not set the position of the line here.
* Do that later based on the motion coordinates
/* NOTE : Set the position of the stationary line here.
* Set the guide line later based on the motion coordinates.
*/
if (bar->orientation == GTK_ORIENTATION_VERTICAL) {
double const y =
sheet_row_get_distance (sheet, 0, bar->resize_pos) / zoom;
points->coords [0] =
sheet_col_get_distance (sheet, 0, gsheet->left_col) / zoom;
points->coords [1] = y;
points->coords [2] =
sheet_col_get_distance (sheet, 0, gsheet->last_visible_col+1) / zoom;
points->coords [3] = y;
} else {
double const x =
sheet_col_get_distance (sheet, 0, bar->resize_pos) / zoom;
points->coords [0] = x;
points->coords [1] =
sheet_row_get_distance (sheet, 0, gsheet->top_row) / zoom;
points->coords [2] = x;
points->coords [3] =
sheet_row_get_distance (sheet, 0, gsheet->last_visible_row+1) / zoom;
}
item = gnome_canvas_item_new ( group,
gnome_canvas_line_get_type (),
"points", points,
"fill_color", "black",
"width_pixels", 1,
NULL);
bar->resize_start = GTK_OBJECT (item);
}
static int
......@@ -446,6 +462,8 @@ item_bar_end_resize (ItemBar *item_bar, int new_size)
item_bar->resize_points = NULL;
}
if (item_bar->resize_guide) {
gtk_object_destroy (item_bar->resize_start);
item_bar->resize_start = NULL;
gtk_object_destroy (item_bar->resize_guide);
item_bar->resize_guide = NULL;
}
......@@ -664,6 +682,7 @@ item_bar_init (ItemBar *item_bar)
item_bar->normal_font = NULL;
item_bar->bold_font = NULL;
item_bar->resize_guide = NULL;
item_bar->resize_start = NULL;
item_bar->resize_points = NULL;
}
......
......@@ -30,6 +30,7 @@ typedef struct {
int resize_width;
int resize_start_pos;
GtkObject *resize_guide;
GtkObject *resize_start;
GnomeCanvasPoints *resize_points;
int dragging : 1;
......
......@@ -72,17 +72,23 @@ file_open_cmd (GtkWidget *widget, Workbook *wb)
char *fname = dialog_query_load_file (wb);
Workbook *new_wb;
if (fname && (new_wb = workbook_read (fname)))
if (!fname)
return;
new_wb = workbook_read (fname);
if (new_wb != NULL) {
gtk_widget_show (new_wb->toplevel);
g_free (fname);
if (workbook_is_pristine (wb)) {
if (workbook_is_pristine (wb)) {
#ifdef ENABLE_BONOBO
gnome_object_unref (GNOME_OBJECT (wb));
gnome_object_unref (GNOME_OBJECT (wb));
#else
gtk_object_unref (GTK_OBJECT (wb));
gtk_object_unref (GTK_OBJECT (wb));
#endif
}
}
g_free (fname);
}
static void
......@@ -95,16 +101,18 @@ file_import_cmd (GtkWidget *widget, Workbook *wb)
return;
new_wb = workbook_import (wb, fname);
if (new_wb)
if (new_wb) {
gtk_widget_show (new_wb->toplevel);
if (workbook_is_pristine (wb)) {
if (workbook_is_pristine (wb)) {
#ifdef ENABLE_BONOBO
gnome_object_unref (GNOME_OBJECT (wb));
gnome_object_unref (GNOME_OBJECT (wb));
#else
gtk_object_unref (GTK_OBJECT (wb));
gtk_object_unref (GTK_OBJECT (wb));
#endif
}
}
g_free (fname);
}
static void
......
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