Re: API review from Jamil ...



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libbonoboui/ChangeLog,v
retrieving revision 1.83
diff -u -u -r1.83 ChangeLog
--- ChangeLog	2001/08/01 00:27:49	1.83
+++ ChangeLog	2001/08/01 00:49:21
@@ -1,3 +1,9 @@
+2001-08-01  ERDI Gergo  <cactus cactus rulez org>
+
+	* bonobo/bonobo-control.h: Add opt_ev's around the place
+
+	* bonobo/bonobo-control-frame.h: ditto
+
 2001-08-01  Michael Meeks  <michael ximian com>
 
 	* samples/controls/sample-control-container.c (main): upd.
Index: bonobo/bonobo-control-frame.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-control-frame.c,v
retrieving revision 1.67
diff -u -u -r1.67 bonobo-control-frame.c
--- bonobo/bonobo-control-frame.c	2001/07/27 11:45:53	1.67
+++ bonobo/bonobo-control-frame.c	2001/08/01 00:49:22
@@ -688,13 +688,16 @@
  * @control_frame: A BonoboControlFrame object.
  * @control: The CORBA object for the BonoboControl embedded
  * in this BonoboControlFrame.
+ * @opt_ev: Optional exception environment
  *
  * Associates @control with this @control_frame.
  */
 void
-bonobo_control_frame_bind_to_control (BonoboControlFrame *control_frame, Bonobo_Control control)
+bonobo_control_frame_bind_to_control (BonoboControlFrame *control_frame,
+				      Bonobo_Control      control,
+				      CORBA_Environment  *opt_ev)
 {
-	CORBA_Environment ev;
+	CORBA_Environment *ev, tmp_ev;
 
 	g_return_if_fail (control != CORBA_OBJECT_NIL);
 	g_return_if_fail (BONOBO_IS_CONTROL_FRAME (control_frame));
@@ -705,18 +708,24 @@
 	if (control_frame->priv->control != CORBA_OBJECT_NIL)
 		g_warning ("FIXME: leaking control reference");
 
-	CORBA_exception_init (&ev);
+	if (!opt_ev) {
+		CORBA_exception_init (&tmp_ev);
+		ev = &tmp_ev;
+	} else
+		ev = opt_ev;
 
-	control_frame->priv->control = bonobo_object_dup_ref (control, &ev);
+	control_frame->priv->control = bonobo_object_dup_ref (control, ev);
 
 	/*
 	 * Introduce ourselves to the Control.
 	 */
-	Bonobo_Control_setFrame (control, BONOBO_OBJREF (control_frame), &ev);
+	Bonobo_Control_setFrame (control, BONOBO_OBJREF (control_frame), ev);
+
+	if (BONOBO_EX (ev))
+		bonobo_object_check_env (BONOBO_OBJECT (control_frame), control, ev);
 
-	if (BONOBO_EX (&ev))
-		bonobo_object_check_env (BONOBO_OBJECT (control_frame), control, &ev);
-	CORBA_exception_free (&ev);
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
 
 	/* 
 	 * Re-create the socket if it got destroyed by the Control before.
@@ -851,9 +860,11 @@
 
 void
 bonobo_control_frame_size_request (BonoboControlFrame *control_frame,
-				   int *desired_width, int *desired_height)
+				   int                *desired_width,
+				   int                *desired_height,
+				   CORBA_Environment  *opt_ev)
 {
-	CORBA_Environment ev;
+	CORBA_Environment *ev, tmp_ev;
 	CORBA_short width, height;
 
 	g_return_if_fail (control_frame != NULL);
@@ -862,15 +873,19 @@
 	g_return_if_fail (desired_width != NULL);
 	g_return_if_fail (desired_height != NULL);
 
-	CORBA_exception_init (&ev);
-
+	if (!opt_ev) {
+		CORBA_exception_init (&tmp_ev);
+		ev = &tmp_ev;
+	} else
+		ev = opt_ev;
+		
 	Bonobo_Control_getDesiredSize (control_frame->priv->control,
-				       &width, &height, &ev);
+				       &width, &height, ev);
 
-	if (BONOBO_EX (&ev)) {
+	if (BONOBO_EX (ev)) {
 		bonobo_object_check_env (
 			BONOBO_OBJECT (control_frame),
-			(CORBA_Object) control_frame->priv->control, &ev);
+			(CORBA_Object) control_frame->priv->control, ev);
 
 		width = height = 0;
 	}
@@ -878,7 +893,8 @@
 	*desired_width = width;
 	*desired_height = height;
 
-	CORBA_exception_free (&ev);
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
 }
 
 /*
Index: bonobo/bonobo-control-frame.h
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-control-frame.h,v
retrieving revision 1.29
diff -u -u -r1.29 bonobo-control-frame.h
--- bonobo/bonobo-control-frame.h	2001/06/28 13:49:21	1.29
+++ bonobo/bonobo-control-frame.h	2001/08/01 00:49:22
@@ -78,7 +78,8 @@
 
 /* Connecting to the remote control */
 void                          bonobo_control_frame_bind_to_control           (BonoboControlFrame  *control_frame,
-									      Bonobo_Control       control);
+									      Bonobo_Control       control,
+									      CORBA_Environment   *opt_ev);
 
 Bonobo_Control                bonobo_control_frame_get_control               (BonoboControlFrame  *control_frame);
 
