From 98bd78c93b51fde343681fd6090a49c1dd0b6dc1 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 10 Aug 2010 15:46:33 -0500 Subject: [PATCH] libnm-glib: better handling of missing user settings service If it's not running or we can't spawn it (it's not supposed to be autospawned anyway) we should just ignore the error and poke clients that we've tried and failed to get user settings instead of warning with an annoying message. --- libnm-glib/nm-remote-settings.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index 92814a15c..6a9a1d71e 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -166,12 +166,26 @@ fetch_connections_done (DBusGProxy *proxy, int i; if (error) { - g_warning ("%s: error fetching %s connections: (%d) %s.", - __func__, - priv->scope == NM_CONNECTION_SCOPE_USER ? "user" : "system", - error->code, - error->message ? error->message : "(unknown)"); + gboolean is_spawn_error = FALSE; + + /* Don't warn if the user settings service wasn't running since that's + * just annoying when running headless. + */ + if ( g_error_matches (error, DBUS_GERROR, DBUS_GERROR_SERVICE_UNKNOWN) + || g_error_matches (error, DBUS_GERROR, DBUS_GERROR_NAME_HAS_NO_OWNER)) + is_spawn_error = TRUE; + + if (!is_spawn_error || priv->scope == NM_CONNECTION_SCOPE_SYSTEM) { + g_warning ("%s: error fetching %s connections: (%d) %s.", + __func__, + priv->scope == NM_CONNECTION_SCOPE_USER ? "user" : "system", + error->code, + error->message ? error->message : "(unknown)"); + } g_clear_error (&error); + + /* We tried to read connections and failed */ + g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CONNECTIONS_READ); return; }