Example #1
0
void
bonobo_event_source_client_remove_listener (Bonobo_Unknown     object,
        Bonobo_Listener    listener,
        CORBA_Environment *opt_ev)
{
    Bonobo_Unknown     es;
    CORBA_Environment *ev, temp_ev;

    g_return_if_fail (object != CORBA_OBJECT_NIL);

    if (!opt_ev) {
        CORBA_exception_init (&temp_ev);
        ev = &temp_ev;
    } else
        ev = opt_ev;

    es = Bonobo_Unknown_queryInterface (object,
                                        "IDL:Bonobo/EventSource:1.0", ev);

    if (!BONOBO_EX (ev) && es) {

        Bonobo_EventSource_removeListener (es, listener, ev);

        Bonobo_Unknown_unref (es, ev);
    }

    if (!opt_ev) {
        if (BONOBO_EX (ev)) {
            char *text = bonobo_exception_get_text (ev);
            g_warning ("remove_listener failed '%s'", text);
            g_free (text);
        }
        CORBA_exception_free (ev);
    }
}
static gboolean
impl_exists (BonoboUIComponent *component,
	     const char        *path,
	     CORBA_Environment *opt_ev)
{
	gboolean ret;
	Bonobo_UIContainer container;
	CORBA_Environment *ev, tmp_ev;

	container = component->priv->container;
	g_return_val_if_fail (container != CORBA_OBJECT_NIL, FALSE);

	if (opt_ev)
		ev = opt_ev;
	else {
		CORBA_exception_init (&tmp_ev);
		ev = &tmp_ev;
	}

	ret = Bonobo_UIContainer_exists (container, path, ev);

	if (BONOBO_EX (ev)) {
		ret = FALSE;
		if (!opt_ev)
			g_warning ("Serious exception on path_exists '$%s'",
				   bonobo_exception_get_text (ev));
	}

	if (!opt_ev)
		CORBA_exception_free (&tmp_ev);

	return ret;
}
Example #3
0
/* Does a simple activation and unreffing of the alarm notification service so
 * that the daemon will be launched if it is not running yet.
 */
static gboolean
launch_alarm_daemon_cb (gpointer data)
{
	CORBA_Environment ev;
	CORBA_Object an;
	guint *idle_id = (guint *) data;

	/* remove the idle function */
	g_source_remove (*idle_id);
	g_free (idle_id);

	/* activate the alarm daemon */
	CORBA_exception_init (&ev);
	an = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify:" BASE_VERSION, 0, NULL, &ev);

	if (BONOBO_EX (&ev)) {
		g_message ("launch_alarm_daemon_cb(): %s", bonobo_exception_get_text (&ev));
		CORBA_exception_free (&ev);
		return FALSE;
	}
	CORBA_exception_free (&ev);

	/* Just get rid of it; what we are interested in is that it gets launched */

	CORBA_exception_init (&ev);
	bonobo_object_release_unref (an, &ev);
	if (BONOBO_EX (&ev))
		g_message ("add_alarms(): Could not unref the alarm notification service");

	CORBA_exception_free (&ev);

	return FALSE;
}
/**
 * bonobo_ui_component_object_get:
 * @component: the component
 * @path: the path to set
 * @ev: the (optional) CORBA exception environment
 * 
 * This returns the @control CORBA object registered with the
 * #BonoboUIContainer associated with this @component at
 * the specified @path.
 *
 * Returns: the associated remote CORBA object.
 **/
