Пример #1
0
/* Does a simple activation and unreffing of the alarm notification service so
 * that the daemon will be launched if it is not running yet.
 */
static gboolean
launch_alarm_daemon_cb (gpointer data)
{
	CORBA_Environment ev;
	CORBA_Object an;
	guint *idle_id = (guint *) data;

	/* remove the idle function */
	g_source_remove (*idle_id);
	g_free (idle_id);

	/* activate the alarm daemon */
	CORBA_exception_init (&ev);
	an = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify:" BASE_VERSION, 0, NULL, &ev);

	if (BONOBO_EX (&ev)) {
		g_message ("launch_alarm_daemon_cb(): %s", bonobo_exception_get_text (&ev));
		CORBA_exception_free (&ev);
		return FALSE;
	}
	CORBA_exception_free (&ev);

	/* Just get rid of it; what we are interested in is that it gets launched */

	CORBA_exception_init (&ev);
	bonobo_object_release_unref (an, &ev);
	if (BONOBO_EX (&ev))
		g_message ("add_alarms(): Could not unref the alarm notification service");

	CORBA_exception_free (&ev);

	return FALSE;
}
Пример #2
0
static void
on_view_as_activate (GtkMenuItem *item, ViewAsData *d)
{
	GtkWidget *w, *c, *s;
	Bonobo_Control control;
	CORBA_Environment ev;
	CameraFile *f;
	int result;
	Bonobo_PersistStream pstream;
	BonoboObject *stream;
	const char *data = NULL;
	unsigned long int size;
	const char *type;

	g_return_if_fail (d->iid != NULL);

	CORBA_exception_init (&ev);
	control = bonobo_get_object (d->iid, "IDL:Bonobo/Control:1.0", &ev);
	if (BONOBO_EX (&ev) || (control == CORBA_OBJECT_NIL)) {
		CORBA_exception_free (&ev);
		g_warning ("Could not get control from '%s'.", d->iid);
		return;
	}

	w = bonobo_window_new (d->file, d->file);
	c = bonobo_widget_new_control_from_objref (control, CORBA_OBJECT_NIL);
	gtk_widget_show (c);
	bonobo_window_set_contents (BONOBO_WINDOW (w), c);

	gtk_widget_show (w);

	s = gtkam_status_new (_("Downloading '%s' from '%s'..."), d->file,
			      d->folder);
	g_signal_emit (G_OBJECT (d->list), signals[NEW_STATUS], 0, s);
	gp_file_new (&f);
	result = gp_camera_file_get (d->camera->camera, d->folder, d->file,
				     GP_FILE_TYPE_NORMAL, f,
				     GTKAM_STATUS (s)->context->context);
	if (d->camera->multi)
		gp_camera_exit (d->camera->camera, NULL);
	if (result >= 0) {
		CORBA_exception_init (&ev);
		pstream = Bonobo_Unknown_queryInterface (control,
					"IDL:Bonobo/PersistStream:1.0", &ev);
		if (!BONOBO_EX (&ev) && (pstream != CORBA_OBJECT_NIL)) {
			gp_file_get_data_and_size (f, &data, &size);
			gp_file_get_mime_type (f, &type);
			stream = bonobo_stream_mem_create (data, size,
							   TRUE, FALSE);
			Bonobo_PersistStream_load (pstream,
				bonobo_object_corba_objref (stream), type, &ev);
			g_object_unref (G_OBJECT (stream));
			bonobo_object_release_unref (pstream, NULL);
		}
		CORBA_exception_free (&ev);
	}
	gp_file_unref (f);
	gtk_object_destroy (GTK_OBJECT (s));
}
static void
set_data_and_props (SunOneInvitationList *list, int row) 
{
	SunOneInvitationListPrivate *priv = list->priv;
	BonoboControlFrame *control_frame;
	Bonobo_PropertyBag prop_bag;
	ECalComponent *comp;
	icalcomponent *top_level;
	char *string;
	CORBA_Environment ev;

	if (row == -1) {
		set_data (BONOBO_WIDGET (priv->control), "");
		return;
	}
		
	comp = sunone_invitation_list_model_get_comp (priv->model, row);
	if (!comp)
		return;

	/* Set the from address on the control */
	control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (priv->control));
	prop_bag = bonobo_control_frame_get_control_property_bag (control_frame, NULL);		
	if (prop_bag != CORBA_OBJECT_NIL){
		ECalComponentOrganizer organizer;

		CORBA_exception_init (&ev);
		
		e_cal_component_get_organizer (comp, &organizer);
		bonobo_property_bag_client_set_value_string (prop_bag, "from_address", 
							     organizer.value, &ev);


		CORBA_exception_init (&ev);

		bonobo_property_bag_client_set_value_gint (prop_bag, "view_only", 
							   1, &ev);

		Bonobo_Unknown_unref (prop_bag, &ev);
		CORBA_exception_free (&ev);
	}

	/* Send the icalendar code over */
	top_level = toplevel_with_zones (list, comp);
	string = icalcomponent_as_ical_string_r (top_level);
	set_data (BONOBO_WIDGET (priv->control), string);
	g_free (string);
	icalcomponent_free (top_level);
}
Пример #4
0
int main(int argc, char* argv[]) {
    EchoApp_Echo echo_service = CORBA_OBJECT_NIL;
    CosNaming_NamingContext name_service = CORBA_OBJECT_NIL;

    gchar *id[] = {"EchoApp", "Echo", NULL};

    CORBA_Environment ev[1];
    CORBA_exception_init(ev);

    client_init(&argc, argv, &global_orb, ev);
    etk_abort_if_exception(ev, "init failed");

    g_print("Resolving service reference from name-service with id\"%s\"\n", id[0]);

    name_service = etk_get_name_service(global_orb, ev);
    etk_abort_if_exception(ev, "failed resolving name-service");

    echo_service = (EchoApp_Echo)etk_name_service_resolve(name_service, id, ev);
    etk_abort_if_exception(ev, "failed resolving name service at name-service");

    client_run(echo_service, ev);
    etk_abort_if_exception(ev, "service not reachable");

    client_cleanup(global_orb, echo_service, ev);
    etk_abort_if_exception(ev, "cleanup failed");

    exit(0);
}
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;
}
CORBA_TypeCode
MateCORBA_imodule_create_alias_typecode (GHashTable    *typecodes,
				     IDL_tree       tree,
				     CORBA_TypeCode original_type)
{
	CORBA_Environment env;
	CORBA_TypeCode    retval;

	CORBA_exception_init (&env);

	g_return_val_if_fail (IDL_NODE_TYPE (tree) == IDLN_IDENT, NULL);
	g_return_val_if_fail (g_hash_table_lookup (typecodes,
						   IDL_IDENT (tree).repo_id) == NULL, NULL);

	retval = CORBA_ORB_create_alias_tc (NULL,
			IDL_IDENT (tree).repo_id,
			IDL_IDENT (tree).str,
			original_type, &env);

	MateCORBA_imodule_register_typecode (
			typecodes, IDL_IDENT (tree).repo_id, retval);

	if (env._major != CORBA_NO_EXCEPTION)
		g_warning ("MateCORBA_imodule_create_alias_typecode: exception %s", env._id);

	CORBA_exception_free (&env);

	return retval;
}
/** 
 * matecomponent_stream_cache_create:
 * @cs: a reference to the stream we want to cache
 * @opt_ev: an optional environment
 *
 * Returns a new MateComponentStream object
 */
