source: trunk/third/libgnome/monikers/bonobo-moniker-conf-indirect.c @ 18320

Revision 18320, 1.4 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18319, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * gnome-moniker-conf-indirect.c: conf_indirect Moniker implementation
3 *
4 * This is the ior (container) based Moniker implementation.
5 *
6 * Author:
7 *      Rodrigo Moya (rodrigo@gnome-db.org)
8 */
9
10#include <config.h>
11#include <bonobo/bonobo-i18n.h>
12#include <bonobo/bonobo-main.h>
13#include <bonobo/bonobo-exception.h>
14#include <bonobo/bonobo-moniker-util.h>
15#include <gconf/gconf-client.h>
16
17#include "bonobo-moniker-extra.h"
18
19Bonobo_Unknown
20bonobo_moniker_conf_indirect_resolve (BonoboMoniker *moniker,
21                                      const Bonobo_ResolveOptions *options,
22                                      const CORBA_char *requested_interface,
23                                      CORBA_Environment *ev)
24{
25        const char *key;
26        char *oiid;
27        Bonobo_Unknown object;
28        GConfClient *conf_client;
29        GError *err = NULL;
30
31        /* retrieve the key contents from GConf */
32        key = bonobo_moniker_get_name (moniker);
33
34        if (!gconf_is_initialized ())
35                gconf_init (0, NULL, NULL);
36
37        conf_client = gconf_client_get_default ();
38        oiid = gconf_client_get_string (conf_client, key, &err);
39        g_object_unref (G_OBJECT (conf_client));
40
41        if (!oiid) {
42                bonobo_exception_general_error_set (
43                        ev, NULL,
44                        err ? err->message : _("Key %s not found in configuration"), key);
45                g_error_free (err);
46                return CORBA_OBJECT_NIL;
47        }
48
49        /* activate the object referenced in the GConf entry */
50        object = bonobo_get_object ((const CORBA_char *) oiid,
51                                    requested_interface,
52                                    ev);
53
54        return object;
55}
Note: See TracBrowser for help on using the repository browser.