Re: So, what should we do about Persist::getIId?



On Thu, 19 Jul 2001, Michael Meeks wrote:

> both proposals are effectively:
>   
>         string getString (); 
>   
>         it's not worth delaying indefinately over a name,            

So don't, and let me commit this patch:

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libbonobo/ChangeLog,v
retrieving revision 1.77
diff -u -u -r1.77 ChangeLog
--- ChangeLog	2001/07/19 18:31:48	1.77
+++ ChangeLog	2001/07/19 22:53:21
@@ -229,6 +229,19 @@
 
 	* configure.in: Added ta to the languages list.
 
+2001-06-21  ERDI Gergo  <cactus cactus rulez org>
+
+        * idl/Bonobo_Persist.idl: Added new getIId method to
+        Bonobo::Persist
+
+        * bonobo/bonobo-persist.[ch]:
+        * bonobo/bonobo-persist-file.[ch]:
+        * bonobo/bonobo-persist-stream.[ch]: Added code to support
+        Bonobo::Persist::getIID
+
+        * bonobo/bonobo-persist-stream.[ch]: Since new arguments are added
+        to _new and _construct, I removed the legacy dummy argument
+
 2001-06-19  Peter Williams  <peterw ximian com>
 
 	* bonobo/bonobo-property-bag.c (bonobo_property_bag_add_gtk_args): 
Index: bonobo/bonobo-persist-file.c
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist-file.c,v
retrieving revision 1.34
diff -u -u -r1.34 bonobo-persist-file.c
--- bonobo/bonobo-persist-file.c	2001/06/26 16:43:32	1.34
+++ bonobo/bonobo-persist-file.c	2001/07/19 22:53:21
@@ -161,6 +161,7 @@
  * @pf: A BonoboPersistFile
  * @load_fn: Loading routine
  * @save_fn: Saving routine
+ * @iid: OAF IID of the object this interface is aggregated to
  * @closure: Data passed to IO routines.
  *
  * Initializes the BonoboPersistFile object.  The @load_fn and @save_fn
@@ -171,6 +172,7 @@
 bonobo_persist_file_construct (BonoboPersistFile    *pf,
 			       BonoboPersistFileIOFn load_fn,
 			       BonoboPersistFileIOFn save_fn,
+			       const gchar          *iid,
 			       void                 *closure)
 {
 	g_return_val_if_fail (pf != NULL, NULL);
@@ -179,6 +181,8 @@
 	pf->load_fn = load_fn;
 	pf->save_fn = save_fn;
 	pf->closure = closure;
+
+	bonobo_persist_construct (BONOBO_PERSIST (pf), iid);
 		
 	return pf;
 }
@@ -187,6 +191,7 @@
  * bonobo_persist_file_new:
  * @load_fn: Loading routine
  * @save_fn: Saving routine
+ * @iid: OAF IID of the object this interface is aggregated to
  * @closure: Data passed to IO routines.
  *
  * Creates a BonoboPersistFile object.  The @load_fn and @save_fn
@@ -194,9 +199,10 @@
  * operations are performed by the class load and save methods
  */
 BonoboPersistFile *
-bonobo_persist_file_new (BonoboPersistFileIOFn load_fn,
-			 BonoboPersistFileIOFn save_fn,
-			 void                 *closure)
+bonobo_persist_file_new (BonoboPersistFileIOFn  load_fn,
+			 BonoboPersistFileIOFn  save_fn,
+			 const gchar           *iid,
+			 void                  *closure)
 {
 	BonoboPersistFile *pf;
 
@@ -204,7 +210,7 @@
 
 	pf->filename = NULL;
 
-	bonobo_persist_file_construct (pf, load_fn, save_fn, closure);
+	bonobo_persist_file_construct (pf, load_fn, save_fn, iid, closure);
 
 	return pf;
 }
Index: bonobo/bonobo-persist-file.h
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist-file.h,v
retrieving revision 1.19
diff -u -u -r1.19 bonobo-persist-file.h
--- bonobo/bonobo-persist-file.h	2001/04/18 22:09:07	1.19
+++ bonobo/bonobo-persist-file.h	2001/07/19 22:53:22
@@ -71,11 +71,13 @@
 
 BonoboPersistFile *bonobo_persist_file_new       (BonoboPersistFileIOFn load_fn,
 						  BonoboPersistFileIOFn save_fn,
+						  const gchar          *iid,
 						  void                 *closure);
 
 BonoboPersistFile *bonobo_persist_file_construct (BonoboPersistFile    *ps,
 						  BonoboPersistFileIOFn load_fn,
 						  BonoboPersistFileIOFn save_fn,
+						  const gchar          *iid,
 						  void                 *closure);
 
 G_END_DECLS