Bonobo_Unknown
bonobo_ui_component_object_get (BonoboUIComponent  *component,
				const char         *path,
				CORBA_Environment  *ev)
{
	CORBA_Environment *real_ev, tmp_ev;
	Bonobo_Unknown     ret;
	Bonobo_UIContainer container;

	g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component),
			      CORBA_OBJECT_NIL);
	container = component->priv->container;
	g_return_val_if_fail (container != CORBA_OBJECT_NIL,
			      CORBA_OBJECT_NIL);

	if (ev)
		real_ev = ev;
	else {
		CORBA_exception_init (&tmp_ev);
		real_ev = &tmp_ev;
	}

	ret = Bonobo_UIContainer_getObject (container, path, real_ev);

	if (!ev && BONOBO_EX (real_ev))
		g_warning ("Serious exception getting object '%s' '%s'",
			   path, bonobo_exception_get_text (real_ev));

	if (!ev)
		CORBA_exception_free (&tmp_ev);

	return ret;
}
static void
impl_xml_rm (BonoboUIComponent  *component,
	     const char         *path,
	     CORBA_Environment  *ev)
{
	BonoboUIComponentPrivate *priv;
	CORBA_Environment *real_ev, tmp_ev;
	Bonobo_UIContainer container;

	container = component->priv->container;
	g_return_if_fail (container != CORBA_OBJECT_NIL);

	if (ev)
		real_ev = ev;
	else {
		CORBA_exception_init (&tmp_ev);
		real_ev = &tmp_ev;
	}

	priv = component->priv;

	Bonobo_UIContainer_removeNode (
		container, path, priv->name, real_ev);

	if (!ev && BONOBO_EX (real_ev))
		g_warning ("Serious exception removing path  '%s' '%s'",
			   path, bonobo_exception_get_text (real_ev));

	if (!ev)
		CORBA_exception_free (&tmp_ev);
}
static void
impl_thaw (BonoboUIComponent *component,
	   CORBA_Environment *ev)
{
	component->priv->frozenness--;

	if (component->priv->frozenness == 0) {
		CORBA_Environment *real_ev, tmp_ev;
		Bonobo_UIContainer container;

		container = component->priv->container;
		g_return_if_fail (container != CORBA_OBJECT_NIL);

		if (ev)
			real_ev = ev;
		else {
			CORBA_exception_init (&tmp_ev);
			real_ev = &tmp_ev;
		}

		Bonobo_UIContainer_thaw (container, real_ev);

		if (BONOBO_EX (real_ev) && !ev)
			g_warning ("Serious exception on UI thaw '$%s'",
				   bonobo_exception_get_text (real_ev));

		if (!ev)
			CORBA_exception_free (&tmp_ev);

	} else if (component->priv->frozenness < 0)
		g_warning ("Freeze/thaw mismatch on '%s'",
			   component->priv->name ? component->priv->name : "<Null>");
}
static void
impl_freeze (BonoboUIComponent *component,
	     CORBA_Environment *ev)
{
	if (component->priv->frozenness == 0) {
		CORBA_Environment *real_ev, tmp_ev;
		Bonobo_UIContainer container;

		container = component->priv->container;
		g_return_if_fail (container != CORBA_OBJECT_NIL);

		if (ev)
			real_ev = ev;
		else {
			CORBA_exception_init (&tmp_ev);
			real_ev = &tmp_ev;
		}

		Bonobo_UIContainer_freeze (container, real_ev);

		if (BONOBO_EX (real_ev) && !ev)
			g_warning ("Serious exception on UI freeze '$%s'",
				   bonobo_exception_get_text (real_ev));

		if (!ev)
			CORBA_exception_free (&tmp_ev);
	}

	component->priv->frozenness++;
}
Example #8
0
GnomeDialog *
gnocam_camera_selector_new (void)
{
	GnoCamCameraSelector *selector;
	const gchar *buttons[] = {GNOME_STOCK_BUTTON_OK,
				  GNOME_STOCK_BUTTON_CANCEL, NULL};
	GtkWidget *hbox, *pixmap, *vbox, *widget, *label;
	Bonobo_PropertyBag pb;
	CORBA_Environment ev;
	
	selector = gtk_type_new (GNOCAM_TYPE_CAMERA_SELECTOR);
	gnome_dialog_constructv (GNOME_DIALOG (selector), _("Select a Camera"),
				 buttons);
	gnome_dialog_set_default (GNOME_DIALOG (selector), 0);
	gtk_window_set_policy (GTK_WINDOW (selector), TRUE, TRUE, TRUE);
	gtk_widget_set_usize (GTK_WIDGET (selector), 400, 300);

	hbox = gtk_hbox_new (FALSE, 10);
	gtk_widget_show (hbox);
	gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (selector)->vbox), hbox);
	
	vbox = gtk_vbox_new (FALSE, 10);
	gtk_widget_show (vbox);
	gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);

	/* The camera picture */
	pixmap = gnome_pixmap_new_from_file (IMAGEDIR "/gnocam.png");
	gtk_widget_show (pixmap);
	gtk_box_pack_start (GTK_BOX (vbox), pixmap, FALSE, FALSE, 0);

	/* The "Autodetect" check button */
	CORBA_exception_init (&ev);
	pb = bonobo_get_object ("config:/apps/" PACKAGE,
				"Bonobo/PropertyBag", &ev);
	if (BONOBO_EX (&ev)) {
		g_warning ("Could not get property bag: %s", 
			   bonobo_exception_get_text (&ev));
	} else {
		GtkObject *ed;

		ed = bonobo_peditor_new (pb, "autodetect", TC_boolean, NULL);
		bonobo_object_release_unref (pb, NULL);
		widget = bonobo_peditor_get_widget (BONOBO_PEDITOR (ed));
		gtk_widget_show (widget);
		gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
		label = gtk_label_new (_("Autodetect"));
		gtk_widget_show (label);
		gtk_container_add (GTK_CONTAINER (widget), label);
	}
	CORBA_exception_free (&ev);

	/* The camera list */
	selector->priv->table = gnocam_capplet_table_scrolled_new (NULL);
	gtk_widget_show (selector->priv->table);
	gtk_box_pack_start (GTK_BOX (hbox), selector->priv->table,
			    TRUE, TRUE, 0);
	
	return (GNOME_DIALOG (selector));
}
Example #9
0
Bonobo_Listener
bonobo_event_source_client_add_listener_full (Bonobo_Unknown     object,
        GClosure          *event_callback,
        const char        *opt_mask,
        CORBA_Environment *opt_ev)
{
    BonoboListener    *listener = NULL;
    Bonobo_Listener    corba_listener = CORBA_OBJECT_NIL;
    Bonobo_Unknown     es;
    CORBA_Environment *ev, temp_ev;

    g_return_val_if_fail (event_callback != NULL, CORBA_OBJECT_NIL);

    if (!opt_ev) {
        ev = &temp_ev;
        CORBA_exception_init (ev);
    } else
        ev = opt_ev;

    es = Bonobo_Unknown_queryInterface (object,
                                        "IDL:Bonobo/EventSource:1.0", ev);

    if (BONOBO_EX (ev) || !es)
        goto add_listener_end;

    if (!(listener = bonobo_listener_new_closure (event_callback)))
        goto add_listener_end;

    corba_listener = BONOBO_OBJREF (listener);

    if (opt_mask)
        Bonobo_EventSource_addListenerWithMask (
            es, corba_listener, opt_mask, ev);
    else
        Bonobo_EventSource_addListener (
            es, corba_listener, ev);

    corba_listener = CORBA_Object_duplicate (corba_listener, ev);

    bonobo_object_unref (BONOBO_OBJECT (listener));

    bonobo_object_release_unref (es, ev);

add_listener_end:

    if (!opt_ev) {
        if (BONOBO_EX (ev)) {
            char *text = bonobo_exception_get_text (ev);
            g_warning ("add_listener failed '%s'", text);
            g_free (text);
        }
        CORBA_exception_free (ev);
    }

    return corba_listener;
}
/**
 * bonobo_ui_component_set_container:
 * @component: the component
 * @container: a remote container object.
 * 
 * This associates this @component with a remote @container
 * object.
 **/