@@ -98,8 +99,9 @@
  */
 void  bonobo_control_frame_size_request (BonoboControlFrame *control_frame,
 					 int                *desired_width,
-					 int                *desired_height);
-
+					 int                *desired_height,
+					 CORBA_Environment  *opt_ev);
+					 
 /* You almost certainly don't want these methods */
 void  bonobo_control_frame_sync_realize   (BonoboControlFrame *frame);
 void  bonobo_control_frame_sync_unrealize (BonoboControlFrame *frame);
Index: bonobo/bonobo-control.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-control.c,v
retrieving revision 1.89
diff -u -u -r1.89 bonobo-control.c
--- bonobo/bonobo-control.c	2001/07/30 20:36:45	1.89
+++ bonobo/bonobo-control.c	2001/08/01 00:49:23
@@ -173,7 +173,7 @@
 	if (control->priv->ui_component == NULL)
 		return;
 
-	remote_container = bonobo_control_get_remote_ui_container (control);
+	remote_container = bonobo_control_get_remote_ui_container (control, NULL);
 	if (remote_container == CORBA_OBJECT_NIL)
 		return;
 
@@ -221,7 +221,7 @@
 {
 	BonoboControl *control = BONOBO_CONTROL (bonobo_object_from_servant (servant));
 
-	bonobo_control_set_control_frame (control, frame);
+	bonobo_control_set_control_frame (control, frame, ev);
 }
 
 
@@ -684,51 +684,68 @@
  * bonobo_control_set_control_frame:
  * @control: A BonoboControl object.
  * @control_frame: A CORBA interface for the ControlFrame which contains this Controo.
+ * @opt_ev: an optional exception environment
  *
  * Sets the ControlFrame for @control to @control_frame.
  */
 void
-bonobo_control_set_control_frame (BonoboControl *control, Bonobo_ControlFrame control_frame)
+bonobo_control_set_control_frame (BonoboControl       *control,
+				  Bonobo_ControlFrame  control_frame,
+				  CORBA_Environment   *opt_ev)
 {
-	CORBA_Environment ev;
+	CORBA_Environment *ev, tmp_ev;
 
 	g_return_if_fail (BONOBO_IS_CONTROL (control));
-
-	CORBA_exception_init (&ev);
 
+	if (!opt_ev) {
+		CORBA_exception_init (&tmp_ev);
+		ev = &tmp_ev;
+	} else
+		ev = opt_ev;
+		
 	if (control->priv->control_frame != CORBA_OBJECT_NIL)
-		CORBA_Object_release (control->priv->control_frame, &ev);
+		CORBA_Object_release (control->priv->control_frame, ev);
 	
 	if (control_frame == CORBA_OBJECT_NIL)
 		control->priv->control_frame = CORBA_OBJECT_NIL;
 	else
-		control->priv->control_frame = CORBA_Object_duplicate (control_frame, &ev);
+		control->priv->control_frame = CORBA_Object_duplicate (control_frame, ev);
 	
-	CORBA_exception_free (&ev);
-
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
+	
 	g_signal_emit (G_OBJECT (control), control_signals [SET_FRAME], 0);
-}
+	}
 
 /**
  * bonobo_control_get_control_frame:
  * @control: A BonoboControl object whose Bonobo_ControlFrame CORBA interface is
  * being retrieved.
+ * @opt_ev: an optional exception environment
  *
  * Returns: The Bonobo_ControlFrame CORBA object associated with @control, this is
  * a CORBA_Object_duplicated object.  You need to CORBA_Object_release it when you are
  * done with it.
  */
 Bonobo_ControlFrame
