PersistStream typing changes



There are three parts to this diff: the IDL changes to bonobo-persist,
the corresponding code changes to bonobo-persist.c and
bonobo-persist-stream.c, and then a whole lot of changes to calls to
Bonobo_PersistStream_{load,save}.

This is presumably going to break many things outside of Bonobo as
well. Given that, is there anything else we want to break at the same
time? :)

Index: idl/bonobo-persist.idl
===================================================================
RCS file: /cvs/gnome/bonobo/idl/bonobo-persist.idl,v
retrieving revision 1.14
diff -u -r1.14 bonobo-persist.idl
--- idl/bonobo-persist.idl	2000/05/05 13:37:16	1.14
+++ idl/bonobo-persist.idl	2000/05/24 16:54:41
@@ -17,26 +17,17 @@
 		exception WrongDataType {};
 		exception FileNotFound {};
 
-		typedef string               StreamType;
-		typedef sequence<StreamType> StreamTypeList;
+		typedef string                ContentType;
+		typedef sequence<ContentType> ContentTypeList;
 		
 		/**
 		 * get_types:
 		 *
 		 *  Gets a list of supported mime types that this
-		 * persistor can cope with. The default / preferred
-		 * type being the first element.
+		 * persistor can save its data in. The default /
+		 * preferred type being the first element.
 		 */
-/*		StreamTypeList get_types ();*/
-
-		/**
-		 * type:
-		 *
-		 *  Determines the content type of the stream about to
-		 * be passed.
-		 */
-/*		void       set_type (in StreamType type);
-		StreamType get_type ();*/
+		ContentTypeList get_content_types ();
 	};
 	
 	/*
@@ -150,18 +141,24 @@
 		/**
 		 * load:
 		 * @stream: Where to load the state from
+		 * @type: the MIME content type of the data, or "*"
+		 * if it is unknown.
 		 *
 		 * Loads the status of the object from @stream
 		 */
-		void load (in Bonobo::Stream stream) raises (WrongDataType);
+		void load (in Bonobo::Stream stream, in ContentType type)
+			raises (WrongDataType);
 
 		/**
 		 * save:
 		 * @stream: Where to save the state to.
+		 * @type: the MIME content type to save the data in,
+		 * or "*" if any type is acceptable.
 		 *
 		 * Saves the state of the object to the @stream
 		 */