Index: bonobo/bonobo-persist-stream.c
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist-stream.c,v
retrieving revision 1.41
diff -u -u -r1.41 bonobo-persist-stream.c
--- bonobo/bonobo-persist-stream.c	2001/05/02 22:19:26	1.41
+++ bonobo/bonobo-persist-stream.c	2001/07/19 22:53:22
@@ -124,8 +124,8 @@
  * @ps: A BonoboPersistStream object
  * @load_fn: Loading routine
  * @save_fn: Saving routine
- * @compat_dummy: unused, NULL
  * @types_fn: returns the supported types
+ * @iid: OAF IID of the object this interface is aggregated to
  * @closure: Data passed to IO routines.
  *
  * Initializes the BonoboPersistStream object.  The load and save
@@ -141,8 +141,8 @@
 bonobo_persist_stream_construct (BonoboPersistStream       *ps,
 				 BonoboPersistStreamIOFn    load_fn,
 				 BonoboPersistStreamIOFn    save_fn,
-				 gpointer                   compat_dummy,
 				 BonoboPersistStreamTypesFn types_fn,
+				 const gchar               *iid,
 				 void                      *closure)
 {
 	g_return_val_if_fail (ps != NULL, NULL);
@@ -152,6 +152,8 @@
 	ps->save_fn = save_fn;
 	ps->types_fn = types_fn;
 	ps->closure = closure;
+
+	bonobo_persist_construct (BONOBO_PERSIST (ps), iid);
 	
 	return ps;
 }
@@ -160,8 +162,8 @@
  * bonobo_persist_stream_new:
  * @load_fn: Loading routine
  * @save_fn: Saving routine
- * @compat_dummy: unused, NULL
  * @types_fn: get_content_types routine
+ * @iid: OAF IID of the object this interface is aggregated to
  * @closure: Data passed to IO routines.
  *
  * Creates a new BonoboPersistStream object. The various operations
@@ -175,8 +177,8 @@
 BonoboPersistStream *
 bonobo_persist_stream_new (BonoboPersistStreamIOFn    load_fn,
 			   BonoboPersistStreamIOFn    save_fn,
-			   gpointer                   compat_dummy,
 			   BonoboPersistStreamTypesFn types_fn,
+			   const gchar               *iid,
 			   void                      *closure)
 {
 	BonoboPersistStream *ps;
@@ -184,7 +186,7 @@
 	ps = g_object_new (bonobo_persist_stream_get_type (), NULL);
 
 	bonobo_persist_stream_construct (ps, load_fn, save_fn,
-					 compat_dummy, types_fn, closure);
+					 types_fn, iid, closure);
 
 	return ps;
 }
Index: bonobo/bonobo-persist-stream.h
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist-stream.h,v
retrieving revision 1.23
diff -u -u -r1.23 bonobo-persist-stream.h
--- bonobo/bonobo-persist-stream.h	2001/05/02 22:19:26	1.23
+++ bonobo/bonobo-persist-stream.h	2001/07/19 22:53:22
@@ -78,15 +78,15 @@
 
 BonoboPersistStream *bonobo_persist_stream_new       (BonoboPersistStreamIOFn    load_fn,
 						      BonoboPersistStreamIOFn    save_fn,
-						      gpointer                   compat_dummy,
 						      BonoboPersistStreamTypesFn types_fn,
+						      const gchar               *iid,
 						      void                      *closure);
 
 BonoboPersistStream *bonobo_persist_stream_construct (BonoboPersistStream       *ps,
 						      BonoboPersistStreamIOFn    load_fn,
 						      BonoboPersistStreamIOFn    save_fn,
-						      gpointer                   compat_dummy,
 						      BonoboPersistStreamTypesFn types_fn,
+						      const gchar               *iid,
 						      void                      *closure);
 
 G_END_DECLS
Index: bonobo/bonobo-persist.c
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist.c,v
retrieving revision 1.28
diff -u -u -r1.28 bonobo-persist.c
--- bonobo/bonobo-persist.c	2001/06/27 23:40:03	1.28
+++ bonobo/bonobo-persist.c	2001/07/19 22:53:22
@@ -20,6 +20,11 @@
 
 #define CLASS(o) BONOBO_PERSIST_CLASS(G_OBJECT_GET_CLASS (o))
 