MateComponentObject *
matecomponent_stream_cache_create (MateComponent_Stream      cs,
			    CORBA_Environment *opt_ev)
{
	MateComponentStreamCache *stream;
	CORBA_Environment  ev, *my_ev;

	matecomponent_return_val_if_fail (cs != NULL, NULL, opt_ev);

	if (!(stream = g_object_new (matecomponent_stream_cache_get_type (), NULL))) {
		if (opt_ev)
			matecomponent_exception_set (opt_ev, ex_MateComponent_Storage_IOError);
		return NULL;
	}
	
	if (!opt_ev) {
		CORBA_exception_init (&ev);
		my_ev = &ev;
	} else
		my_ev = opt_ev;

	stream->priv->cs = matecomponent_object_dup_ref (cs, my_ev);

	if (MATECOMPONENT_EX (my_ev)) {
		if (!opt_ev)
			CORBA_exception_free (&ev);
		matecomponent_object_unref (MATECOMPONENT_OBJECT (stream));
		return NULL;
	}

	if (!opt_ev)
		CORBA_exception_free (&ev);

	return (MateComponentObject *) stream;
}
Пример #8
0
static void
impl_xml_rm (BonoboUIComponent  *component,
	     const char         *path,
	     CORBA_Environment  *ev)
{
	BonoboUIComponentPrivate *priv;
	CORBA_Environment *real_ev, tmp_ev;
	Bonobo_UIContainer container;

	container = component->priv->container;
	g_return_if_fail (container != CORBA_OBJECT_NIL);

	if (ev)
		real_ev = ev;
	else {
		CORBA_exception_init (&tmp_ev);
		real_ev = &tmp_ev;
	}

	priv = component->priv;

	Bonobo_UIContainer_removeNode (
		container, path, priv->name, real_ev);

	if (!ev && BONOBO_EX (real_ev))
		g_warning ("Serious exception removing path  '%s' '%s'",
			   path, bonobo_exception_get_text (real_ev));

	if (!ev)
		CORBA_exception_free (&tmp_ev);
}
Пример #9
0
void
bonobo_event_source_client_remove_listener (Bonobo_Unknown     object,
        Bonobo_Listener    listener,
        CORBA_Environment *opt_ev)
{
    Bonobo_Unknown     es;
    CORBA_Environment *ev, temp_ev;

    g_return_if_fail (object != CORBA_OBJECT_NIL);

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

    es = Bonobo_Unknown_queryInterface (object,
                                        "IDL:Bonobo/EventSource:1.0", ev);

    if (!BONOBO_EX (ev) && es) {

        Bonobo_EventSource_removeListener (es, listener, ev);

        Bonobo_Unknown_unref (es, ev);
    }

    if (!opt_ev) {
        if (BONOBO_EX (ev)) {
            char *text = bonobo_exception_get_text (ev);
            g_warning ("remove_listener failed '%s'", text);
            g_free (text);
        }
        CORBA_exception_free (ev);
    }
}
GList *
matecomponent_zoomable_frame_get_preferred_zoom_level_names (MateComponentZoomableFrame *zoomable_frame)
{
	CORBA_Environment ev;
	MateComponent_ZoomLevelNameList *zoom_level_names;
	GList *list = NULL;
	int i;

	g_return_val_if_fail (MATECOMPONENT_IS_ZOOMABLE_FRAME (zoomable_frame), NULL);

	CORBA_exception_init (&ev);

	zoom_level_names = MateComponent_Zoomable__get_preferredLevelNames (
		zoomable_frame->priv->zoomable, &ev);

	if (MATECOMPONENT_EX (&ev)) {
		matecomponent_object_check_env (MATECOMPONENT_OBJECT (zoomable_frame),
					 zoomable_frame->priv->zoomable, &ev);
		CORBA_exception_free (&ev);
		return NULL;
	}
	CORBA_exception_free (&ev);

	if (zoom_level_names == CORBA_OBJECT_NIL)
		return NULL;

	for (i = 0; i < zoom_level_names->_length; i++)
		list = g_list_prepend (list, g_strdup (zoom_level_names->_buffer [i]));

	CORBA_free (zoom_level_names);

	return g_list_reverse (list);
}
/**
 * matecomponent_property_control_changed:
 * @property_control: The MateComponentPropertyControl that has changed.
 * @opt_ev: An optional CORBA_Environment for exception handling. 
 *
 * Tells the server that a value in the property control has been changed,
 * and that it should indicate this somehow.
 */
