GTop CORBA ideas (was Re: GNOME CVS: gnome-utils martin)
- From: Martin Baulig <martin home-of-linux org>
- To: Elliot Lee <sopwith redhat com>
- Cc: gnome-list gnome org
- Subject: GTop CORBA ideas (was Re: GNOME CVS: gnome-utils martin)
- Date: 08 Sep 1998 12:07:21 +0200
Elliot Lee <sopwith@redhat.com> writes:
> I think I am going to have to write a "when not to use CORBA" paper :-)
Well, I wanted to export the inner working of GTop through CORBA - my main
idea was to have some GTop_Applets that can be used as a GTopWidget
(subclassed from GtkWidget) like this:
gtop_widget_corba_init ("gtop-client", &argc, argv);
app = gnome_app_new ("test", "Hello World CORBAified");
gtk_widget_realize (app);
vbox = gtk_vbox_new (FALSE, 0);
widget = gtop_widget_new ("/GTop/MemUsage", 0);
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, TRUE, 0);
gnome_app_set_contents (GNOME_APP (app), vbox);
gtk_widget_show (widget);
gtk_widget_show (app);
To allow more than one program to use this widgets, I'm using a `gtop' CORBA
object that registers itself with the GNOME naming service:
interface gtop {
/* Request unique ID for applet with given name and subtype.
* Creates a new ID if `add_id' is true. */
long request_gtop_applet_id (in string name, in long subtype,
in short add_id);
/* Called from the applet once it's ready. */
void register_gtop_applet (in long id, in gtop_applet applet);
/* Ask the server to start a new applet. */
void start_new_gtop_applet (in long id, in long xid);
};
When an applet is started it creates a new `gtop_applet' CORBA object:
interface gtop_applet {
void start_new_gtop_applet (in long id, in long xid);
};
and registers itself with the `gtop' object (this is the code of an
example applet):
gtop_applet_corba_init ("gtop-memusage", &argc, argv);
id = GNOME_gtop_request_gtop_applet_id
(gtop, "/GTop/MemUsage", 0, TRUE, &ev);
GNOME_gtop_register_gtop_applet (gtop, id, gtop_applet, &ev);
gtk_main ()
When the user creates a GTopWidget, gtop_widget_real_realize () looks up
the applet and finally tells the `gtop' object to start a new applet:
id = GNOME_gtop_request_gtop_applet_id
(gtop, "/GTop/MemUsage", 0, FALSE, &ev);
xid = GDK_WINDOW_XWINDOW (GTK_WIDGET (widget)->window);
GNOME_gtop_start_new_gtop_applet (gtop, id, xid, &ev);
The implementation of `start_new_gtop_applet' in the `gtop' object will use
a GHashTable to look up the `gtop_applet' object from the id and then pass the
request to this object.
Finally, the `start_new_gtop_applet' implementation in the `gtop_applet' object
will use `gtop_applet_new ()' (subclassed from GtkPlug) to create a new applet
and plug it to the given xid.
* * *
Well, I just started with my CORBA exeriments, but there is already some working
code in GTop (tag: GNOME_CORBA_BRANCH) - there's a servant for the `gtop' object
(only works with a single applet at the moment), a very simple `hello world'
applet and a sample client - all in the `test' directory.
Martin
--
----------------------------------------------------------------
Martin Baulig - Angewandte Mathematik - Universitaet Trier
baulig@castor.uni-trier.de, http://www.home-of-linux.com/
Key: 1024-bit key with ID C8178435 created 1997/01/24
ID: 67 C1 84 A0 47 F5 11 C5 5F 68 4C 84 99 05 C3 92
Finger baulig@math38 or fetch mykey.asc from the url above
-----------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]