2005-10-16 Rodrigo Moya <rodrigo@novell.com> * factory.c: declare a global GConfClient. (main): unref the global GConfClient. * gnome-settings-daemon.[ch] (gnome_settings_daemon_get_conf_client): new function to use the same GConfClient everywhere. (gnome_settings_daemon_new): use the global GConfClient. * gnome-settings-accessibility-keyboard.c (set_server_from_gconf, ax_response_callback, set_gconf_from_server): * gnome-settings-gtk1theme.c (apply_settings): * gnome-settings-keybindings.c (bindings_get_entry): * gnome-settings-keyboard.c (numlock_get_gconf_state, numlock_set_gconf_state, apply_settings): * gnome-settings-keyboard-xkb.c (apply_xkb_settings, gnome_settings_keyboard_xkb_sysconfig_changed_response, gnome_settings_keyboard_xkb_analyze_sysconfig, gnome_settings_chk_file_list): * gnome-settings-screensaver.c (key_toggled_cb, really_start_screensaver): * gnome-settings-sound.c (apply_settings): * gnome-settings-xmodmap.c (check_button_callback, gnome_settings_load_modmap_files, remove_button_clicked_callback, load_button_clicked_callback, gnome_settings_modmap_dialog_call): * gnome-settings-xsettings.c (xft_callback): use the global GConfClient. * gnome-settings-keyboard-xkb.c (gnome_settings_keyboard_xkb_load): don't get another GConfClient when we're getting one passed!
66 lines
1.8 KiB
C
66 lines
1.8 KiB
C
#include <config.h>
|
|
|
|
#include "gnome-settings-daemon.h"
|
|
|
|
#include <bonobo.h>
|
|
#include <bonobo/bonobo-object.h>
|
|
#include <bonobo/bonobo-generic-factory.h>
|
|
|
|
#include <gconf/gconf.h>
|
|
|
|
#include <libgnome/gnome-init.h>
|
|
#include <libgnomeui/gnome-ui-init.h>
|
|
#include <libgnomeui/gnome-client.h>
|
|
|
|
static BonoboObject *services_server = NULL;
|
|
GConfClient *conf_client = NULL;
|
|
|
|
int main (int argc, char *argv [])
|
|
{
|
|
GnomeClient *session;
|
|
Bonobo_RegistrationResult ret;
|
|
gchar *restart_argv[] = { "gnome-settings-daemon", NULL, NULL };
|
|
|
|
restart_argv[1] = *argv;
|
|
|
|
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
textdomain (GETTEXT_PACKAGE);
|
|
|
|
gnome_program_init ("gnome-settings-daemon", VERSION,
|
|
LIBGNOMEUI_MODULE,
|
|
argc, argv,
|
|
GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,
|
|
NULL);
|
|
|
|
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.");
|
|
}
|
|
|
|
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);
|
|
g_signal_connect (session, "die",
|
|
G_CALLBACK (gtk_main_quit), NULL);
|
|
|
|
gtk_main();
|
|
|
|
/* cleanup */
|
|
if (conf_client)
|
|
g_object_unref (conf_client);
|
|
|
|
return -1;
|
|
}
|