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

new.

2002-02-15  Jody Goldberg <jody@gnome.org>

	* src/sheet-object-image.{ch} : new.

	* src/sheet-object.c (sheet_object_new_view) : use a weak_ref.

	* src/sheet-control-gui.c (scg_object_register) : more safety
	  and use a weak_ref.

	* src/sheet-object-graphic.c : More GObject-ification.
parent 67e634f9
......@@ -27,3 +27,4 @@ intltool-extract*
intltool-merge*
intltool-update*
GNOME_Gnumeric.oaf
.intltool-cache*
2002-02-15 Jody Goldberg <jody@gnome.org>
* src/sheet-object-image.{ch} : new.
* src/sheet-object.c (sheet_object_new_view) : use a weak_ref.
* src/sheet-control-gui.c (scg_object_register) : more safety
and use a weak_ref.
* src/sheet-object-graphic.c : More GObject-ification.
2002-02-15 Morten Welinder <terra@diku.dk>
* src/regression.c (LUPDecomp): Use fabs, not abs.
......
......@@ -32,6 +32,7 @@ Jody:
* guruify autoformat dialog, and update autoformat code.
* move format from cell -> value.
* add an icon to the expr-entry (thanks Jacub)
* make images available without bonobo.
Jon Kåre:
* More correct import of "automatic" colors from Excel
......
2002-02-15 Jody Goldberg <jody@gnome.org>
* src/sheet-object-image.{ch} : new.
* src/sheet-object.c (sheet_object_new_view) : use a weak_ref.
* src/sheet-control-gui.c (scg_object_register) : more safety
and use a weak_ref.
* src/sheet-object-graphic.c : More GObject-ification.
2002-02-15 Morten Welinder <terra@diku.dk>
* src/regression.c (LUPDecomp): Use fabs, not abs.
......
2002-02-15 Jody Goldberg <jody@gnome.org>
* src/sheet-object-image.{ch} : new.
* src/sheet-object.c (sheet_object_new_view) : use a weak_ref.
* src/sheet-control-gui.c (scg_object_register) : more safety
and use a weak_ref.
* src/sheet-object-graphic.c : More GObject-ification.
2002-02-15 Morten Welinder <terra@diku.dk>
* src/regression.c (LUPDecomp): Use fabs, not abs.
......
2002-02-15 Jody Goldberg <jody@gnome.org>
* ms-escher.c (write_file) : delete.
(ms_escher_read_BSE) : remove the bonobo-ness from here it is none of
excel's business. Just use the new SheetObjectImage. While we're
at it avoid a few memory copies of the image.
* ms-excel-read.c (ms_sheet_create_obj) : ditto.
* ms-container.c (ms_container_get_blip) : return non-const.
2002-02-08 Jon K Hellan <hellan@acm.org>
* ms-excel-read.c (ms_excel_read_window2): No need to unref
......
......@@ -38,7 +38,7 @@ ms_container_finalize (MSContainer *container)
for (i = container->blips->len; i-- > 0 ; ) {
MSEscherBlip *blip = g_ptr_array_index (container->blips, i);
if (blip != NULL)
ms_escher_blip_destroy (blip);
ms_escher_blip_free (blip);
}
g_ptr_array_free (container->blips, TRUE);
......@@ -63,7 +63,7 @@ ms_container_add_blip (MSContainer *container, MSEscherBlip *blip)
g_ptr_array_add (container->blips, blip);
}
MSEscherBlip const *
MSEscherBlip *
ms_container_get_blip (MSContainer *container, int blip_id)
{
g_return_val_if_fail (container != NULL, NULL);
......
......@@ -35,12 +35,12 @@ void ms_container_init (MSContainer *container, MSContainerClass const *vtbl,
MSContainer *parent_container);
void ms_container_finalize (MSContainer *container);
void ms_container_add_blip (MSContainer *c, MSEscherBlip *blip);
MSEscherBlip const *ms_container_get_blip (MSContainer *c, int blip_id);
void ms_container_set_blips (MSContainer *c, GPtrArray *blips);
void ms_container_add_obj (MSContainer *c, MSObj *obj);
void ms_container_realize_objs (MSContainer *c);
ExprTree *ms_container_parse_expr (MSContainer *c,
void ms_container_add_blip (MSContainer *c, MSEscherBlip *blip);
MSEscherBlip *ms_container_get_blip (MSContainer *c, int blip_id);
void ms_container_set_blips (MSContainer *c, GPtrArray *blips);
void ms_container_add_obj (MSContainer *c, MSObj *obj);
void ms_container_realize_objs (MSContainer *c);
ExprTree *ms_container_parse_expr (MSContainer *c,
guint8 const *data, int length);
Sheet *ms_container_sheet (MSContainer const *c);
StyleFormat *ms_container_get_fmt (MSContainer const *container, guint16 indx);
......
......@@ -34,13 +34,6 @@
#include "ms-excel-read.h"
#include "ms-obj.h"
#ifdef ENABLE_BONOBO
# include <bonobo/bonobo-stream.h>
# include <bonobo/bonobo-stream-memory.h>
# include "sheet-object-container.h"
# include "sheet-object-graphic.h"
#endif
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnumeric:escher"
......@@ -98,33 +91,32 @@ ms_escher_header_add_attr (MSEscherHeader *h, MSObjAttr *attr)
}
static MSEscherBlip *
ms_escher_blip_new (guint8 const *data, guint32 len, char const *repoid)
ms_escher_blip_new (guint8 *data, guint32 len, char const *type, gboolean copy)
{
MSEscherBlip *blip = g_new (MSEscherBlip, 1);
#ifdef ENABLE_BONOBO
blip->stream = bonobo_stream_mem_create ((char *)data, len, TRUE, FALSE);
#else
guint8 *mem = g_malloc (len);
memcpy (mem, data, len);
blip->raw_data = mem;
#endif
blip->obj_id = repoid;
blip->type = type;
blip->data_len = len;
blip->needs_free = TRUE;
if (copy) {
guint8 *mem = g_malloc (len);
memcpy (mem, data, len);
blip->data = mem;
} else
blip->data = data;
return blip;
}
void
ms_escher_blip_destroy (MSEscherBlip *blip)
{
blip->obj_id = NULL;
#ifdef ENABLE_BONOBO
if (blip->stream)
bonobo_object_unref (BONOBO_OBJECT (blip->stream));
blip->stream = NULL;
#else
g_free (blip->raw_data);
blip->raw_data = NULL;
#endif
ms_escher_blip_free (MSEscherBlip *blip)
{
blip->type = NULL;
if (blip->needs_free) {
g_free (blip->data);
blip->needs_free = FALSE;
}
blip->data = NULL;
g_free (blip);
}
......@@ -324,32 +316,6 @@ bliptype_name (int const type)
}
}
#ifndef NO_DEBUG_EXCEL
static void
write_file (gchar const * const name, guint8 const * data,
gint len, int stored_type)
{
static int num = 0;
char const * suffix = bliptype_name (stored_type);
GString *file_name = g_string_new (name);
FILE *f;
g_string_sprintfa (file_name, "-%d.%s", num++, suffix);
f = fopen (file_name->str, "w");
if (f) {
fwrite (data, len, 1, f);
fclose (f);
if (ms_excel_escher_debug > 0)
printf ("written 0x%x bytes to '%s';\n",
len, file_name->str);
} else
printf ("Can't open '%s';\n",
file_name->str);
g_string_free (file_name, 1);
}
#endif
static gboolean
ms_escher_read_BSE (MSEscherState * state, MSEscherHeader * h)
{
......@@ -414,6 +380,8 @@ ms_escher_read_Blip (MSEscherState * state, MSEscherHeader * h)
guint32 blip_instance = h->instance;
gboolean res = FALSE;
MSEscherBlip *blip = NULL;
char const *type = NULL;
/* This doesn't make alot of sense.
* Which is the normative indicator of what type the blip is ?
......@@ -440,40 +408,40 @@ ms_escher_read_Blip (MSEscherState * state, MSEscherHeader * h)
switch (blip_instance) {
case 0x216 : /* compressed WMF, with Metafile header */
type = "wmf";
break;
case 0x3d4 : /* compressed EMF, with Metafile header */
type = "emf";
break;
case 0x542 : /* compressed PICT, with Metafile header */
type = "pict";
break;
case 0x46a : /* JPEG data, with 1 byte header */
type = "jpeg";
break;
case 0x6e0 : /* PNG data, with 1 byte header */
{
int const header = 17 + primary_uid_size + common_header_len;
gboolean needs_free;
char const *repoid;
guint8 const *data = ms_escher_get_data (state, h->offset,
h->len, header, &needs_free);
repoid = "OAFIID:GNOME_EOG_Embeddable";
blip = ms_escher_blip_new (data, h->len - header, repoid);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_escher_debug > 1)
write_file ("unknown", data, h->len - header, h->fbt - Blip_START);
#endif
if (needs_free)
g_free ((guint8*)data);
type = "png";
break;
}
case 0x7a8 : /* DIB data, with 1 byte header */
type = "dib";
break;
default:
g_warning ("Don't know what to do with this image %x\n", h->instance);
res = TRUE;
g_warning ("Don't know what to do with this image %x\n",
h->instance);
};
if (type != NULL) {
int const header = 17 + primary_uid_size + common_header_len;
gboolean needs_free;
guint8 const *data = ms_escher_get_data (state, h->offset, h->len,
header, &needs_free);
blip = ms_escher_blip_new ((guint8 *)data, h->len - header, type,
!needs_free);
}
/* Always add a blip to keep the indicies in sync, even if its NULL */
ms_container_add_blip (state->container, blip);
return res;
}
......
......@@ -8,26 +8,20 @@
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (michael@ximian.com)
*
* (C) 1998, 1999, 2000 Jody Goldberg, Michael Meeks
* (C) 1998-2002 Jody Goldberg, Michael Meeks
**/
#include "ms-excel-read.h"
#include "ms-container.h"
#ifdef ENABLE_BONOBO
#include <bonobo.h>
#endif
struct _MSEscherBlip
{
char const *obj_id;
#ifdef ENABLE_BONOBO
BonoboStream *stream;
#else
guint8 *raw_data;
#endif
char const *type;
guint8 *data;
guint32 data_len;
gboolean needs_free;
};
void ms_escher_parse (BiffQuery *q, MSContainer *container);
void ms_escher_blip_destroy (MSEscherBlip *blip);
void ms_escher_parse (BiffQuery *q, MSContainer *container);
void ms_escher_blip_free (MSEscherBlip *blip);
#endif /* GNUMERIC_MS_OFFICE_ESCHER_H */
......@@ -43,8 +43,8 @@
#include <sheet-object-cell-comment.h>
#include <sheet-object-widget.h>
#include <sheet-object-graphic.h>
#include <sheet-object-image.h>
#ifdef ENABLE_BONOBO
# include <sheet-object-container.h>
# include <gnumeric-graph.h>
#endif
......@@ -2148,49 +2148,19 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
case 0x07: so = g_object_new (sheet_widget_button_get_type (), NULL);
break;
case 0x08: { /* Picture */
#ifdef ENABLE_BONOBO
MSObjAttr *blip_id = ms_object_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_ID);
if (blip_id != NULL) {
MSEscherBlip const *blip =
ms_container_get_blip (container, blip_id->v.v_uint - 1);
MSEscherBlip *blip = ms_container_get_blip (container,
blip_id->v.v_uint - 1);
if (blip != NULL) {
SheetObjectBonobo *sob;
so = sheet_object_container_new (wb);
sob = SHEET_OBJECT_BONOBO (so);
if (sheet_object_bonobo_set_object_iid (sob, blip->obj_id)) {
CORBA_Environment ev;
CORBA_exception_init (&ev);
sheet_object_bonobo_load_persist_stream (
sob, blip->stream, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Failed to load '%s' from "
"stream: %s", blip->obj_id,
bonobo_exception_get_text (&ev));
g_object_unref (G_OBJECT (so));
so = NULL;
}
CORBA_exception_free (&ev);
} else {
g_warning ("Could not set object iid '%s'!",
blip->obj_id);
g_object_unref (G_OBJECT (so));
so = NULL;
}
so = sheet_object_image_new (blip->type,
blip->data, blip->data_len, !blip->needs_free);
blip->needs_free = FALSE; /* image took over managing data */
}
}
#else
if (esheet->wb->warn_unsupported_images) {
/* TODO : Use IOContext when available */
esheet->wb->warn_unsupported_images = FALSE;
g_warning ("Images are not supported in non-bonobo version");
}
#endif
/* replace blips we don't know how to handle with rectangles */
if (so == NULL)
so = sheet_object_box_new (FALSE); /* placeholder */
......
......@@ -4,5 +4,5 @@ Makefile
.libs
gnumeric
parser.c
gui-gtkmarshalers.c
gui-gtkmarshalers.h
gnm-marshalers.c
gnm-marshalers.h
......@@ -22,8 +22,8 @@ INCLUDES = \
$(GNUMERIC_CFLAGS)
BUILT_SOURCES = \
gui-gtkmarshalers.h \
gui-gtkmarshalers.c
gnm-marshalers.h \
gnm-marshalers.c
GNUMERIC_BASE = \
$(BUILT_SOURCES) \
......@@ -187,6 +187,8 @@ GNUMERIC_BASE = \
sheet-object-cell-comment.h \
sheet-object-graphic.c \
sheet-object-graphic.h \
sheet-object-image.c \
sheet-object-image.h \
sheet-object-widget.c \
sheet-object-widget.h \
sheet-style.c \
......@@ -300,16 +302,14 @@ gnumeric_app_libs = \
widgets/libwidgets.a \
functions/libfunctions.a
noinst_HEADERS = gui-gtkmarshalers.h
gui-gtkmarshalers.h : gui-gtkmarshalers.list $(GLIB_GENMARSHAL)
gnm-marshalers.h : gnm-marshalers.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --header --prefix=gnm_ > $@
gui-gtkmarshalers.c : gui-gtkmarshalers.list $(GLIB_GENMARSHAL)
gnm-marshalers.c : gnm-marshalers.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --body --prefix=gnm_ > $@
# include conditional files to ensure everything gets distributed no matter
# what the build
EXTRA_DIST = GNOME_Gnumeric.xml gui-gtkmarshalers.list \
EXTRA_DIST = GNOME_Gnumeric.xml gnm-marshalers.list \
normal-args.c corba-args.c \
$(GNUMERIC_BONOBO)
......
2002-02-15 Jody Goldberg <jody@gnome.org>
* function-select.glade : fix conversion breakage. Still in bad
shape.
2002-02-10 Jody Goldberg <jody@gnome.org>
* dialog-formula-guru.c (formula_guru_arg_new) : labels don't need
......
......@@ -88,7 +88,7 @@
<child>
<widget class="GtkCList" id="category_list">
<property name="can_focus">yes</property>
<property name="columns">1</property>
<property name="n_columns">1</property>
<property name="column_widths">80</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
<property name="show_titles">yes</property>
......@@ -142,7 +142,7 @@
<child>
<widget class="GtkCList" id="function_list">
<property name="can_focus">yes</property>
<property name="columns">1</property>
<property name="n_columns">1</property>
<property name="column_widths">80</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
<property name="show_titles">yes</property>
......
# see glib-genmarshal(1) for a detailed description of the file format,
# possible parameter types are:
# VOID indicates no return type, or no extra
# parameters. if VOID is used as the parameter
# list, no additional parameters may be present.
# BOOLEAN for boolean types (gboolean)
# CHAR for signed char types (gchar)
# UCHAR for unsigned char types (guchar)
# INT for signed integer types (gint)
# UINT for unsigned integer types (guint)
# LONG for signed long integer types (glong)
# ULONG for unsigned long integer types (gulong)
# ENUM for enumeration types (gint)
# FLAGS for flag enumeration types (guint)
# FLOAT for single-precision float types (gfloat)
# DOUBLE for double-precision float types (gdouble)
# STRING for string types (gchar*)
# BOXED for boxed (anonymous but reference counted) types (GBoxed*)
# POINTER for anonymous pointer types (gpointer)
# OBJECT for GObject or derived types (GObject*)
# NONE deprecated alias for VOID
# BOOL deprecated alias for BOOLEAN
BOOLEAN:POINTER
INT:INT
NONE:INT,INT
NONE:NONE
NONE:POINTER
POINTER:INT,INT
......@@ -35,7 +35,7 @@
#include "style-border.h"
#include "style-color.h"
#include "value.h"
#include "gui-gtkmarshalers.h"
#include "gnm-marshalers.h"
#include <gal/util/e-util.h>
......
......@@ -2132,6 +2132,9 @@ cb_sheet_object_view_destroy (GObject *view, SheetObject *so)
{
SheetControlGUI *scg = sheet_object_view_control (view);
g_return_if_fail (IS_SHEET_OBJECT (so));
g_return_if_fail (view != NULL);
if (scg) {
if (scg->current_object == so)
scg_mode_edit ((SheetControl *) scg);
......
......@@ -32,7 +32,8 @@ typedef enum {
SHEET_OBJECT_OVAL = 102,
} SheetObjectGraphicType;
#define SHEET_OBJECT_GRAPHIC_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SHEET_OBJECT_GRAPHIC_TYPE))
#define SHEET_OBJECT_GRAPHIC(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SHEET_OBJECT_GRAPHIC_TYPE, SheetObjectGraphic))
#define SHEET_OBJECT_GRAPHIC_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SHEET_OBJECT_GRAPHIC_TYPE, SheetObjectGraphicClass))
typedef struct {
SheetObject sheet_object;
......@@ -109,14 +110,14 @@ sheet_object_line_new (gboolean is_arrow)
}
static void
sheet_object_graphic_destroy (GtkObject *object)
sheet_object_graphic_finalize (GObject *object)
{
SheetObjectGraphic *sog;
sog = SHEET_OBJECT_GRAPHIC (object);
style_color_unref (sog->fill_color);
GTK_OBJECT_CLASS (sheet_object_graphic_parent_class)->destroy (object);
G_OBJECT_CLASS (sheet_object_graphic_parent_class)->finalize (object);
}
static GObject *
......@@ -242,7 +243,7 @@ sheet_object_graphic_clone (SheetObject const *so, Sheet *sheet)
g_return_val_if_fail (IS_SHEET_OBJECT_GRAPHIC (so), NULL);
sog = SHEET_OBJECT_GRAPHIC (so);
new_sog = g_object_new (GTK_OBJECT_TYPE (sog), NULL);
new_sog = g_object_new (G_OBJECT_TYPE (so), NULL);
new_sog->type = sog->type;
new_sog->width = sog->width;
......@@ -562,14 +563,14 @@ sheet_object_graphic_user_config (SheetObject *so, SheetControlGUI *scg)
}
static void
sheet_object_graphic_class_init (GtkObjectClass *object_class)
sheet_object_graphic_class_init (GObjectClass *object_class)
{
SheetObjectClass *sheet_object_class;
sheet_object_graphic_parent_class = gtk_type_class (SHEET_OBJECT_TYPE);
/* Object class method overrides */
object_class->destroy = sheet_object_graphic_destroy;
object_class->finalize = sheet_object_graphic_finalize;
/* SheetObject class method overrides */
sheet_object_class = SHEET_OBJECT_CLASS (object_class);
......@@ -584,7 +585,7 @@ sheet_object_graphic_class_init (GtkObjectClass *object_class)
}
static void
sheet_object_graphic_init (GtkObject *obj)
sheet_object_graphic_init (GObject *obj)
{
SheetObjectGraphic *sog;
SheetObject *so;
......@@ -611,7 +612,8 @@ E_MAKE_TYPE (sheet_object_graphic, "SheetObjectGraphic", SheetObjectGraphic,
*
* Derivative of SheetObjectGraphic, with filled parameter
*/
#define IS_SHEET_OBJECT_FILLED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SHEET_OBJECT_FILLED_TYPE, SheetObjectFilledClass))
#define SHEET_OBJECT_FILLED(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SHEET_OBJECT_FILLED_TYPE, SheetObjectFilled))
#define SHEET_OBJECT_FILLED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SHEET_OBJECT_FILLED_TYPE, SheetObjectFilledClass))
typedef struct {
SheetObjectGraphic sheet_object_graphic;
......@@ -656,14 +658,14 @@ sheet_object_box_new (gboolean is_oval)
}
static void
sheet_object_filled_destroy (GtkObject *object)
sheet_object_filled_finalize (GObject *object)
{
SheetObjectFilled *sof;
sof = SHEET_OBJECT_FILLED (object);
style_color_unref (sof->outline_color);
GTK_OBJECT_CLASS (sheet_object_filled_parent_class)->destroy (object);
G_OBJECT_CLASS (sheet_object_filled_parent_class)->finalize (object);
}
static void
......@@ -705,8 +707,7 @@ sheet_object_filled_new_view (SheetObject *so, SheetControlGUI *scg)
fill_color = (sog->fill_color != NULL) ? &sog->fill_color->color : NULL;
outline_color = (sof->outline_color != NULL) ? &sof->outline_color->color : NULL;
item = gnome_canvas_item_new (
gcanvas->object_group,
item = gnome_canvas_item_new (gcanvas->object_group,
(sog->type == SHEET_OBJECT_OVAL) ?
GNOME_TYPE_CANVAS_ELLIPSE :
GNOME_TYPE_CANVAS_RECT,
......@@ -1031,13 +1032,13 @@ sheet_object_filled_print (SheetObject const *so, GnomePrintContext *ctx,
}
static void
sheet_object_filled_class_init (GtkObjectClass *object_class)
sheet_object_filled_class_init (GObjectClass *object_class)
{
SheetObjectClass *sheet_object_class;
sheet_object_filled_parent_class = gtk_type_class (SHEET_OBJECT_GRAPHIC_TYPE);
object_class->destroy = sheet_object_filled_destroy;
object_class->finalize = sheet_object_filled_finalize;
sheet_object_class = SHEET_OBJECT_CLASS (object_class);
sheet_object_class->new_view = sheet_object_filled_new_view;
......@@ -1051,7 +1052,7 @@ sheet_object_filled_class_init (GtkObjectClass *object_class)
}
static void
sheet_object_filled_init (GtkObject *obj)
sheet_object_filled_init (GObject *obj)
{
SheetObjectFilled *sof;
......
......@@ -3,18 +3,16 @@
#include "sheet-object.h"
#define SHEET_OBJECT_GRAPHIC_TYPE (sheet_object_graphic_get_type ())
#define SHEET_OBJECT_GRAPHIC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SHEET_OBJECT_GRAPHIC_TYPE, SheetObjectGraphic))
#define IS_SHEET_OBJECT_GRAPHIC(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SHEET_OBJECT_GRAPHIC_TYPE))
#define SHEET_OBJECT_GRAPHIC_TYPE (sheet_object_graphic_get_type ())
#define IS_SHEET_OBJECT_GRAPHIC(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SHEET_OBJECT_GRAPHIC_TYPE))
GType sheet_object_graphic_get_type (void);
SheetObject *sheet_object_line_new (gboolean with_arrow);
void sheet_object_graphic_fill_color_set (SheetObject *so,
StyleColor *color);
#define SHEET_OBJECT_FILLED_TYPE (sheet_object_filled_get_type ())
#define SHEET_OBJECT_FILLED(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SHEET_OBJECT_FILLED_TYPE, SheetObjectFilled))
#define IS_SHEET_OBJECT_FILLED(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SHEET_OBJECT_FILLED_TYPE))
#define SHEET_OBJECT_FILLED_TYPE (sheet_object_filled_get_type ())
#define IS_SHEET_OBJECT_FILLED(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SHEET_OBJECT_FILLED_TYPE))
GType sheet_object_filled_get_type (void);
SheetObject *sheet_object_box_new (gboolean is_oval);
......
......@@ -24,6 +24,9 @@ struct _SheetObject {
typedef struct {
GObjectClass parent_class;
/* signals */
void (*unrealize) (SheetObject *sheet_object);
/* Virtual methods */
gboolean (*remove_from_sheet) (SheetObject *sheet_object);
gboolean (*assign_to_sheet) (SheetObject *sheet_object,
......
......@@ -109,7 +109,7 @@ sheet_object_unrealize (SheetObject *so)
/* The views remove themselves from the list */
while (so->realized_list != NULL)
g_object_unref (G_OBJECT (so->realized_list->data));
gtk_object_destroy (GTK_OBJECT (so->realized_list->data));
}
/**
......
......@@ -24,7 +24,7 @@
#include <eval.h>
#include <sheet.h>
#include <commands.h>
#include <gui-gtkmarshalers.h>
#include <gnm-marshalers.h>
#include <gal/util/e-util.h>
#include <gtk/gtkentry.h>
......
......@@ -10,7 +10,7 @@
#include <gnumeric.h>
#include "widget-editable-label.h"
#include <style-color.h>
#include <gui-gtkmarshalers.h>
#include <gnm-marshalers.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkbutton.h>
......
......@@ -3637,10 +3637,10 @@ cb_notebook_switch_page (GtkNotebook *notebook, GtkNotebookPage *page,
}
}
static GtkObjectClass *parent_class;
static void
wbcg_destroy (GtkObject *obj)
wbcg_finalize (GObject *obj)
{
GObjectClass *parent_class;
WorkbookControlGUI *wbcg = WORKBOOK_CONTROL_GUI (obj);
/* Disconnect signals that would attempt to change things during
......@@ -3662,7 +3662,9 @@ wbcg_destroy (GtkObject *obj)
if (wbcg->toplevel != NULL)
gtk_object_destroy (GTK_OBJECT (wbcg->toplevel));
GTK_OBJECT_CLASS (parent_class)->destroy (obj);
parent_class = g_type_class_peek (WORKBOOK_CONTROL_TYPE);
if (parent_class != NULL && parent_class->finalize != NULL)
(parent_class)->finalize (obj);
}
static gboolean
......@@ -4373,15 +4375,13 @@ wbcg_validation_msg (WorkbookControl *wbc, ValidationStyle v,
}
static void
workbook_control_gui_ctor_class (GtkObjectClass *object_class)
workbook_control_gui_ctor_class (GObjectClass *object_class)
{
WorkbookControlClass *wbc_class = WORKBOOK_CONTROL_CLASS (object_class);
g_return_if_fail (wbc_class != NULL);
parent_class = gtk_type_class (workbook_control_get_type ());
object_class->destroy = wbcg_destroy;
object_class->finalize = wbcg_finalize;
wbc_class->context_class.progress_set = wbcg_progress_set;
wbc_class->context_class.progress_message_set = wbcg_progress_message_set;
......
......@@ -257,21 +257,22 @@ wb_control_parse_and_jump (WorkbookControl *wbc, const char *text)
/*****************************************************************************/
static GtkObjectClass *parent_class;
static void
wbc_destroy (GtkObject *obj)
wbc_finalize (GObject *obj)
{