void
matecomponent_property_control_changed (MateComponentPropertyControl *property_control,
				 CORBA_Environment     *opt_ev)
{
	MateComponentPropertyControlPrivate *priv;
	CORBA_Environment ev;
	CORBA_any any;
	CORBA_short s;

	g_return_if_fail (property_control != NULL);
	g_return_if_fail (MATECOMPONENT_IS_PROPERTY_CONTROL (property_control));

	priv = property_control->priv;

	if (opt_ev == NULL)
		CORBA_exception_init (&ev);
	else
		ev = *opt_ev;

	s = 0;
	any._type = (CORBA_TypeCode) TC_CORBA_short;
	any._value = &s;

	matecomponent_event_source_notify_listeners (priv->event_source,
					      MATECOMPONENT_PROPERTY_CONTROL_CHANGED,
					      &any, &ev);
	if (opt_ev == NULL && MATECOMPONENT_EX (&ev)) {
		g_warning ("ERROR: %s", CORBA_exception_id (&ev));
	}

	if (opt_ev == NULL)
		CORBA_exception_free (&ev);
}
/**
 * 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);
}
Пример #13
0
MateCanvasItem* get_circle(MateCanvasGroup* group)
{
        CORBA_Object server;
        MateCanvasItem *item;
        CORBA_Environment ev;
  
        CORBA_exception_init (&ev);
  
        server = matecomponent_activation_activate_from_id ("OAFIID:CircleItem", 
                0, NULL, &ev);
  
        if (server == CORBA_OBJECT_NIL || MATECOMPONENT_EX (&ev))
        {
                g_warning (_("Could activate Circle: '%s'"),
                              matecomponent_exception_get_text (&ev));
                CORBA_exception_free(&ev);
                exit(0);
        }
        g_print("Got circle component connect.\n");

        item = mate_canvas_item_new (group, matecomponent_canvas_item_get_type (),
                "corba_factory", server, NULL);
  
        /* I think this tells the object it is OK to exit.
           Probably want to call this when I close.
           or matecomponent_object_release_unref(server, &ev)
        CORBA_Object_release(server, &ev);*/
        matecomponent_object_release_unref(server, &ev);
        CORBA_exception_free(&ev);

        return item;
}
Пример #14
0
Wise2Corba_Singleton * get_Wise2Corba_Singleton(int * argc,char ** argv,char * init_string)
{

  if( static_init_string != NULL ) {
    if( strcmp(static_init_string,init_string) == 0 ) {
      return &singleton;
    } else {
      fprintf(stderr,"Trouble! Asked for orbs of different types %s and %s",init_string,static_init_string);
      return NULL;
    }
  }

  /* else, initiate orb */

  singleton.ev = g_new0(CORBA_Environment,1);

  CORBA_exception_init(singleton.ev);
  singleton.orb = CORBA_ORB_init(argc,argv,init_string,singleton.ev);
  /* FIXME: Exception check! */
  singleton.poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references(singleton.orb,
									   "RootPOA",singleton.ev);

  static_init_string = CORBA_string_dup(init_string);

  return &singleton;
}
Пример #15
0
static void
impl_set_prop (BonoboUIComponent  *component,
	       const char         *path,
	       const char         *prop,
	       const char         *value,
	       CORBA_Environment  *opt_ev)
{
	Bonobo_UIContainer container;
	CORBA_Environment *real_ev, tmp_ev;

	g_return_if_fail (path != NULL);
	g_return_if_fail (prop != NULL);
	g_return_if_fail (value != NULL);

	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;
	}

	Bonobo_UIContainer_setAttr (
		container, path, prop, value,
		component->priv->name, real_ev);

	if (!opt_ev)
		CORBA_exception_free (&tmp_ev);
}
Пример #16
0
static gboolean
dasher_action_speech_activate(DasherAction *pSelf) {
    DasherActionSpeechPrivate *pDasherActionSpeechPrivate = DASHER_ACTION_SPEECH_GET_PRIVATE(pSelf);

    pDasherActionSpeechPrivate->rv = 0;
    Bonobo_ServerInfoList *servers;
    Bonobo_ServerInfo *info;

    servers = bonobo_activation_query("repo_ids.has_one(['IDL:GNOME/Speech/SynthesisDriver:0.2','IDL:GNOME/Speech/SynthesisDriver:0.3'])", NULL, &(pDasherActionSpeechPrivate->ev));

    if(servers->_length == 0) {
        pDasherActionSpeechPrivate->speaker = NULL;
        printf(_("Unable to initialize speech support\n"));
        fflush(stdout);
        return false;
    }

    for(unsigned int i = 0; i < servers->_length; i++) {
        CORBA_exception_init(&(pDasherActionSpeechPrivate->ev));

        info = &servers->_buffer[i];

        pDasherActionSpeechPrivate->rv = bonobo_activation_activate_from_id((const Bonobo_ActivationID)info->iid, 0, NULL, &(pDasherActionSpeechPrivate->ev));
        if(!BONOBO_EX(&(pDasherActionSpeechPrivate->ev))) {
            break;
        }
    }

    CORBA_free(servers);

    GNOME_Speech_SynthesisDriver_driverInit(pDasherActionSpeechPrivate->rv, &(pDasherActionSpeechPrivate->ev));

    pDasherActionSpeechPrivate->voices = GNOME_Speech_SynthesisDriver_getAllVoices(pDasherActionSpeechPrivate->rv, &(pDasherActionSpeechPrivate->ev));

    if(pDasherActionSpeechPrivate->voices == NULL || BONOBO_EX(&(pDasherActionSpeechPrivate->ev)) || pDasherActionSpeechPrivate->voices->_length == 0) {
        g_warning(_("Unable to initialize voices\n"));
        pDasherActionSpeechPrivate->speaker = NULL;
        return false;
    }

    pDasherActionSpeechPrivate->speaker = GNOME_Speech_SynthesisDriver_createSpeaker(pDasherActionSpeechPrivate->rv, &pDasherActionSpeechPrivate->voices->_buffer[0], &(pDasherActionSpeechPrivate->ev));

    GNOME_Speech_ParameterList *list;
    list = GNOME_Speech_Speaker_getSupportedParameters(pDasherActionSpeechPrivate->speaker, &(pDasherActionSpeechPrivate->ev));
    if(BONOBO_EX(&(pDasherActionSpeechPrivate->ev)) || list->_length == 0) {
        if(!BONOBO_EX(&(pDasherActionSpeechPrivate->ev)))
            CORBA_free(list);
        g_warning(_("Warning: unable to set speech parameters\n"));
        return false;
    }
    for(unsigned i = 0; i < list->_length; i++) {
        GNOME_Speech_Parameter *p = &(list->_buffer[i]);
        if(!strcmp(p->name, "rate")) {
            GNOME_Speech_Speaker_setParameterValue(pDasherActionSpeechPrivate->speaker, p->name, 200.0, &(pDasherActionSpeechPrivate->ev));
        }
    }
    CORBA_free(list);

    return true;
}
Пример #17
0
static gboolean
impl_exists (BonoboUIComponent *component,
	     const char        *path,
	     CORBA_Environment *opt_ev)
{
	gboolean ret;
	Bonobo_UIContainer container;
	CORBA_Environment *ev, tmp_ev;

	container = component->priv->container;
	g_return_val_if_fail (container != CORBA_OBJECT_NIL, FALSE);

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

	ret = Bonobo_UIContainer_exists (container, path, ev);

	if (BONOBO_EX (ev)) {
		ret = FALSE;
		if (!opt_ev)
			g_warning ("Serious exception on path_exists '$%s'",
				   bonobo_exception_get_text (ev));
	}

	if (!opt_ev)
		CORBA_exception_free (&tmp_ev);

	return ret;
}
Пример #18
0
int
main (int argc, char *argv[])
{
	CORBA_Object servant = CORBA_OBJECT_NIL;
	
	CORBA_char filename[] = "/tmp/test-ldata.ior";

	CORBA_Environment  ev[1];
	CORBA_exception_init(ev);
	
	server_init (&argc, argv, &global_orb, &root_poa, ev);
	etk_abort_if_exception(ev, "failed ORB init");

	servant = server_activate_service (global_orb, root_poa, ev);
	etk_abort_if_exception(ev, "failed activating service");

	g_print ("Writing service reference to: %s\n\n", filename);

	etk_export_object_to_file (global_orb, 
				   servant, 
				   filename, 
				   ev);
	etk_abort_if_exception(ev, "failed exporting IOR");
	
	server_run (global_orb, ev);
	etk_abort_if_exception(ev, "failed entering main loop");

	server_cleanup (global_orb, root_poa, servant, ev);
	etk_abort_if_exception(ev, "failed cleanup");

	exit (0);
}
Пример #19
0
/**
 * bonobo_ui_component_object_get:
 * @component: the component
 * @path: the path to set
 * @ev: the (optional) CORBA exception environment
 * 
 * This returns the @control CORBA object registered with the
 * #BonoboUIContainer associated with this @component at
 * the specified @path.
 *
 * Returns: the associated remote CORBA object.
 **/
