making the `value' argument of notify_listeners optional



Michael,

as you requested yesterday, here's the patch. OK to commit?

? .deps
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libbonobo/ChangeLog,v
retrieving revision 1.156
diff -u -u -r1.156 ChangeLog
--- ChangeLog	2001/08/16 10:39:56	1.156
+++ ChangeLog	2001/08/17 16:04:08
@@ -1,3 +1,9 @@
+2001-08-17  ERDI Gergo  <cactus cactus rulez org>
+
+	* bonobo/bonobo-event-source.c
+	(bonobo_event_source_notify_listeners): Allow CORBA_OBJECT_NIL for
+	the `value' argument
+
 2001-08-16  Fatih Demir <kabalak gtranslator org>
 
 	* configure.in: Added "tr" to the languages list.
Index: bonobo/bonobo-event-source.c
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-event-source.c,v
retrieving revision 1.36
diff -u -u -r1.36 bonobo-event-source.c
--- bonobo/bonobo-event-source.c	2001/08/07 14:33:24	1.36
+++ bonobo/bonobo-event-source.c	2001/08/17 16:04:09
@@ -144,7 +144,8 @@
  * bonobo_event_source_notify_listeners:
  * @event_source: the Event Source that will emit the event.
  * @event_name: Name of the event being emitted
- * @value: A CORBA_any value that contains the data that is passed to interested clients
+ * @opt_value: A CORBA_any value that contains the data that is passed
+ * to interested clients, or CORBA_OBJECT_NIL for an empty value
  * @opt_ev: A CORBA_Environment where a failure code can be returned, can be NULL.
  *
  * This will notify all clients that have registered with this EventSource
@@ -158,18 +159,24 @@
 void
 bonobo_event_source_notify_listeners (BonoboEventSource *event_source,
 				      const char        *event_name,
-				      const CORBA_any   *value,
+				      const CORBA_any   *opt_value,
 				      CORBA_Environment *opt_ev)
 {
 	GSList *l, *notify;
 	CORBA_Environment ev, *my_ev;
-
+	const BonoboArg *my_value;
+	
 	if (!opt_ev) {
 		CORBA_exception_init (&ev);
 		my_ev = &ev;
 	} else
 		my_ev = opt_ev;
 
+	if (opt_value == CORBA_OBJECT_NIL)
+		my_value = bonobo_arg_new (BONOBO_ARG_NULL);
+	else
+		my_value = opt_value;
+	
 	notify = NULL;
 
 	for (l = event_source->priv->listeners; l; l = l->next) {
@@ -183,7 +190,7 @@
 	bonobo_object_ref (BONOBO_OBJECT (event_source));
 
 	for (l = notify; l; l = l->next)
-		Bonobo_Listener_event (l->data, event_name, value, my_ev);
+		Bonobo_Listener_event (l->data, event_name, my_value, my_ev);
 
 	bonobo_object_unref (BONOBO_OBJECT (event_source));
 
@@ -191,6 +198,8 @@
 
 	if (!opt_ev)
 		CORBA_exception_free (&ev);
+	if (!opt_value)
+		bonobo_arg_release ((BonoboArg*)my_value);
 }
 
 void
@@ -198,7 +207,7 @@
 					   const char        *path,
 					   const char        *type,
 					   const char        *subtype,
-					   const CORBA_any   *value,                          
+					   const CORBA_any   *opt_value,
 					   CORBA_Environment *opt_ev)
 {
 	char *event_name;
@@ -206,7 +215,7 @@
 	event_name = bonobo_event_make_name (path, type, subtype);
 
 	bonobo_event_source_notify_listeners (event_source, event_name,
-					      value, opt_ev);
+					      opt_value, opt_ev);
 
 	g_free (event_name);
 }
Index: bonobo/bonobo-event-source.h
===================================================================
RCS file: /cvs/gnome/libbonobo/bonobo/bonobo-event-source.h,v
retrieving revision 1.15
diff -u -u -r1.15 bonobo-event-source.h
--- bonobo/bonobo-event-source.h	2001/08/08 05:15:46	1.15
+++ bonobo/bonobo-event-source.h	2001/08/17 16:04:10
@@ -40,14 +40,14 @@
 BonoboEventSource *bonobo_event_source_new              (void);
 void               bonobo_event_source_notify_listeners (BonoboEventSource *event_source,
 							 const char        *event_name,
-							 const CORBA_any   *value,
+							 const CORBA_any   *opt_value,
 							 CORBA_Environment *opt_ev);
 
 void        bonobo_event_source_notify_listeners_full   (BonoboEventSource *event_source,
 							 const char        *path,
 							 const char        *type,
 							 const char        *subtype,
-							 const CORBA_any   *value,                          
+							 const CORBA_any   *opt_value,
 							 CORBA_Environment *opt_ev);
 
 void        bonobo_event_source_client_remove_listener  (Bonobo_Unknown     object,

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
Morálisan helytelen hagyni, hogy a balekoknál pénz maradjon.





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