Re: GenericFactory FUBAR?
- From: ERDI Gergo <cactus cactus rulez org>
- To: Martin Baulig <martin home-of-linux org>
- Cc: gnome-components-list gnome org
- Subject: Re: GenericFactory FUBAR?
- Date: Thu, 26 Jul 2001 18:15:16 +0200 (CEST)
Martin,
I am very happy you decided to help me on this because this is
really blocking my work.
>
> > 207 res = OAF_ActivationContext_activate (ac, (char *)
> > ext_requirements,
> > (gdb) print *ev
> > $1 = {_id = 0x8066dfc "IDL:OAF/GeneralError:1.0", _major = 1, _any = {
> > _type = 0x0, _value = 0x8066da0, _release = 1 '\001'}}
> > (gdb) print
> > *((char**)ev->_any->_value)
> > $2 = 0x8066dac "Child process did not give an error message, unknown
> > failure occurred"
>
> Which component are you trying to activate ? You should have included
> the value `ext_requirements' in your bug report so that I can try to
> reproduce it .....
I have no idea why liboaf added ext_requirements to the query. The query
should be whatever query Bonobo uses to activate monikers.
> > Tracing a simple Bonobo component factory shows that the factory callback
> > is not called at all.
>
> Again, I need to know which factory if I should help you :-)
I can't resolve _any_ monikers. I have attached the actual test code I
used, but this is not really factory-dependant as no moniker works.
--
.--= ULLA! =---------------------. `We are not here to give users what
\ http://cactus.rulez.org \ they want' -- RMS, at GUADEC 2001
`---= cactus cactus rulez org =---'
Time flies like an arrow; Fruit flies like a banana
/* -*- mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* X-to-Bonobo clipboard bridge
*
* Author: ÉRDI Gergő <cactus cactus rulez org>
*
* Copyright 2001 Gergő Érdi
*/
#include <config.h>
#include <bonobo/bonobo-moniker.h>
#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-moniker-simple.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-persist-stream.h>
#include <bonobo/bonobo-stream-client.h>
#include <gtk/gtkclipboard.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define OAFIID "OAFIID:Bonobo_Moniker_XClipboard"
static void pstream_save_impl (BonoboPersistStream *ps,
const Bonobo_Stream stream,
Bonobo_Persist_ContentType type,
void *closure,
CORBA_Environment *ev)
{
CORBA_Environment my_ev;
GtkClipboard *xclipboard;
gchar *clipboard_contents;
xclipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
clipboard_contents = gtk_clipboard_wait_for_text (xclipboard);
if (clipboard_contents)
{
CORBA_exception_init (&my_ev);
bonobo_stream_client_write_string (stream,
clipboard_contents,
TRUE,
&my_ev);
CORBA_exception_free (&my_ev);
}
}
static void pstream_load_impl (BonoboPersistStream *ps,
const Bonobo_Stream stream,
Bonobo_Persist_ContentType type,
void *closure,
CORBA_Environment *ev)
{
CORBA_Environment my_ev;
GtkClipboard *xclipboard;
gchar *clipboard_contents;
CORBA_exception_init (&my_ev);
bonobo_stream_client_read_string (stream,
&clipboard_contents,
&my_ev);
CORBA_exception_free (&my_ev);
xclipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
gtk_clipboard_set_text (xclipboard, clipboard_contents , -1);
g_free (clipboard_contents);
}
static Bonobo_Unknown xclipboard_resolve (BonoboMoniker *moniker,
const Bonobo_ResolveOptions *options,
const CORBA_char *requested_interface,
CORBA_Environment *ev)
{
BonoboPersistStream *pstream;
if (strcmp (requested_interface, "IDL:Bonobo/PersistStream:1.0"))
{
bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound);
return CORBA_OBJECT_NIL;
}
pstream = bonobo_persist_stream_new (pstream_load_impl,
pstream_save_impl,
NULL,
OAFIID,
NULL);
return bonobo_object_corba_objref (BONOBO_OBJECT (pstream));
}
BonoboObject * bonobo_moniker_xclipboard_factory (BonoboGenericFactory *factory,
void *user_data)
{
static BonoboMoniker *instance = 0;
{
FILE *f;
f = fopen ("/tmp/foonotif", "a");
fprintf (f, "Inside _factory\n");
fclose (f);
}
if (!instance || !BONOBO_IS_OBJECT (instance))
{
g_warning ("new instance created");
instance = bonobo_moniker_simple_new ("xclipboard:", xclipboard_resolve);
}
bonobo_object_ref (BONOBO_OBJECT (instance));
return BONOBO_OBJECT (instance);
}
int main (int argc, char *argv [])
{
BonoboGenericFactory *factory;
{
FILE *f;
f = fopen ("/tmp/foonotif", "a");
fprintf (f, "I was started\n");
fclose (f);
}
if (!bonobo_init (&argc, argv))
g_error ("bonobo_init failed");
g_warning ("bonobo-moniker-xclipboard-server started");
factory = bonobo_generic_factory_new (OAFIID,
bonobo_moniker_xclipboard_factory,
NULL);
bonobo_main ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]