-bonobo_control_get_control_frame (BonoboControl *control)
+bonobo_control_get_control_frame (BonoboControl     *control,
+				  CORBA_Environment *opt_ev)
 {
 	Bonobo_ControlFrame control_frame;
-	CORBA_Environment ev;
+	CORBA_Environment *ev, tmp_ev;
 	
 	g_return_val_if_fail (BONOBO_IS_CONTROL (control), CORBA_OBJECT_NIL);
 
-	CORBA_exception_init (&ev);
-	control_frame = CORBA_Object_duplicate (control->priv->control_frame, &ev);
-	CORBA_exception_free (&ev);
+	if (!opt_ev) {
+		CORBA_exception_init (&tmp_ev);
+		ev = &tmp_ev;
+	} else
+		ev = opt_ev;
+	
+	control_frame = CORBA_Object_duplicate (control->priv->control_frame, ev);
+	
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
 
 	return control_frame;
 }
@@ -767,12 +784,15 @@
  * bonobo_control_set_properties:
  * @control: A #BonoboControl object.
  * @pb: A #Bonobo_PropertyBag.
+ * @opt_ev: An optional exception environment
  *
  * Binds @pb to @control.  When a remote object queries @control
  * for its property bag, @pb will be used in the responses.
  */
 void
-bonobo_control_set_properties (BonoboControl *control, Bonobo_PropertyBag pb)
+bonobo_control_set_properties (BonoboControl      *control,
+			       Bonobo_PropertyBag  pb,
+			       CORBA_Environment  *opt_ev)
 {
 	Bonobo_PropertyBag old_bag;
 
@@ -783,10 +803,10 @@
 	control->priv->propbag = pb;
 
 	if (pb)
-		bonobo_object_dup_ref (pb, NULL);
+		bonobo_object_dup_ref (pb, opt_ev);
 
 	if (old_bag)
-		bonobo_object_release_unref (old_bag, NULL);
+		bonobo_object_release_unref (old_bag, opt_ev);
 }
 
 /**
@@ -807,18 +827,18 @@
  * bonobo_control_get_ambient_properties:
  * @control: A #BonoboControl which is bound to a remote
  * #BonoboControlFrame.
- * @ev: CORBA exception environment.
+ * @opt_ev: an optional exception environment
  *
  * Returns: A #Bonobo_PropertyBag bound to the bag of ambient
  * properties associated with this #Control's #ControlFrame.
  */
 Bonobo_PropertyBag
 bonobo_control_get_ambient_properties (BonoboControl     *control,
-				       CORBA_Environment *ev)
+				       CORBA_Environment *opt_ev)
 {
 	Bonobo_ControlFrame control_frame;
 	Bonobo_PropertyBag pbag;
-	CORBA_Environment *real_ev, tmp_ev;
+	CORBA_Environment *real_ev = 0, tmp_ev;
 
 	g_return_val_if_fail (BONOBO_IS_CONTROL (control), NULL);
 
@@ -827,8 +847,8 @@
 	if (control_frame == CORBA_OBJECT_NIL)
 		return NULL;
 
-	if (ev)
-		real_ev = ev;
+	if (opt_ev)
+		real_ev = opt_ev;
 	else {
 		CORBA_exception_init (&tmp_ev);
 		real_ev = &tmp_ev;
@@ -838,7 +858,7 @@
 		control_frame, real_ev);
 
 	if (BONOBO_EX (real_ev)) {
-		if (!ev)
+		if (!opt_ev)
 			CORBA_exception_free (&tmp_ev);
 		pbag = CORBA_OBJECT_NIL;
 	}
@@ -850,13 +870,15 @@
  * bonobo_control_get_remote_ui_container:
  * @control: A BonoboControl object which is associated with a remote
  * ControlFrame.
+ * @opt_ev: an optional exception environment
  *
  * Returns: The Bonobo_UIContainer CORBA server for the remote BonoboControlFrame.
  */
 Bonobo_UIContainer
-bonobo_control_get_remote_ui_container (BonoboControl *control)
+bonobo_control_get_remote_ui_container (BonoboControl     *control,
+					CORBA_Environment *opt_ev)
 {
-	CORBA_Environment  ev;
+	CORBA_Environment  tmp_ev, *ev;
 	Bonobo_UIContainer ui_container;
 
 	g_return_val_if_fail (BONOBO_IS_CONTROL (control), CORBA_OBJECT_NIL);
@@ -864,13 +886,18 @@
 	g_return_val_if_fail (control->priv->control_frame != CORBA_OBJECT_NIL,
 			      CORBA_OBJECT_NIL);
 
-	CORBA_exception_init (&ev);
+	if (!opt_ev) {
+		CORBA_exception_init (&tmp_ev);
+		ev = &tmp_ev;
+	} else
+		ev = opt_ev;
 
-	ui_container = Bonobo_ControlFrame_getUIHandler (control->priv->control_frame, &ev);
+	ui_container = Bonobo_ControlFrame_getUIHandler (control->priv->control_frame, ev);
 
-	bonobo_object_check_env (BONOBO_OBJECT (control), control->priv->control_frame, &ev);
+	bonobo_object_check_env (BONOBO_OBJECT (control), control->priv->control_frame, ev);
 
-	CORBA_exception_free (&ev);
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
 
 	return ui_container;
 }
@@ -880,26 +907,33 @@
  * @control: A #BonoboControl object which is bound
  * to a remote ControlFrame.
  * @activated: Whether or not @control has been activated.
+ * @opt_ev: An optional exception environment
  *
  * Notifies the remote ControlFrame which is associated with
  * @control that @control has been activated/deactivated.
  */
 void
-bonobo_control_activate_notify (BonoboControl *control,
-				gboolean      activated)
+bonobo_control_activate_notify (BonoboControl     *control,
+				gboolean           activated,
+				CORBA_Environment *opt_ev)
 {
-	CORBA_Environment ev;
+	CORBA_Environment *ev, tmp_ev;
 
 	g_return_if_fail (BONOBO_IS_CONTROL (control));
 	g_return_if_fail (control->priv->control_frame != CORBA_OBJECT_NIL);
-	
-	CORBA_exception_init (&ev);
+
+	if (!opt_ev) {
+		CORBA_exception_init (&tmp_ev);
+		ev = &tmp_ev;
+	} else
+		ev = opt_ev;
 
-	Bonobo_ControlFrame_activated (control->priv->control_frame, activated, &ev);
+	Bonobo_ControlFrame_activated (control->priv->control_frame, activated, ev);
 
-	bonobo_object_check_env (BONOBO_OBJECT (control), control->priv->control_frame, &ev);
+	bonobo_object_check_env (BONOBO_OBJECT (control), control->priv->control_frame, ev);
 
-	CORBA_exception_free (&ev);
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
 }
 
 static void
@@ -960,12 +994,13 @@
 
 void
 bonobo_control_set_property (BonoboControl       *control,
+			     CORBA_Environment   *opt_ev,
 			     const char          *first_prop,
 			     ...)
 {
 	Bonobo_PropertyBag  bag;
 	char               *err;
-	CORBA_Environment   ev;
+	CORBA_Environment  *ev, tmp_ev;
 	va_list             args;
 
 	g_return_if_fail (first_prop != NULL);
@@ -973,26 +1008,32 @@
 
 	va_start (args, first_prop);
 
-	CORBA_exception_init (&ev);
-
+	if (!opt_ev) {
+		CORBA_exception_init (&tmp_ev);
+		ev = &tmp_ev;
+	} else
+		ev = opt_ev;
+		
 	bag = control->priv->propbag;
 
-	if ((err = bonobo_property_bag_client_setv (bag, &ev, first_prop, args)))
+	if ((err = bonobo_property_bag_client_setv (bag, ev, first_prop, args)))
 		g_warning ("Error '%s'", err);
 
-	CORBA_exception_free (&ev);
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
 
 	va_end (args);
 }
 
 void
 bonobo_control_get_property (BonoboControl       *control,
+			     CORBA_Environment   *opt_ev,
 			     const char          *first_prop,
 			     ...)
 {
 	Bonobo_PropertyBag  bag;
 	char               *err;
-	CORBA_Environment   ev;
+	CORBA_Environment  *ev, tmp_ev;
 	va_list             args;
 
 	g_return_if_fail (first_prop != NULL);
@@ -1000,14 +1041,19 @@
 
 	va_start (args, first_prop);
 
-	CORBA_exception_init (&ev);
+	if (!opt_ev) {
+		CORBA_exception_init (&tmp_ev);
+		ev = &tmp_ev;
+	} else
+		ev = opt_ev;
 
 	bag = control->priv->propbag;
 
-	if ((err = bonobo_property_bag_client_getv (bag, &ev, first_prop, args)))
+	if ((err = bonobo_property_bag_client_getv (bag, ev, first_prop, args)))
 		g_warning ("Error '%s'", err);
 
-	CORBA_exception_free (&ev);
+	if (!opt_ev)
+		CORBA_exception_free (&tmp_ev);
 
 	va_end (args);
 }
Index: bonobo/bonobo-control.h
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-control.h,v
retrieving revision 1.35
diff -u -u -r1.35 bonobo-control.h
--- bonobo/bonobo-control.h	2001/07/27 11:45:53	1.35
+++ bonobo/bonobo-control.h	2001/08/01 00:49:23
@@ -52,9 +52,11 @@
 gboolean                    bonobo_control_get_automerge           (BonoboControl *control);
 
 void                        bonobo_control_set_property            (BonoboControl       *control,
+								    CORBA_Environment   *opt_ev,
 								    const char          *first_prop,
 								    ...);
 void                        bonobo_control_get_property            (BonoboControl       *control,
+								    CORBA_Environment   *opt_ev,
 								    const char          *first_prop,
 								    ...);
 
@@ -65,17 +67,22 @@
 BonoboUIComponent          *bonobo_control_get_ui_component        (BonoboControl       *control);
 void                        bonobo_control_set_ui_component        (BonoboControl       *control,
 								    BonoboUIComponent   *component);
-Bonobo_UIContainer          bonobo_control_get_remote_ui_container (BonoboControl       *control);
+Bonobo_UIContainer          bonobo_control_get_remote_ui_container (BonoboControl       *control,
+								    CORBA_Environment   *opt_ev);
 void                        bonobo_control_set_control_frame       (BonoboControl       *control,
-								    Bonobo_ControlFrame  control_frame);
-Bonobo_ControlFrame         bonobo_control_get_control_frame       (BonoboControl       *control);
+								    Bonobo_ControlFrame  control_frame,
+								    CORBA_Environment   *opt_ev);
+Bonobo_ControlFrame         bonobo_control_get_control_frame       (BonoboControl       *control,
+								    CORBA_Environment   *opt_ev);
 void                        bonobo_control_set_properties          (BonoboControl       *control,
-								    Bonobo_PropertyBag   pb);
+								    Bonobo_PropertyBag   pb,
+								    CORBA_Environment   *opt_ev);
 Bonobo_PropertyBag          bonobo_control_get_properties          (BonoboControl       *control);
 Bonobo_PropertyBag          bonobo_control_get_ambient_properties  (BonoboControl       *control,
-								    CORBA_Environment   *ev);
+								    CORBA_Environment   *opt_ev);
 void                        bonobo_control_activate_notify         (BonoboControl       *control,
-								    gboolean             activated);
+								    gboolean             activated,
+								    CORBA_Environment   *opt_ev);
 Bonobo_Control_windowId     bonobo_control_window_id_from_x11      (guint32              x11_id);
 guint32                     bonobo_control_x11_from_window_id      (Bonobo_Control_windowId id);
 #define                     bonobo_control_windowid_from_x11(a) \
Index: bonobo/bonobo-widget.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-widget.c,v
retrieving revision 1.47
diff -u -u -r1.47 bonobo-widget.c
--- bonobo/bonobo-widget.c	2001/07/23 16:39:22	1.47
+++ bonobo/bonobo-widget.c	2001/08/01 00:49:23
@@ -108,7 +108,8 @@
 	 */
 	bw->priv->control_frame = bonobo_control_frame_new (uic);
 
-	bonobo_control_frame_bind_to_control (bw->priv->control_frame, control);
+	bonobo_control_frame_bind_to_control
+		(bw->priv->control_frame, control, NULL);
 
 	/*
 	 * People that pass us controls get them sunk.
-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
05.04: Luke Skywalker Day (May the 4th be with you) (Ankh #gnome)





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