예제 #1
0
static void
impl_ComponentView_getControls(PortableServer_Servant servant,
		 Bonobo_Control *side_control,
		 Bonobo_Control *view_control,
		 Bonobo_Control *statusbar_control,
		 CORBA_Environment *ev)
{
	EComponentView *ecv = (EComponentView *)bonobo_object_from_servant(servant);

	*side_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->side_control), ev);
	*view_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->view_control), ev);
	*statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->statusbar_control), ev);
}
예제 #2
0
파일: accessible.c 프로젝트: GNOME/at-spi
/*
 * CORBA Accessibility::Accessible::getRelationSet method implementation
 */
static Accessibility_RelationSet *
impl_accessibility_accessible_get_relation_set (PortableServer_Servant servant,
						CORBA_Environment     *ev)
{
  Accessibility_RelationSet *retval;
  gint n_relations = 0;
  gint i;
  AtkRelationSet *relation_set;
  AtkObject      *object = get_atkobject_from_servant (servant);

  bonobo_return_val_if_fail (object != NULL, NULL, ev);

  relation_set = atk_object_ref_relation_set (object);

  if (relation_set)
    n_relations = atk_relation_set_get_n_relations (relation_set);

  retval = CORBA_sequence_Accessibility_Relation__alloc ();
  retval->_length = retval->_maximum = n_relations;
  retval->_buffer = CORBA_sequence_Accessibility_Relation_allocbuf (n_relations);
  CORBA_sequence_set_release (retval, CORBA_TRUE);
	  
  for (i = 0; i < n_relations; ++i)
    {
      retval->_buffer[i] =
        CORBA_Object_duplicate (
          BONOBO_OBJREF (
            spi_relation_new (atk_relation_set_get_relation (relation_set, i))),
	  NULL);
    }
  
  return retval;
}
예제 #3
0
static GNOME_C_Camera
impl_connect (PortableServer_Servant servant, const CORBA_char *manufacturer,
	      const CORBA_char *model, const CORBA_char *port, 
	      CORBA_Environment *ev)
{
	KncCMngr *m = KNC_C_MNGR (bonobo_object (servant));
	KncCCamera *c;
	GPPort *p = NULL;
	GPPortInfo info;
	unsigned int i;

	gp_port_new (&p);
	for (i = 0; i < MAX (gp_port_info_list_count (m->priv->il), 0); i++) {
		gp_port_info_list_get_info (m->priv->il, i, &info);
		if (!strcmp (info.name, port)) {
			gp_port_set_info (p, info);
			c = knc_c_camera_new (manufacturer, model, p, ev);
			if (BONOBO_EX (ev)) return CORBA_OBJECT_NIL;
			return CORBA_Object_duplicate (BONOBO_OBJREF (c), ev);
		}
	}
	gp_port_free (p);
	
	CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_C_Error, NULL);
	return CORBA_OBJECT_NIL;
}
예제 #4
0
static void
impl_setLineStatus(PortableServer_Servant servant, GNOME_Evolution_ShellState shell_state, GNOME_Evolution_Listener listener, CORBA_Environment *ev)
{
	struct _setline_data *sd;
	int status = status_check(shell_state);

	/* This will dis/enable further auto-mail-check action. */
	/* FIXME: If send/receive active, wait for it to finish? */
	if (status)
		camel_session_set_online(session, status);

	sd = g_malloc0(sizeof(*sd));
	sd->status = status;
	sd->listener = CORBA_Object_duplicate(listener, ev);
	if (ev->_major == CORBA_NO_EXCEPTION)
		mail_component_stores_foreach(mail_component_peek(), setline_check, sd);
	else
		CORBA_exception_free(ev);

	if (sd->pending == 0) {
		if (sd->listener) {
			CORBA_Object_release(sd->listener, ev);
			CORBA_exception_free(ev);
		}

		g_free(sd);

		if (!status)
			camel_session_set_online(session, status);
		GNOME_Evolution_Listener_complete(listener, ev);
	}
}
예제 #5
0
파일: accessible.c 프로젝트: GNOME/at-spi
/**
 * spi_accessible_new_return:
 * @o: an AtkObject or NULL
 * @release_ref: whether to unref this AtkObject before return
 * @ev: a CORBA environment
 * 
 * A helper function to instantiate a CORBA accessiblility
 * proxy from an AtkObject.
 * 
 * Return value: the proxy or CORBA_OBJECT_NIL
 **/
Accessibility_Accessible
spi_accessible_new_return (AtkObject         *o,
			   gboolean           release_ref,
			   CORBA_Environment *ev)
{
  SpiAccessible *accessible;
  Accessibility_Accessible retval;

  if (!o)
    {
      return CORBA_OBJECT_NIL;
    }
  else if (SPI_IS_REMOTE_OBJECT (o))
    {
      retval = spi_remote_object_get_accessible (SPI_REMOTE_OBJECT (o));
    }
  else
    {
      accessible = spi_accessible_construct (SPI_ACCESSIBLE_TYPE, o);
      retval = CORBA_Object_duplicate (BONOBO_OBJREF (accessible), ev); 
    }

  if (release_ref)
    {
      g_object_unref (G_OBJECT (o));
    }
  
  return retval;
}
/**
 * bonobo_zoomable_frame_bind_to_zoomable:
 * @zoomable_frame: A BonoboZoomableFrame object.
 * @zoomable: The CORBA object for the BonoboZoomable embedded
 * in this BonoboZoomableFrame.
 *
 * Associates @zoomable with this @zoomable_frame.
 */
void
bonobo_zoomable_frame_bind_to_zoomable (BonoboZoomableFrame *zoomable_frame,
					Bonobo_Zoomable      zoomable,
					CORBA_Environment   *opt_ev)
{
	CORBA_Environment *ev, temp_ev;

	g_return_if_fail (zoomable != CORBA_OBJECT_NIL);
	g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame));

	if (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL)
		CORBA_Object_release (zoomable_frame->priv->zoomable, NULL);

	zoomable_frame->priv->zoomable = CORBA_Object_duplicate (zoomable, NULL);

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

	Bonobo_Zoomable_setFrame (zoomable, BONOBO_OBJREF (zoomable_frame), ev);

	if (BONOBO_EX (ev))
		bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), zoomable, ev);

	if (!opt_ev)
		CORBA_exception_free (&temp_ev);
}
예제 #7
0
static Examples_ByteSeq_Storage
impl_Examples_ByteSeq_Storage__create(PortableServer_POA poa,
				      CORBA_Environment * ev)
{
   Examples_ByteSeq_Storage retval;
   impl_POA_Examples_ByteSeq_Storage *newservant;
   PortableServer_ObjectId *objid;

   newservant = g_new0(impl_POA_Examples_ByteSeq_Storage, 1);
   newservant->servant.vepv = &impl_Examples_ByteSeq_Storage_vepv;
   newservant->poa =
      (PortableServer_POA) CORBA_Object_duplicate((CORBA_Object) poa, ev);

   POA_Examples_ByteSeq_Storage__init((PortableServer_Servant) newservant,
				      ev);
   /* Before servant is going to be activated all
    * private attributes must be initialized.  */

   /* ------ init private attributes here ------ */
   newservant->chunk = ORBit_sequence_alloc (TC_CORBA_sequence_CORBA_octet, 64);   /* ------ ---------- end ------------- ------ */

   objid = PortableServer_POA_activate_object(poa, newservant, ev);
   CORBA_free(objid);
   retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);

   return retval;
}
예제 #8
0
static Examples_BadCall
impl_Examples_BadCall__create(PortableServer_POA poa, CORBA_Environment * ev)
{
   Examples_BadCall retval;
   impl_POA_Examples_BadCall *newservant;
   PortableServer_ObjectId *objid;

   newservant = g_new0(impl_POA_Examples_BadCall, 1);
   newservant->servant.vepv = &impl_Examples_BadCall_vepv;
   newservant->poa =
      (PortableServer_POA) CORBA_Object_duplicate((CORBA_Object) poa, ev);
   POA_Examples_BadCall__init((PortableServer_Servant) newservant, ev);
   /* Before servant is going to be activated all
    * private attributes must be initialized.  */

   /* ------ init private attributes here ------ */ 
   newservant->counter=0;  /* init */
   /* ------ ---------- end ------------- ------ */

   objid = PortableServer_POA_activate_object(poa, newservant, ev);
   CORBA_free(objid);
   retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);

   return retval;
}
/**
 * matecomponent_zoomable_frame_bind_to_zoomable:
 * @zoomable_frame: A MateComponentZoomableFrame object.
 * @zoomable: The CORBA object for the MateComponentZoomable embedded
 * in this MateComponentZoomableFrame.
 *
 * Associates @zoomable with this @zoomable_frame.
 */
void
matecomponent_zoomable_frame_bind_to_zoomable (MateComponentZoomableFrame *zoomable_frame,
					MateComponent_Zoomable      zoomable,
					CORBA_Environment   *opt_ev)
{
	CORBA_Environment *ev, temp_ev;

	g_return_if_fail (zoomable != CORBA_OBJECT_NIL);
	g_return_if_fail (MATECOMPONENT_IS_ZOOMABLE_FRAME (zoomable_frame));

	if (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL)
		CORBA_Object_release (zoomable_frame->priv->zoomable, NULL);

	zoomable_frame->priv->zoomable = CORBA_Object_duplicate (zoomable, NULL);

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

	MateComponent_Zoomable_setFrame (zoomable, MATECOMPONENT_OBJREF (zoomable_frame), ev);

	if (MATECOMPONENT_EX (ev))
		matecomponent_object_check_env (MATECOMPONENT_OBJECT (zoomable_frame), zoomable, ev);

	if (!opt_ev)
		CORBA_exception_free (&temp_ev);
}
MateComponentObject *
matecomponent_foreign_object_new (CORBA_Object corba_objref)
{
	MateComponentObject *object;
	CORBA_Environment ev[1];

	g_return_val_if_fail (corba_objref != CORBA_OBJECT_NIL, NULL);

	CORBA_exception_init (ev);
	if (!CORBA_Object_is_a (corba_objref, "IDL:MateComponent/Unknown:1.0", ev)) {
		if (ev->_major != CORBA_NO_EXCEPTION) {
			char *text = matecomponent_exception_get_text (ev);
			g_warning ("CORBA_Object_is_a: %s", text);
			g_free (text);
		} else
			g_warning ("matecomponent_foreign_object_new: corba_objref"
				   " doesn't have interface MateComponent::Unknown");
		object = NULL;

	} else {
		object = MATECOMPONENT_OBJECT (g_object_new (MATECOMPONENT_TYPE_FOREIGN_OBJECT, NULL));
		object->corba_objref = CORBA_Object_duplicate (corba_objref, NULL);
		matecomponent_running_context_add_object_T (object->corba_objref);
	}
	CORBA_exception_free (ev);

	return object;
}
static MateComponent_Control
impl_MateComponent_PropertyControl_getControl (PortableServer_Servant servant,
					CORBA_long pagenumber,
					CORBA_Environment *ev)
{
	MateComponentObject *matecomponent_object;
	MateComponentPropertyControl *property_control;
	MateComponentPropertyControlPrivate *priv;
	MateComponentControl *control;

	matecomponent_object = matecomponent_object_from_servant (servant);
	property_control = MATECOMPONENT_PROPERTY_CONTROL (matecomponent_object);
	priv = property_control->priv;

	if (pagenumber < 0 || pagenumber >= priv->page_count) {
		CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
				     ex_MateComponent_PropertyControl_NoPage, NULL);
		return CORBA_OBJECT_NIL;
	}

	control = priv->get_fn (property_control, 
			        pagenumber,
		                priv->closure);

	if (control == NULL)
		return CORBA_OBJECT_NIL;

	return (MateComponent_Control) CORBA_Object_duplicate 
		(MATECOMPONENT_OBJREF (control), ev);
}
예제 #12
0
void
pymatecorba_register_stub(CORBA_TypeCode tc, PyObject *stub)
{
    init_hash_tables();

    if (tc->repo_id) {
        CORBA_Object_duplicate((CORBA_Object)tc, NULL);
        g_hash_table_replace(type_codes, tc->repo_id, tc);
    }

    if (stub) {
        PyObject *stub_dict = NULL;
        Py_INCREF(stub);
        g_hash_table_insert(stubs, tc->repo_id, stub);

        if (!strncmp(tc->repo_id, "IDL:omg.org/CORBA", 17)) {
            gchar *other_repo_id = g_strconcat("IDL:", &tc->repo_id[12], NULL);

            g_hash_table_insert(stubs, other_repo_id, stub);
        }

        if (PyType_Check(stub))
            stub_dict = ((PyTypeObject *)stub)->tp_dict;
        else if (PyClass_Check(stub))
            stub_dict = ((PyClassObject *)stub)->cl_dict;

        if (stub_dict && !PyDict_GetItemString(stub_dict, "__typecode__")) {
            PyObject *py_tc = pycorba_typecode_new(tc);

            PyDict_SetItemString(stub_dict, "__typecode__", py_tc);
            Py_DECREF(py_tc);
        }
    }
}
MateComponent_Unknown
matecomponent_moniker_config_resolve (MateComponentMoniker *moniker,
			       const MateComponent_ResolveOptions *options,
			       const CORBA_char *requested_interface,
			       CORBA_Environment *ev)
{
	const gchar *name;

	name = matecomponent_moniker_get_name (moniker);

	if (!strcmp (requested_interface, "IDL:MateComponent/PropertyBag:1.0")) {
		MateComponentConfigBag *bag;

		bag = matecomponent_config_bag_new (name);
		if (bag) {
			return (MateComponent_Unknown) CORBA_Object_duplicate (
				MATECOMPONENT_OBJREF (bag), ev);
		}

		matecomponent_exception_set (ev, ex_MateComponent_Moniker_InterfaceNotFound);
	}
	else
		matecomponent_exception_set (ev, ex_MateComponent_Moniker_InterfaceNotFound);

	return CORBA_OBJECT_NIL;
}
예제 #14
0
static int
pycorba_any_init(PyCORBA_Any *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "typecode", "value", NULL };
    PyCORBA_TypeCode *pytc;
    PyObject *value;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O:CORBA.any.__init__",
				     kwlist, &PyCORBA_TypeCode_Type, &pytc,
				     &value))
	return -1;

    self->any._type = (CORBA_TypeCode)CORBA_Object_duplicate(
					(CORBA_Object)pytc->tc, NULL);
    self->any._value = MateCORBA_small_alloc(self->any._type);

    if (!pymatecorba_marshal_any(&self->any, value)) {
	CORBA_Object_release((CORBA_Object)self->any._type, NULL);
	self->any._type = NULL;
	CORBA_free(self->any._value);
	self->any._value = NULL;
	PyErr_SetString(PyExc_TypeError, "could not marshal value");
	return -1;
    }

    return 0;
}
static void
MateCORBA_imodule_setup_label_any (CORBA_TypeCode  tc,
			       IDL_tree        node,
			       CORBA_any      *label)
{
	if (!node) { /* default case */
		label->_type = TC_CORBA_octet;
		label->_value = MateCORBA_small_alloc (TC_CORBA_octet);
		*(CORBA_octet *) label->_value = -1;
		return;
	}

	label->_type = (CORBA_TypeCode)
				CORBA_Object_duplicate (
					(CORBA_Object) tc, NULL);
	label->_value = MateCORBA_small_alloc (tc);

	switch (IDL_NODE_TYPE (node)) {
	case IDLN_BOOLEAN:
	case IDLN_CHAR:
	case IDLN_INTEGER:
		MateCORBA_imodule_jam_int (node, tc, label->_value);
		break;

	case IDLN_FLOAT:
		g_assert (tc->kind == CORBA_tk_float);
		*(CORBA_float *) label->_value = IDL_FLOAT (node).value;
		break;
	case IDLN_BINOP:  /* drop through */
	case IDLN_UNARYOP: {
		IDL_tree val;

		if (IDL_NODE_TYPE (node) == IDLN_BINOP)
			val = _IDL_binop_eval (IDL_BINOP (node).op,
					       IDL_BINOP (node).left,
					       IDL_BINOP (node).right);
		else
			val = _IDL_unaryop_eval (IDL_BINOP (node).op,
					       IDL_UNARYOP (node).operand);

		MateCORBA_imodule_jam_int (val, tc, label->_value);
		IDL_tree_free (val);
		break;
	}
	case IDLN_IDENT: {
		CORBA_long val;

		g_assert (label->_type->kind == CORBA_tk_enum);
		for (val = 0; val < label->_type->sub_parts; val++)
			if (!strcmp (IDL_IDENT (node).str, label->_type->subnames [val]))
				break;
		g_assert (val < label->_type->sub_parts);
		*(CORBA_long *) label->_value = val;
		break;
	}
	default:
		g_assert_not_reached ();
		break;
	}
}
static void
impl_MateComponent_Control_setFrame (PortableServer_Servant servant,
			      MateComponent_ControlFrame    frame,
			      CORBA_Environment     *ev)
{
	MateComponentControl *control = MATECOMPONENT_CONTROL (
		matecomponent_object_from_servant (servant));

	g_object_ref (control);

	if (control->priv->frame != frame) {
		matecomponent_control_unset_control_frame (control, ev);
	
		if (frame == CORBA_OBJECT_NIL)
			control->priv->frame = CORBA_OBJECT_NIL;
		else {
			control->priv->frame = CORBA_Object_duplicate (
				frame, NULL);
		}
	
		control->priv->inproc_frame = (MateComponentControlFrame *)
			matecomponent_object (MateCORBA_small_get_servant (frame));

		if (!control->priv->inproc_frame)
			matecomponent_control_add_listener (
				frame,
				G_CALLBACK (control_frame_connection_died_cb),
				control, ev);
	
		g_signal_emit (control, control_signals [SET_FRAME], 0);
	}

	g_object_unref (control);
}
예제 #17
0
static GNOME_C_File
impl_get_file (PortableServer_Servant servant, CORBA_unsigned_long id,
	       CORBA_Environment *ev)
{
	KncCDir *d = KNC_C_DIR (bonobo_object (servant));
	KncCFile *f = knc_c_file_new (d->priv->c, id, ev);
	if (BONOBO_EX (ev)) return CORBA_OBJECT_NIL;
	return CORBA_Object_duplicate (BONOBO_OBJREF (f), ev);
}
MateComponent_Listener
matecomponent_event_source_client_add_listener_full (MateComponent_Unknown     object,
					      GClosure          *event_callback,
					      const char        *opt_mask,
					      CORBA_Environment *opt_ev)
{
	MateComponentListener    *listener = NULL;
	MateComponent_Listener    corba_listener = CORBA_OBJECT_NIL;
	MateComponent_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 = MateComponent_Unknown_queryInterface (object, 
		"IDL:MateComponent/EventSource:1.0", ev);

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

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

	corba_listener = MATECOMPONENT_OBJREF (listener);
	
	if (opt_mask)
		MateComponent_EventSource_addListenerWithMask (
			es, corba_listener, opt_mask, ev);
	else 
		MateComponent_EventSource_addListener (
			es, corba_listener, ev);

	corba_listener = CORBA_Object_duplicate (corba_listener, ev);

	matecomponent_object_unref (MATECOMPONENT_OBJECT (listener));

	matecomponent_object_release_unref (es, ev);

 add_listener_end:

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

	return corba_listener;
} 
static void
typecodes_hash_foreach (const char        *repo_id,
			CORBA_TypeCode     tc,
			TypecodesHashIter *iter)
{
	g_assert (iter->iter < iter->sequence->_length);

	iter->sequence->_buffer [iter->iter++] =
		(CORBA_TypeCode) CORBA_Object_duplicate ((CORBA_Object) tc, NULL);
}
static CORBA_UnionMemberSeq *
MateCORBA_imodule_get_union_members (GHashTable        *typecodes,
				 IDL_tree           tree,
				 CORBA_TypeCode     switchtc,
				 CORBA_Environment *ev)
{
	CORBA_UnionMemberSeq *members;
	IDL_tree              l;
	int                   num_members = 0;
	int                   i;

	g_return_val_if_fail (IDL_NODE_TYPE (tree) == IDLN_TYPE_UNION, NULL);

	for (l = IDL_TYPE_UNION (tree).switch_body; l; l = IDL_LIST (l).next)
		num_members += IDL_list_length (IDL_CASE_STMT (IDL_LIST (l).data).labels);

	members = CORBA_UnionMemberSeq__alloc ();

	members->_length  = members->_maximum = num_members;
	members->_buffer  = CORBA_UnionMemberSeq_allocbuf (members->_length);
	members->_release = CORBA_TRUE;

	for (i = 0, l = IDL_TYPE_UNION (tree).switch_body; l; l = IDL_LIST (l).next) {
		CORBA_TypeCode subtc;
		IDL_tree       member, label, dcl;

		member = IDL_CASE_STMT (IDL_LIST (l).data).element_spec;
		g_assert (IDL_NODE_TYPE (member) == IDLN_MEMBER);

		subtc = MateCORBA_imodule_get_typecode (
				typecodes, IDL_MEMBER (member).type_spec);
		dcl = IDL_LIST (IDL_MEMBER (member).dcls).data;

		for (label = IDL_CASE_STMT (IDL_LIST (l).data).labels; label;
		     label = IDL_LIST (label).next, i++) {
			CORBA_UnionMember *umember = &members->_buffer [i];

			MateCORBA_imodule_setup_label_any (
				switchtc, IDL_LIST (label).data, &umember->label);

			umember->label._release = CORBA_TRUE;

			umember->name     = CORBA_string_dup (IDL_IDENT (dcl).str);
			umember->type     = (CORBA_TypeCode)
						CORBA_Object_duplicate ((CORBA_Object) subtc, ev);
			umember->type_def = CORBA_OBJECT_NIL; /* Not used? */
		}

		CORBA_Object_release ((CORBA_Object) subtc, ev);
	}

	g_assert (i == num_members);

	return members;
}
static void
MateCORBA_imodule_register_typecode (GHashTable     *typecodes,
				 const char     *repo_id,
				 CORBA_TypeCode  tc)
{
	g_return_if_fail (g_hash_table_lookup (typecodes, repo_id) == NULL);

	g_hash_table_insert (
		typecodes, g_strdup (repo_id),
		CORBA_Object_duplicate ((CORBA_Object) tc, NULL));
}
static CORBA_TypeCode
MateCORBA_imodule_lookup_typecode (GHashTable *typecodes,
			       const char *repo_id)
{
	if (!typecodes)
		return CORBA_OBJECT_NIL;

	return (CORBA_TypeCode) CORBA_Object_duplicate (
					g_hash_table_lookup (typecodes, repo_id),
					NULL);
}
예제 #23
0
PyObject *
pycorba_policy_new(CORBA_Object policy)
{
    PyCORBA_Policy *self;

    self = PyObject_NEW(PyCORBA_Policy, &PyCORBA_Policy_Type);
    if (!self)
	return NULL;

    self->objref = CORBA_Object_duplicate(policy, NULL);
    return (PyObject *)self;
}
/**
 * matecomponent_event_source_notify_listeners:
 * @event_source: the Event Source that will emit the event.
 * @event_name: Name of the event being emitted
 * @opt_value: A CORBA_any value that contains the data that is passed
 * to interested clients, or NULL 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
 * (through the addListener or addListenerWithMask methods) of the availability
 * of the event named @event_name.  The @value CORBA::any value is passed to
 * all listeners.
 *
 * @event_name can not contain comma separators, as commas are used to
 * separate the various event names. 
 */
void
matecomponent_event_source_notify_listeners (MateComponentEventSource *event_source,
				      const char        *event_name,
				      const CORBA_any   *opt_value,
				      CORBA_Environment *opt_ev)
{
	GSList *l, *notify;
	CORBA_Environment  *ev, temp_ev;
	const MateComponentArg *my_value;

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

	if (!opt_value)
		my_value = matecomponent_arg_new (MATECOMPONENT_ARG_NULL);
	else
		my_value = opt_value;
	
	notify = NULL;

	for (l = event_source->priv->listeners; l; l = l->next) {
		ListenerDesc *desc = (ListenerDesc *) l->data;

		if (desc->event_masks == NULL || 
		    event_match (event_name, desc->event_masks)) {
			notify = g_slist_prepend (
				notify,
				CORBA_Object_duplicate (desc->listener, ev));
		}
	}

	matecomponent_object_ref (MATECOMPONENT_OBJECT (event_source));

	for (l = notify; l; l = l->next) {
		MateComponent_Listener_event (l->data, event_name, my_value, ev);
		CORBA_Object_release (l->data, ev);
	}

	matecomponent_object_unref (MATECOMPONENT_OBJECT (event_source));

	g_slist_free (notify);

	if (!opt_ev)
		CORBA_exception_free (ev);

	if (!opt_value)
		matecomponent_arg_release ((MateComponentArg *) my_value);
}
static CORBA_StructMemberSeq *
MateCORBA_imodule_get_struct_members (GHashTable        *typecodes,
				  IDL_tree           tree,
				  CORBA_Environment *ev)
{
	CORBA_StructMemberSeq *members;
	IDL_tree               l;
	int                    num_members = 0;
	int                    i;

	g_return_val_if_fail (IDL_NODE_TYPE (tree) == IDLN_TYPE_STRUCT ||
			      IDL_NODE_TYPE (tree) == IDLN_EXCEPT_DCL, NULL);

	for (l = IDL_TYPE_STRUCT (tree).member_list; l; l = IDL_LIST (l).next)
		num_members += IDL_list_length (IDL_MEMBER (IDL_LIST (l).data).dcls);

	members = CORBA_StructMemberSeq__alloc ();

	members->_length  = members->_maximum = num_members;
	members->_buffer  = CORBA_StructMemberSeq_allocbuf (members->_length);
	members->_release = CORBA_TRUE;

	for (i = 0, l = IDL_TYPE_STRUCT (tree).member_list; l; l = IDL_LIST (l).next) {
		CORBA_TypeCode subtc;
		IDL_tree       dcl;

		subtc = MateCORBA_imodule_get_typecode (
				typecodes, IDL_MEMBER (IDL_LIST (l).data).type_spec);

		for (dcl = IDL_MEMBER (IDL_LIST (l).data).dcls; dcl;
		     dcl = IDL_LIST (dcl).next, i++) {
			CORBA_StructMember *member = &members->_buffer [i];
			CORBA_string        name;

			if (IDL_NODE_TYPE (dcl) == IDLN_IDENT)
				name = IDL_IDENT (dcl).str;
			else /* IDLN_TYPE_ARRAY */
				name = IDL_IDENT (IDL_TYPE_ARRAY (dcl).ident).str;

			member->name     = CORBA_string_dup (name);
			member->type     = (CORBA_TypeCode)
						CORBA_Object_duplicate ((CORBA_Object) subtc, ev);
			member->type_def = CORBA_OBJECT_NIL; /* Not used? */
		}

		CORBA_Object_release ((CORBA_Object) subtc, ev);
	}

	g_assert (i == num_members);

	return members;
}
예제 #26
0
PyObject *
pycorba_orb_new(CORBA_ORB orb)
{
    PyCORBA_ORB *self;

    self =  PyObject_NEW(PyCORBA_ORB, &PyCORBA_ORB_Type);
    if (!self)
	return NULL;

    self->orb = (CORBA_ORB)CORBA_Object_duplicate((CORBA_Object)orb, NULL);
    return (PyObject *)self;
    
}
static Bonobo_Control
impl__get_control (PortableServer_Servant servant,
		   CORBA_Environment *ev)
{
	EvolutionConfigControl *config_control;
	EvolutionConfigControlPrivate *priv;

	config_control = EVOLUTION_CONFIG_CONTROL (bonobo_object_from_servant (servant));
	priv = config_control->priv;

	bonobo_object_ref (BONOBO_OBJECT (priv->control));

	return CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (priv->control)), ev);
}
예제 #28
0
PyObject *
pycorba_any_new(CORBA_any *any)
{
    PyCORBA_Any *self;

    self =  PyObject_NEW(PyCORBA_Any, &PyCORBA_Any_Type);
    if (!self)
	return NULL;
    self->any._type = (CORBA_TypeCode)CORBA_Object_duplicate((CORBA_Object)any->_type, NULL);
    self->any._value = MateCORBA_copy_value(any->_value, any->_type);
    self->any._release = CORBA_FALSE;

    return (PyObject *)self;
}
예제 #29
0
/**
 * 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));
}
예제 #30
0
static void
impl_GNOME_Camera_captureImage (PortableServer_Servant servant,
				const Bonobo_Listener listener,
				CORBA_Environment *ev)
{
	IdleData *d;

	d = g_new0 (IdleData, 1);
	d->gc = GNOCAM_CAMERA (bonobo_object_from_servant (servant));
	bonobo_object_ref (d->gc);
	d->listener = CORBA_Object_duplicate (listener, NULL);

	g_message ("Adding idle function...");
	g_idle_add_full (0, capture_image_idle, d, idle_data_destroy);
}