void
bonobo_ui_component_set_container (BonoboUIComponent *component,
				   Bonobo_UIContainer container,
				   CORBA_Environment *opt_ev)
{
	Bonobo_UIContainer ref_cont;

	g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));

	bonobo_object_ref (BONOBO_OBJECT (component));

	if (container != CORBA_OBJECT_NIL) {
		Bonobo_UIComponent corba_component;
		CORBA_Environment *ev, temp_ev;
		char              *name;
		
		if (!opt_ev) {
			CORBA_exception_init (&temp_ev);
			ev = &temp_ev;
		} else
			ev = opt_ev;

		ref_cont = CORBA_Object_duplicate (container, ev);

		corba_component = BONOBO_OBJREF (component);

		name = component->priv->name ? component->priv->name : "";

		Bonobo_UIContainer_registerComponent (
			ref_cont, name, corba_component, ev);

		if (!opt_ev && BONOBO_EX (ev)) {
			char *err;
			g_warning ("Serious exception registering component '%s'",
				   (err = bonobo_exception_get_text (ev)));
			g_free (err);
		}
		
		if (!opt_ev)
			CORBA_exception_free (&temp_ev);
	} else
		ref_cont = CORBA_OBJECT_NIL;

	bonobo_ui_component_unset_container (component, NULL);

	component->priv->container = ref_cont;

	bonobo_object_unref (BONOBO_OBJECT (component));
}
/**
 * e_get_activation_failure_msg:
 * @ev: An exception returned by an oaf_activate call.
 *
 * Get a descriptive error message from @ev.
 *
 * Return value: A newly allocated string with the printable error message.
 **/
