Problems with Embedding Bonobo Control



Hi,

I'm embedding a Bonobo control for an image, using a pop-up menu that
has the option "View With". The user can choose either EOG or Nautilus
Image Viewer to view the image with.

However, the window opens, and the Bonobo control *seems* to be
embedded, but the image is not loaded. I only load the image if a call
to Bonobo_Unknown_queryInterface returns a Bonobo_PersistStream object.
My code is:

on_view_as_activate (GtkMenuItem *item, char *iid)
...
GtkWidget *w, *c;
Bonobo_Control control;
CORBA_Environment ev;
Bonobo_PersistStream pstream;
BonoboObject *stream;

CORBA_exception_init (&ev);
control = bonobo_get_object (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'.", iid);
        return;
}

w = bonobo_window_new ("filename", "filename");
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);

CORBA_exception_init (&ev);

pstream = Bonobo_Unknown_queryInterface (control,
                        "IDL:Bonobo/PersistStream:1.0", &ev);

/* Following fails check, because pstream == CORBA_OBJECT_NIL!! */
if (!BONOBO_EX (&ev) && (pstream != CORBA_OBJECT_NIL)) {
        /* Image loaded after this point */
        ...

The iid string passed to the method is either "OAFIID:GNOME_EOG_Control"
or "OAFIID:Nautilus_Image_Properties_View", these being values retrieved
from a bonobo-activation-query.

I know this is a tricky one, and most of the docs available are geared
towards better programmers than me! Anyone have any ideas as to why
pstream is not being populated with anything?

Thanks in advance,

Andrew





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]