## The GConfEngine object

GConfClient should be used instead of GConfEngine in most applications. See Chapter , GConfClient higher-level API. Because libgnome uses GConfClient, apps using libgnome MUST use GConfClient. GConfClient gets confused if you poke at the GConfEngine it "wraps."

A GConfEngine object represents your connection to a configuration database. Normally the database you're connecting to is the user's default database, defined by all the sources in their configuration source path. `gconf_engine_get_default()` returns a handle to this default database. `gconf_engine_get_default_with_address()` returns a handle to a single configuration source; normally, applications will not use this function—it's intended for system configuration tools and the like.

### Note

Nearly always, you should use GConfClient instead of GConfEngine. GConfClient has a default handler for errors, and keeps a client-side cache of configuration values to avoid remote queries.

    #include <gconf/gconf.h>

<funcdef>GConfEngine* `gconf_engine_get_default` </funcdef><void></void>

    #include <gconf/gconf.h>

<funcdef>GConfEngine* `gconf_engine_get_default_with_address` </funcdef><paramdef>const gchar* `address`</paramdef>

The GConfEngine object is reference counted; it begins with a count of 1, and is destroyed when the count reaches 0. In other words, the creator of the GConfEngine "owns" a reference to the GConfEngine as soon as it's created, and should call `gconf_engine_unref()` to make it go away. `gconf_engine_ref()` creates a new reference to the GConfEngine.

    #include <gconf/gconf.h>

<funcdef>void `gconf_engine_ref` </funcdef><paramdef>GConfEngine* `conf`</paramdef>

    #include <gconf/gconf.h>

<funcdef>void `gconf_engine_unref` </funcdef><paramdef>GConfEngine* `conf`</paramdef>