Пример #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 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;
}
Пример #3
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);
    }
}
Пример #4
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));
}
Пример #5
0
Bonobo_Listener
bonobo_event_source_client_add_listener_full (Bonobo_Unknown     object,
        GClosure          *event_callback,
        const char        *opt_mask,
        CORBA_Environment *opt_ev)
{
    BonoboListener    *listener = NULL;
    Bonobo_Listener    corba_listener = CORBA_OBJECT_NIL;
    Bonobo_Unknown     es;
    CORBA_Environment *ev, temp_ev;

    g_return_val_if_fail (event_callback != NULL, CORBA_OBJECT_NIL);

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

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

    if (BONOBO_EX (ev) || !es)
        goto add_listener_end;

    if (!(listener = bonobo_listener_new_closure (event_callback)))
        goto add_listener_end;

    corba_listener = BONOBO_OBJREF (listener);

    if (opt_mask)
        Bonobo_EventSource_addListenerWithMask (
            es, corba_listener, opt_mask, ev);
    else
        Bonobo_EventSource_addListener (
            es, corba_listener, ev);

    corba_listener = CORBA_Object_duplicate (corba_listener, ev);

    bonobo_object_unref (BONOBO_OBJECT (listener));

    bonobo_object_release_unref (es, ev);

add_listener_end:

    if (!opt_ev) {
        if (BONOBO_EX (ev)) {
            char *text = bonobo_exception_get_text (ev);
            g_warning ("add_listener failed '%s'", text);
            g_free (text);
        }
        CORBA_exception_free (ev);
    }

    return corba_listener;
}
Пример #6
0
Bonobo_Unknown
bonobo_moniker_cache_resolve (BonoboMoniker               *moniker,
                              const Bonobo_ResolveOptions *options,
                              const CORBA_char            *requested_interface,
                              CORBA_Environment           *ev)
{
    Bonobo_Moniker parent;
    BonoboStream *stream;
    Bonobo_Stream in_stream;

    if (!strcmp (requested_interface, "IDL:Bonobo/Stream:1.0")) {

        parent = bonobo_moniker_get_parent (moniker, ev);

        if (BONOBO_EX (ev) || parent == CORBA_OBJECT_NIL)
            return CORBA_OBJECT_NIL;

        in_stream = Bonobo_Moniker_resolve (parent, options,
                                            "IDL:Bonobo/Stream:1.0",
                                            ev);

        if (BONOBO_EX (ev) || in_stream == CORBA_OBJECT_NIL) {
            bonobo_object_release_unref (parent, NULL);
            return CORBA_OBJECT_NIL;
        }

        bonobo_object_release_unref (parent, ev);

        if (BONOBO_EX (ev))
            return CORBA_OBJECT_NIL;

        stream = bonobo_stream_cache_create (in_stream, ev);

        if (BONOBO_EX (ev) || stream == CORBA_OBJECT_NIL) {
            bonobo_object_release_unref (in_stream, NULL);
            return CORBA_OBJECT_NIL;
        }

        bonobo_object_release_unref (in_stream, ev);

        if (BONOBO_EX (ev))
            return CORBA_OBJECT_NIL;

        return CORBA_Object_duplicate (BONOBO_OBJREF (stream), ev);
    }

    return CORBA_OBJECT_NIL; /* use the extender */
}
Пример #7
0
GnoCamCamera *
gnocam_camera_new (Camera *camera, CORBA_Environment *ev)
{
	GnoCamCamera *gc;
	BonoboStorageCamera *storage;

	bonobo_return_val_if_fail (camera, NULL, ev);

	g_message ("Creating storage...");
	storage = bonobo_storage_camera_new (camera, "/",
					     Bonobo_Storage_READ |
					     Bonobo_Storage_WRITE, ev);
	if (BONOBO_EX (ev))
		return (NULL);

	gc = g_object_new (GNOCAM_TYPE_CAMERA, NULL);

	gc->camera = camera;
	gp_camera_ref (camera);

	g_message ("Adding interfaces...");
	bonobo_object_add_interface (BONOBO_OBJECT (gc),
				     BONOBO_OBJECT (storage));

	gc->priv->event_source = bonobo_event_source_new ();
	bonobo_object_add_interface (BONOBO_OBJECT (gc),
				     BONOBO_OBJECT (gc->priv->event_source));

	return (gc);
}
Пример #8
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);
}
Пример #9
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;
}
Пример #10
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>");
}
Пример #11
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;
}
Пример #12
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);
}
Пример #13
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++;
}
Пример #14
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);
}
Пример #15
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;
}
Пример #16
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);
}
Пример #17
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);
}
Пример #18
0
GnomeDialog *
gnocam_camera_selector_new (void)
{
	GnoCamCameraSelector *selector;
	const gchar *buttons[] = {GNOME_STOCK_BUTTON_OK,
				  GNOME_STOCK_BUTTON_CANCEL, NULL};
	GtkWidget *hbox, *pixmap, *vbox, *widget, *label;
	Bonobo_PropertyBag pb;
	CORBA_Environment ev;
	
	selector = gtk_type_new (GNOCAM_TYPE_CAMERA_SELECTOR);
	gnome_dialog_constructv (GNOME_DIALOG (selector), _("Select a Camera"),
				 buttons);
	gnome_dialog_set_default (GNOME_DIALOG (selector), 0);
	gtk_window_set_policy (GTK_WINDOW (selector), TRUE, TRUE, TRUE);
	gtk_widget_set_usize (GTK_WIDGET (selector), 400, 300);

	hbox = gtk_hbox_new (FALSE, 10);
	gtk_widget_show (hbox);
	gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (selector)->vbox), hbox);
	
	vbox = gtk_vbox_new (FALSE, 10);
	gtk_widget_show (vbox);
	gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);

	/* The camera picture */
	pixmap = gnome_pixmap_new_from_file (IMAGEDIR "/gnocam.png");
	gtk_widget_show (pixmap);
	gtk_box_pack_start (GTK_BOX (vbox), pixmap, FALSE, FALSE, 0);

	/* The "Autodetect" check button */
	CORBA_exception_init (&ev);
	pb = bonobo_get_object ("config:/apps/" PACKAGE,
				"Bonobo/PropertyBag", &ev);
	if (BONOBO_EX (&ev)) {
		g_warning ("Could not get property bag: %s", 
			   bonobo_exception_get_text (&ev));
	} else {
		GtkObject *ed;

		ed = bonobo_peditor_new (pb, "autodetect", TC_boolean, NULL);
		bonobo_object_release_unref (pb, NULL);
		widget = bonobo_peditor_get_widget (BONOBO_PEDITOR (ed));
		gtk_widget_show (widget);
		gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
		label = gtk_label_new (_("Autodetect"));
		gtk_widget_show (label);
		gtk_container_add (GTK_CONTAINER (widget), label);
	}
	CORBA_exception_free (&ev);

	/* The camera list */
	selector->priv->table = gnocam_capplet_table_scrolled_new (NULL);
	gtk_widget_show (selector->priv->table);
	gtk_box_pack_start (GTK_BOX (hbox), selector->priv->table,
			    TRUE, TRUE, 0);
	
	return (GNOME_DIALOG (selector));
}
Пример #19
0
static GtkListStore *
do_query (void)
{
  GtkListStore *store;
  Bonobo_ServerInfoList *servers;
#if 0
  /* This is the old query, but too many components are not generally useful
     and cause problems, so we are changing to an 'opt-in' query, where
     we only include components that have a 'glade:show' property set to TRUE.
  */
  const char *query = "repo_ids.has('IDL:Bonobo/Control:1.0') AND NOT "
		      "repo_ids.has('IDL:GNOME/Vertigo/PanelAppletShell:1.0')";
#else
  const char *query = "glade:show";
#endif
  char *sort[] = { "description", NULL };
  CORBA_Environment ev;
  int i;

  Bonobo_ServerInfo *serverinfo;
  const char *desc;
  GtkTreeIter iter;
  
  store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);

  CORBA_exception_init (&ev);

  servers = bonobo_activation_query (query, sort, &ev);
  if (BONOBO_EX (&ev)) {
    g_warning ("query failed: %s\n", ev._id);
    CORBA_exception_free (&ev);
    return store;
  }
  CORBA_exception_free (&ev);
  
