Commit 8fd8d8a3 authored by Lutz Müller's avatar Lutz Müller Committed by Lutz Müller

Clean up the handling of bonobo objects by introducing

2001-07-13  Lutz Mller <urc8@rz.uni-karlsruhe.de>

        * src/sheet-control-gui.[c,h]: Clean up the handling of bonobo objects
        by introducing
        (scg_activate_view_frame) and
        (scg_deactivate_view_frame).
        * src/sheet-object-bonobo.[c,h]: Check for existence of interfaces
        before querying it. Fix ref-counting. Make functions
        (sheet_object_bonobo_load_persist_file),
        (sheet_object_bonobo_load_persist_stream), and
        (sheet_object_bonobo_load_stream) consistent.
        * src/sheet-object-container.c: Parent class is and has ever been
        SheetObjectBonobo. This file should be called
        sheet-object-bonobo-container... Fix ref-counting.
        (cb_user_activation_request): Activate the view frame and set edit mode
        (cb_view_activated): Removed
        (sheet_object_container_new_view): Let the canvas item remember the
        view frame (through gtk_object_set_data)
        * src/sheet-object-container.h: Rename IS_SHEET_CONTAINER_OBJECT to
        IS_SHEET_OBJECT_CONTAINER to be consistent. Remove view_frame
        variable - this object can produce many view frames.
