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