#if 0
  g_print ("got %d servers.\n", servers ? servers->_length : 0);
#endif

  for (i = 0; i < servers->_length; i++) {    
    serverinfo = &servers->_buffer[i];
    
    desc = bonobo_server_info_prop_lookup (serverinfo, "description", NULL);
    if (!desc)
      desc = bonobo_server_info_prop_lookup (serverinfo, "name", NULL);
    if (!desc)
      desc = serverinfo->iid;
    
    gtk_list_store_append (store, &iter);
    gtk_list_store_set (store, &iter,
			COL_OBJID, serverinfo->iid, 
			COL_DESC, desc,
			-1);
  }
  
  CORBA_free (servers);
  
  return store;
}
Пример #20
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);
}
Пример #21
0
static gint
invitation_double_clicked_cb (ETable *et, int row, int col, GdkEvent *event, gpointer data)
{
	SunOneInvitationList *list = SUNONE_INVITATION_LIST (data);
	SunOneInvitationListPrivate *priv = list->priv;
	ECalComponent *comp, *clone;
	GNOME_Evolution_Calendar_CompEditorFactory factory;
	const char *uid;
	CORBA_Environment ev;

	comp = sunone_invitation_list_model_get_comp (priv->model, row);
	if (!comp)
		return FALSE;

	clone = e_cal_component_clone (comp);	
	sunone_util_mangle_uid (clone);
	e_cal_component_get_uid (clone, &uid);

	/* Get the factory */
	CORBA_exception_init (&ev);
	factory = bonobo_activation_activate_from_id (COMPEDITORFACTORY, 0, NULL, &ev);
	if (BONOBO_EX (&ev)) {
		g_message ("%s: Could not activate the component editor factory (%s)", G_GNUC_FUNCTION,
			   CORBA_exception_id (&ev));
		CORBA_exception_free (&ev);
		return FALSE;
	}

	GNOME_Evolution_Calendar_CompEditorFactory_editExisting (factory, priv->model->uri, (char *)uid, GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT, &ev);

	if (BONOBO_EX (&ev)) {
		g_message ("%s: Execption while editing the component (%s)", G_GNUC_FUNCTION, 
			   CORBA_exception_id (&ev));
	}

	g_object_unref (G_OBJECT (clone));
	
	CORBA_exception_free (&ev);
	bonobo_object_release_unref (factory, NULL);	

	return FALSE;
}
Пример #22
0
static CORBA_char *
impl_GNOME_Camera_getInfo (PortableServer_Servant servant, 
		           CORBA_Environment *ev)
{
	GnoCamCamera *c;
	CameraText text;

	c = GNOCAM_CAMERA (bonobo_object_from_servant (servant));
	CR (gp_camera_get_manual (c->camera, &text, NULL), ev);
	if (BONOBO_EX (ev))
		return (NULL);

	return (g_strdup (text.text));
}
Пример #23
0
static void
kill_old_dataserver (void)
{
	GNOME_Evolution_DataServer_InterfaceCheck iface;
	CORBA_Environment ev;
	CORBA_char *version;

	CORBA_exception_init (&ev);

	/* FIXME Should we really kill it off?  We also shouldn't hard code the version */
	iface = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_DataServer_InterfaceCheck", 0, NULL, &ev);
	if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) {
		kill_dataserver ();
		CORBA_exception_free (&ev);
		return;
	}

	version = GNOME_Evolution_DataServer_InterfaceCheck__get_interfaceVersion (iface, &ev);
	if (BONOBO_EX (&ev)) {
		kill_dataserver ();
		CORBA_Object_release (iface, &ev);
		CORBA_exception_free (&ev);
		return;
	}

	if (strcmp (version, DATASERVER_VERSION) != 0) {
		CORBA_free (version);
		kill_dataserver ();
		CORBA_Object_release (iface, &ev);
		CORBA_exception_free (&ev);
		return;
	}

	CORBA_free (version);
	CORBA_Object_release (iface, &ev);
	CORBA_exception_free (&ev);
}
Пример #24
0
/**
 * bonobo_ui_component_set_container:
 * @component: the component
 * @container: a remote container object.
 * 
 * This associates this @component with a remote @container
 * object.
 **/
