Ejemplo n.º 1
0
static GConfClient*
get_global_client (void)
{
    GError *error = NULL;

    /* Initialize gconf if needed */
    if (!gconf_is_initialized ()) {
        char *argv[] = { "seahorse", NULL };

        if (!gconf_init (1, argv, &error)) {
            if (handle_error (&error))
                return NULL;
        }
    }

    if (global_gconf_client == NULL) {
        global_gconf_client = gconf_client_get_default ();

        if (global_gconf_client) {
            gconf_client_add_dir (global_gconf_client, SEAHORSE_DESKTOP_KEYS,
                                  GCONF_CLIENT_PRELOAD_NONE, &error);
            handle_error (&error);
            gconf_client_add_dir (global_gconf_client, SEAHORSE_SCHEMAS,
                                  GCONF_CLIENT_PRELOAD_NONE, &error);
            handle_error (&error);
        }

        atexit (global_client_free);
    }

    return global_gconf_client;
}
Ejemplo n.º 2
0
/* Public */
GConfClient *
eel_gconf_client_get_global (void)
{
    /* Initialize gconf if needed */
    if (!gconf_is_initialized ()) {
        char *argv[] = { "eel-preferences", NULL };
        GError *error = NULL;

        if (!gconf_init (1, argv, &error)) {
            if (eel_gconf_handle_error (&error)) {
                return NULL;
            }
        }
    }

    if (global_gconf_client == NULL) {
        global_gconf_client = gconf_client_get_default ();
        eel_debug_call_at_shutdown (global_client_free);
    }

    return global_gconf_client;
}
Bonobo_Unknown
bonobo_moniker_conf_indirect_resolve (BonoboMoniker *moniker,
				      const Bonobo_ResolveOptions *options,
				      const CORBA_char *requested_interface,
				      CORBA_Environment *ev)
{
	const char *key;
	char *oiid;
	Bonobo_Unknown object;
	GConfClient *conf_client;
	GError *err = NULL;

	/* retrieve the key contents from GConf */
	key = bonobo_moniker_get_name (moniker);

	if (!gconf_is_initialized ())
		gconf_init (0, NULL, NULL);

	conf_client = gconf_client_get_default ();
	oiid = gconf_client_get_string (conf_client, key, &err);
	g_object_unref (conf_client);

	if (!oiid) {
		bonobo_exception_general_error_set (
			ev, NULL,
			err ? err->message : _("Key %s not found in configuration"), key);
		g_error_free (err);
		return CORBA_OBJECT_NIL;
	}

	/* activate the object referenced in the GConf entry */
	object = bonobo_get_object ((const CORBA_char *) oiid,
				    requested_interface,
				    ev);
	g_free (oiid);

	return object;
}
Ejemplo n.º 4
0
static GConfClient *
gsearchtool_gconf_client_get_global (void)
{
	static GConfClient * global_gconf_client = NULL;

	/* Initialize gconf if needed */
	if (!gconf_is_initialized ()) {
		char *argv[] = { "gsearchtool-preferences", NULL };
		GError *error = NULL;

		if (!gconf_init (1, argv, &error)) {
			if (gsearchtool_gconf_handle_error (&error)) {
				return NULL;
			}
		}
	}

	if (global_gconf_client == NULL) {
		global_gconf_client = gconf_client_get_default ();
	}

	return global_gconf_client;
}