Bonobo_Unknown
bonobo_ui_component_object_get (BonoboUIComponent  *component,
				const char         *path,
				CORBA_Environment  *ev)
{
	CORBA_Environment *real_ev, tmp_ev;
	Bonobo_Unknown     ret;
	Bonobo_UIContainer container;

	g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (component),
			      CORBA_OBJECT_NIL);
	container = component->priv->container;
	g_return_val_if_fail (container != CORBA_OBJECT_NIL,
			      CORBA_OBJECT_NIL);

	if (ev)
		real_ev = ev;
	else {
		CORBA_exception_init (&tmp_ev);
		real_ev = &tmp_ev;
	}

	ret = Bonobo_UIContainer_getObject (container, path, real_ev);

	if (!ev && BONOBO_EX (real_ev))
		g_warning ("Serious exception getting object '%s' '%s'",
			   path, bonobo_exception_get_text (real_ev));

	if (!ev)
		CORBA_exception_free (&tmp_ev);

	return ret;
}
Пример #20
0
/**
 * 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);
}
void
matecomponent_event_source_client_remove_listener (MateComponent_Unknown     object,
					    MateComponent_Listener    listener,
					    CORBA_Environment *opt_ev)
{
	MateComponent_Unknown     es;
	CORBA_Environment *ev, temp_ev;

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

	es = MateComponent_Unknown_queryInterface (object, 
	        "IDL:MateComponent/EventSource:1.0", ev);

	if (!MATECOMPONENT_EX (ev) && es) {

		MateComponent_EventSource_removeListener (es, listener, ev);

		MateComponent_Unknown_unref (es, ev);
	}

	if (!opt_ev) {
		if (MATECOMPONENT_EX (ev)) {
			char *text = matecomponent_exception_get_text (ev);
			g_warning ("remove_listener failed '%s'", text);
			g_free (text);
		}
		CORBA_exception_free (ev);
	}
}
Пример #22
0
GList *
bonobo_zoomable_frame_get_preferred_zoom_level_names (BonoboZoomableFrame *zoomable_frame)
{
	CORBA_Environment ev;
	Bonobo_ZoomLevelNameList *zoom_level_names;
	GList *list = NULL;
	int i;

	g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), NULL);

	CORBA_exception_init (&ev);

	zoom_level_names = Bonobo_Zoomable__get_preferredLevelNames (
		zoomable_frame->priv->zoomable, &ev);

	if (BONOBO_EX (&ev)) {
		bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame),
					 zoomable_frame->priv->zoomable, &ev);
		CORBA_exception_free (&ev);
		return NULL;
	}
	CORBA_exception_free (&ev);

	if (zoom_level_names == CORBA_OBJECT_NIL)
		return NULL;

	for (i = 0; i < zoom_level_names->_length; i++)
		list = g_list_prepend (list, g_strdup (zoom_level_names->_buffer [i]));

	CORBA_free (zoom_level_names);

	return g_list_reverse (list);
}
/* returns 1 in case of success. 0 otherwise. 
   -1 if answer timeouted.... */
