isDirty



Here's a patch that promotes the isDirty to the Persist base interface,
instead of duplicating it in every subclass.  :-)

Let me know if I can commit.

Mike
Index: bonobo/bonobo-persist-file.c
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist-file.c,v
retrieving revision 1.35
diff -u -r1.35 bonobo-persist-file.c
--- bonobo/bonobo-persist-file.c	2001/07/20 11:33:49	1.35
+++ bonobo/bonobo-persist-file.c	2001/07/21 00:07:00
@@ -44,15 +44,6 @@
 }
 
 
-static CORBA_boolean
-impl_is_dirty (PortableServer_Servant servant, CORBA_Environment * ev)
-{
-	BonoboObject *object = bonobo_object_from_servant (servant);
-	BonoboPersistFile *pfile = BONOBO_PERSIST_FILE (object);
-
-	return pfile->is_dirty;
-}
-
 static void
 impl_load (PortableServer_Servant servant,
 	   const CORBA_char      *filename,
@@ -115,7 +106,6 @@
 			ev, CORBA_USER_EXCEPTION,
 			ex_Bonobo_Persist_FileNotFound, NULL);
 	}
-	pf->is_dirty = FALSE;
 }
 
 static CORBA_char *
@@ -141,7 +131,6 @@
 
 	epv->load           = impl_load;
 	epv->save           = impl_save;
-	epv->isDirty        = impl_is_dirty;
 	epv->getCurrentFile = impl_get_current_file;
 }
 
Index: bonobo/bonobo-persist-file.h
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist-file.h,v
retrieving revision 1.20
diff -u -r1.20 bonobo-persist-file.h
--- bonobo/bonobo-persist-file.h	2001/07/20 11:33:49	1.20
+++ bonobo/bonobo-persist-file.h	2001/07/21 00:07:00
@@ -32,7 +32,6 @@
 struct _BonoboPersistFile {
 	BonoboPersist persist;
 
-	gboolean     is_dirty;
 	char *filename;
 
 	/*
@@ -66,8 +65,6 @@
 } BonoboPersistFileClass;
 
 GType             bonobo_persist_file_get_type  (void);
-void                bonobo_persist_file_set_dirty (BonoboPersistFile   *ps,
-						   gboolean             dirty);
 
 BonoboPersistFile *bonobo_persist_file_new       (BonoboPersistFileIOFn load_fn,
 						  BonoboPersistFileIOFn save_fn,
Index: bonobo/bonobo-persist-stream.c
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist-stream.c,v
retrieving revision 1.42
diff -u -r1.42 bonobo-persist-stream.c
--- bonobo/bonobo-persist-stream.c	2001/07/20 11:33:49	1.42
+++ bonobo/bonobo-persist-stream.c	2001/07/21 00:07:00
@@ -19,15 +19,6 @@
 /* Parent GTK object class */
 static BonoboPersistClass *bonobo_persist_stream_parent_class;
 
-static CORBA_boolean
-impl_is_dirty (PortableServer_Servant servant, CORBA_Environment * ev)
-{
-	BonoboObject *object = bonobo_object_from_servant (servant);
-	BonoboPersistStream *pstream = BONOBO_PERSIST_STREAM (object);
-
-	return pstream->is_dirty;
-}
-
 static void
 impl_load (PortableServer_Servant servant,
 	   Bonobo_Stream stream,
@@ -105,7 +96,6 @@
 
 	epv->load       = impl_load;
 	epv->save       = impl_save;
-	epv->isDirty    = impl_is_dirty;
 }
 
 static void
@@ -191,18 +181,3 @@
 	return ps;
 }
 
-/**
- * bonobo_persist_stream_set_dirty:
- * @ps: A BonoboPersistStream object
- * @dirty: A boolean value representing whether the object is dirty or not
- *
- * This routine sets the dirty bit for the PersistStream object.
- */
-void
-bonobo_persist_stream_set_dirty (BonoboPersistStream *pstream, gboolean dirty)
-{
-	g_return_if_fail (pstream != NULL);
-	g_return_if_fail (BONOBO_IS_PERSIST_STREAM (pstream));
-
-	pstream->is_dirty = dirty;
-}
Index: bonobo/bonobo-persist-stream.h
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist-stream.h,v
retrieving revision 1.24
diff -u -r1.24 bonobo-persist-stream.h
--- bonobo/bonobo-persist-stream.h	2001/07/20 11:33:49	1.24
+++ bonobo/bonobo-persist-stream.h	2001/07/21 00:07:00
@@ -73,8 +73,6 @@
 } BonoboPersistStreamClass;
 
 GType                bonobo_persist_stream_get_type  (void);
