Port to new CORBA interface

2001-08-23  Bradford Hovinen  <hovinen@ximian.com>

	* main.c: Port to new CORBA interface
This commit is contained in:
Bradford Hovinen 2001-08-23 19:08:26 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 11696dba5a
commit 768a3d5a46
2 changed files with 49 additions and 13 deletions

View file

@ -1,3 +1,7 @@
2001-08-23 Bradford Hovinen <hovinen@ximian.com>
* main.c: Port to new CORBA interface
2001-08-19 Abel Cheung <maddog@linux.org.hk> 2001-08-19 Abel Cheung <maddog@linux.org.hk>
* screensavers/Makefile.am: Added missing DESTDIR to install-data-local * screensavers/Makefile.am: Added missing DESTDIR to install-data-local

View file

@ -39,8 +39,8 @@
#include <capplet-widget.h> #include <capplet-widget.h>
#ifdef HAVE_XIMIAN_ARCHIVER #ifdef HAVE_XIMIAN_ARCHIVER
# include <ximian-archiver/archive.h> # include <bonobo.h>
# include <ximian-archiver/location.h> # include <ximian-archiver/archiver-client.h>
#endif /* HAVE_XIMIAN_ARCHIVER */ #endif /* HAVE_XIMIAN_ARCHIVER */
#include "preferences.h" #include "preferences.h"
@ -57,26 +57,37 @@ static CappletWidget *capplet;
#ifdef HAVE_XIMIAN_ARCHIVER #ifdef HAVE_XIMIAN_ARCHIVER
static Archive *archive; static ConfigArchiver_Archive archive;
static gboolean outside_location; static gboolean outside_location;
static void static void
store_archive_data (void) store_archive_data (void)
{ {
Location *location; ConfigArchiver_Location location;
xmlDocPtr xml_doc; xmlDocPtr xml_doc;
CORBA_Environment ev;
CORBA_exception_init (&ev);
if (capplet_get_location () == NULL) if (capplet_get_location () == NULL)
location = archive_get_current_location (archive); location = ConfigArchiver_Archive__get_currentLocation (archive, &ev);
else else
location = archive_get_location (archive, location = ConfigArchiver_Archive_getLocation
capplet_get_location ()); (archive, capplet_get_location (), &ev);
if (BONOBO_EX (&ev) || location == CORBA_OBJECT_NIL) {
g_critical ("Could not open location %s", capplet_get_location ());
return;
}
xml_doc = preferences_write_xml (prefs); xml_doc = preferences_write_xml (prefs);
location_store_xml (location, "screensaver-properties-capplet", location_client_store_xml (location, "screensaver-properties-capplet",
xml_doc, STORE_MASK_PREVIOUS); xml_doc, STORE_MASK_PREVIOUS, &ev);
xmlFreeDoc (xml_doc); xmlFreeDoc (xml_doc);
archive_close (archive); bonobo_object_release_unref (archive, NULL);
bonobo_object_release_unref (location, NULL);
CORBA_exception_free (&ev);
} }
#endif /* HAVE_XIMIAN_ARCHIVER */ #endif /* HAVE_XIMIAN_ARCHIVER */
@ -314,6 +325,12 @@ do_restore_from_defaults (void)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
#ifdef HAVE_XIMIAN_ARCHIVER
CORBA_ORB orb;
CORBA_Environment ev;
CORBA_char *current_location_id = NULL;
#endif /* HAVE_XIMIAN_ARCHIVER */
GnomeClient *client; GnomeClient *client;
GnomeClientFlags flags; GnomeClientFlags flags;
gint token, res; gint token, res;
@ -348,6 +365,13 @@ main (int argc, char **argv)
glade_gnome_init (); glade_gnome_init ();
#ifdef HAVE_XIMIAN_ARCHIVER
CORBA_exception_init (&ev);
orb = oaf_init (argc, argv);
if (!bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL))
g_critical ("Could not initialize Bonobo");
#endif /* HAVE_XIMIAN_ARCHIVER */
client = gnome_master_client (); client = gnome_master_client ();
flags = gnome_client_get_flags (client); flags = gnome_client_get_flags (client);
@ -378,11 +402,16 @@ main (int argc, char **argv)
init_resource_database (argc, argv); init_resource_database (argc, argv);
#ifdef HAVE_XIMIAN_ARCHIVER #ifdef HAVE_XIMIAN_ARCHIVER
archive = ARCHIVE (archive_load (FALSE)); archive = bonobo_get_object ("archive:user-archive", "IDL:ConfigArchiver/Archive:1.0", &ev);
if (BONOBO_EX (&ev) || archive == CORBA_OBJECT_NIL)
g_critical ("Could not resolve archive moniker");
else
current_location_id = ConfigArchiver_Archive__get_currentLocationId (archive, &ev);
if (capplet_get_location () != NULL && if (capplet_get_location () != NULL &&
strcmp (capplet_get_location (), current_location_id != NULL &&
archive_get_current_location_id (archive))) strcmp (capplet_get_location (), current_location_id))
{ {
outside_location = TRUE; outside_location = TRUE;
do_set_xml (FALSE); do_set_xml (FALSE);
@ -394,6 +423,9 @@ main (int argc, char **argv)
preferences_load (prefs); preferences_load (prefs);
} }
if (current_location_id != NULL)
CORBA_free (current_location_id);
if (!outside_location && token) { if (!outside_location && token) {
if (prefs->selection_mode != SM_DISABLE_SCREENSAVER) if (prefs->selection_mode != SM_DISABLE_SCREENSAVER)
start_xscreensaver (); start_xscreensaver ();