| 1 |
/* |
| 2 |
* cdebconf frontend, corba servant, text frontend main program, will |
| 3 |
* only work in an xterm, haha |
| 4 |
*/ |
| 5 |
|
| 6 |
/* |
| 7 |
* To test: |
| 8 |
* $ xemacs dcf-text.gnorba |
| 9 |
* $ GNOME_GNORBA_PATH=`pwd` goad-browser |
| 10 |
*/ |
| 11 |
|
| 12 |
#include "dcf-textimpl.c" |
| 13 |
|
| 14 |
int main(int argc, char* argv[]) { |
| 15 |
CORBA_ORB orb; |
| 16 |
CORBA_Environment *ev; |
| 17 |
PortableServer_POA root_poa; |
| 18 |
PortableServer_POAManager pm; |
| 19 |
CORBA_Object name_service; |
| 20 |
Debconf_Frontend dcf_text; |
| 21 |
CORBA_char *ior; |
| 22 |
|
| 23 |
ev = g_new0(CORBA_Environment,1); |
| 24 |
|
| 25 |
CORBA_exception_init(ev); |
| 26 |
|
| 27 |
orb = gnorba_CORBA_init(&argc, argv, GNORBA_INIT_SERVER_FUNC, ev); |
| 28 |
if (ev->_major != CORBA_NO_EXCEPTION) { |
| 29 |
fprintf(stderr, "Error: could not initializing ORB: %s\n", CORBA_exception_id(ev)); |
| 30 |
exit(1); |
| 31 |
} |
| 32 |
|
| 33 |
root_poa = (PortableServer_POA) |
| 34 |
CORBA_ORB_resolve_initial_references(orb, "RootPOA", ev); |
| 35 |
if (ev->_major != CORBA_NO_EXCEPTION) { |
| 36 |
fprintf(stderr, "Error: could not get RootPOA: %s\n", CORBA_exception_id(ev)); |
| 37 |
exit(1); |
| 38 |
} |
| 39 |
|
| 40 |
dcf_text = impl_Debconf_Frontend__create(root_poa, ev); |
| 41 |
|
| 42 |
pm = PortableServer_POA__get_the_POAManager(root_poa, ev); |
| 43 |
PortableServer_POAManager_activate(pm, ev); |
| 44 |
|
| 45 |
ior = CORBA_ORB_object_to_string(orb, dcf_text, ev); |
| 46 |
fprintf(stderr, "%s\n", ior); |
| 47 |
CORBA_free(ior); |
| 48 |
|
| 49 |
name_service = gnome_name_service_get(); |
| 50 |
switch (goad_server_register(CORBA_OBJECT_NIL, dcf_text, "dcf-text", "server", ev)) { |
| 51 |
case -2: |
| 52 |
/* There is a dcf-text running; bring it forward and quit */ |
| 53 |
dcf_text = goad_server_activate_with_repo_id(NULL, "IDL:GNOME/dcf-text:1.0", |
| 54 |
0, NULL); |
| 55 |
CORBA_exception_free (ev); |
| 56 |
exit(0); |
| 57 |
case -1: |
| 58 |
g_warning("There was trouble with the name server.\n" |
| 59 |
"aborting...\n"); |
| 60 |
exit(1); |
| 61 |
default: |
| 62 |
g_warning("Beautiful, isn't it?\n"); |
| 63 |
} |
| 64 |
|
| 65 |
CORBA_ORB_run(orb, ev); |
| 66 |
|
| 67 |
CORBA_exception_free (ev); |
| 68 |
return 0; |
| 69 |
} |