static int
test_activate_from_id (char *aid)
{
        CORBA_Environment ev;
        callback_data_t data;
        GMainLoop *loop = g_main_loop_new (NULL, FALSE);
        guint timeout_id;

        CORBA_exception_init (&ev);

        data.callback_called = FALSE;
        data.succeeded = FALSE;
        data.loop = loop;
        bonobo_activation_activate_from_id_async (aid, 0, test_callback, &data, &ev);

        timeout_id = g_timeout_add (DEBUG_TIMEOUT, (GSourceFunc) g_main_loop_quit, loop);
        g_main_loop_run (loop);
        if (data.callback_called == FALSE)
                g_source_remove (timeout_id);
        g_main_loop_unref (loop);

        if (data.callback_called == FALSE) {
                return -1;
        }
        if (data.succeeded == TRUE) {
                return 1;
        } else {
                return 0;
        }
}
static void
empty_activation_cb (CORBA_Object   obj,
                     const char    *error_reason, 
                     gpointer       user_data)
{
        CORBA_Environment ev;
	gboolean          ret = FALSE;
	char             *repo_id = user_data;

        CORBA_exception_init (&ev);

        if (error_reason)
                g_warning ("Async activation error activating '%s' : '%s'", repo_id, error_reason);

        else if (test_object (obj, &ev, "by async query"))
                ret = test_empty (obj, &ev, "by async query");

	if (ret) {
		passed++;
		fprintf (stderr, "PASSED %d of %d: async activation\n", passed + failed, TOTAL_TEST_SCORE);
	} else {
		failed++;
		fprintf (stderr, "FAILED %d of %d: async activation\n", passed + failed, TOTAL_TEST_SCORE);
	}

        CORBA_exception_free (&ev);

        async_done++;
}
Пример #25
0
static gboolean
capture_image_idle (gpointer user_data)
{
	CameraFilePath path;
	IdleData *d = user_data;
	CORBA_Environment ev;
	CORBA_any any;
	gchar *p = NULL;

	CORBA_exception_init (&ev);
	memset (&path, 0, sizeof (CameraFilePath));
	CR (gp_camera_capture (d->gc->camera, GP_CAPTURE_IMAGE,
			       &path, NULL), &ev);
	if (BONOBO_EX (&ev)) {
		GNOME_Camera_ErrorCode e = GNOME_Camera_ERROR;
		any._type = TC_GNOME_Camera_ErrorCode;
		any._value = &e;
	} else {
		p = g_build_path ("/", path.folder, path.name);
		any._type = TC_CORBA_string;
		any._value = &p;
	}

	g_message ("Notifying...");
	Bonobo_Listener_event (d->listener, "result", &any, &ev);
	g_message ("Notified.");

	if (p)
		g_free (p);

	CORBA_exception_free (&ev);

	return (FALSE);
}
Пример #26
0
static void
impl_freeze (BonoboUIComponent *component,
	     CORBA_Environment *ev)
{
	if (component->priv->frozenness == 0) {
		CORBA_Environment *real_ev, tmp_ev;
		Bonobo_UIContainer container;

		container = component->priv->container;
		g_return_if_fail (container != CORBA_OBJECT_NIL);

		if (ev)
			real_ev = ev;
		else {
			CORBA_exception_init (&tmp_ev);
			real_ev = &tmp_ev;
		}

		Bonobo_UIContainer_freeze (container, real_ev);

		if (BONOBO_EX (real_ev) && !ev)
			g_warning ("Serious exception on UI freeze '$%s'",
				   bonobo_exception_get_text (real_ev));

		if (!ev)
			CORBA_exception_free (&tmp_ev);
	}

	component->priv->frozenness++;
}
Пример #27
0
/**
 * guignome_corba_activate_server:
 * @void:
 *
 * Activates the POA manager and thus makes the services available to the
 * outside world.
 **/