void
bonobo_ui_component_set_container (BonoboUIComponent *component,
				   Bonobo_UIContainer container,
				   CORBA_Environment *opt_ev)
{
	Bonobo_UIContainer ref_cont;

	g_return_if_fail (BONOBO_IS_UI_COMPONENT (component));

	bonobo_object_ref (BONOBO_OBJECT (component));

	if (container != CORBA_OBJECT_NIL) {
		Bonobo_UIComponent corba_component;
		CORBA_Environment *ev, temp_ev;
		char              *name;
		
		if (!opt_ev) {
			CORBA_exception_init (&temp_ev);
			ev = &temp_ev;
		} else
			ev = opt_ev;

		ref_cont = CORBA_Object_duplicate (container, ev);

		corba_component = BONOBO_OBJREF (component);

		name = component->priv->name ? component->priv->name : "";

		Bonobo_UIContainer_registerComponent (
			ref_cont, name, corba_component, ev);

		if (!opt_ev && BONOBO_EX (ev)) {
			char *err;
			g_warning ("Serious exception registering component '%s'",
				   (err = bonobo_exception_get_text (ev)));
			g_free (err);
		}
		
		if (!opt_ev)
			CORBA_exception_free (&temp_ev);
	} else
		ref_cont = CORBA_OBJECT_NIL;

	bonobo_ui_component_unset_container (component, NULL);

	component->priv->container = ref_cont;

	bonobo_object_unref (BONOBO_OBJECT (component));
}
static void
setup_options (void)
{
	Bonobo_ServerInfoList *applets;
	CORBA_Environment      env;
	int                    i;
	char                  *prefs_dir;
	char                  *unique_key;
	ComboItem             *applet_items;
	int                    applet_nb;

	CORBA_exception_init (&env);

	applets = bonobo_activation_query (
			"has (repo_ids, 'IDL:GNOME/Vertigo/PanelAppletShell:1.0')",
			NULL, &env);

	if (BONOBO_EX (&env))
		g_error (_("query returned exception %s\n"), BONOBO_EX_REPOID (&env));

	CORBA_exception_free (&env);

	applet_nb = applets->_length;
	applet_items = g_new0 (ComboItem, applet_nb);

	for (i = 0; i < applet_nb; i++) {
		Bonobo_ServerInfo *info;

		info = &applets->_buffer [i];

		applet_items[i].name = info->iid;
		applet_items[i].value = info->iid;
	}

	setup_combo (applet_combo, applet_items, applet_nb, TRUE);
	g_free (applet_items);
	CORBA_free (applets);

	setup_combo (size_combo, size_items, G_N_ELEMENTS (size_items), FALSE);
	setup_combo (orient_combo, orient_items,
		     G_N_ELEMENTS (orient_items), FALSE);

	unique_key = gconf_unique_key ();
	prefs_dir = g_strdup_printf ("/tmp/%s", unique_key);
	g_free (unique_key);
	gtk_entry_set_text (GTK_ENTRY (prefs_dir_entry), prefs_dir);
	g_free (prefs_dir);
}
Пример #26
0
static void
test_real_monikers (void)
{
	CORBA_Environment *ev, real_ev;
	Bonobo_Unknown     object;

	CORBA_exception_init ((ev = &real_ev));

	/* Try an impossible moniker resolve */
	object = bonobo_get_object ("OAFIID:Bonobo_Moniker_Oaf",
				    "IDL:Bonobo/PropertyBag:1.0", ev);
	g_assert (object == CORBA_OBJECT_NIL);
	if (BONOBO_EX (ev))
		printf ("%s\n", bonobo_exception_get_text (ev));

	CORBA_exception_free (ev);
}
Пример #27
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);
}
Пример #28
0
static gchar *
impl_get_prop (BonoboUIComponent *component,
	       const char        *path,
	       const char        *prop,
	       CORBA_Environment *opt_ev)
{
	Bonobo_UIContainer container;
	CORBA_Environment *ev, tmp_ev;
	CORBA_char        *ret;
	gchar             *retval;

	g_return_val_if_fail (path != NULL, NULL);
	g_return_val_if_fail (prop != NULL, NULL);

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

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

	ret = Bonobo_UIContainer_getAttr (
		container, path, prop, ev);

	if (BONOBO_EX (ev)) {
		if (!opt_ev && strcmp (BONOBO_EX_REPOID (ev),
				       ex_Bonobo_UIContainer_NonExistentAttr))
			g_warning ("Invalid path '%s' on prop '%s' get",
				   path, prop);
		ret = NULL;
	}

	if (!opt_ev)
		CORBA_exception_free (&tmp_ev);

	if (ret) {
		retval = g_strdup (ret);
		CORBA_free (ret);
	} else
		retval = NULL;

	return retval;
}
Пример #29
0
float
bonobo_zoomable_frame_get_max_zoom_level (BonoboZoomableFrame *zoomable_frame)
{
	CORBA_Environment ev;
	float retval;

	g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), 0.0);
	g_return_val_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL, 0.0);

	CORBA_exception_init (&ev);
	retval = Bonobo_Zoomable__get_maxLevel (zoomable_frame->priv->zoomable, &ev);
	if (BONOBO_EX (&ev))
		retval = 0.0;
	bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame),
				 zoomable_frame->priv->zoomable, &ev);
	CORBA_exception_free (&ev);

	return retval;
}
Пример #30
0
gboolean
bonobo_zoomable_frame_is_continuous (BonoboZoomableFrame *zoomable_frame)
{
	CORBA_Environment ev;
	gboolean retval;

	g_return_val_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame), FALSE);
	g_return_val_if_fail (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL, FALSE);

	CORBA_exception_init (&ev);
	retval = Bonobo_Zoomable__get_isContinuous (zoomable_frame->priv->zoomable, &ev);
	if (BONOBO_EX (&ev))
		retval = FALSE;
	bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame),
				 zoomable_frame->priv->zoomable, &ev);
	CORBA_exception_free (&ev);

	return retval;
}