-		void save (in Bonobo::Stream stream);
+		void save (in Bonobo::Stream stream, in ContentType type)
+			raises (WrongDataType);
 
 		/**
 		 * get_size_max:

Index: bonobo/bonobo-persist-stream.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-persist-stream.c,v
retrieving revision 1.27
diff -u -r1.27 bonobo-persist-stream.c
--- bonobo/bonobo-persist-stream.c	2000/04/28 21:48:16	1.27
+++ bonobo/bonobo-persist-stream.c	2000/05/24 16:54:40
@@ -31,6 +31,7 @@
 static void
 impl_load (PortableServer_Servant servant,
 	   Bonobo_Stream stream,
+	   Bonobo_Persist_ContentType type,
 	   CORBA_Environment *ev)
 {
 	BonoboObject *object = bonobo_object_from_servant (servant);
@@ -38,12 +39,12 @@
 	int result;
 	
 	if (ps->load_fn != NULL)
-		result = (*ps->load_fn)(ps, stream, ps->closure);
+		result = (*ps->load_fn)(ps, stream, type, ps->closure);
 	else {
 		GtkObjectClass *oc = GTK_OBJECT (ps)->klass;
 		BonoboPersistStreamClass *class = BONOBO_PERSIST_STREAM_CLASS (oc);
 		
-		result = (*class->load)(ps, stream);
+		result = (*class->load)(ps, stream, type);
 	}
 	if (result != 0){
 		g_warning ("FIXME: should report an exception");
@@ -53,6 +54,7 @@
 static void
 impl_save (PortableServer_Servant servant,
 	   Bonobo_Stream stream,
+	   Bonobo_Persist_ContentType type,
 	   CORBA_Environment *ev)
 {
 	BonoboObject *object = bonobo_object_from_servant (servant);
@@ -60,12 +62,12 @@
 	int result;
 	
 	if (ps->save_fn != NULL)
-		result = (*ps->save_fn)(ps, stream, ps->closure);
+		result = (*ps->save_fn)(ps, stream, type, ps->closure);
 	else {
 		GtkObjectClass *oc = GTK_OBJECT (ps)->klass;
 		BonoboPersistStreamClass *class = BONOBO_PERSIST_STREAM_CLASS (oc);
 		
-		result = (*class->save)(ps, stream);
+		result = (*class->save)(ps, stream, type);
 	}
 	
 	if (result != 0){
Index: bonobo/bonobo-persist-stream.h
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-persist-stream.h,v
retrieving revision 1.14
diff -u -r1.14 bonobo-persist-stream.h
--- bonobo/bonobo-persist-stream.h	2000/05/02 20:48:55	1.14
+++ bonobo/bonobo-persist-stream.h	2000/05/24 16:54:40
@@ -16,9 +16,11 @@
 typedef struct _BonoboPersistStreamPrivate BonoboPersistStreamPrivate;
 
 
-typedef int        (*BonoboPersistStreamIOFn)  (BonoboPersistStream *ps,
-						const Bonobo_Stream  stream,
-						void                *closure);
+typedef int   (*BonoboPersistStreamIOFn) (BonoboPersistStream         *ps,
+					  const Bonobo_Stream         stream,
+					  Bonobo_Persist_ContentType  type,
+					  void                       *closure);
+
 typedef CORBA_long (*BonoboPersistStreamMaxFn) (BonoboPersistStream *ps,
 						void                *closure);
 
@@ -46,10 +48,12 @@
 	/*
 	 * methods
 	 */
-	int        (*load)         (BonoboPersistStream *ps,
-				    Bonobo_Stream        stream);
-	int        (*save)         (BonoboPersistStream *ps,
-				    Bonobo_Stream        stream);
+	int        (*load)         (BonoboPersistStream        *ps,
+				    Bonobo_Stream              stream,
+				    Bonobo_Persist_ContentType type);
+	int        (*save)         (BonoboPersistStream        *ps,
+				    Bonobo_Stream              stream,
+				    Bonobo_Persist_ContentType type);
 	CORBA_long (*get_size_max) (BonoboPersistStream *ps);
 } BonoboPersistStreamClass;
 
Index: bonobo/bonobo-persist.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-persist.c,v
retrieving revision 1.16
diff -u -r1.16 bonobo-persist.c
--- bonobo/bonobo-persist.c	2000/02/16 10:27:55	1.16
+++ bonobo/bonobo-persist.c	2000/05/24 16:54:40
@@ -15,6 +15,23 @@
 /* Parent GTK object class */
 static BonoboObjectClass *bonobo_persist_parent_class;
 
+#define CLASS(o) BONOBO_PERSIST_CLASS(GTK_OBJECT(o)->klass)
+
+static inline BonoboPersist *
+bonobo_persist_from_servant (PortableServer_Servant servant)
+{
+	return BONOBO_PERSIST (bonobo_object_from_servant (servant));
+}
+
+static Bonobo_Persist_ContentTypeList *
+impl_get_content_types (PortableServer_Servant	servant,
+			CORBA_Environment	*ev)
+{
+	BonoboPersist *persist = bonobo_persist_from_servant (servant);
+
+	return CLASS (persist)->get_content_types (persist, ev);
+}
+
 /**
  * bonobo_persist_get_epv:
  */
@@ -24,6 +41,8 @@
 	POA_Bonobo_Persist__epv *epv;
 
 	epv = g_new0 (POA_Bonobo_Persist__epv, 1);
+
+	epv->get_content_types = impl_get_content_types;
 
 	return epv;
 }
