Exemplo n.º 1
0
static GNOME_GnoCam_ModelList *
impl_GNOME_GnoCam_getModelList (PortableServer_Servant servant,
					CORBA_Environment *ev)
{
	GnoCamMain *gm;
	GNOME_GnoCam_ModelList *list;
	CameraAbilitiesList *al = NULL;
	int n, i;
	CameraAbilities a;

	gm = GNOCAM_MAIN (bonobo_object_from_servant (servant));

	gp_abilities_list_new (&al);
	gp_abilities_list_load (al, NULL);
	n = MAX (0, gp_abilities_list_count (al));
	list = GNOME_GnoCam_ModelList__alloc ();
	list->_buffer = CORBA_sequence_CORBA_string_allocbuf (n);
	for (i = 0; i < n; i++) {
		if (gp_abilities_list_get_abilities (al, i, &a) >= 0) {
			list->_buffer[list->_length] =
				CORBA_string_dup (a.model);
			list->_length++;
		}
	}
	CORBA_sequence_set_release (list, TRUE);
	gp_abilities_list_free (al);

	return (list);
}
Exemplo n.º 2
0
static GNOME_GnoCam_PortList *
impl_GNOME_GnoCam_getPortList (PortableServer_Servant servant,
				       CORBA_Environment *ev)
{
	GnoCamMain *gm;
	GNOME_GnoCam_PortList *list;
	GPPortInfoList *il = NULL;
	GPPortInfo info;
	int n, i;

	gm = GNOCAM_MAIN (bonobo_object_from_servant (servant));

	gp_port_info_list_new (&il);
	gp_port_info_list_load (il);
	n = MAX (0, gp_port_info_list_count (il));

	list = GNOME_GnoCam_PortList__alloc ();
	list->_buffer = CORBA_sequence_CORBA_string_allocbuf (n);
	for (i = 0; i < n; i++) {
		if (gp_port_info_list_get_info (il, i, &info) >= 0) {
			list->_buffer[list->_length] =
				CORBA_string_dup (info.name);
			list->_length++;
		}
	}
	CORBA_sequence_set_release (list, TRUE);
	gp_port_info_list_free (il);

	return (list);
}
Exemplo n.º 3
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;
}
static void
CORBA_sequence_CORBA_string_copy (CORBA_sequence_CORBA_string       *copy,
                                  const CORBA_sequence_CORBA_string *original)
{
	int i;

	copy->_maximum = original->_length;
	copy->_length = original->_length;
	copy->_buffer = CORBA_sequence_CORBA_string_allocbuf (original->_length);

	for (i = 0; i < original->_length; i++) {
		copy->_buffer[i] = CORBA_string_dup (original->_buffer[i]);
	}

	CORBA_sequence_set_release (copy, TRUE);
}
Exemplo n.º 5
0
static void corba_getplaylist(PortableServer_Servant servant, Freeamp_StringList** list, CORBA_Environment *ev) {
	int i=0;
	char **p;
	int num_entries = freeamp_getplaylist(tptr, &p);
#ifdef CORBADEBUG
	printf("-> corba_getplaylist %d\n", num_entries);
#endif
	*list = CORBA_sequence_CORBA_string__alloc();
	(*list)->_buffer = CORBA_sequence_CORBA_string_allocbuf(num_entries);
	(*list)->_length = num_entries;
	for (i=0; i<num_entries; i++) {
		(*list)->_buffer[i] = CORBA_string_dup(p[i]);
		free(p[i]);
		p[i]=0;
	}
	free(p);
#ifdef CORBADEBUG
	printf("<- corba_getplaylist\n");
#endif
}
Exemplo n.º 6
0
/*
 * Returns a list of the objects in this container
 */
static Bonobo_ItemContainer_ObjectNames *
impl_Bonobo_ItemContainer_enumObjects (PortableServer_Servant servant,
                                       CORBA_Environment     *ev)
{
    Bonobo_ItemContainer_ObjectNames *list;
    BonoboItemContainer              *container;
    GSList                           *objects, *l;
    int                               i;

    container = BONOBO_ITEM_CONTAINER (
                    bonobo_object_from_servant (servant));
    g_return_val_if_fail (container != NULL, NULL);

    list = Bonobo_ItemContainer_ObjectNames__alloc ();
    if (!list)
        return NULL;

    objects = NULL;
    g_hash_table_foreach (container->priv->objects,
                          get_object_names, &objects);

    list->_length = list->_maximum = g_slist_length (objects);

    list->_buffer = CORBA_sequence_CORBA_string_allocbuf (list->_length);
    if (!list->_buffer) {
        CORBA_free (list);
        for (l = objects; l; l = l->next)
            CORBA_free (l->data);
        g_slist_free (objects);
        return NULL;
    }

    /* Assemble the list of objects */
    for (i = 0, l = objects; l; l = l->next)
        list->_buffer [i++] = l->data;

    g_slist_free (objects);

    return list;
}
Exemplo n.º 7
0
static Accessibility_AttributeSet*
impl_getAttributes (PortableServer_Servant servant,
		    CORBA_Environment *ev){
  
  AtkDocument *document = get_document_from_servant (servant);
  AtkAttributeSet *attributes = NULL;
  AtkAttribute *attr = NULL;
  Accessibility_AttributeSet *retval;
  gint n_attributes = 0;
  gint i;
  gchar *concat_str;
  
  g_return_val_if_fail (document != NULL, NULL);
  
  attributes = atk_document_get_attributes (document);

  /* according to atkobject.h, AtkAttributeSet is a GSList */
  if (attributes)
    n_attributes = g_slist_length (attributes);
    
  retval = CORBA_sequence_CORBA_string__alloc ();
  retval->_length = retval->_maximum = n_attributes;
  retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (n_attributes);
  CORBA_sequence_set_release (retval, CORBA_TRUE);
  
  for (i = 0; i < n_attributes; ++i)
  {
      attr = g_slist_nth_data (attributes, i);
      concat_str = g_strconcat (attr->name, ":", attr->value, NULL);
      retval->_buffer [i] = CORBA_string_dup (concat_str);
      g_free (concat_str);
  }
    
  atk_attribute_set_free (attributes);

  return retval;
  
}