Re: moniker question
- From: Lutz Müller <urc8 rz uni-karlsruhe de>
- To: gnome-components-list gnome org
- Subject: Re: moniker question
- Date: 01 Feb 2001 14:04:48 +0000
On 01 Feb 2001 10:46:43 +0000, Lutz Müller wrote:
> On 31 Jan 2001 18:37:16 -0500, Michael Meeks wrote:
> > > (4) In the camera case, I can't hardcode eog, as some digital cameras
> > > can also store movies or sound. Therefore, I guess I should use
> > > another moniker to resolve the stream I get from the camera. BUT: How
> > > can I resolve a stream without temporarily saving it to disk? Is there
> > > a way of getting a control directly from a stream? That would be
> > > useful for the bonobo-moniker-http, too.
> >
> > Yes; you need to look for interfaces supporting the PersistStream
> > interface and then call 'load' with your stream on that interface.
>
> I just discovered that bonobo-moniker-gzip uses
> bonobo_moniker_use_extender - I guess that is the function I have been
> looking for.
>
> Using this function lets bonobo-moniker-camera.c shrink to 39 lines -
> the same would apply to bonobo-moniker-http.c. It really would be much
> more convenient to make bonobo to look directly for "libstorage_hey.so"
> when someone requests something like "hey:/whatever". This would save us
> lots of helper programs like bonobo-moniker-http, bonobo-moniker-camera,
> bonobo-moniker-ftp, and so on. Or am I missing something?
The following patch will get rid of the hard-coded ebrowser in monikers/bonobo-moniker-http.c. See bonobo-moniker-gunzip.c for the analogy.
Index: bonobo-moniker-http.c
===================================================================
RCS file: /cvs/gnome/bonobo/monikers/bonobo-moniker-http.c,v
retrieving revision 1.12
diff -r1.12 bonobo-moniker-http.c
10a11
> #include <bonobo/bonobo-moniker-extender.h>
20,22d20
< const char *url = "" (moniker);
< char *real_url;
<
25,55c23
< /* because resolving the moniker drops the "http:" */
< real_url = g_strconcat ("http:", url, NULL);
<
< if (strcmp (requested_interface, "IDL:Bonobo/Control:1.0") == 0) {
< BonoboObjectClient *client;
< Bonobo_Unknown object;
<
< client = bonobo_object_activate ("OAFIID:GNOME_GtkHTML_EBrowser", 0);
<
< if (!client) {
< /* FIXME: Set a InterfaceNotFound exception here? */
< return CORBA_OBJECT_NIL;
< }
<
< object = BONOBO_OBJREF (client);
<
< if (ev->_major != CORBA_NO_EXCEPTION)
< return CORBA_OBJECT_NIL;
<
< if (object == CORBA_OBJECT_NIL) {
< g_warning ("Can't find object satisfying requirements");< CORBA_exception_set (
< ev, CORBA_USER_EXCEPTION,
< ex_Bonobo_Moniker_InterfaceNotFound, NULL);
< return CORBA_OBJECT_NIL;
< }
<
< return bonobo_moniker_util_qi_return (
< object, requested_interface, ev);
< }
< else if (strcmp (requested_interface, "IDL:Bonobo/Stream:1.0") == 0) {
---
> if (strcmp (requested_interface, "IDL:Bonobo/Stream:1.0") == 0) {
56a25,29
> const char *url = "" (moniker);
> char *real_url;
>
> /* because resolving the moniker drops the "http:" */
> real_url = g_strconcat ("http:", url, NULL);
75c48,51
< return CORBA_OBJECT_NIL;
---
> return bonobo_moniker_use_extender (
> "OAFIID:Bonobo_MonikerExtender_stream",
> moniker, options, requested_interface, ev);
>
I had to manually include bonobo/bonobo-moniker-extender.h. Did you forget to add this file to bonobo/bonobo.h?
As I said, you can easily add a bonobo-moniker-camera.c/h - simply take the bonobo-moniker-http.c/h and replace all "http" by "camera". As with the bonobo-moniker-http, which needs gtkhtml to be useful, bonobo-moniker-camera would need GnoCam. I think this is wrong. The functionality "hey:whatever" -> "libstorage_hey.so" should be in bonobo.
>
> I have yet to get the extender stuff to work. "moniker-test -c
> file:/home/lutz/image.jpeg" results in
>
> ** WARNING **: Attempt activate object satisfying
> 'bonobo:supported_mime_types.has ('image/jpeg') AND repo_ids.has
> ('IDL:Bonobo/Control:1.0') AND repo_ids.has
> ('IDL:Bonobo/PersistFile:1.0')': 0x8067cf0
>
> and gives me the image back, whereas "moniker-test -c
> camera://camera/image.jpeg" results in
>
> ** WARNING **: Attempt activate object satisfying
> 'bonobo:supported_mime_types.has ('image/jpeg') AND repo_ids.has
> ('IDL:Bonobo/Control:1.0') AND repo_ids.has
> (['IDL:Bonobo/PersistStream:1.0'])': (nil)
>
> ** WARNING **: Can't find object satisfying requirements
>
> >From GNOME_EOG.oafinfo, I read that EOG supports the PersistStream
> interface, too. I'll have a deeper look at it.
Here's a patch against monikers/bonobo-moniker-extender-stream.c to fix a typo (?). At least above error is fixed by this patch... See bonobo-moniker-extender-file.c for the analogy.
Index: bonobo-moniker-extender-stream.c
===================================================================
RCS file: /cvs/gnome/bonobo/monikers/bonobo-moniker-extender-stream.c,v
retrieving revision 1.3
diff -r1.3 bonobo-moniker-extender-stream.c
71c71
< "repo_ids.has (['IDL:Bonobo/PersistStream:1.0'])",
---
> "repo_ids.has ('IDL:Bonobo/PersistStream:1.0')",
Thank you!
Lutz
--
\|||/
+------------------------------------------------+ (o o)
| Lutz Mueller +49 (7156) 34837 +---ooO-(_)-Ooo---+
| |
| Hans-Sachs-Strasse 5 |
| 71254 Ditzingen http://www.uni-karlsruhe.de/~Lutz.Mueller |
| Germany urc8 rz uni-karlsruhe de |
+------------------------------------------------------------------+
Index: bonobo-moniker-extender-stream.c
===================================================================
RCS file: /cvs/gnome/bonobo/monikers/bonobo-moniker-extender-stream.c,v
retrieving revision 1.3
diff -r1.3 bonobo-moniker-extender-stream.c
71c71
< "repo_ids.has (['IDL:Bonobo/PersistStream:1.0'])",
---
> "repo_ids.has ('IDL:Bonobo/PersistStream:1.0')",
Index: bonobo-moniker-http.c
===================================================================
RCS file: /cvs/gnome/bonobo/monikers/bonobo-moniker-http.c,v
retrieving revision 1.12
diff -r1.12 bonobo-moniker-http.c
10a11
> #include <bonobo/bonobo-moniker-extender.h>
20,22d20
< const char *url = bonobo_moniker_get_name (moniker);
< char *real_url;
<
25,55c23
< /* because resolving the moniker drops the "http:" */
< real_url = g_strconcat ("http:", url, NULL);
<
< if (strcmp (requested_interface, "IDL:Bonobo/Control:1.0") == 0) {
< BonoboObjectClient *client;
< Bonobo_Unknown object;
<
< client = bonobo_object_activate ("OAFIID:GNOME_GtkHTML_EBrowser", 0);
<
< if (!client) {
< /* FIXME: Set a InterfaceNotFound exception here? */
< return CORBA_OBJECT_NIL;
< }
<
< object = BONOBO_OBJREF (client);
<
< if (ev->_major != CORBA_NO_EXCEPTION)
< return CORBA_OBJECT_NIL;
<
< if (object == CORBA_OBJECT_NIL) {
< g_warning ("Can't find object satisfying requirements");< CORBA_exception_set (
< ev, CORBA_USER_EXCEPTION,
< ex_Bonobo_Moniker_InterfaceNotFound, NULL);
< return CORBA_OBJECT_NIL;
< }
<
< return bonobo_moniker_util_qi_return (
< object, requested_interface, ev);
< }
< else if (strcmp (requested_interface, "IDL:Bonobo/Stream:1.0") == 0) {
---
> if (strcmp (requested_interface, "IDL:Bonobo/Stream:1.0") == 0) {
56a25,29
> const char *url = bonobo_moniker_get_name (moniker);
> char *real_url;
>
> /* because resolving the moniker drops the "http:" */
> real_url = g_strconcat ("http:", url, NULL);
75c48,51
< return CORBA_OBJECT_NIL;
---
> return bonobo_moniker_use_extender (
> "OAFIID:Bonobo_MonikerExtender_stream",
> moniker, options, requested_interface, ev);
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]