Index: bonobo/bonobo-persist.h
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-persist.h,v
retrieving revision 1.14
diff -u -r1.14 bonobo-persist.h
--- bonobo/bonobo-persist.h	2000/01/25 11:35:43	1.14
+++ bonobo/bonobo-persist.h	2000/05/24 16:54:40
@@ -22,6 +22,9 @@
 
 typedef struct {
 	BonoboObjectClass parent_class;
+
+	Bonobo_Persist_ContentTypeList * (*get_content_types) (BonoboPersist *persist,
+							       CORBA_Environment *ev);
 } BonoboPersistClass;
 
 GtkType       bonobo_persist_get_type  (void);

Index: bonobo/bonobo-object-client.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object-client.c,v
retrieving revision 1.35
diff -u -r1.35 bonobo-object-client.c
--- bonobo/bonobo-object-client.c	2000/04/28 18:15:14	1.35
+++ bonobo/bonobo-object-client.c	2000/05/24 16:54:40
@@ -219,7 +219,7 @@
 				Bonobo_PersistStream_load (
 					(Bonobo_PersistStream) persist,
 					bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
-					&ev);
+					"*", &ev);
 				
 				if (ev._major != CORBA_NO_EXCEPTION)
 					rtn = CORBA_OBJECT_NIL;
Index: bonobo/bonobo-object-io.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-object-io.c,v
retrieving revision 1.7
diff -u -r1.7 bonobo-object-io.c
--- bonobo/bonobo-object-io.c	2000/02/16 10:27:55	1.7
+++ bonobo/bonobo-object-io.c	2000/05/24 16:54:40
@@ -118,7 +118,7 @@
 
 	bonobo_persist_stream_save_goad_id (target, goad_id, &ev);
 
-	Bonobo_PersistStream_save (pstream, target, &ev);
+	Bonobo_PersistStream_save (pstream, target, "*", &ev);
 	if (ev._major != CORBA_NO_EXCEPTION){
 		CORBA_exception_free (&ev);
 		return GNOME_IOERR_GENERAL;
Index: bonobo/bonobo-property-bag-client.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-property-bag-client.c,v
retrieving revision 1.12
diff -u -r1.12 bonobo-property-bag-client.c
--- bonobo/bonobo-property-bag-client.c	2000/05/10 18:24:55	1.12
+++ bonobo/bonobo-property-bag-client.c	2000/05/24 16:54:40
@@ -263,7 +263,7 @@
 		return;
 	}
 
-	Bonobo_PersistStream_save (persist, stream, &ev);
+	Bonobo_PersistStream_save (persist, stream, "*", &ev);
 
 	if (ev._major != CORBA_NO_EXCEPTION) {
 		g_warning ("BonoboPropertyBagClient: Exception caught while persisting "
@@ -315,7 +315,7 @@
 		return;
 	}
 
-	Bonobo_PersistStream_load (persist, stream, &ev);
+	Bonobo_PersistStream_load (persist, stream, "*", &ev);
 
 	if (ev._major != CORBA_NO_EXCEPTION) {
 		g_warning ("BonoboPropertyBagClient: Exception caught while persisting "
Index: bonobo/test-container-autoload.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/test-container-autoload.c,v
retrieving revision 1.29
diff -u -r1.29 test-container-autoload.c
--- bonobo/test-container-autoload.c	2000/04/28 21:48:17	1.29
+++ bonobo/test-container-autoload.c	2000/05/24 16:54:40
@@ -131,7 +131,7 @@
 		return;
 	}
 
-	Bonobo_PersistStream_load (persist, stream_obj, &ev);
+	Bonobo_PersistStream_load (persist, stream_obj, "*", &ev);
         if (ev._major != CORBA_NO_EXCEPTION)
 		g_print ("The bonobo object failed to load the file %s\n",
 			 filename);
@@ -211,7 +211,7 @@
 	view_frame = bonobo_client_site_new_view (client_site, CORBA_OBJECT_NIL);
 	view_widget = bonobo_view_frame_get_wrapper (view_frame);
 
-	frame = gtk_frame_new (view_widget);
+	frame = gtk_frame_new (od_server_info_get_name (server_info));
 	gtk_widget_show (frame);
 	gtk_box_pack_start (GTK_BOX (app->box), frame, TRUE, TRUE, 0);
 
Index: bonobo/test-container.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/test-container.c,v
retrieving revision 1.56
diff -u -r1.56 test-container.c
--- bonobo/test-container.c	2000/04/28 21:48:18	1.56
+++ bonobo/test-container.c	2000/05/24 16:54:41
@@ -307,7 +307,7 @@
 	
 	Bonobo_PersistStream_load (
 		persist,
-		(Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), &ev);
+		(Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), "*", &ev);
 
 	Bonobo_Unknown_unref  (persist, &ev);
 	CORBA_Object_release (persist, &ev);
@@ -351,7 +351,7 @@
 	
 	Bonobo_PersistStream_load (
 		persist,
-		(Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), &ev);
+		(Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), "*", &ev);
 
 	Bonobo_Unknown_unref (persist, &ev);
 	CORBA_Object_release (persist, &ev);
