Re: PersistStream typing changes
- From: Dan Winship <danw helixcode com>
- To: gnome-components-list gnome org
- Subject: Re: PersistStream typing changes
- Date: Wed, 24 May 2000 22:09:09 -0400
OK, ignore that last diff. Here's a new one.
This additionally makes PersistStream deal with exceptions in a useful
manner, rather than not at all like it currently does. And fixes a few
small bugs and kills some warnings. There's one warning left in
bonobo, which someone may want to ponder:
bonobo-uih-toolbar.c:2309: warning: `toolbar_item_remote_get_pos' defined but not used
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.390
diff -u -r1.390 ChangeLog
--- ChangeLog 2000/05/23 22:34:03 1.390
+++ ChangeLog 2000/05/25 02:02:15
@@ -1,3 +1,52 @@
+2000-05-24 Dan Winship <danw@helixcode.com>
+
+ * idl/bonobo-persist.idl: rename StreamType and StreamTypeList to
+ ContentType and ContentTypeList. Remove unused get_types,
+ get_type, and set_type methods. Add Persist::get_content_types.
+ Add a ContentType parameter to PersistStream::load and ::save
+
+ * bonobo/bonobo-persist.[ch] (bonobo_persist_from_servant): New
+ function.
+ (impl_get_content_types): Default implementation for
+ Bonobo::Persist::get_content_types.
+ (bonobo_persist_generate_content_type): CORBA ickiness wrapper
+ helper function.
+
+ * bonobo/bonobo-persist-stream.[ch] (impl_load, impl_save,
+ impl_get_size_max, bonobo_persist_stream_nop): Update for
+ interface changes.
+ (bonobo_persist_stream_size_unknown): Replacement for
+ bonobo_persist_stream_zero that was supposed to have been
+ committed long ago.
+ (get_content_types): default implementation.
+ (bonobo_persist_stream_class_init,
+ bonobo_persist_stream_construct, bonobo_persist_stream_new):
+ Update to use additional function pointers for better overriding
+ action.
+
+ * gshell/inout.c (buffer_save_ps, buffer_load_ps):
+ * bonobo/test-container.c (add_image_cmd, add_pdf_cmd,
+ add_text_cmd):
+ * bonobo/bonobo-property-bag-client.c
+ (bonobo_property_bag_client_persist,
+ bonobo_property_bag_client_depersist):
+ * bonobo/bonobo-object-io.c (bonobo_persiststream_save_to_stream):
+ * bonobo/bonobo-object-client.c (bonobo_object_restore_from_url):
+ Update for Bonobo_PersistStream_{load,save} change.
+
+ * components/text-plain/bonobo-text-plain.c (stream_read,
+ pstream_load, pstream_save, pstream_get_max_size,
+ pstream_get_content_types):
+ * components/audio-ulaw/bonobo-audio-ulaw.c (pstream_load,
+ pstream_save, pstream_get_max_size, pstream_get_content_types):
+ Update for PersistStream changes.
+
+ * bonobo/test-container-autoload.c (hydrate_object_from_file_cb):
+ (add_object_to_container): Fix a bug in the GOAD->OAF conversion
+
+ * bonobo/bonobo-ui-handler.c (path_escape_forward_slashes): const
+ poisoning
+
2000-05-23 Mike Kestner <mkestner@ameritech.net>
* bonobo/bonobo-uih-toolbar.c (toolbar_toplevel_item_create_widgets):
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/25 02:02:15
@@ -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/25 02:02:15
@@ -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-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/25 02:02:15
@@ -31,46 +31,40 @@
static void
impl_load (PortableServer_Servant servant,
Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
CORBA_Environment *ev)
{
BonoboObject *object = bonobo_object_from_servant (servant);
BonoboPersistStream *ps = BONOBO_PERSIST_STREAM (object);
- int result;
if (ps->load_fn != NULL)
- result = (*ps->load_fn)(ps, stream, ps->closure);
+ (*ps->load_fn)(ps, stream, type, ps->closure, ev);
else {
GtkObjectClass *oc = GTK_OBJECT (ps)->klass;
BonoboPersistStreamClass *class = BONOBO_PERSIST_STREAM_CLASS (oc);
- result = (*class->load)(ps, stream);
+ (*class->load)(ps, stream, type, ev);
}
- if (result != 0){
- g_warning ("FIXME: should report an exception");
- }
}
static void
impl_save (PortableServer_Servant servant,
Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
CORBA_Environment *ev)
{
BonoboObject *object = bonobo_object_from_servant (servant);
BonoboPersistStream *ps = BONOBO_PERSIST_STREAM (object);
- int result;
if (ps->save_fn != NULL)
- result = (*ps->save_fn)(ps, stream, ps->closure);
+ (*ps->save_fn)(ps, stream, type, ps->closure, ev);
else {
GtkObjectClass *oc = GTK_OBJECT (ps)->klass;
BonoboPersistStreamClass *class = BONOBO_PERSIST_STREAM_CLASS (oc);
- result = (*class->save)(ps, stream);
- }
-
- if (result != 0){
- g_warning ("FIXME: should report an exception");
+ (*class->save)(ps, stream, type, ev);
}
+
ps->is_dirty = FALSE;
}
@@ -83,10 +77,10 @@
BonoboPersistStreamClass *class = BONOBO_PERSIST_STREAM_CLASS (oc);
- if (ps->get_size_max_fn != NULL)
- return (*ps->get_size_max_fn)(ps, ps->closure);
+ if (ps->max_fn != NULL)
+ return (*ps->max_fn)(ps, ps->closure, ev);
- return (*class->get_size_max)(BONOBO_PERSIST_STREAM (object));
+ return (*class->get_size_max)(BONOBO_PERSIST_STREAM (object), ev);
}
/**
@@ -116,22 +110,37 @@
bonobo_persist_stream_vepv.Bonobo_PersistStream_epv = bonobo_persist_stream_get_epv ();
}
-static int
-bonobo_persist_stream_nop (BonoboPersistStream *ps, Bonobo_Stream stream)
+static void
+bonobo_persist_stream_nop (BonoboPersistStream *ps, Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ CORBA_Environment *ev)
{
- /* Nothing: just return success */
- return 0;
+ /* Nothing */
}
static CORBA_long
-bonobo_persist_stream_zero (BonoboPersistStream *ps)
+bonobo_persist_stream_size_unknown (BonoboPersistStream *ps,
+ CORBA_Environment *ev)
+{
+ return -1;
+}
+
+static Bonobo_Persist_ContentTypeList *
+get_content_types (BonoboPersist *persist, CORBA_Environment *ev)
{
- return 0;
+ BonoboPersistStream *ps = BONOBO_PERSIST_STREAM (persist);
+
+ if (ps->types_fn)
+ return ps->types_fn (ps, ps->closure, ev);
+ else
+ return bonobo_persist_generate_content_types (1, "*");
}
static void
bonobo_persist_stream_class_init (BonoboPersistStreamClass *klass)
{
+ BonoboPersistClass *persist_class = BONOBO_PERSIST_CLASS (klass);
+
bonobo_persist_stream_parent_class = gtk_type_class (bonobo_persist_get_type ());
/*
@@ -140,8 +149,10 @@
klass->save = bonobo_persist_stream_nop;
klass->load = bonobo_persist_stream_nop;
- klass->get_size_max = bonobo_persist_stream_zero;
+ klass->get_size_max = bonobo_persist_stream_size_unknown;
+ persist_class->get_content_types = get_content_types;
+
init_persist_stream_corba_class ();
}
@@ -196,10 +207,12 @@
*/
BonoboPersistStream *
bonobo_persist_stream_construct (BonoboPersistStream *ps,
- Bonobo_PersistStream corba_ps,
- BonoboPersistStreamIOFn load_fn,
- BonoboPersistStreamIOFn save_fn,
- void *closure)
+ Bonobo_PersistStream corba_ps,
+ BonoboPersistStreamIOFn load_fn,
+ BonoboPersistStreamIOFn save_fn,
+ BonoboPersistStreamMaxFn max_fn,
+ BonoboPersistStreamTypesFn types_fn,
+ void *closure)
{
g_return_val_if_fail (ps != NULL, NULL);
g_return_val_if_fail (BONOBO_IS_PERSIST_STREAM (ps), NULL);
@@ -209,6 +222,8 @@
ps->load_fn = load_fn;
ps->save_fn = save_fn;
+ ps->max_fn = max_fn;
+ ps->types_fn = types_fn;
ps->closure = closure;
return ps;
@@ -241,20 +256,23 @@
* bonobo_persist_stream_new:
* @load_fn: Loading routine
* @save_fn: Saving routine
+ * @max_fn: get_max_size routine
+ * @types_fn: get_content_types routine
* @closure: Data passed to IO routines.
*
- * Creates a new BonoboPersistStream object. The load and save
- * operations for the object are performed by the provided @load_fn
- * and @save_fn callback functions, which are passed @closure when
- * they are invoked. If either @load_fn or @save_fn is %NULL, the
- * corresponding operation is performed by the class load and save
- * routines.
+ * Creates a new BonoboPersistStream object. The various operations
+ * for the object are performed by the provided callback functions,
+ * which are passed @closure when they are invoked. If any callback is
+ * %NULL, the corresponding operation is performed by the class load
+ * and save routines.
*
* Returns: the newly-created BonoboPersistStream object.
*/
BonoboPersistStream *
bonobo_persist_stream_new (BonoboPersistStreamIOFn load_fn,
BonoboPersistStreamIOFn save_fn,
+ BonoboPersistStreamMaxFn max_fn,
+ BonoboPersistStreamTypesFn types_fn,
void *closure)
{
BonoboPersistStream *ps;
@@ -268,7 +286,8 @@
return NULL;
}
- bonobo_persist_stream_construct (ps, corba_ps, load_fn, save_fn, closure);
+ bonobo_persist_stream_construct (ps, corba_ps, load_fn, save_fn,
+ max_fn, types_fn, closure);
return ps;
}
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/25 02:02:15
@@ -16,11 +16,19 @@
typedef struct _BonoboPersistStreamPrivate BonoboPersistStreamPrivate;
-typedef int (*BonoboPersistStreamIOFn) (BonoboPersistStream *ps,
- const Bonobo_Stream stream,
- void *closure);
+typedef void (*BonoboPersistStreamIOFn) (BonoboPersistStream *ps,
+ const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ void *closure,
+ CORBA_Environment *ev);
+
typedef CORBA_long (*BonoboPersistStreamMaxFn) (BonoboPersistStream *ps,
- void *closure);
+ void *closure,
+ CORBA_Environment *ev);
+
+typedef Bonobo_Persist_ContentTypeList * (*BonoboPersistStreamTypesFn) (BonoboPersistStream *ps,
+ void *closure,
+ CORBA_Environment *ev);
struct _BonoboPersistStream {
BonoboPersist persist;
@@ -28,12 +36,13 @@
gboolean is_dirty;
/*
- * For the sample routines, NULL if we use the ::save and ::load
+ * For the sample routines, NULL if we use the
* methods from the class
*/
- BonoboPersistStreamIOFn save_fn;
- BonoboPersistStreamIOFn load_fn;
- BonoboPersistStreamMaxFn get_size_max_fn;
+ BonoboPersistStreamIOFn save_fn;
+ BonoboPersistStreamIOFn load_fn;
+ BonoboPersistStreamMaxFn max_fn;
+ BonoboPersistStreamTypesFn types_fn;
void *closure;
@@ -46,11 +55,19 @@
/*
* methods
*/
- int (*load) (BonoboPersistStream *ps,
- Bonobo_Stream stream);
- int (*save) (BonoboPersistStream *ps,
- Bonobo_Stream stream);
- CORBA_long (*get_size_max) (BonoboPersistStream *ps);
+ void (*load) (BonoboPersistStream *ps,
+ Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ CORBA_Environment *ev);
+ void (*save) (BonoboPersistStream *ps,
+ Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ CORBA_Environment *ev);
+ CORBA_long (*get_size_max) (BonoboPersistStream *ps,
+ CORBA_Environment *ev);
+ Bonobo_Persist_ContentTypeList * (*get_content_types) (BonoboPersistStream *ps,
+ CORBA_Environment *ev);
+
} BonoboPersistStreamClass;
GtkType bonobo_persist_stream_get_type (void);
@@ -59,11 +76,15 @@
BonoboPersistStream *bonobo_persist_stream_new (BonoboPersistStreamIOFn load_fn,
BonoboPersistStreamIOFn save_fn,
+ BonoboPersistStreamMaxFn max_fn,
+ BonoboPersistStreamTypesFn types_fn,
void *closure);
BonoboPersistStream *bonobo_persist_stream_construct (BonoboPersistStream *ps,
Bonobo_PersistStream corba_ps,
BonoboPersistStreamIOFn load_fn,
BonoboPersistStreamIOFn save_fn,
+ BonoboPersistStreamMaxFn max_fn,
+ BonoboPersistStreamTypesFn types_fn,
void *closure);
POA_Bonobo_PersistStream__epv *bonobo_persist_stream_get_epv (void);
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/25 02:02:15
@@ -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:
*/
@@ -25,6 +42,8 @@
epv = g_new0 (POA_Bonobo_Persist__epv, 1);
+ epv->get_content_types = impl_get_content_types;
+
return epv;
}
@@ -100,4 +119,33 @@
return type;
}
+/**
+ * bonobo_persist_generate_content_types:
+ * @num: the number of content types specified
+ * @...: the content types (as strings)
+ *
+ * Returns: a ContentTypeList containing the given ContentTypes
+ **/
+Bonobo_Persist_ContentTypeList *
+bonobo_persist_generate_content_types (int num, ...)
+{
+ Bonobo_Persist_ContentTypeList *types;
+ va_list ap;
+ char *type;
+ int i;
+
+ types = Bonobo_Persist_ContentTypeList__alloc ();
+ CORBA_sequence_set_release (types, TRUE);
+ types->_length = types->_maximum = num;
+ types->_buffer = CORBA_sequence_Bonobo_Persist_ContentType_allocbuf (num);
+
+ va_start (ap, num);
+ for (i = 0; i < num; i++) {
+ type = va_arg (ap, char *);
+ types->_buffer[i] = CORBA_string_alloc (strlen (type) + 1);
+ strcpy (types->_buffer[i], type);
+ }
+ va_end (ap);
+ return types;
+}
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/25 02:02:15
@@ -22,11 +22,17 @@
typedef struct {
BonoboObjectClass parent_class;
+
+ Bonobo_Persist_ContentTypeList * (*get_content_types) (BonoboPersist *persist,
+ CORBA_Environment *ev);
} BonoboPersistClass;
GtkType bonobo_persist_get_type (void);
BonoboPersist *bonobo_persist_construct (BonoboPersist *persist,
- Bonobo_Persist corba_persist);
+ Bonobo_Persist corba_persist);
+
+Bonobo_Persist_ContentTypeList *bonobo_persist_generate_content_types (int num,
+ ...);
POA_Bonobo_Persist__epv *bonobo_persist_get_epv (void);
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/25 02:02:18
@@ -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/bonobo-ui-handler.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-handler.c,v
retrieving revision 1.60
diff -u -r1.60 bonobo-ui-handler.c
--- bonobo/bonobo-ui-handler.c 2000/05/11 01:38:35 1.60
+++ bonobo/bonobo-ui-handler.c 2000/05/25 02:02:22
@@ -761,9 +761,9 @@
* replaces "\" with "\\".
*/
static char *
-path_escape_forward_slashes (char *str)
+path_escape_forward_slashes (const char *str)
{
- char *p = str;
+ const char *p = str;
char *new, *newp;
char *final;
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/25 02:02:22
@@ -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/25 02:02:22
@@ -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: components/application-x-gnomine/ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/components/application-x-gnomine/ChangeLog,v
retrieving revision 1.12
diff -u -r1.12 ChangeLog
--- components/application-x-gnomine/ChangeLog 2000/05/18 14:06:54 1.12
+++ components/application-x-gnomine/ChangeLog 2000/05/25 02:02:23
@@ -1,3 +1,9 @@
+2000-05-24 Dan Winship <danw@helixcode.com>
+
+ * bonobo-application-x-mines.c (load_board, save_board,
+ content_types):
+ Update PersistStream implementations.
+
2000-05-18 Iain Holmes <ih@csd.abdn.ac.uk>
* bonobo/bonobo-uih-toolbar.c (toolbar_toplevel_item_set_pixmap_internal):
Index: components/application-x-gnomine/bonobo-application-x-mines.c
===================================================================
RCS file: /cvs/gnome/bonobo/components/application-x-gnomine/bonobo-application-x-mines.c,v
retrieving revision 1.17
diff -u -r1.17 bonobo-application-x-mines.c
--- components/application-x-gnomine/bonobo-application-x-mines.c 2000/05/18 14:06:54 1.17
+++ components/application-x-gnomine/bonobo-application-x-mines.c 2000/05/25 02:02:23
@@ -94,34 +94,46 @@
bonobo_embeddable_foreach_view (embeddable, queue_redraw, NULL);
}
-static int
-load_board (BonoboPersistStream *ps,
- const Bonobo_Stream stream,
- void *closure)
+static void
+load_board (BonoboPersistStream *ps,
+ const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ void *closure,
+ CORBA_Environment *ev)
{
embeddable_data_t *embed = closure;
MineField *mf;
Bonobo_Stream_iobuf *buffer;
- CORBA_Environment ev;
int bx, by, j;
- CORBA_exception_init (&ev);
+ g_return_if_fail (embed != NULL);
+ g_return_if_fail (embed->data != NULL);
- g_return_val_if_fail (embed != NULL, -1);
- g_return_val_if_fail (embed->data != NULL, -1);
+ if (strcmp (type, "*") != 0 &&
+ g_strcasecmp (type, "application/x-mines") != 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
mf = embed->data;
- Bonobo_Stream_read (stream, 5, &buffer, &ev);
- if (buffer->_length != 5)
- return -1;
+ Bonobo_Stream_read (stream, 5, &buffer, ev);
+ if (buffer->_length != 5) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
sscanf (buffer->_buffer, "%2u%2u\n", &bx, &by);
CORBA_free (buffer);
- if (bx > 128 || by > 128)
- return -1;
+ if (bx > 128 || by > 128) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
minefield_set_size (mf, bx, by);
minefield_restart (mf);
@@ -129,8 +141,13 @@
for (j = 0; j < by; j++) {
int i;
- Bonobo_Stream_read (stream, bx*2 + 1, &buffer, &ev);
- g_return_val_if_fail (buffer->_length != bx + 1, -1);
+ Bonobo_Stream_read (stream, bx*2 + 1, &buffer, ev);
+ if (buffer->_length != bx + 1) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType,
+ NULL);
+ return;
+ }
for (i = 0; i < bx; i++)
minefield_set_at (mf, i, j, buffer->_buffer[(i << 1)],
@@ -139,29 +156,31 @@
CORBA_free (buffer);
}
- CORBA_exception_free (&ev);
-
embeddable_update_all_views (embed);
-
- return 0;
}
-static int
-save_board (BonoboPersistStream *ps,
- const Bonobo_Stream stream,
- void *closure)
+static void
+save_board (BonoboPersistStream *ps,
+ const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ void *closure,
+ CORBA_Environment *ev)
{
embeddable_data_t *embed = closure;
MineField *mf;
Bonobo_Stream_iobuf *buffer;
- CORBA_Environment ev;
char *data;
int j;
- CORBA_exception_init (&ev);
+ g_return_if_fail (embed != NULL);
+ g_return_if_fail (embed->data != NULL);
- g_return_val_if_fail (embed != NULL, -1);
- g_return_val_if_fail (embed->data != NULL, -1);
+ if (strcmp (type, "*") != 0 &&
+ g_strcasecmp (type, "application/x-mines") != 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
mf = embed->data;
@@ -169,8 +188,10 @@
buffer = Bonobo_Stream_iobuf__alloc ();
buffer->_buffer = data;
buffer->_length = strlen (data);
- Bonobo_Stream_write (stream, buffer, &ev);
+ Bonobo_Stream_write (stream, buffer, ev);
CORBA_free (buffer);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ return;
for (j = 0; j < mf->ysize; j++) {
int i;
@@ -184,14 +205,19 @@
&buffer->_buffer[(i << 1) + 1]);
buffer->_buffer[(i << 1)] = '\n';
- Bonobo_Stream_write (stream, buffer, &ev);
+ Bonobo_Stream_write (stream, buffer, ev);
CORBA_free (buffer);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ return;
}
-
- CORBA_exception_free (&ev);
+}
- return 0;
+static Bonobo_Persist_ContentTypeList *
+content_types (BonoboPersistStream *ps, void *closure, CORBA_Environment *ev)
+{
+ return bonobo_persist_generate_content_types (1, "application/x-mines");
}
+
/*
* This callback is envoked when the view is destroyed. We use it to
* free up our ancillary view-centric data structures.
@@ -533,8 +559,8 @@
return NULL;
}
- stream = bonobo_persist_stream_new (load_board,
- save_board,
+ stream = bonobo_persist_stream_new (load_board, save_board,
+ NULL, content_types,
embeddable_data);
if (stream == NULL) {
Index: components/audio-ulaw/bonobo-audio-ulaw.c
===================================================================
RCS file: /cvs/gnome/bonobo/components/audio-ulaw/bonobo-audio-ulaw.c,v
retrieving revision 1.15
diff -u -r1.15 bonobo-audio-ulaw.c
--- components/audio-ulaw/bonobo-audio-ulaw.c 2000/04/18 20:24:42 1.15
+++ components/audio-ulaw/bonobo-audio-ulaw.c 2000/05/25 02:02:23
@@ -145,12 +145,20 @@
/*
* This function implements the Bonobo::PersistStream:load method.
*/
-static int
-pstream_load (BonoboPersistStream *ps, Bonobo_Stream stream,
- void *data)
+static void
+pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type, void *data,
+ CORBA_Environment *ev)
{
embeddable_data_t *embeddable_data = data;
+ if (strcmp (type, "*") != 0 &&
+ g_strcasecmp (type, "audio/ulaw") != 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
+
/*
* 1. Free the old sound data.
*/
@@ -159,29 +167,37 @@
/*
* 2. Read the new sound data.
*/
- if (stream_read (stream, embeddable_data) < 0)
- return -1; /* This will raise an exception. */
+ if (stream_read (stream, embeddable_data) < 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_FileNotFound, NULL);
+ return;
+ }
/*
* 3. Update the displays.
*/
bonobo_embeddable_foreach_view (embeddable_data->embeddable,
update_view_foreach, embeddable_data);
-
- return 0;
} /* pstream_load */
/*
* This function implements the Bonobo::PersistStream:save method.
*/
-static int
-pstream_save (BonoboPersistStream *ps, Bonobo_Stream stream,
- void *data)
+static void
+pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type, void *data,
+ CORBA_Environment *ev)
{
embeddable_data_t *embeddable_data = data;
Bonobo_Stream_iobuf *buffer;
size_t pos;
- CORBA_Environment ev;
+
+ if (strcmp (type, "*") != 0 &&
+ g_strcasecmp (type, "audio/ulaw") != 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
/*
* Write the sound data into the stream.
@@ -197,18 +213,16 @@
buffer->_length = embeddable_data->sound_len;
pos = 0;
- CORBA_exception_init (&ev);
while (pos < embeddable_data->sound_len) {
CORBA_long bytes_read;
- bytes_read = Bonobo_Stream_write (stream, buffer, &ev);
+ bytes_read = Bonobo_Stream_write (stream, buffer, ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
+ if (ev->_major != CORBA_NO_EXCEPTION) {
CORBA_free (buffer);
CORBA_free (data);
- CORBA_exception_free (&ev);
- return -1;
+ return;
}
pos += bytes_read;
@@ -216,11 +230,24 @@
CORBA_free (buffer);
CORBA_free (data);
- CORBA_exception_free (&ev);
-
- return 0;
} /* pstream_save */
+static CORBA_long
+pstream_get_max_size (BonoboPersistStream *ps, void *data,
+ CORBA_Environment *ev)
+{
+ embeddable_data_t *embeddable_data = data;
+
+ return embeddable_data->sound_len;
+}
+
+static Bonobo_Persist_ContentTypeList *
+pstream_get_content_types (BonoboPersistStream *ps, void *closure,
+ CORBA_Environment *ev)
+{
+ return bonobo_persist_generate_content_types (1, "audio/ulaw");
+}
+
/*
* Bonobo::ProgressiveDataSink
*
@@ -370,9 +397,10 @@
/*
* Register the Bonobo::PersistStream interface.
*/
- stream = bonobo_persist_stream_new (pstream_load,
- pstream_save,
- embeddable_data);
+ stream = bonobo_persist_stream_new (pstream_load, pstream_save,
+ pstream_get_max_size,
+ pstream_get_content_types,
+ embeddable_data);
if (stream == NULL) {
bonobo_object_unref (BONOBO_OBJECT (embeddable));
g_free (embeddable_data);
Index: components/text-plain/bonobo-text-plain.c
===================================================================
RCS file: /cvs/gnome/bonobo/components/text-plain/bonobo-text-plain.c,v
retrieving revision 1.41
diff -u -r1.41 bonobo-text-plain.c
--- components/text-plain/bonobo-text-plain.c 2000/05/02 20:48:55 1.41
+++ components/text-plain/bonobo-text-plain.c 2000/05/25 02:02:23
@@ -503,20 +503,20 @@
* save methods which allow data to be loaded into and out of the
* BonoboObject.
*/
-static int
-stream_read (Bonobo_Stream stream, bonobo_object_data_t *bonobo_object_data)
+static void
+stream_read (Bonobo_Stream stream, bonobo_object_data_t *bonobo_object_data,
+ CORBA_Environment *ev)
{
Bonobo_Stream_iobuf *buffer;
CORBA_long bytes_read;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
do {
#define READ_CHUNK_SIZE 65536
bytes_read = Bonobo_Stream_read (stream, READ_CHUNK_SIZE,
- &buffer, &ev);
+ &buffer, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ return;
bonobo_object_data->text = g_realloc (bonobo_object_data->text,
bonobo_object_data->text_len
@@ -530,24 +530,25 @@
CORBA_free (buffer);
} while (bytes_read > 0);
-
- CORBA_exception_free (&ev);
-
- if (bytes_read < 0)
- return -1;
-
- return 0;
} /* stream_read */
/*
* This function implements the Bonobo::PersistStream:load method.
*/
-static int
-pstream_load (BonoboPersistStream *ps, Bonobo_Stream stream,
- void *data)
+static void
+pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type, void *data,
+ CORBA_Environment *ev)
{
bonobo_object_data_t *bonobo_object_data = data;
+ if (strcmp (type, "*") != 0 &&
+ g_strcasecmp (type, "text/plain") != 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
+
/*
* 1. Free the old text data and blank the views.
*/
@@ -557,31 +558,36 @@
/*
* 2. Read the new text data.
*/
- if (stream_read (stream, bonobo_object_data) < 0)
- return -1; /* This will raise an exception. */
+ stream_read (stream, bonobo_object_data, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ return;
/*
* 3. Update the displays.
*/
update_all_views (bonobo_object_data);
- return 0;
} /* pstream_load */
/*
* This function implements the Bonobo::PersistStream:save method.
*/
-static int
-pstream_save (BonoboPersistStream *ps, Bonobo_Stream stream,
- void *data)
+static void
+pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type, void *data,
+ CORBA_Environment *ev)
{
bonobo_object_data_t *bonobo_object_data = data;
Bonobo_Stream_iobuf *buffer;
size_t pos;
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
-
+ if (strcmp (type, "*") != 0 &&
+ g_strcasecmp (type, "text/plain") != 0) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Bonobo_Persist_WrongDataType, NULL);
+ return;
+ }
+
/*
* Write the text data into the stream.
*
@@ -599,13 +605,12 @@
while (pos < bonobo_object_data->text_len) {
CORBA_long bytes_read;
- bytes_read = Bonobo_Stream_write (stream, buffer, &ev);
+ bytes_read = Bonobo_Stream_write (stream, buffer, ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
+ if (ev->_major != CORBA_NO_EXCEPTION) {
CORBA_free (buffer);
CORBA_free (data);
- CORBA_exception_free (&ev);
- return -1;
+ return;
}
pos += bytes_read;
@@ -613,11 +618,24 @@
CORBA_free (buffer);
CORBA_free (data);
- CORBA_exception_free (&ev);
-
- return 0;
} /* pstream_save */
+static CORBA_long
+pstream_get_max_size (BonoboPersistStream *ps, void *data,
+ CORBA_Environment *ev)
+{
+ bonobo_object_data_t *bonobo_object_data = data;
+
+ return bonobo_object_data->text_len;
+}
+
+static Bonobo_Persist_ContentTypeList *
+pstream_get_content_types (BonoboPersistStream *ps, void *closure,
+ CORBA_Environment *ev)
+{
+ return bonobo_persist_generate_content_types (1, "text/plain");
+}
+
/*
* Bonobo::ProgressiveDataSink
*
@@ -838,9 +856,10 @@
/*
* Register the Bonobo::PersistStream interface.
*/
- stream = bonobo_persist_stream_new (pstream_load,
- pstream_save,
- bonobo_object_data);
+ stream = bonobo_persist_stream_new (pstream_load, pstream_save,
+ pstream_get_max_size,
+ pstream_get_content_types,
+ bonobo_object_data);
if (stream == NULL) {
gtk_object_unref (GTK_OBJECT (bonobo_object));
g_free (bonobo_object_data);
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/25 02:02:24
@@ -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: 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/25 02:02:24
@@ -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: samples/compound-doc/bonobo-hello/ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/samples/compound-doc/bonobo-hello/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- samples/compound-doc/bonobo-hello/ChangeLog 2000/05/01 11:07:11 1.1
+++ samples/compound-doc/bonobo-hello/ChangeLog 2000/05/25 02:02:24
@@ -1,3 +1,11 @@
+2000-05-24 Dan Winship <danw@helixcode.com>
+
+ * hello-object.c, hello-object-io.[ch] (hello_object_stream_read,
+ hello_object_pstream_load, hello_object_pstream_save,
+ hello_object_pstream_get_max_size,
+ hello_object_pstream_get_content_types): Update PersistStream
+ implementation.
+
2000-04-24 ERDI Gergo <cactus@cactus.rulez.org>
* hello-object-print.c (hello_object_print): Bonobo::Print implementation
Index: samples/compound-doc/bonobo-hello/hello-object-io.c
===================================================================
RCS file: /cvs/gnome/bonobo/samples/compound-doc/bonobo-hello/hello-object-io.c,v
retrieving revision 1.3
diff -u -r1.3 hello-object-io.c
--- samples/compound-doc/bonobo-hello/hello-object-io.c 2000/05/23 16:43:08 1.3
+++ samples/compound-doc/bonobo-hello/hello-object-io.c 2000/05/25 02:02:24
@@ -19,26 +19,23 @@
#include "hello-object-io.h"
-static int hello_object_stream_read (Bonobo_Stream stream, Hello * obj);
-
/* Load data from a BonoboStream -- implementation */
-static int
-hello_object_stream_read (Bonobo_Stream stream, Hello * obj)
+static void
+hello_object_stream_read (Bonobo_Stream stream, Hello * obj,
+ CORBA_Environment *ev)
{
Bonobo_Stream_iobuf *buffer;
CORBA_long bytes_read;
- CORBA_Environment ev;
gchar *charbuf = g_new0 (gchar, 0);
size_t last_len = 0;
- CORBA_exception_init (&ev);
-
/* We will read the data in chunks of the specified size */
#define READ_CHUNK_SIZE 65536
do {
bytes_read =
- Bonobo_Stream_read (stream, READ_CHUNK_SIZE, &buffer,
- &ev);
+ Bonobo_Stream_read (stream, READ_CHUNK_SIZE, &buffer, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ return;
charbuf = g_realloc (charbuf, last_len + buffer->_length);
memcpy (charbuf + last_len, buffer->_buffer,
@@ -49,48 +46,41 @@
} while (bytes_read > 0);
#undef READ_CHUNK_SIZE
- CORBA_exception_free (&ev);
-
- if (bytes_read < 0) {
- g_free (charbuf);
- return -1;
- }
-
charbuf[last_len] = '\0';
hello_model_set_text (obj, charbuf);
g_free (charbuf);
-
- return 0;
}
/* This function implements the Bonobo::PersistStream:load method. */
-int
+void
hello_object_pstream_load (BonoboPersistStream * ps,
- Bonobo_Stream stream, void *data)
+ const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ void *data, CORBA_Environment *ev)
{
Hello *obj = (Hello *) data;
+ /* 0. Check the Content Type? FIXME */
+
/* 1. Free the old data */
hello_model_clear (obj);
/* 2. Read the new text data. */
- if (hello_object_stream_read (stream, obj) < 0)
- return -1; /* This will raise an exception. */
-
- return 0;
+ hello_object_stream_read (stream, obj, ev);
}
/* This function implements the Bonobo::PersistStream:save method. */
-int
+void
hello_object_pstream_save (BonoboPersistStream * ps,
- Bonobo_Stream stream, void *data)
+ const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ void *data, CORBA_Environment *ev)
{
Hello *obj = data;
Bonobo_Stream_iobuf *buffer;
size_t pos = 0, length = strlen (obj->text);
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
+ /* FIXME: Should check content type */
/* Write the text data into the stream. */
buffer = Bonobo_Stream_iobuf__alloc ();
@@ -101,19 +91,32 @@
while (pos < length) {
CORBA_long bytes_written;
- bytes_written = Bonobo_Stream_write (stream, buffer, &ev);
+ bytes_written = Bonobo_Stream_write (stream, buffer, ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
+ if (ev->_major != CORBA_NO_EXCEPTION) {
CORBA_free (buffer);
- CORBA_exception_free (&ev);
- return -1; /* Raise exception */
+ return;
}
pos += bytes_written;
}
CORBA_free (buffer);
- CORBA_exception_free (&ev);
+}
+
+CORBA_long
+hello_object_pstream_get_max_size (BonoboPersistStream *ps, void *data,
+ CORBA_Environment *ev)
+{
+ Hello *obj = data;
- return 0;
+ return strlen (obj->text);
+}
+
+Bonobo_Persist_ContentTypeList *
+hello_object_pstream_get_types (BonoboPersistStream *ps, void *closure,
+ CORBA_Environment *ev)
+{
+ /* FIXME */
+ return bonobo_persist_generate_content_types (1, "*");
}
Index: samples/compound-doc/bonobo-hello/hello-object-io.h
===================================================================
RCS file: /cvs/gnome/bonobo/samples/compound-doc/bonobo-hello/hello-object-io.h,v
retrieving revision 1.3
diff -u -r1.3 hello-object-io.h
--- samples/compound-doc/bonobo-hello/hello-object-io.h 2000/05/23 16:43:08 1.3
+++ samples/compound-doc/bonobo-hello/hello-object-io.h 2000/05/25 02:02:24
@@ -22,9 +22,19 @@
#include "hello-object.h"
-int hello_object_pstream_load (BonoboPersistStream * ps,
- Bonobo_Stream stream, void *data);
-int hello_object_pstream_save (BonoboPersistStream * ps,
- Bonobo_Stream stream, void *data);
+void hello_object_pstream_load (BonoboPersistStream * ps,
+ const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ void *data, CORBA_Environment *ev);
+void hello_object_pstream_save (BonoboPersistStream * ps,
+ const Bonobo_Stream stream,
+ Bonobo_Persist_ContentType type,
+ void *data, CORBA_Environment *ev);
+CORBA_long hello_object_pstream_get_max_size (BonoboPersistStream *ps,
+ void *data,
+ CORBA_Environment *ev);
+Bonobo_Persist_ContentTypeList *hello_object_pstream_get_types (BonoboPersistStream *ps,
+ void *closure,
+ CORBA_Environment *ev);
#endif
Index: samples/compound-doc/bonobo-hello/hello-object.c
===================================================================
RCS file: /cvs/gnome/bonobo/samples/compound-doc/bonobo-hello/hello-object.c,v
retrieving revision 1.3
diff -u -r1.3 hello-object.c
--- samples/compound-doc/bonobo-hello/hello-object.c 2000/05/23 16:43:08 1.3
+++ samples/compound-doc/bonobo-hello/hello-object.c 2000/05/25 02:02:24
@@ -57,6 +57,8 @@
/* Register the Bonobo::PersistStream interface. */
stream = bonobo_persist_stream_new (hello_object_pstream_load,
hello_object_pstream_save,
+ hello_object_pstream_get_max_size,
+ hello_object_pstream_get_types,
obj);
g_return_val_if_fail (stream, -1);
Index: samples/compound-doc/container/ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/samples/compound-doc/container/ChangeLog,v
retrieving revision 1.4
diff -u -r1.4 ChangeLog
--- samples/compound-doc/container/ChangeLog 2000/05/22 14:39:00 1.4
+++ samples/compound-doc/container/ChangeLog 2000/05/25 02:02:24
@@ -1,3 +1,9 @@
+2000-05-24 Dan Winship <danw@helixcode.com>
+
+ * component.c (load_stream_cb):
+ * component-io.c (component_load, component_save):
+ Update for Bonobo_PersistStream_{load,save} changes.
+
2000-05-22 ERDI Gergo <cactus@cactus.rulez.org>
* Makefile.am (sample_container_SOURCES): Add the new sources
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/25 02:02:24
@@ -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/25 02:02:25
@@ -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]