void
guignome_corba_activate_server (void)
{
  CORBA_Environment ev;
  PortableServer_POAManager poa_manager;
  
  g_message("In guignome_corba_activate_server (1)\n");

  /* Do nothing if the server is already running */
  if (guignome_corba_have_server)
    return;
   
  g_message("In guignome_corba_activate_server (2)\n");
  CORBA_exception_init (&ev);
    
  poa_manager = PortableServer_POA__get_the_POAManager (poa, &ev);
  if (ev._major != CORBA_NO_EXCEPTION)
    goto out;

  g_message("In guignome_corba_activate_server (3)\n");
  PortableServer_POAManager_activate (poa_manager, &ev);
  if (ev._major != CORBA_NO_EXCEPTION)
    goto out;

  g_message("In guignome_corba_activate_server (4)\n");
 out:
  { CORBA_char *str=CORBA_exception_id(&ev);;
  g_message("In guignome_corba_activate_server (4a) exception=%d - %s\n",
    ev._major,str==NULL? "<NULL>" : str);
  CORBA_exception_free (&ev);
  g_message("In guignome_corba_activate_server (5)\n");
  }
}
Пример #28
0
static void
impl_thaw (BonoboUIComponent *component,
	   CORBA_Environment *ev)
{
	component->priv->frozenness--;

	if (component->priv->frozenness == 0) {
		CORBA_Environment *real_ev, tmp_ev;
		Bonobo_UIContainer container;

		container = component->priv->container;
		g_return_if_fail (container != CORBA_OBJECT_NIL);

		if (ev)
			real_ev = ev;
		else {
			CORBA_exception_init (&tmp_ev);
			real_ev = &tmp_ev;
		}

		Bonobo_UIContainer_thaw (container, real_ev);

		if (BONOBO_EX (real_ev) && !ev)
			g_warning ("Serious exception on UI thaw '$%s'",
				   bonobo_exception_get_text (real_ev));

		if (!ev)
			CORBA_exception_free (&tmp_ev);

	} else if (component->priv->frozenness < 0)
		g_warning ("Freeze/thaw mismatch on '%s'",
			   component->priv->name ? component->priv->name : "<Null>");
}
Пример #29
0
static void
control_activate_cb (BonoboControl *control,
		     gboolean activate,
		     EYank *yank)
{
	BonoboUIComponent *ui_component;
	
	ui_component = bonobo_control_get_ui_component (control);
	
	if (yank->shell_view_interface == NULL) {
		Bonobo_ControlFrame control_frame;
		CORBA_Environment ev;

		control_frame = bonobo_control_get_control_frame (control);
		if (control_frame == NULL) {
			goto out;
		}

		CORBA_exception_init (&ev);
		yank->shell_view_interface = Bonobo_Unknown_queryInterface (control_frame, "IDL:GNOME/Evolution/ShellView:1.0", &ev);

		if (BONOBO_EX (&ev)) {
			g_warning ("Error getting ShellView. %s", CORBA_exception_id (&ev));
			yank->shell_view_interface = CORBA_OBJECT_NIL;
		}
		CORBA_exception_free (&ev);
	}
 out:

	if (activate)
		control_activate (control, ui_component, yank);
	else
		control_deactivate (control, ui_component, yank);
}
Пример #30
0
static void
set_data (BonoboWidget *control, const char *string)
{
	Bonobo_PersistStream persist;
	BonoboObject *bstream;

	CORBA_Environment ev;

	persist = (Bonobo_PersistStream) Bonobo_Unknown_queryInterface (
		       bonobo_widget_get_objref (control), 
		       "IDL:Bonobo/PersistStream:1.0", &ev);
			
	if (persist == CORBA_OBJECT_NIL) {
			g_object_ref_sink (G_OBJECT (control));
			return ;
	}

	bstream = bonobo_stream_mem_create (string, strlen (string), TRUE, FALSE);

	CORBA_exception_init (&ev);
	Bonobo_PersistStream_load (persist, BONOBO_OBJREF (bstream),
				   "text/calendar", &ev);
	bonobo_object_unref (BONOBO_OBJECT (bstream));
	Bonobo_Unknown_unref (persist, &ev);
	CORBA_Object_release (persist, &ev);
}