+struct _BonoboPersistPrivate
+{
+	gchar *iid;
+};
+
 static inline BonoboPersist *
 bonobo_persist_from_servant (PortableServer_Servant servant)
 {
@@ -35,9 +40,23 @@
 	return CLASS (persist)->get_content_types (persist, ev);
 }
 
+static CORBA_char*
+impl_Bonobo_Persist_getIId (PortableServer_Servant   servant,
+			    CORBA_Environment       *ev)
+{
+	BonoboPersist *persist = bonobo_persist_from_servant (servant);
+
+	return CORBA_string_dup (persist->priv->iid);
+}
+
 static void
 bonobo_persist_finalize (GObject *object)
 {
+	BonoboPersist *persist = BONOBO_PERSIST (object);
+	
+	g_free (persist->priv->iid);
+	g_free (persist->priv);
+	
 	bonobo_persist_parent_class->finalize (object);
 }
 
@@ -53,12 +72,14 @@
 	object_class->finalize = bonobo_persist_finalize;
 
 	epv->getContentTypes = impl_Bonobo_Persist_getContentTypes;
+	epv->getIId = impl_Bonobo_Persist_getIId;
 }
 
 static void
 bonobo_persist_init (GObject *object)
 {
-	/* nothing to do */
+	BonoboPersist *persist = BONOBO_PERSIST (object);
+	persist->priv = g_new0 (BonoboPersistPrivate, 1);
 }
 
 BONOBO_TYPE_FUNC_FULL (BonoboPersist, 
@@ -95,4 +116,28 @@
 	va_end (ap);
 
 	return types;
+}
+
+/**
+ * bonobo_persist_construct:
+ * @persist: A BonoboPersist
+ * @iid: OAF IID of the object this interface is aggregated to
+ *
+ * Initializes the BonoboPersist object. You should only use this
+ * method in derived implementations, because a BonoboPersist instance
+ * doesn't make a lot of sense, but the iid private field has to be
+ * set at construction time.
+ */
+BonoboPersist *
+bonobo_persist_construct (BonoboPersist *persist,
+			  const gchar   *iid)
+{
+	g_return_val_if_fail (persist != NULL, NULL);
+	g_return_val_if_fail (BONOBO_IS_PERSIST (persist), NULL);
+
+	g_return_val_if_fail (iid != NULL, NULL);
+
+	persist->priv->iid = g_strdup (iid);
+
+	return persist;
 }
Index: bonobo/bonobo-persist.h
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist.h,v
retrieving revision 1.22
diff -u -u -r1.22 bonobo-persist.h
--- bonobo/bonobo-persist.h	2001/04/18 22:09:07	1.22
+++ bonobo/bonobo-persist.h	2001/07/19 22:53:22
@@ -38,11 +38,13 @@
 						    CORBA_Environment *ev);
 } BonoboPersistClass;
 
-GType                         bonobo_persist_get_type               (void);
+GType                           bonobo_persist_get_type (void);
 
 Bonobo_Persist_ContentTypeList *bonobo_persist_generate_content_types (int num,
 								       ...);
 
+BonoboPersist                  *bonobo_persist_construct (BonoboPersist *persist,
+							  const gchar   *iid);
 G_END_DECLS
 
 #endif /* _BONOBO_PERSIST_H_ */
Index: idl/Bonobo_Persist.idl
===================================================================
RCS file: /cvs/gnome/libbonobo/idl/Bonobo_Persist.idl,v
retrieving revision 1.28
diff -u -u -r1.28 Bonobo_Persist.idl
--- idl/Bonobo_Persist.idl	2001/05/02 22:19:27	1.28
+++ idl/Bonobo_Persist.idl	2001/07/19 22:53:22
@@ -26,7 +26,6 @@
 
 		exception WrongDataType {};
 		exception FileNotFound {};
-	
 
 		typedef string                ContentType;
 		typedef sequence<ContentType> ContentTypeList;
@@ -39,6 +38,16 @@
 		 * preferred type being the first element.
 		 */
 		ContentTypeList getContentTypes ();
+
+		typedef string                IID;
+		
+		/**
+		 * getIId:
+		 *
+		 * Get the IID necessary to recreate the object whose
+		 * internal state this interface represents
+		 */
+		IID getIId ();
 	};
 	
 	/*


-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
Kételkedem, tehát lehet hogy vagyok.





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