@@ -591,7 +591,7 @@
 	}
 	
 	Bonobo_PersistStream_load (
-	     persist, (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), &ev);
+	     persist, (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)), "*", &ev);
 
 	Bonobo_Unknown_unref (persist, &ev);
 	CORBA_Object_release (persist, &ev);
Index: gshell/inout.c
===================================================================
RCS file: /cvs/gnome/bonobo/gshell/inout.c,v
retrieving revision 1.12
diff -u -r1.12 inout.c
--- gshell/inout.c	2000/04/29 22:04:11	1.12
+++ gshell/inout.c	2000/05/24 16:54:41
@@ -141,7 +141,7 @@
 
 	Bonobo_PersistStream_save (persist,
 	     (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
-				  &ev);
+				  "*", &ev);
 
 	if (ev._major != CORBA_NO_EXCEPTION) {
 		gnome_warning_dialog (_("An exception occured while trying "
@@ -190,7 +190,7 @@
 
 	Bonobo_PersistStream_load (persist,
 	   (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
-				  &ev);
+				  "*", &ev);
 
 	if (ev._major != CORBA_NO_EXCEPTION) {
 		gnome_warning_dialog (_("An exception occured while trying "
Index: samples/compound-doc/container/component-io.c
===================================================================
RCS file: /cvs/gnome/bonobo/samples/compound-doc/container/component-io.c,v
retrieving revision 1.2
diff -u -r1.2 component-io.c
--- samples/compound-doc/container/component-io.c	2000/05/22 16:48:27	1.2
+++ samples/compound-doc/container/component-io.c	2000/05/24 16:54:42
@@ -38,7 +38,7 @@
 
 	CORBA_exception_init (&ev);
 
-	Bonobo_PersistStream_load (persist, corba_stream, &ev);
+	Bonobo_PersistStream_load (persist, corba_stream, "*", &ev);
 
 	/* See if we had any problems */
 	if (ev._major != CORBA_NO_EXCEPTION)
@@ -72,7 +72,7 @@
 
 	CORBA_exception_init (&ev);
 
-	Bonobo_PersistStream_save (persist, corba_stream, &ev);
+	Bonobo_PersistStream_save (persist, corba_stream, "*", &ev);
 
 	/* See if we had any problems */
 	if (ev._major != CORBA_NO_EXCEPTION) {
Index: samples/compound-doc/container/component.c
===================================================================
RCS file: /cvs/gnome/bonobo/samples/compound-doc/container/component.c,v
retrieving revision 1.3
diff -u -r1.3 component.c
--- samples/compound-doc/container/component.c	2000/05/22 16:48:27	1.3
+++ samples/compound-doc/container/component.c	2000/05/24 16:54:42
@@ -410,7 +410,8 @@
 		Bonobo_PersistStream_load (persist,
 					   (Bonobo_Stream)
 					   bonobo_object_corba_objref
-					   (BONOBO_OBJECT (stream)), &ev);
+					   (BONOBO_OBJECT (stream)),
+					   "*", &ev);
 
 		if (ev._major != CORBA_NO_EXCEPTION) {
 			gnome_warning_dialog (_




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