char *
e_get_activation_failure_msg (CORBA_Environment *ev)
{
	g_return_val_if_fail (ev != NULL, NULL);

	if (CORBA_exception_id (ev) == NULL)
		return NULL;

	if (strcmp (CORBA_exception_id (ev), ex_Bonobo_GeneralError) != 0) {
		return bonobo_exception_get_text (ev);
	} else {
		const Bonobo_GeneralError *oaf_general_error;

		oaf_general_error = CORBA_exception_value (ev);
		return g_strdup (oaf_general_error->description);
	}
}
void
bonobo_ui_component_widget_set (BonoboUIComponent  *component,
				const char         *path,
				GtkWidget          *widget,
				CORBA_Environment  *opt_ev)
{
	gpointer in_proc_servant;
	BonoboObject *in_proc_container;
	CORBA_Environment *real_ev, tmp_ev;
	Bonobo_UIContainer container;

	g_return_if_fail (widget != CORBA_OBJECT_NIL);
	g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));
	container = component->priv->container;
	g_return_if_fail (container != CORBA_OBJECT_NIL);

	if (opt_ev)
		real_ev = opt_ev;
	else {
		CORBA_exception_init (&tmp_ev);
		real_ev = &tmp_ev;
	}

	if ((in_proc_servant = ORBit_small_get_servant (container)) &&
	    (in_proc_container = bonobo_object (in_proc_servant)) &&
	    BONOBO_IS_UI_CONTAINER (in_proc_container)) {
		BonoboUIEngine *engine;

		engine = bonobo_ui_container_get_engine (
			BONOBO_UI_CONTAINER (in_proc_container));
		g_return_if_fail (engine != NULL);
		bonobo_ui_engine_widget_set (engine, path, widget);
	} else {
		BonoboControl *control = bonobo_control_new (widget);
		Bonobo_UIContainer_setObject (
			container, path, BONOBO_OBJREF (control), real_ev);
		bonobo_object_unref (control);
	}

	if (!opt_ev && BONOBO_EX (real_ev))
		g_warning ("Serious exception setting object '%s' '%s'",
			   path, bonobo_exception_get_text (real_ev));

	if (!opt_ev)
		CORBA_exception_free (&tmp_ev);
}
Example #13
0
static void
test_real_monikers (void)
{
	CORBA_Environment *ev, real_ev;
	Bonobo_Unknown     object;

	CORBA_exception_init ((ev = &real_ev));

	/* Try an impossible moniker resolve */
	object = bonobo_get_object ("OAFIID:Bonobo_Moniker_Oaf",
				    "IDL:Bonobo/PropertyBag:1.0", ev);
	g_assert (object == CORBA_OBJECT_NIL);
	if (BONOBO_EX (ev))
		printf ("%s\n", bonobo_exception_get_text (ev));

	CORBA_exception_free (ev);
}
Example #14
0
int 
main (int argc, char *argv [])
{
	Bonobo_Sample_Echo echo_server;
	CORBA_Environment  ev;

	/*
	 * Initialize bonobo.
	 */
	if (!bonobo_init (&argc, argv))
		g_error (_("I could not initialize Bonobo"));
	
	/*
	 * Enable CORBA/Bonobo to start processing requests
	 */
	bonobo_activate ();

	echo_server = bonobo_get_object ("OAFIID:Bonobo_Sample_Echo",
					 "Bonobo/Sample/Echo", NULL);

	if (echo_server == CORBA_OBJECT_NIL) {
		g_warning (_("Could not create an instance of the sample echo component"));
		return bonobo_debug_shutdown ();
	}

	/* Send a message */
	CORBA_exception_init (&ev);

	Bonobo_Sample_Echo_echo (echo_server, "This is the message from the client\n", &ev);

	/* Check for exceptions */
	if (BONOBO_EX (&ev)) {
		char *err = bonobo_exception_get_text (&ev);
		g_warning (_("An exception occurred '%s'"), err);
		g_free (err);
	}

	CORBA_exception_free (&ev);

	bonobo_object_release_unref (echo_server, NULL);
	
	return bonobo_debug_shutdown ();
}
/**
 * bonobo_ui_component_unset_container:
 * @component: the component
 * 
 * This dis-associates the @component from its associated
 * #BonoboUIContainer.
 **/
