gnome-control-center/gnome-settings-daemon/factory.c
Seth Nickell 3831d63e77 Make the settings daemon a singleton BonoboObject so capplets can detect
2002-03-10  Seth Nickell  <snickell@stanford.edu>

        Make the settings daemon a singleton BonoboObject so capplets
	can detect whether its running and activate it if its not.

	* Makefile.am:
	* factory.c: (main):
	* gnome-settings-daemon.c: (awake_impl), (finalize),
	(gnome_settings_daemon_class_init), (gnome_settings_daemon_init),
	(gnome_settings_daemon_new):
	* gnome-settings-daemon.h:

	Convert the settings-daemon into a BonoboObject and add code to
	register it with bonobo-activation. Still has a main loop that can
	be run normally to launch the settings daemon.
2002-03-11 01:44:03 +00:00

48 lines
1.5 KiB
C

#include "gnome-settings-daemon.h"
#include <bonobo.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-generic-factory.h>
#include <libgnome/gnome-init.h>
#include <libgnomeui/gnome-ui-init.h>
#include <libgnomeui/gnome-client.h>
#include <config.h>
static BonoboObject *services_server = NULL;
int main (int argc, char *argv [])
{
GnomeClient *session;
Bonobo_RegistrationResult ret;
gchar *restart_argv[] = { "gnome2-settings-daemon", *argv, 0 };
gnome_program_init ("gnome2-settings-daemon", VERSION, LIBGNOMEUI_MODULE,
argc, argv, NULL);
session = gnome_master_client ();
gnome_client_set_restart_command (session, 2, restart_argv);
gnome_client_set_restart_style (session, GNOME_RESTART_IMMEDIATELY);
gnome_client_set_priority (session, 5);
if (!bonobo_init (&argc, argv)) {
g_error (_("Could not initialize Bonobo"));
}
gconf_init (argc, argv, NULL); /* exits w/ message on failure */
/* start the settings daemon */
services_server = BONOBO_OBJECT (gnome_settings_daemon_new ());
ret = bonobo_activation_active_server_register ("OAFIID:GNOME_SettingsDaemon",
BONOBO_OBJREF (services_server));
if (ret != Bonobo_ACTIVATION_REG_SUCCESS) {
g_warning ("Encountered problems registering the settings daemon with bonobo-activation. "
"Clients may not detect that the settings daemon is already running.");
}
gtk_main();
return -1;
}