Пример #1
0
static void
_do_test(AtkObject *object)
{
   AtkStreamableContent *streamable;
   const gchar *mime, *uri;
   int n_mimes;
   GIOChannel *gio;

   /*AtkStreamableContent test*/
   g_assert(ATK_IS_STREAMABLE_CONTENT(object));
   streamable = ATK_STREAMABLE_CONTENT(object);
   n_mimes = atk_streamable_content_get_n_mime_types(streamable);
   g_assert(n_mimes == 1);
   mime = atk_streamable_content_get_mime_type(streamable, 0);
   g_assert(!strcmp(mime, "video/x-msvideo"));
   uri = atk_streamable_content_get_uri(streamable, "video/x-msvideo");
   _printf("file uri %s\n", uri);
   char *res = g_strrstr(uri, "softboy.avi");
   g_assert(res);
   gio = NULL;
   gio = atk_streamable_content_get_stream(streamable, "video/x-msvideo");
   g_assert(gio);
   if (gio)
     {
        g_io_channel_shutdown(gio, TRUE, NULL);
        g_io_channel_unref(gio);
     }

   eailu_test_code_called = 1;
}
Пример #2
0
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;
}