void
bonobo_ui_component_unset_container (BonoboUIComponent *component,
				     CORBA_Environment *opt_ev)
{
	Bonobo_UIContainer container;

	g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));

	bonobo_object_ref (BONOBO_OBJECT (component));

	container = component->priv->container;
	component->priv->container = CORBA_OBJECT_NIL;

	if (container != CORBA_OBJECT_NIL) {
		CORBA_Environment *ev, temp_ev;
		char              *name;
		
		if (!opt_ev) {
			CORBA_exception_init (&temp_ev);
			ev = &temp_ev;
		} else
			ev = opt_ev;

		name = component->priv->name ? component->priv->name : "";

		Bonobo_UIContainer_deregisterComponent (container, name, ev);
		
		if (!opt_ev && BONOBO_EX (ev)) {
			char *err;
			g_warning ("Serious exception deregistering component '%s'",
				   (err = bonobo_exception_get_text (ev)));
			g_free (err);
		}

		CORBA_Object_release (container, ev);

		if (!opt_ev)
			CORBA_exception_free (&temp_ev);
	}

	bonobo_object_unref (BONOBO_OBJECT (component));
}
static CORBA_char *
impl_xml_get (BonoboUIComponent *component,
	      const char        *path,
	      gboolean           recurse,
	      CORBA_Environment *ev)
{
	CORBA_Environment *real_ev, tmp_ev;
	CORBA_char *xml;
	Bonobo_UIContainer container;

	container = component->priv->container;
	g_return_val_if_fail (container != CORBA_OBJECT_NIL, NULL);

	if (ev)
		real_ev = ev;
	else {
		CORBA_exception_init (&tmp_ev);
		real_ev = &tmp_ev;
	}

	xml = Bonobo_UIContainer_getNode (container, path, !recurse, real_ev);

	if (BONOBO_EX (real_ev)) {
		if (!ev)
			g_warning ("Serious exception getting node '%s' '$%s'",
				   path, bonobo_exception_get_text (real_ev));
		if (!ev)
			CORBA_exception_free (&tmp_ev);
		
		return NULL;
	}

	if (!ev)
		CORBA_exception_free (&tmp_ev);
	
	return xml;
}
static void
impl_xml_set (BonoboUIComponent  *component,
	      const char         *path,
	      const char         *xml,
	      CORBA_Environment  *ev)
{
	CORBA_Environment *real_ev, tmp_ev;
	Bonobo_UIContainer container;
	char              *name;

	container = component->priv->container;
	g_return_if_fail (container != CORBA_OBJECT_NIL);

	if (xml [0] == '\0')
		return;

	if (ev)
		real_ev = ev;
	else {
		CORBA_exception_init (&tmp_ev);
		real_ev = &tmp_ev;
	}

	name = component->priv->name ? component->priv->name : "";

/*	fprintf (stderr, "setNode ( '%s', '%s', '%s' )", path, xml, name); */
	Bonobo_UIContainer_setNode (container, path, xml,
				    name, real_ev);

	if (BONOBO_EX (real_ev) && !ev)
		g_warning ("Serious exception on node_set '$%s' of '%s' to '%s'",
			   bonobo_exception_get_text (real_ev), xml, path);

	if (!ev)
		CORBA_exception_free (&tmp_ev);
}
static void
query_components (EComponentRegistry *registry)
{
	Bonobo_ServerInfoList *info_list;
	const gchar * const *language_names;
	CORBA_Environment ev;
	GSList *languages = NULL;
	char *query;
	int i;

	if (registry->priv->init)
		return;

	registry->priv->init = TRUE;

	CORBA_exception_init (&ev);
	query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Component:%s')", BASE_VERSION);
	info_list = bonobo_activation_query (query, NULL, &ev);
	g_free (query);

	if (BONOBO_EX (&ev)) {
		char *ex_text = bonobo_exception_get_text (&ev);
		g_warning ("Cannot query for components: %s\n", ex_text);
		g_free (ex_text);
		CORBA_exception_free (&ev);
		return;
	}

	language_names = g_get_language_names ();
	while (*language_names != NULL)
		languages = g_slist_append (languages, (gpointer)(*language_names++));

	for (i = 0; i < info_list->_length; i++) {
		const char *id;
		const char *label;
		const char *menu_label;
		const char *menu_accelerator;
		const char *alias;
		const char *icon_name;
		const char *sort_order_string;
		const char *tooltips;
		GdkPixbuf *icon = NULL, *menuicon = NULL;
		EComponentInfo *info;
		int sort_order;
		GNOME_Evolution_Component iface;

		id = info_list->_buffer[i].iid;
		iface = bonobo_activation_activate_from_id ((char *)id, 0, NULL, &ev);
		if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) {
			char *ex_text = bonobo_exception_get_text (&ev);

			g_warning("Cannot activate '%s': %s\n", id, ex_text);
			g_free(ex_text);
			CORBA_exception_free(&ev);
			CORBA_exception_init(&ev);
			continue;
		}

		label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_label", languages);

		tooltips = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_tooltips", languages);

		menu_label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_label", languages);

		menu_accelerator = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_accelerator", languages);

		alias = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:component_alias", NULL);

		icon_name = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_icon", NULL);
		if (icon_name) {
			icon = e_icon_factory_get_icon (icon_name, E_ICON_SIZE_LARGE_TOOLBAR);
			menuicon = e_icon_factory_get_icon (icon_name, E_ICON_SIZE_MENU);
		}

		sort_order_string = bonobo_server_info_prop_lookup (& info_list->_buffer[i],
								    "evolution:button_sort_order", NULL);
		if (sort_order_string == NULL)
			sort_order = 0;
		else
			sort_order = atoi (sort_order_string);

		info = component_info_new (id, iface, alias, label, tooltips, menu_label,
					   menu_accelerator, sort_order, icon, menuicon);
		set_schemas (info, & info_list->_buffer [i]);

		registry->priv->infos = g_slist_prepend (registry->priv->infos, info);

		if (icon != NULL)
			g_object_unref (icon);
		if (menuicon != NULL)
			g_object_unref (menuicon);
		bonobo_object_release_unref(iface, NULL);
	}
	g_slist_free(languages);

	CORBA_free (info_list);
	CORBA_exception_free (&ev);

	registry->priv->infos = g_slist_sort (registry->priv->infos,
					      (GCompareFunc) component_info_compare_func);
}
Example #19
0
int
main (int argc, char *argv [])
{
	BonoboObject     *object;
	Bonobo_Unknown    ref;
	CORBA_Environment *ev, real_ev;

        g_thread_init (NULL);

	free (malloc (8));

	if (bonobo_init (&argc, argv) == FALSE)
		g_error ("Can not bonobo_init");
	bonobo_activate ();

	ev = &real_ev;
	CORBA_exception_init (ev);

	fprintf (stderr, "Local lifecycle\n");
	{
		object = BONOBO_OBJECT (g_object_new (
			bonobo_moniker_get_type (), NULL));

		g_assert (bonobo_object_ref (object) == object);
		g_assert (bonobo_object_unref (BONOBO_OBJECT (object)) == NULL);

		bonobo_object_unref (BONOBO_OBJECT (object));
	}

	fprintf (stderr, "In-proc lifecycle\n");
	{
		object = BONOBO_OBJECT (g_object_new (
			bonobo_moniker_get_type (), NULL));

		ref = CORBA_Object_duplicate (BONOBO_OBJREF (object), NULL);

		bonobo_object_release_unref (ref, NULL);
	}

	fprintf (stderr, "Query interface\n");
	{
		BonoboObject *a, *b;

		a = BONOBO_OBJECT (g_object_new (
			bonobo_moniker_get_type (), NULL));
		b = BONOBO_OBJECT (g_object_new (
			bonobo_stream_mem_get_type (), NULL));

		bonobo_object_add_interface (a, b);

		fprintf (stderr, "  invalid interface\n");
		object = bonobo_object_query_local_interface (
			a, "IDL:This/Is/Not/There:1.0");
		g_assert (object == CORBA_OBJECT_NIL);

		fprintf (stderr, "  symmetry\n");
		object = bonobo_object_query_local_interface (
			a, "IDL:Bonobo/Stream:1.0");
		g_assert (object == b);
		bonobo_object_unref (object);

		object = bonobo_object_query_local_interface (
			b, "IDL:Bonobo/Stream:1.0");
		g_assert (object == b);
		bonobo_object_unref (object);

		object = bonobo_object_query_local_interface (
			a, "IDL:Bonobo/Moniker:1.0");
		g_assert (object == a);
		bonobo_object_unref (object);

		object = bonobo_object_query_local_interface (
			b, "IDL:Bonobo/Moniker:1.0");
		g_assert (object == a);
		bonobo_object_unref (object);

		fprintf (stderr, "  remote\n");
		ref = Bonobo_Unknown_queryInterface (
			BONOBO_OBJREF (a), "IDL:Broken/1.0", ev);
		g_assert (!BONOBO_EX (ev));
		g_assert (ref == CORBA_OBJECT_NIL);

		ref = Bonobo_Unknown_queryInterface (
			BONOBO_OBJREF (a), "IDL:Bonobo/Stream:1.0", ev);
		g_assert (!BONOBO_EX (ev));
		g_assert (ref == BONOBO_OBJREF (b));
		bonobo_object_release_unref (ref, ev);
		g_assert (!BONOBO_EX (ev));

		bonobo_object_unref (a);
	}

	fprintf (stderr, "Environment exception checks\n");
	{
		object = BONOBO_OBJECT (g_object_new (
			bonobo_moniker_get_type (), NULL));

		g_signal_connect (G_OBJECT (object),
				  "system_exception",
				  G_CALLBACK (system_exception_cb),
				  object);

		CORBA_exception_set_system (
			ev, ex_CORBA_COMM_FAILURE,
			CORBA_COMPLETED_MAYBE);
		g_assert (BONOBO_EX (ev));

		signal_emitted = 0;
		BONOBO_OBJECT_CHECK (
			object, BONOBO_OBJREF (object), ev);
		g_assert (signal_emitted);

		CORBA_exception_free (ev);

		bonobo_object_unref (object);
	}

	fprintf (stderr, "Servant mapping...\n");
	{
		PortableServer_Servant servant;

		object = BONOBO_OBJECT (g_object_new (
			bonobo_moniker_get_type (), NULL));

		servant = (PortableServer_Servant) &object->servant;

		g_assert (bonobo_object (object) == object);
		g_assert (bonobo_object (&object->servant) == object);
		g_assert (bonobo_object_get_servant (object) == servant);
		g_assert (bonobo_object_from_servant (servant) == object);
		g_assert (bonobo_object_fast (object) == object);
		g_assert (bonobo_object_fast (servant) == object);

		bonobo_object_unref (object);
	}

	fprintf (stderr, "Ret-ex tests...\n");
	{
		g_assert (!ret_ex_test (ev));
		ex_test (ev);

		CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
				     ex_Bonobo_PropertyBag_NotFound, NULL);
		g_assert (ret_ex_test (ev));
		
		CORBA_exception_free (ev);
	}

	fprintf (stderr, "General error tests...\n");
	{
		bonobo_exception_general_error_set (
			ev, NULL, "a%s exception occurred", "n exceptional");
		g_assert (BONOBO_EX (ev));
		g_assert (!strcmp (BONOBO_EX_REPOID (ev), ex_Bonobo_GeneralError));
		g_assert (!strcmp (bonobo_exception_get_text (ev),
				   "an exceptional exception occurred"));
	}

	fprintf (stderr, "All tests passed\n");

	return bonobo_debug_shutdown ();
}