/**
 * e_data_book_factory_activate:
 * @factory: an #EDataBookFactory
 * @iid: the OAF ID of the factory to activate
 *
 * Activates the factory specified by @iid, using Bonobo.
 *
 * Return value: %TRUE for success, %FALSE otherwise.
 **/
gboolean
e_data_book_factory_activate (EDataBookFactory *factory, const char *iid)
{
	EDataBookFactoryPrivate *priv;
	Bonobo_RegistrationResult result;
	char *tmp_iid;

	g_return_val_if_fail (factory != NULL, FALSE);
	g_return_val_if_fail (E_IS_DATA_BOOK_FACTORY (factory), FALSE);

	priv = factory->priv;

	g_return_val_if_fail (!priv->registered, FALSE);

	/* if iid is NULL, use the default factory OAFIID */
	if (iid)
		tmp_iid = g_strdup (iid);
	else
		tmp_iid = g_strdup (DEFAULT_E_DATA_BOOK_FACTORY_OAF_ID);

	result = bonobo_activation_active_server_register (tmp_iid, bonobo_object_corba_objref (BONOBO_OBJECT (factory)));

	switch (result) {
	case Bonobo_ACTIVATION_REG_SUCCESS:
		priv->registered = TRUE;
		priv->iid = tmp_iid;
		return TRUE;
	case Bonobo_ACTIVATION_REG_NOT_LISTED:
		g_message ("Error registering the PAS factory: not listed");
		break;
	case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
		g_message ("Error registering the PAS factory: already active");
		break;
	case Bonobo_ACTIVATION_REG_ERROR:
	default:
		g_message ("Error registering the PAS factory: generic error");
		break;
	}

	g_free (tmp_iid);
	return FALSE;
}
예제 #2
0
static int
register_activate_server(void)
{
	Bonobo_RegistrationResult res;
	CORBA_Object r_obj = CORBA_OBJECT_NIL;

	if (registerior) {
		r_obj = CORBA_ORB_string_to_object (orb, registerior, &ev);
		if (ev._major != CORBA_NO_EXCEPTION)
			return 1;
	}

	if (r_obj) {
		res = bonobo_activation_active_server_register(registeriid, r_obj);
		if (res == Bonobo_ACTIVATION_REG_SUCCESS || res == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE)
			return 0;
	}

	return 1;
}