"system_exception"s ...




Hi,

	As I pour over the source code for the components I notice a
recurring theme:

gtk_signal_connect (GTK_OBJECT (embeddable), "system_exception",
                    GTK_SIGNAL_FUNC (embeddable_system_exception_cb),
                    embeddable_data);
...
static void
embeddable_system_exception_cb (GnomeEmbeddable *embeddable, CORBA_Object
corba_object,
				CORBA_Environment *ev, gpointer data)
{
	gnome_object_destroy (GNOME_OBJECT (embeddable));
}

	Over and over again, both for the embeddable and the view. Hence I
was thinking that if we add a default "system_exception" handler to
gnome-object that destroys the object we might save code. This sounds like
a dangerous strategy to me inasmuch that there might be all manner of
referencing of this object that I don't know about. So; perhaps it is
better simply to put this code in GnomeEmbeddable and GnomeView ?

	Anyhow, here is a patch to GnomeObject: ( also some 'class'
variables had krept in uninvited); untested, half-witted etc.

Index: gnome-object.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/gnome-object.c,v
retrieving revision 1.48
diff -u -r1.48 gnome-object.c
--- gnome-object.c	1999/12/10 06:35:42	1.48
+++ gnome-object.c	1999/12/11 17:10:52
@@ -297,10 +297,17 @@
 }
 
 static void
-gnome_object_class_init (GnomeObjectClass *class)
+gnome_object_system_exception (GnomeObject *object, CORBA_Object
corba_object,
+			       CORBA_Environment *ev)
 {
-	GtkObjectClass *object_class = (GtkObjectClass *) class;
+	gnome_object_destroy (object);
+}
 
+static void
+gnome_object_class_init (GnomeObjectClass *klass)
+{
+	GtkObjectClass *object_class = (GtkObjectClass *) klass;
+
 	gnome_object_parent_class = gtk_type_class (gtk_object_get_type
());
 
 	gnome_object_signals [QUERY_INTERFACE] =
@@ -328,7 +335,8 @@
 
 	gtk_object_class_add_signals (object_class, gnome_object_signals,
LAST_SIGNAL);
 
-	object_class->destroy = gnome_object_object_destroy;
+	object_class->destroy   = gnome_object_object_destroy;
+	klass->system_exception = gnome_object_system_exception;
 
 	init_object_corba_class ();
 }

	I really have no idea if this is a good idea.

	Regards,

		Michael.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]