# The GConfEngine object

GConfClient should be used instead of GConfEngine in most applications. See the chapter called 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>

`GConfEngine* gconf_engine_get_default` (void);

    #include <gconf/gconf.h>

`GConfEngine* gconf_engine_get_default_with_address` (const gchar* address);

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>

`void gconf_engine_ref` (GConfEngine* conf);

    #include <gconf/gconf.h>

`void gconf_engine_unref` (GConfEngine* conf);