-void                 bonobo_persist_stream_set_dirty (BonoboPersistStream       *ps,
-						      gboolean                   dirty);
 
 BonoboPersistStream *bonobo_persist_stream_new       (BonoboPersistStreamIOFn    load_fn,
 						      BonoboPersistStreamIOFn    save_fn,
Index: bonobo/bonobo-persist.c
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist.c,v
retrieving revision 1.29
diff -u -r1.29 bonobo-persist.c
--- bonobo/bonobo-persist.c	2001/07/20 11:33:49	1.29
+++ bonobo/bonobo-persist.c	2001/07/21 00:07:00
@@ -23,6 +23,7 @@
 struct _BonoboPersistPrivate
 {
 	gchar *iid;
+	gboolean dirty;
 };
 
 static inline BonoboPersist *
@@ -49,6 +50,15 @@
 	return CORBA_string_dup (persist->priv->iid);
 }
 
+static CORBA_boolean
+impl_Bonobo_Persist_isDirty (PortableServer_Servant   servant,
+			     CORBA_Environment       *ev)
+{
+	BonoboPersist *persist = bonobo_persist_from_servant (servant);
+
+	return persist->priv->dirty;
+}
+
 static void
 bonobo_persist_finalize (GObject *object)
 {
@@ -73,6 +83,7 @@
 
 	epv->getContentTypes = impl_Bonobo_Persist_getContentTypes;
 	epv->getIId = impl_Bonobo_Persist_getIId;
+	epv->isDirty = impl_Bonobo_Persist_isDirty;
 }
 
 static void
@@ -140,4 +151,18 @@
 	persist->priv->iid = g_strdup (iid);
 
 	return persist;
+}
+
+/**
+ * bonobo_persist_set_dirty:
+ * @persist: A BonoboPersist
+ * @dirty: A flag indicating the dirty status of this object.
+ *
+ * Sets the dirty status of the interface which is reported via
+ * the isDirty method.
+ */
+void
+bonobo_persist_set_dirty (BonoboPersist *persist, gboolean dirty)
+{
+	persist->priv->dirty = dirty;
 }
Index: bonobo/bonobo-persist.h
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-persist.h,v
retrieving revision 1.23
diff -u -r1.23 bonobo-persist.h
--- bonobo/bonobo-persist.h	2001/07/20 11:33:49	1.23
+++ bonobo/bonobo-persist.h	2001/07/21 00:07:00
@@ -45,6 +45,10 @@
 
 BonoboPersist                  *bonobo_persist_construct (BonoboPersist *persist,
 							  const gchar   *iid);
+
+void				bonobo_persist_set_dirty (BonoboPersist *persist,
+							  gboolean dirty);
+
 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.29
diff -u -r1.29 Bonobo_Persist.idl
--- idl/Bonobo_Persist.idl	2001/07/20 11:33:49	1.29
+++ idl/Bonobo_Persist.idl	2001/07/21 00:07:01
@@ -48,6 +48,14 @@
 		 * internal state this interface represents
 		 */
 		IID getIId ();
+
+		/**
+		 * isDirty:
+		 * 
+		 * Indicates if a save is necessary.
+		 */
+		boolean isDirty ();
+	
 	};
 	
 	/*
@@ -84,14 +92,6 @@
 			raises (IOError, NotSupported);
 	
 		/**
-		 * isDirty:
-		 * 
-		 * returns whether the document needs to be
-		 * saved
-		 */
-		boolean isDirty ();
-	
-		/**
 		 * getCurrentFile:
 		 * 
 		 * Returns the name of the current file. 
@@ -109,14 +109,6 @@
 	interface PersistStorage : Persist {
 		
 		/**
-		 * isDirty:
-		 * 
-		 * returns whether the document needs to be
-		 * saved
-		 */
-		boolean isDirty ();
-	
-		/**
 		 * load:
 		 * @storage: The storage to load the state from
 		 *
@@ -151,7 +143,6 @@
 	 * and used them after this).
 	 */
 	interface PersistStream : Persist {
-		boolean isDirty ();
 		
 		/**
 		 * load:


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