Commit b0895e19 authored by Ray Strode's avatar Ray Strode

dbus: Don't spew to console when unable to connect to dbus daemon

Instead pass the error up for the caller to decide what to do.

This prevent untrappable warning messages from showing up at the
console if gconftool --makefile-install-rule is called.
parent 98ff7acc
......@@ -105,7 +105,7 @@ static GHashTable *engines_by_db = NULL;
static GHashTable *engines_by_address = NULL;
static gboolean dbus_disconnected = FALSE;
static gboolean ensure_dbus_connection (void);
static gboolean ensure_dbus_connection (GError **error);
static gboolean ensure_service (gboolean start_if_not_found,
GError **err);
static gboolean ensure_database (GConfEngine *conf,
......@@ -383,7 +383,7 @@ gconf_engine_detach (GConfEngine *conf)
}
static gboolean
ensure_dbus_connection (void)
ensure_dbus_connection (GError **err)
{
DBusError error;
......@@ -392,7 +392,9 @@ ensure_dbus_connection (void)
if (dbus_disconnected)
{
g_warning ("The connection to DBus was broken. Can't reinitialize it.");
g_set_error (err, GCONF_ERROR,
GCONF_ERROR_NO_SERVER,
"The connection to DBus was broken. Can't reinitialize it.");
return FALSE;
}
......@@ -402,7 +404,10 @@ ensure_dbus_connection (void)
if (!global_conn)
{
g_warning ("Client failed to connect to the D-BUS daemon:\n%s", error.message);
g_set_error (err, GCONF_ERROR,
GCONF_ERROR_NO_SERVER,
"Client failed to connect to the D-BUS daemon:\n%s",
error.message);
dbus_error_free (&error);
return FALSE;
......@@ -431,13 +436,8 @@ ensure_service (gboolean start_if_not_found,
if (global_conn == NULL)
{
if (!ensure_dbus_connection ())
{
g_set_error (err, GCONF_ERROR,
GCONF_ERROR_NO_SERVER,
_("No D-BUS daemon running\n"));
return FALSE;
}
if (!ensure_dbus_connection (err))
return FALSE;
g_assert (global_conn != NULL);
}
......@@ -2512,7 +2512,7 @@ gconf_ping_daemon (void)
{
if (global_conn == NULL)
{
if (!ensure_dbus_connection ())
if (!ensure_dbus_connection (NULL))
{
return FALSE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment