예제 #1
0
파일: hyperlink.c 프로젝트: GNOME/at-spi
SpiHyperlink *
spi_hyperlink_new (AtkHyperlink *object)
{
  SpiHyperlink *new_hyperlink = g_object_new (
	  SPI_HYPERLINK_TYPE, NULL);

  spi_base_construct (SPI_BASE (new_hyperlink), G_OBJECT(object));

  /* 
   * some hyperlinks are actionable... this is an ATK convention 
   * that seems convenient though possibly poorly documented or unintended.
   */
  if (ATK_IS_ACTION (object))
    {
      /* 
       * NOTE: we don't cast 'object' to ATK_OBJECT in the call to 
       * spi_action_interface_new(), because of the above convention, 
       * even though it means we may be violating the func prototype.
       * See discussion in bugzilla bug #120659.
       * !!!
       * IMPORTANT! The 'AtkObject' typecast, instead of the cast macro,
       * is used below, because 'object' may NOT really be an AtkObject;
       * it will be cast back to a G_OBJECT inside spi_action_interface_new
       * before use, so this is OK though very ropey coding style.
       */

	/* Don't aggregate action twice... if this is from AtkHyperlinkImpl */
	if (!bonobo_object_query_interface (bonobo_object (new_hyperlink), "IDL:Accessibility/Action:1.0",
					    NULL))
	    
	    bonobo_object_add_interface (bonobo_object (new_hyperlink),
					 BONOBO_OBJECT (spi_action_interface_new ((AtkObject *) object)));
    }
  return new_hyperlink;
}
예제 #2
0
static GNOME_C_IDList *
impl_get_files (PortableServer_Servant servant, CORBA_Environment *ev)
{
	KncCDir *d = KNC_C_DIR (bonobo_object (servant));
	KncStatus s;
	KncCamRes cam_res;
	KncCntrlRes cntrl_res;
	unsigned int i;
	KncImageInfo info;
	GNOME_C_IDList *l;

	cntrl_res = knc_get_status (d->priv->c, &cam_res, &s);
	CNIL (cntrl_res, cam_res, ev);
	l = GNOME_C_IDList__alloc ();
	l->_length = 0;
	l->_buffer = CORBA_sequence_CORBA_unsigned_long_allocbuf (s.pictures);
	for (i = 0; i < s.pictures; i++) {
		cntrl_res = knc_get_image_info (d->priv->c, &cam_res, i, &info);
		if (cntrl_res || cam_res)
			continue;
		l->_buffer[l->_length] = info.id;
		l->_length++;
	}
	CORBA_sequence_set_release (l, CORBA_TRUE);
	return l;
}
예제 #3
0
static void
mem_write (PortableServer_Servant servant,
	   const Bonobo_Stream_iobuf *buffer,
	   CORBA_Environment *ev)
{
	BonoboStreamMem *smem = BONOBO_STREAM_MEM (
		bonobo_object (servant));
	long len = buffer->_length;

	if (smem->read_only){
		g_warning ("Should signal an exception here");
		return;
	}

	if (smem->pos + len > smem->size){
		if (smem->resizable){
			smem->size = smem->pos + len;
			smem->buffer = g_realloc (smem->buffer, smem->size);
		} else {
			mem_truncate (servant, smem->pos + len, ev);
			g_warning ("Should check for an exception here");
		}
	}

	if (smem->pos + len > smem->size)
		len = smem->size - smem->pos;
	
	memcpy (smem->buffer + smem->pos, buffer->_buffer, len);
	smem->pos += len;
		
	return;
}
예제 #4
0
static void
mem_truncate (PortableServer_Servant servant,
	      const CORBA_long new_size, 
	      CORBA_Environment *ev)
{
	BonoboStreamMem *smem = BONOBO_STREAM_MEM (
		bonobo_object (servant));
	void *newp;
	
	if (smem->read_only)
		return;

	newp = g_realloc (smem->buffer, new_size);
	if (!newp) {
		CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
				     ex_Bonobo_Stream_NoPermission, NULL);
		return;
	}

	smem->buffer = newp;
	smem->size = new_size;

	if (smem->pos > new_size)
		smem->pos = new_size;
}
예제 #5
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;
}
예제 #6
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);
}
예제 #7
0
static GNOME_C_Mngr_ManufacturerList *
impl_get_devices (PortableServer_Servant servant, CORBA_Environment *ev)
{
	KncCMngr *m = KNC_C_MNGR (bonobo_object (servant));
	GNOME_C_Mngr_ManufacturerList *l;
	unsigned int i, j, k, n, o;
	GPPortInfo info;
	int c;

	l = GNOME_C_Mngr_ManufacturerList__alloc ();

	/* List all manufacturers */
	l->_buffer = GNOME_C_Mngr_ManufacturerList_allocbuf (
						knc_count_devices ());
	l->_length = 0;
	for (i = 0; i < knc_count_devices (); i++) {
	    for (j = 0; j < l->_length; j++)
		if (!strcmp (l->_buffer[j].manufacturer,
			     knc_get_device_manufacturer (i))) break;
	    if (j == l->_length) {
		l->_length++;
		l->_buffer[j].manufacturer = CORBA_string_dup (
				knc_get_device_manufacturer (i));
		l->_buffer[j].models._length = 0;
		l->_buffer[j].models._buffer =
			GNOME_C_Mngr_ModelList_allocbuf (knc_count_devices ());

		/* List all models */
		for (k = 0; k < knc_count_devices (); k++) {
		    if (strcmp (l->_buffer[j].manufacturer,
			        knc_get_device_manufacturer (k))) continue;
		    n = l->_buffer[j].models._length;
		    l->_buffer[j].models._length++;
		    l->_buffer[j].models._buffer[n].model =
			    CORBA_string_dup (knc_get_device_model (k));

		    /* List all serial ports */
		    c = gp_port_info_list_count (m->priv->il);
		    l->_buffer[j].models._buffer[n].ports._length = 0;
		    l->_buffer[j].models._buffer[n].ports._buffer =
			    CORBA_sequence_CORBA_string_allocbuf (MAX (c, 0));
		    for (o = 0; o < MAX (c, 0); o++) {
			gp_port_info_list_get_info (m->priv->il, o, &info);
			if (info.type == GP_PORT_SERIAL) {
			    l->_buffer[j].models._buffer[n].ports._buffer[
				l->_buffer[j].models._buffer[n].ports._length] =
					CORBA_string_dup (info.name);
			    l->_buffer[j].models._buffer[n].ports._length++;
			}
		    }
		}
	    }
	}
	CORBA_sequence_set_release (l, CORBA_TRUE);

	return l;
}
예제 #8
0
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);
}
예제 #9
0
static void
mem_set_info (PortableServer_Servant servant,
	      const Bonobo_StorageInfo *info,
	      const Bonobo_StorageInfoFields mask,
	      CORBA_Environment *ev)
{
	BonoboStreamMem *smem = BONOBO_STREAM_MEM (
		bonobo_object (servant));

	if (smem->read_only) {
		CORBA_exception_set (
			ev, CORBA_USER_EXCEPTION,
			ex_Bonobo_Stream_NoPermission, NULL);
		return;
	}

	if (mask & Bonobo_FIELD_SIZE) {
		CORBA_exception_set (
			ev, CORBA_USER_EXCEPTION,
			ex_Bonobo_Stream_NotSupported, NULL);
		return;
	}

	if ((mask & Bonobo_FIELD_TYPE) &&
	    (info->type != Bonobo_STORAGE_TYPE_REGULAR)) {
		CORBA_exception_set (
			ev, CORBA_USER_EXCEPTION,
			ex_Bonobo_Stream_NotSupported, NULL);
		return;
	}

	if (mask & Bonobo_FIELD_CONTENT_TYPE) {
		bonobo_return_if_fail (info->content_type != NULL, ev);
		g_free (smem->content_type);
		smem->content_type = g_strdup (info->content_type);
	}

	if (strcmp (info->name, smem->name)) {
		bonobo_return_if_fail (info->name != NULL, ev);
		g_free (smem->name);
		smem->name = g_strdup (info->name);
	}
}
static void
impl_GNOME_CertificateAuthentication_CertificateSource_signData (
    PortableServer_Servant servant,
    const GNOME_CertificateAuthentication_CertificateListener listener,
    const CORBA_long opid,
    const GNOME_CertificateAuthentication_Data *certificate,
    const GNOME_CertificateAuthentication_Data *hashData,
    CORBA_Environment *ev)
{
    BonoboObject *obj;
    gnutls_datum_t cert;
    gnutls_datum_t hash;
    gnutls_datum_t signature = { 0, 0 };
    GNOME_CertificateAuthentication_Data corba_signature;
    GcaCertificateSource *source;
    int i;
    
    GCA_ENTER;

    obj = bonobo_object (servant);
    if (obj == NULL || !GCA_IS_CERTIFICATE_SOURCE (obj)) {
        g_warning ("Could not find listener from servant");
        GCA_EXIT;
        return;
    }
    
    source = GCA_CERTIFICATE_SOURCE (obj);
 
    GCA_CERTIFICATE_SOURCE_GET_CLASS (source)->sign_data (
        source,
        _gca_corba_to_datum (&cert, certificate),
        _gca_corba_to_datum (&hash, hashData),
        &signature);

    GNOME_CertificateAuthentication_CertificateListener_notifyDataSigned (
        listener, opid,
        _gca_datum_to_corba (&corba_signature, &signature),
        ev);

    g_free (signature.data);

    GCA_EXIT;
}
예제 #11
0
static void
mem_read (PortableServer_Servant servant, CORBA_long count,
	  Bonobo_Stream_iobuf ** buffer,
	  CORBA_Environment *ev)
{
	BonoboStreamMem *smem = BONOBO_STREAM_MEM (
		bonobo_object (servant));

	if (smem->pos + count > smem->size)
		count = smem->size - smem->pos;
	    
	*buffer = Bonobo_Stream_iobuf__alloc ();
	CORBA_sequence_set_release (*buffer, TRUE);
	(*buffer)->_buffer = CORBA_sequence_CORBA_octet_allocbuf (count);
	(*buffer)->_length = count;
	
	memcpy ((*buffer)->_buffer, smem->buffer + smem->pos, count);

	smem->pos += count;
}
예제 #12
0
파일: echo.c 프로젝트: Distrotech/libbonobo
/*
 * CORBA Demo::Echo::echo method implementation
 */
static void
impl_demo_echo_echo (PortableServer_Servant  servant,
		     const CORBA_char       *string,
		     CORBA_Environment      *ev)
{
	Echo *echo = ECHO (bonobo_object (servant));
									 
	/* activation-server-main.c redirects fd 2 to the bit bucket
	 * 2, so we need to freopen stdout if we want the below output
	 * to show up. Try the controlling terminal.
	 */
	if (freopen (
#ifdef G_OS_WIN32
		     "CONOUT$",
#else
		     "/dev/tty",
#endif
		     "w", stdout))
	    printf ("Echo message received: %s (echo instance data: %s)\n",
		    string, echo->instance_data);
}
예제 #13
0
static CORBA_long
mem_seek (PortableServer_Servant servant,
	  CORBA_long offset, Bonobo_Stream_SeekType whence,
	  CORBA_Environment *ev)
{
	BonoboStreamMem *smem = BONOBO_STREAM_MEM (
		bonobo_object (servant));
	int pos = 0;
	
	switch (whence){
	case Bonobo_Stream_SeekSet:
		pos = offset;
		break;

	case Bonobo_Stream_SeekCur:
		pos = smem->pos + offset;
		break;

	case Bonobo_Stream_SeekEnd:
		pos = smem->size + offset;
		break;

	default:
		g_warning ("Signal exception");
	}

	if (pos > smem->size){
		if (smem->resizable){
			smem->buffer = g_realloc (smem->buffer, pos);
			memset (smem->buffer + smem->size, 0,
				pos - smem->size);
			smem->size = pos;
		} else
			mem_truncate (servant, pos, ev);
	}
	smem->pos = pos;
	return pos;
}
예제 #14
0
static Bonobo_StorageInfo*
mem_get_info (PortableServer_Servant         servant,
	      const Bonobo_StorageInfoFields mask,
	      CORBA_Environment             *ev)
{
	Bonobo_StorageInfo *si;
	BonoboStreamMem    *smem = BONOBO_STREAM_MEM (
		bonobo_object (servant));

	si = Bonobo_StorageInfo__alloc ();

	si->name = CORBA_string_dup (smem->name);

	if (mask & Bonobo_FIELD_SIZE)
		si->size = smem->size;
	if (mask & Bonobo_FIELD_TYPE)
		si->type = Bonobo_STORAGE_TYPE_REGULAR;
	si->content_type = CORBA_string_dup (
		(mask & Bonobo_FIELD_CONTENT_TYPE)
		? smem->content_type
		: "");

	return si;
}
예제 #15
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 ();
}
static GNOME_Evolution_Addressbook_Book
impl_GNOME_Evolution_Addressbook_BookFactory_getBook (PortableServer_Servant        servant,
						      const CORBA_char             *source_xml,
						      const GNOME_Evolution_Addressbook_BookListener listener,
						      CORBA_Environment            *ev)
{
	EDataBookFactory      *factory = E_DATA_BOOK_FACTORY (bonobo_object (servant));
	GNOME_Evolution_Addressbook_Book corba_book;
	EBookBackend *backend;
	EDataBook *book = NULL;
	ESource *source;
	gchar *uri;

	printf ("impl_GNOME_Evolution_Addressbook_BookFactory_getBook\n");

	source = e_source_new_from_standalone_xml (source_xml);
	if (!source) {
		CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
				     ex_GNOME_Evolution_Addressbook_BookFactory_ProtocolNotSupported,
				     NULL);
		return CORBA_OBJECT_NIL;
	}

	uri = e_source_get_uri (source);
	if (!uri) {
		g_object_unref (source);
		CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
				     ex_GNOME_Evolution_Addressbook_BookFactory_ProtocolNotSupported,
				     NULL);
		return CORBA_OBJECT_NIL;
	}
	printf (" + %s\n", uri);

	/* Look up the backend and create one if needed */
	g_mutex_lock (factory->priv->map_mutex);

	backend = g_hash_table_lookup (factory->priv->active_server_map, uri);

	if (!backend) {
		EBookBackendFactory*  backend_factory;

		backend_factory = e_data_book_factory_lookup_backend_factory (factory, uri);

		if (backend_factory == NULL) {
			CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
					     ex_GNOME_Evolution_Addressbook_BookFactory_ProtocolNotSupported,
					     NULL);

			g_mutex_unlock (factory->priv->map_mutex);

			g_free (uri);
			return CORBA_OBJECT_NIL;
		}

		backend = e_data_book_factory_launch_backend (factory, backend_factory, listener, uri);
	}

	g_free (uri);

	if (backend) {
		g_mutex_unlock (factory->priv->map_mutex);

		book = e_data_book_new (backend, source, listener);

		e_book_backend_add_client (backend, book);
		e_book_backend_set_mode (backend, factory->priv->mode);
		corba_book = bonobo_object_corba_objref (BONOBO_OBJECT (book));
	}
	else {
		/* probably need a more descriptive exception here */
		CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
				     ex_GNOME_Evolution_Addressbook_BookFactory_ProtocolNotSupported,
				     NULL);
		g_mutex_unlock (factory->priv->map_mutex);

		corba_book = CORBA_OBJECT_NIL;
	}

	g_object_unref (source);
	if (book)
		printf (" => %p\n", book);
	return corba_book;
}
static void
impl_GNOME_CertificateAuthentication_CertificateSource_requestCertificate (
    PortableServer_Servant servant,
    const GNOME_CertificateAuthentication_CertificateListener listener,
    const CORBA_long opid,
    const GNOME_CertificateAuthentication_DataList* reqCaRdn,
    CORBA_Environment *ev)
{
    BonoboObject *obj;
    gnutls_datum_t *cert_der = NULL;
    gnutls_datum_t *req_ca_rdn;
    GNOME_CertificateAuthentication_DataList cert_der_corba;
    GcaCertificateSource *source;
    int i;
    int nreqs;

    GCA_ENTER;

    obj = bonobo_object (servant);
    if (obj == NULL || !GCA_IS_CERTIFICATE_SOURCE (obj)) {
        g_warning ("Could not find listener from servant");
        GCA_EXIT;
        return;
    }
    
    source = GCA_CERTIFICATE_SOURCE (obj);
    
    nreqs = reqCaRdn->_length;
    req_ca_rdn = g_new0 (gnutls_datum_t, nreqs);
    for (i = 0; i < nreqs; i++) {
        _gca_corba_to_datum (&req_ca_rdn[i], &reqCaRdn->_buffer[i]);
    }

    cert_der_corba._length = 0;

    GCA_CERTIFICATE_SOURCE_GET_CLASS (source)->request_certificate (
        source,
        req_ca_rdn, nreqs,
        &cert_der, &cert_der_corba._length);

    cert_der_corba._buffer = GNOME_CertificateAuthentication_DataList_allocbuf (cert_der_corba._length);
    cert_der_corba._release = TRUE;
    for (i = 0; i < cert_der_corba._length; i++) {
        _gca_datum_to_corba (&cert_der_corba._buffer[i], &cert_der[i]);
    }

    GNOME_CertificateAuthentication_CertificateListener_notifyCertificatePresented (
        listener, opid, &cert_der_corba, ev);

    GNOME_CertificateAuthentication_DataList__freekids (&cert_der_corba, NULL);
    
    for (i = 0; i < cert_der_corba._length; i++) {
        g_free (cert_der[i].data);
    }
    g_free (cert_der);
    
    g_free (req_ca_rdn);
#if 0
    g_free (sign_algos);
#endif
    GCA_EXIT;
}
예제 #18
0
파일: accessible.c 프로젝트: GNOME/at-spi
SpiAccessible *
spi_accessible_construct (GType type, AtkObject *o)
{
    SpiAccessible *retval;
    CORBA_Environment ev;

    CORBA_exception_init (&ev);

    g_assert (o);
    g_assert (g_type_is_a (type, SPI_ACCESSIBLE_TYPE));

    if ((retval = g_hash_table_lookup (get_public_refs (), o)))
      {
        bonobo_object_ref (BONOBO_OBJECT (retval));
	return retval;
      }
    else
      {
        retval = g_object_new (type, NULL);
        spi_base_construct (SPI_BASE (retval), G_OBJECT(o));
      }
    
    g_hash_table_insert (get_public_refs (), o, retval);
    g_signal_connect (G_OBJECT (retval), "destroy",
		      G_CALLBACK (de_register_public_ref),
		      NULL);

    /* aggregate appropriate SPI interfaces based on ATK interfaces */
 
    if (ATK_IS_ACTION (o))
      {
        bonobo_object_add_interface (bonobo_object (retval),
		BONOBO_OBJECT (spi_action_interface_new (o)));
      }

    if (ATK_IS_COMPONENT (o))
      {
        bonobo_object_add_interface (bonobo_object (retval),
				     BONOBO_OBJECT (spi_component_interface_new (o)));
      }

    if (ATK_IS_EDITABLE_TEXT (o))
      {
         bonobo_object_add_interface (bonobo_object (retval),
				      BONOBO_OBJECT(spi_editable_text_interface_new (o)));
      }

    else if (ATK_IS_TEXT (o))
       {
         bonobo_object_add_interface (bonobo_object (retval),
				      BONOBO_OBJECT (spi_text_interface_new (o)));
       }

    if (ATK_IS_HYPERTEXT (o))
      {
        bonobo_object_add_interface (bonobo_object (retval),
				     BONOBO_OBJECT (spi_hypertext_interface_new (o)));
      }

    if (ATK_IS_IMAGE (o))
      {
        bonobo_object_add_interface (bonobo_object (retval),
				     BONOBO_OBJECT (spi_image_interface_new (o)));
      }

    if (ATK_IS_SELECTION (o))
      {
        bonobo_object_add_interface (bonobo_object (retval),
				     BONOBO_OBJECT (spi_selection_interface_new (o)));
      }

    if (ATK_IS_TABLE (o))
      {
        bonobo_object_add_interface (bonobo_object (retval),
				     BONOBO_OBJECT (spi_table_interface_new (o)));
      }

    if (ATK_IS_VALUE (o))
      {
        bonobo_object_add_interface (bonobo_object (retval),
				     BONOBO_OBJECT (spi_value_interface_new (o)));
      }

    if (ATK_IS_STREAMABLE_CONTENT (o))
      {
        bonobo_object_add_interface (bonobo_object (retval),
				     BONOBO_OBJECT (spi_streamable_interface_new (o)));
      }
    if (ATK_IS_DOCUMENT (o)) /* We add collection interface to document */
      {

	   
	 SpiDocument *doc = spi_document_interface_new (o);
	 bonobo_object_add_interface (BONOBO_OBJECT (doc), 
				      BONOBO_OBJECT (spi_collection_interface_new (o)));

	 bonobo_object_add_interface (bonobo_object (retval),
					BONOBO_OBJECT (doc));
      }
    if (ATK_IS_HYPERLINK_IMPL (o))
      {
	  /* !!! the cast below is used instead of the ATK_HYPERLINK macro, since 
	   the object 'o' is not really a hyperlink, but is in fact an AtkHyperlinkImpl.
	   Ouch.  This works since it gets cast back to GObject, but it's nasty and needs
	   to be cleaned up.
	  */
	bonobo_object_add_interface (bonobo_object (retval),
				     BONOBO_OBJECT (spi_hyperlink_new ((AtkHyperlink*)o)));
      }

    return retval;
}
예제 #19
0
파일: at.c 프로젝트: GNOME/at-spi
int
main(int argc, char **argv)
{
        CORBA_Environment ev;
        CORBA_Object oclient;
        char *obj_id;
        CORBA_long i;
        CORBA_short n_desktops;
        CORBA_long j;
        CORBA_long n_apps;
	CORBA_string s;
        Accessibility_Desktop desktop;
        Accessibility_Application app;
        Accessibility_Registry registry;
        SpiListener *listener;

        CORBA_exception_init(&ev);

        if (!bonobo_init (&argc, argv))
          {
            g_error ("Could not initialize Bonobo");
          }

        obj_id = "OAFIID:Accessibility_Registry:1.0";

        oclient = bonobo_activation_activate_from_id (obj_id, 0, NULL, &ev);
        if (ev._major != CORBA_NO_EXCEPTION) {
                fprintf(stderr,
                ("Accessibility app error: exception during registry activation from id: %s\n"),
                        CORBA_exception_id(&ev));
                CORBA_exception_free(&ev);
                exit(-1);
        }

        if (CORBA_Object_is_nil (oclient, &ev))
          {
            g_error ("Could not locate registry");
          }

        bonobo_activate ();

        listener = spi_listener_new ();

        registry = (Accessibility_Registry) oclient;

        Accessibility_Registry_registerGlobalEventListener
                                   (registry,
                                    (Accessibility_EventListener)
                                         bonobo_object_corba_objref (bonobo_object (listener)),
                                    "focus:",
                                    &ev);
        check_ev (&ev, "register:focus");
        Accessibility_Registry_registerGlobalEventListener
                                   (registry,
                                    (Accessibility_EventListener)
                                         bonobo_object_corba_objref (bonobo_object (listener)),
                                    "Gtk:GtkWidget:button-press-event",
                                    &ev);
        check_ev (&ev, "register:button_press");
        fprintf (stderr, "AT callback registered.\n");

            n_desktops = Accessibility_Registry_getDesktopCount (registry, &ev);

            for (i=0; i<n_desktops; ++i)
              {
                desktop = Accessibility_Registry_getDesktop (registry, i, &ev);
		s = Accessibility_Desktop__get_name (desktop, &ev);
                fprintf (stderr, "desktop %d name: %s\n", i, s);
	        CORBA_free (s);	 
                check_ev (&ev, "desktop:name");
                n_apps = Accessibility_Desktop__get_childCount (desktop, &ev);
                check_ev (&ev, "desktop:childCount");
                fprintf (stderr, "desktop has %d apps:\n", n_apps);
                for (j=0; j<n_apps; ++j)
                  {
                    app = (Accessibility_Application) Accessibility_Desktop_getChildAtIndex (desktop, j, &ev);
                    check_ev (&ev, "desktop:getChildAtIndex");
                    s = Accessibility_Application__get_name (app, &ev);
		    fprintf (stderr, "app %d name: %s\n", j, s);
		    CORBA_free (s);
                    check_ev (&ev, "app:getName");
                  }
              }

            fprintf (stderr, "finished querying desktop(s).\n");
            bonobo_main ();
               /* needed by at because it is a server ? */
        exit(0);
}