parent 641bd7b7
2001-07-13 Lutz Mller <urc8@rz.uni-karlsruhe.de>
* src/sheet-control-gui.[c,h]: Clean up the handling of bonobo objects
by introducing
(scg_activate_view_frame) and
(scg_deactivate_view_frame).
* src/sheet-object-bonobo.[c,h]: Check for existence of interfaces
before querying it. Fix ref-counting. Make functions
(sheet_object_bonobo_load_persist_file),
(sheet_object_bonobo_load_persist_stream), and
(sheet_object_bonobo_load_stream) consistent.
* src/sheet-object-container.c: Parent class is and has ever been
SheetObjectBonobo. This file should be called
sheet-object-bonobo-container... Fix ref-counting.
(cb_user_activation_request): Activate the view frame and set edit mode
(cb_view_activated): Removed
(sheet_object_container_new_view): Let the canvas item remember the
view frame (through gtk_object_set_data)
* src/sheet-object-container.h: Rename IS_SHEET_CONTAINER_OBJECT to
IS_SHEET_OBJECT_CONTAINER to be consistent. Remove view_frame
variable - this object can produce many view frames.
2001-07-13 Morten Welinder <terra@diku.dk>
* src/analysis-tools.c (ttest_eq_var_tool): Fixed for pooled
......
2001-07-13 Lutz Mller <urc8@rz.uni-karlsruhe.de>
* src/sheet-control-gui.[c,h]: Clean up the handling of bonobo objects
by introducing
(scg_activate_view_frame) and
(scg_deactivate_view_frame).
* src/sheet-object-bonobo.[c,h]: Check for existence of interfaces
before querying it. Fix ref-counting. Make functions
(sheet_object_bonobo_load_persist_file),
(sheet_object_bonobo_load_persist_stream), and
(sheet_object_bonobo_load_stream) consistent.
* src/sheet-object-container.c: Parent class is and has ever been
SheetObjectBonobo. This file should be called
sheet-object-bonobo-container... Fix ref-counting.
(cb_user_activation_request): Activate the view frame and set edit mode
(cb_view_activated): Removed
(sheet_object_container_new_view): Let the canvas item remember the
view frame (through gtk_object_set_data)
* src/sheet-object-container.h: Rename IS_SHEET_CONTAINER_OBJECT to
IS_SHEET_OBJECT_CONTAINER to be consistent. Remove view_frame
variable - this object can produce many view frames.
2001-07-13 Morten Welinder <terra@diku.dk>
* src/analysis-tools.c (ttest_eq_var_tool): Fixed for pooled
......
2001-07-13 Lutz Mller <urc8@rz.uni-karlsruhe.de>
* src/sheet-control-gui.[c,h]: Clean up the handling of bonobo objects
by introducing
(scg_activate_view_frame) and
(scg_deactivate_view_frame).
* src/sheet-object-bonobo.[c,h]: Check for existence of interfaces
before querying it. Fix ref-counting. Make functions
(sheet_object_bonobo_load_persist_file),
(sheet_object_bonobo_load_persist_stream), and
(sheet_object_bonobo_load_stream) consistent.
* src/sheet-object-container.c: Parent class is and has ever been
SheetObjectBonobo. This file should be called
sheet-object-bonobo-container... Fix ref-counting.
(cb_user_activation_request): Activate the view frame and set edit mode
(cb_view_activated): Removed
(sheet_object_container_new_view): Let the canvas item remember the
view frame (through gtk_object_set_data)
* src/sheet-object-container.h: Rename IS_SHEET_CONTAINER_OBJECT to
IS_SHEET_OBJECT_CONTAINER to be consistent. Remove view_frame
variable - this object can produce many view frames.
2001-07-13 Morten Welinder <terra@diku.dk>
* src/analysis-tools.c (ttest_eq_var_tool): Fixed for pooled
......
2001-07-13 Lutz Mller <urc8@rz.uni-karlsruhe.de>
* src/sheet-control-gui.[c,h]: Clean up the handling of bonobo objects
by introducing
(scg_activate_view_frame) and
(scg_deactivate_view_frame).
* src/sheet-object-bonobo.[c,h]: Check for existence of interfaces
before querying it. Fix ref-counting. Make functions
(sheet_object_bonobo_load_persist_file),
(sheet_object_bonobo_load_persist_stream), and
(sheet_object_bonobo_load_stream) consistent.
* src/sheet-object-container.c: Parent class is and has ever been
SheetObjectBonobo. This file should be called
sheet-object-bonobo-container... Fix ref-counting.
(cb_user_activation_request): Activate the view frame and set edit mode
(cb_view_activated): Removed
(sheet_object_container_new_view): Let the canvas item remember the
view frame (through gtk_object_set_data)
* src/sheet-object-container.h: Rename IS_SHEET_CONTAINER_OBJECT to
IS_SHEET_OBJECT_CONTAINER to be consistent. Remove view_frame
variable - this object can produce many view frames.
2001-07-13 Morten Welinder <terra@diku.dk>
* src/analysis-tools.c (ttest_eq_var_tool): Fixed for pooled
......
......@@ -1426,13 +1426,7 @@ scg_object_stop_editing (SheetControlGUI *scg, SheetObject *so)
if (SO_CLASS (so)->set_active != NULL)
SO_CLASS (so)->set_active (so, FALSE);
#ifdef ENABLE_BONOBO
/* FIXME FIXME FIXME : JEG 11/Sep/2000 */
if (scg->active_object_frame) {
bonobo_view_frame_view_deactivate (scg->active_object_frame);
if (scg->active_object_frame != NULL)
bonobo_view_frame_set_covered (scg->active_object_frame, TRUE);
scg->active_object_frame = NULL;
}
scg_deactivate_view_frame (scg);
#endif
}
}
......@@ -2630,6 +2624,34 @@ scg_colrow_resize_move (SheetControlGUI *scg,
gnumeric_pane_colrow_resize_move (scg->pane + i, is_cols, pos);
}
#ifdef ENABLE_BONOBO
void
scg_activate_view_frame (SheetControlGUI *scg, BonoboViewFrame *view_frame)
{
g_return_if_fail (IS_SHEET_CONTROL_GUI (scg));
/* Deactivate activated frame (if any) */
scg_deactivate_view_frame (scg);
/* Activate given frame */
bonobo_view_frame_view_activate (view_frame);
bonobo_view_frame_set_covered (view_frame, FALSE);
scg->active_object_frame = view_frame;
}
void
scg_deactivate_view_frame (SheetControlGUI *scg)
{
g_return_if_fail (IS_SHEET_CONTROL_GUI (scg));
if (scg->active_object_frame) {
bonobo_view_frame_view_deactivate (scg->active_object_frame);
bonobo_view_frame_set_covered (scg->active_object_frame, TRUE);
scg->active_object_frame = NULL;
}
}
#endif
static void
scg_class_init (GtkObjectClass *object_class)
{
......
......@@ -3,6 +3,9 @@
#include "gui-gnumeric.h"
#include "sheet-control.h"
#ifdef ENABLE_BONOBO
#include <bonobo/bonobo-view-frame.h>
#endif
#define SHEET_CONTROL_GUI_TYPE (sheet_control_gui_get_type ())
#define SHEET_CONTROL_GUI(obj) (GTK_CHECK_CAST((obj), SHEET_CONTROL_GUI_TYPE, SheetControlGUI))
......@@ -69,6 +72,11 @@ void scg_colrow_resize_start (SheetControlGUI *scg,
gboolean is_cols, int resize_first);
void scg_colrow_resize_move (SheetControlGUI *scg,
gboolean is_cols, int resize_last);
#ifdef ENABLE_BONOBO
void scg_activate_view_frame (SheetControlGUI *scg,
BonoboViewFrame *view_frame);
void scg_deactivate_view_frame (SheetControlGUI *scg);
#endif
/* DO NOT USE THIS WITHOUT ALOT OF THOUGHT */
GnumericSheet *scg_pane (SheetControlGUI *scg, int pane);
......
......@@ -47,12 +47,10 @@ sheet_object_bonobo_destroy (GtkObject *object)
sob->client_site = NULL;
}
#if 0
if (sob->object_server != NULL) {
bonobo_object_unref (BONOBO_OBJECT (sob->object_server));
sob->object_server = NULL;
}
#endif
if (sob->object_id != NULL) {
g_free (sob->object_id);
......@@ -96,128 +94,43 @@ get_file_name (void)
return filename;
}
/**
* sheet_object_bonobo_load_file:
* @sob: A SheetBonoboObject
* @fname: File from which the state is loaded for @sob
*
* Loads the state for the Bonobo component from @fname
*
* Returns TRUE on success, FALSE on failure.
*/
gboolean
sheet_object_bonobo_load_file (SheetObjectBonobo *sob, const char *fname)
void
sheet_object_bonobo_load_persist_file (SheetObjectBonobo *sob,
const char *fname,
CORBA_Environment *ev)
{
CORBA_Environment ev;
Bonobo_PersistFile pf;
Bonobo_PersistStream ps;
CORBA_exception_init (&ev);
pf = Bonobo_Unknown_queryInterface (
bonobo_object_corba_objref (BONOBO_OBJECT (sob->object_server)),
"IDL:Bonobo/PersistFile:1.0", &ev);
if (ev._major == CORBA_NO_EXCEPTION && pf != CORBA_OBJECT_NIL){
char *file;
if (!fname)
file = get_file_name ();
else
file = g_strdup (fname);
if (file) {
Bonobo_PersistFile_load (pf, file, &ev);
if (BONOBO_EX (&ev))
g_warning ("Error '%s'", bonobo_exception_get_text (&ev));
}
bonobo_object_release_unref (pf, &ev);
g_free (file);
goto finish;
}
g_return_if_fail (IS_SHEET_OBJECT_BONOBO (sob));
g_return_if_fail (sob->has_persist_file);
ps = Bonobo_Unknown_queryInterface (
bonobo_object_corba_objref (BONOBO_OBJECT (sob->object_server)),
"IDL:Bonobo/PersistStream:1.0", &ev);
if (ev._major == CORBA_NO_EXCEPTION && ps != CORBA_OBJECT_NIL){
char *file;
if (!fname)
file = get_file_name ();
else
file = g_strdup (fname);
if (file) {
BonoboStream *stream;
stream = bonobo_stream_open ("fs", file, Bonobo_Storage_READ, 0);
if (stream) {
Bonobo_PersistStream_load (
ps,
(Bonobo_Stream) bonobo_object_corba_objref (
BONOBO_OBJECT (stream)), "", &ev);
if (BONOBO_EX (&ev))
g_warning ("Error '%s'", bonobo_exception_get_text (&ev));
} else
g_warning ("Failed to open '%s'", file);
}
bonobo_object_release_unref (pf, &ev);
g_free (file);
goto finish;
pf = Bonobo_Unknown_queryInterface (BONOBO_OBJREF (sob->object_server),
"IDL:Bonobo/PersistFile:1.0", ev);
if (!BONOBO_EX (ev)) {
Bonobo_PersistFile_load (pf, fname, ev);
bonobo_object_release_unref (pf, NULL);
}
CORBA_exception_free (&ev);
return FALSE;
finish:
CORBA_exception_free (&ev);
return TRUE;
}
/**
* sheet_object_bonobo_load_stream:
* @sob: SheetObject Bonobo component
* @stream: Stream used to load the state of the @sob component
*/
gboolean
sheet_object_bonobo_load_stream (SheetObjectBonobo *sob,
BonoboStream *stream)
void
sheet_object_bonobo_load_persist_stream (SheetObjectBonobo *sob,
BonoboStream *stream,
CORBA_Environment *ev)
{
CORBA_Environment ev;
Bonobo_PersistStream ret;
if (!stream)
return TRUE;
g_return_val_if_fail (sob != NULL, FALSE);
g_return_val_if_fail (IS_SHEET_OBJECT_BONOBO (sob), FALSE);
g_return_val_if_fail (sob->client_site != NULL, FALSE);
CORBA_exception_init (&ev);
Bonobo_PersistStream ps;
ret = Bonobo_Unknown_queryInterface (
bonobo_object_corba_objref (BONOBO_OBJECT (sob->object_server)),
"IDL:Bonobo/PersistStream:1.0", &ev);
if (ev._major == CORBA_NO_EXCEPTION && ret != CORBA_OBJECT_NIL) {
if (stream) {
Bonobo_PersistStream_load (
ret,
(Bonobo_Stream) bonobo_object_corba_objref (
BONOBO_OBJECT (stream)), "", &ev);
Bonobo_Unknown_unref ((Bonobo_Unknown) ret, &ev);
CORBA_Object_release (ret, &ev);
}
} else {
g_warning ("Component has data to load but no PersistStream interface");
CORBA_exception_free (&ev);
return FALSE;
bonobo_return_if_fail (IS_SHEET_OBJECT_BONOBO (sob), ev);
g_return_if_fail (sob->client_site != NULL);
g_return_if_fail (sob->has_persist_stream);
ps = Bonobo_Unknown_queryInterface (BONOBO_OBJREF (sob->object_server),
"IDL:Bonobo/PersistStream:1.0",
ev);
if (!BONOBO_EX (ev)) {
Bonobo_PersistStream_load (ps,
(Bonobo_Stream) BONOBO_OBJREF (stream), "", ev);
bonobo_object_release_unref (ps, NULL);
}
CORBA_exception_free (&ev);
return TRUE;
}
static void
......@@ -227,7 +140,7 @@ sheet_object_bonobo_print (SheetObject const *so,
SheetObjectBonobo const *sob;
BonoboPrintClient *bpc;
g_return_if_fail (IS_SHEET_OBJECT_BONOBO (so));
g_return_if_fail (IS_SHEET_OBJECT (so));
sob = SHEET_OBJECT_BONOBO (so);
......@@ -243,27 +156,66 @@ sheet_object_bonobo_print (SheetObject const *so,
bonobo_print_client_render (bpc, pi->pd);
}
void
sheet_object_bonobo_load_file (SheetObjectBonobo *sob, const gchar *fname,
CORBA_Environment *ev)
{
BonoboStream *stream;
bonobo_return_if_fail (IS_SHEET_OBJECT_BONOBO (sob), ev);
g_return_if_fail (sob->has_persist_file || sob->has_persist_stream);
if (sob->has_persist_file)
sheet_object_bonobo_load_persist_file (sob, fname, ev);
else {
stream = bonobo_stream_open ("fs", fname,
Bonobo_Storage_READ, 0);
sheet_object_bonobo_load_persist_stream (sob, stream, ev);
bonobo_object_unref (BONOBO_OBJECT (stream));
}
}
static void
open_cb (GtkMenuItem *item, SheetObjectBonobo *sheet_object)
open_cb (GtkMenuItem *item, SheetObjectBonobo *sob)
{
sheet_object_bonobo_load_file (sheet_object, NULL);
gchar *filename;
CORBA_Environment ev;
g_return_if_fail (sob->has_persist_file || sob->has_persist_stream);
CORBA_exception_init (&ev);
filename = get_file_name ();
sheet_object_bonobo_load_file (sob, filename, &ev);
g_free (filename);
if (BONOBO_EX (&ev)) {
g_warning ("Could not open: %s",
bonobo_exception_get_text (&ev));
}
CORBA_exception_free (&ev);
}
static void
sheet_object_bonobo_populate_menu (SheetObject *sheet_object,
GtkObject *obj_view,
GtkMenu *menu)
sheet_object_bonobo_populate_menu (SheetObject *so,
GtkObject *obj_view,
GtkMenu *menu)
{
GtkWidget *item = gtk_menu_item_new_with_label (_("Open"));
SheetObjectBonobo *sob;
GtkWidget *item;
gtk_signal_connect (GTK_OBJECT (item), "activate",
(GtkSignalFunc) open_cb, sheet_object);
g_return_if_fail (IS_SHEET_OBJECT_BONOBO (so));
gtk_menu_append (menu, item);
sob = SHEET_OBJECT_BONOBO (so);
if (sob->has_persist_file || sob->has_persist_stream) {
item = gtk_menu_item_new_with_label (_("Open"));
gtk_signal_connect (GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (open_cb), so);
gtk_menu_append (menu, item);
}
if (sheet_object_bonobo_parent_class->populate_menu)
sheet_object_bonobo_parent_class->
populate_menu (sheet_object, obj_view, menu);
sheet_object_bonobo_parent_class->populate_menu (so, obj_view, menu);
}
static gboolean
......@@ -294,14 +246,16 @@ sheet_object_bonobo_write_xml (SheetObject const *so,
static void
sheet_object_bonobo_class_init (GtkObjectClass *object_class)
{
SheetObjectClass *sheet_object_class = SHEET_OBJECT_CLASS (object_class);
SheetObjectClass *sheet_object_class;
sheet_object_bonobo_parent_class = gtk_type_class (sheet_object_get_type ());
/* Object class method overrides */
/* GtkObject class method overrides */
object_class->destroy = sheet_object_bonobo_destroy;
sheet_object_class->print = sheet_object_bonobo_print;
/* SheetObject class method overrides */
sheet_object_class = SHEET_OBJECT_CLASS (object_class);
sheet_object_class->print = sheet_object_bonobo_print;
sheet_object_class->populate_menu = sheet_object_bonobo_populate_menu;
sheet_object_class->read_xml = sheet_object_bonobo_read_xml;
sheet_object_class->write_xml = sheet_object_bonobo_write_xml;
......@@ -322,8 +276,10 @@ sheet_object_bonobo_construct (SheetObjectBonobo *sob,
sob->object_server = NULL;
sob->client_site = bonobo_client_site_new (sheet->workbook->priv->bonobo_container);
if (object_id != NULL &&
!sheet_object_bonobo_set_object_iid (sob, object_id))
!sheet_object_bonobo_set_object_iid (sob, object_id)) {
bonobo_object_unref (BONOBO_OBJECT (sob->client_site));
return NULL;
}
return sob;
}
......@@ -349,19 +305,24 @@ sheet_object_bonobo_set_object_iid (SheetObjectBonobo *sob,
char const *object_id)
{
BonoboObjectClient *server;
gboolean result;
g_return_val_if_fail (IS_SHEET_OBJECT_BONOBO (sob), FALSE);
g_return_val_if_fail (sob->object_id == NULL, FALSE);
g_return_val_if_fail (object_id != NULL, FALSE);
server = bonobo_object_activate (object_id, 0);
if (!server) {
gtk_object_destroy (GTK_OBJECT (sob));
if (!server)
return FALSE;
result = sheet_object_bonobo_set_server (sob, server);
bonobo_object_unref (BONOBO_OBJECT (server));
if (result == TRUE) {
sob->object_id = g_strdup (object_id);
return (TRUE);
}
sob->object_id = g_strdup (object_id);
return sheet_object_bonobo_set_server (sob, server);
return (FALSE);
}
gboolean
......@@ -372,12 +333,16 @@ sheet_object_bonobo_set_server (SheetObjectBonobo *sob,
g_return_val_if_fail (sob->object_server == NULL, FALSE);
g_return_val_if_fail (BONOBO_IS_OBJECT_CLIENT (server), FALSE);
if (!bonobo_client_site_bind_embeddable (sob->client_site, server)) {
gtk_object_destroy (GTK_OBJECT (sob));
if (!bonobo_client_site_bind_embeddable (sob->client_site, server))
return FALSE;
}
bonobo_object_ref (BONOBO_OBJECT (server));
sob->object_server = server;
sob->has_persist_file = bonobo_object_client_has_interface (server,
"IDL:Bonobo/PersistFile:1.0", NULL);
sob->has_persist_stream = bonobo_object_client_has_interface (server,
"IDL:Bonobo/PersistStream:1.0", NULL);
return TRUE;
}
......@@ -29,6 +29,8 @@ typedef struct {
/* the object server that implements this SheetObjectBonobo */
BonoboObjectClient *object_server;
gboolean has_persist_file;
gboolean has_persist_stream;
} SheetObjectBonobo;
typedef struct {
......@@ -44,10 +46,15 @@ gboolean sheet_object_bonobo_set_object_iid (SheetObjectBonobo *sob,
char const *object_id);
gboolean sheet_object_bonobo_set_server (SheetObjectBonobo *sob,
BonoboObjectClient *object_server);
gboolean sheet_object_bonobo_load_file (SheetObjectBonobo *sob,
char const *fname);
gboolean sheet_object_bonobo_load_stream (SheetObjectBonobo *sob,
BonoboStream *stream);
void sheet_object_bonobo_load_file (SheetObjectBonobo *sob,
char const *fname,
CORBA_Environment *ev);
void sheet_object_bonobo_load_persist_file (SheetObjectBonobo *sob,
char const *fname,
CORBA_Environment *ev);
void sheet_object_bonobo_load_persist_stream (SheetObjectBonobo *sob,
BonoboStream *stream,
CORBA_Environment *ev);
void sheet_object_bonobo_query_size (SheetObjectBonobo *sob);
#endif /* GNUMERIC_SHEET_OBJECT_ITEM_H */
......@@ -28,7 +28,7 @@
#include <bonobo/bonobo-object-client.h>
#include <bonobo/bonobo-object-directory.h>
static SheetObject *sheet_object_container_parent_class;
static SheetObjectBonoboClass *sheet_object_container_parent_class;
static gint
cb_user_activation_request (BonoboViewFrame *view_frame, GtkObject *so_view)
......@@ -36,67 +36,16 @@ cb_user_activation_request (BonoboViewFrame *view_frame, GtkObject *so_view)
SheetControlGUI *scg = sheet_object_view_control (so_view);
SheetObject *so = sheet_object_view_obj (so_view);
if (scg->active_object_frame) {
bonobo_view_frame_view_deactivate (scg->active_object_frame);
if (scg->active_object_frame != NULL)
bonobo_view_frame_set_covered (scg->active_object_frame, TRUE);
scg->active_object_frame = NULL;
}
bonobo_view_frame_view_activate (view_frame);
scg_activate_view_frame (scg, view_frame);
scg_mode_edit_object (scg, so);
return FALSE;
}
static gint
cb_view_activated (BonoboViewFrame *view_frame, gboolean activated, GtkObject *so_view)
{
SheetControlGUI *scg = sheet_object_view_control (so_view);
if (activated) {
if (scg->active_object_frame != NULL) {
g_warning ("View requested to be activated but there is already "
"an active View!\n");
return FALSE;
}
/*
* Otherwise, uncover it so that it can receive
* events, and set it as the active View.
*/
bonobo_view_frame_set_covered (view_frame, FALSE);
scg->active_object_frame = view_frame;
} else {
/*
* If the View is asking to be deactivated, always
* oblige. We may have already deactivated it (see
* user_activation_request_cb), but there's no harm in
* doing it again. There is always the possibility
* that a View will ask to be deactivated when we have
* not told it to deactivate itself, and that is
* why we cover the view here.
*/
bonobo_view_frame_set_covered (view_frame, TRUE);
if (view_frame == scg->active_object_frame)
scg->active_object_frame = NULL;
}
return FALSE;
}
static void
sheet_object_container_destroy (GtkObject *object)
{
SheetObjectBonobo *sob = SHEET_OBJECT_BONOBO (object);
if (sob != NULL && sob->client_site != NULL) {
bonobo_object_unref (BONOBO_OBJECT (sob->client_site));
sob->client_site = NULL;
sob->object_server = NULL;
}
(*GTK_OBJECT_CLASS(sheet_object_container_parent_class)->destroy) (object);
GTK_OBJECT_CLASS (sheet_object_container_parent_class)->destroy (object);
}
static GtkObject *
......@@ -109,12 +58,13 @@ sheet_object_container_new_view (SheetObject *so, SheetControlGUI *scg)
GtkWidget *view_widget;
GnomeCanvasItem *view_item;
g_return_val_if_fail (IS_SHEET_OBJECT_CONTAINER (so), NULL);
soc = SHEET_OBJECT_CONTAINER (so);
view_frame = bonobo_client_site_new_view (
SHEET_OBJECT_BONOBO (so)->client_site,
bonobo_ui_component_get_container (scg->wbcg->uic));
if (!view_frame) {
g_warning ("Component died");
return NULL;
......@@ -127,10 +77,10 @@ sheet_object_container_new_view (SheetObject *so, SheetControlGUI *scg)
"widget", view_widget,
"size_pixels", FALSE,
NULL);
gtk_object_set_data (GTK_OBJECT (view_item), "view_frame", view_frame);
gtk_signal_connect (GTK_OBJECT (view_frame), "user_activate",
GTK_SIGNAL_FUNC (cb_user_activation_request), view_item);
gtk_signal_connect (GTK_OBJECT (view_frame), "activated",
GTK_SIGNAL_FUNC (cb_view_activated), view_item);
GTK_SIGNAL_FUNC (cb_user_activation_request),
view_item);
scg_object_widget_register (so, view_widget, view_item);
gtk_widget_show (view_widget);
......@@ -144,7 +94,7 @@ sheet_object_container_new_view (SheetObject *so, SheetControlGUI *scg)
*/
static void
sheet_object_container_update_bounds (SheetObject *so, GtkObject *view,
SheetControlGUI *scg)
SheetControlGUI *scg)
{
double coords [4];
......@@ -157,27 +107,20 @@ sheet_object_container_update_bounds (SheetObject *so, GtkObject *view,
NULL);
}
static void
sheet_object_container_set_active (SheetObject *so, gboolean val)
{
GList *l;
for (l = so->realized_list; l; l = l->next){
}
}
static void
sheet_object_container_class_init (GtkObjectClass *object_class)
{
SheetObjectClass *so_class = SHEET_OBJECT_CLASS (object_class);
SheetObjectClass *so_class;
sheet_object_container_parent_class = gtk_type_class (sheet_object_get_type ());
sheet_object_container_parent_class = gtk_type_class (SHEET_OBJECT_BONOBO_TYPE);
/* SheetObject class method overrides */
/* GtkObject class method overrides */
object_class->destroy = sheet_object_container_destroy;
so_class->new_view = sheet_object_container_new_view;
/* SheetObject class method overrides */
so_class = SHEET_OBJECT_CLASS (object_class);
so_class->new_view = sheet_object_container_new_view;
so_class->update_bounds = sheet_object_container_update_bounds;
so_class->set_active = sheet_object_container_set_active;
}
SheetObject *
......@@ -202,6 +145,7 @@ sheet_object_container_new_object (Sheet *sheet, const char *object_id)
SheetObject *
sheet_object_container_new_file (Sheet *sheet, const char *fname)
{
CORBA_Environment ev;
SheetObject *so = NULL;
char *msg;
char *iid;
......@@ -218,8 +162,18 @@ sheet_object_container_new_file (Sheet *sheet, const char *fname)
if (so == NULL) {
msg = g_strdup_printf (_("can't create object for '%s'"), iid);
gnome_dialog_run_and_close (GNOME_DIALOG (gnome_error_dialog (msg)));
} else
sheet_object_bonobo_load_file (SHEET_OBJECT_BONOBO (so), fname);
} else {
CORBA_exception_init (&ev);
sheet_object_bonobo_load_file (SHEET_OBJECT_BONOBO (so),
fname, &ev);
if (BONOBO_EX (&ev)) {
msg = g_strdup_printf (
_("Could not load file: %s"),
bonobo_exception_get_text (&ev));
gnome_dialog_run_and_close (GNOME_DIALOG (gnome_error_dialog (msg)));
}
CORBA_exception_free (&ev);
}
g_free (iid);
} else
gnome_dialog_run_and_close (GNOME_DIALOG (gnome_error_dialog (msg)));
......@@ -229,5 +183,5 @@ sheet_object_container_new_file (Sheet *sheet, const char *fname)
return so;
}
E_MAKE_TYPE (sheet_object_container, "SheetObjectItem", SheetObjectContainer,
sheet_object_container_class_init, NULL, SHEET_OBJECT_BONOBO_TYPE);
E_MAKE_TYPE (sheet_object_container, "SheetObjectContainer", SheetObjectContainer,
sheet_object_container_class_init, NULL, SHEET_OBJECT_BONOBO_TYPE);
......@@ -12,15 +12,14 @@
#define SHEET_OBJECT_CONTAINER_TYPE (sheet_object_container_get_type ())
#define SHEET_OBJECT_CONTAINER(obj) (GTK_CHECK_CAST((obj), SHEET_OBJECT_CONTAINER_TYPE, SheetObjectContainer))
#define SHEET_OBJECT_CONTAINER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SHEET_OBJECT_CONTAINER_TYPE, SheetObjectContainerClass))
#define IS_SHEET_CONTAINER_OBJECT(o) (GTK_CHECK_TYPE((o), SHEET_OBJECT_CONTAINER_TYPE))
#define IS_SHEET_OBJECT_CONTAINER(o) (GTK_CHECK_TYPE((o), SHEET_OBJECT_CONTAINER_TYPE))
typedef struct {
SheetObjectBonobo parent_object;
BonoboViewFrame *view_frame;
SheetObjectBonobo parent_object;
} SheetObjectContainer;
typedef struct {
SheetObjectClass parent_class;
SheetObjectBonoboClass parent_class;
} SheetObjectContainerClass;
/*
......