sure. The "unknown object type" one always annoys me...
On 02/06/2014 05:51 AM, Dan Williams wrote: > Most of these warnings are things libnm-glib can't do anything > about, and they are pretty annoying when running nmcli or nmtui, > and libraries usually shouldn't print random warnings anyway. > Downgrade them to debug messages that can be enabled if we need > to see them. > --- > libnm-glib/nm-object.c | 77 > +++++++++++++++++++++++--------------------------- > 1 file changed, 36 insertions(+), 41 deletions(-) > > diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c > index 497f6c3..2fbc4f1 100644 > --- a/libnm-glib/nm-object.c > +++ b/libnm-glib/nm-object.c > @@ -150,15 +150,15 @@ constructor (GType type, > object = G_OBJECT_CLASS (nm_object_parent_class)->constructor (type, > > n_construct_params, > > construct_params); > > priv = NM_OBJECT_GET_PRIVATE (object); > > if (priv->connection == NULL || priv->path == NULL) { > - g_warning ("%s: bus connection and path required.", __func__); > + g_warn_if_reached (); > g_object_unref (object); > return NULL; > } > > _nm_object_cache_add (NM_OBJECT (object)); > > return object; > @@ -566,27 +566,26 @@ _nm_object_create (GType type, DBusGConnection > *connection, const char *path) > GError *error = NULL; > > type_func = g_hash_table_lookup (type_funcs, GSIZE_TO_POINTER (type)); > if (type_func) > type = type_func (connection, path); > > if (type == G_TYPE_INVALID) { > - g_warning ("Could not create object for %s: unknown object > type", path); > + dbgmsg ("Could not create object for %s: unknown object type", > path); > return NULL; > } > > object = g_object_new (type, > NM_OBJECT_DBUS_CONNECTION, connection, > NM_OBJECT_DBUS_PATH, path, > NULL); > if (!g_initable_init (G_INITABLE (object), NULL, &error)) { > - g_object_unref (object); > - object = NULL; > - g_warning ("Could not create object for %s: %s", path, > error->message); > + dbgmsg ("Could not create object for %s: %s", path, > error->message); > g_error_free (error); > + g_clear_object (&object); > } > > return object; > } > > typedef void (*NMObjectCreateCallbackFunc) (GObject *, const char *, > gpointer); > typedef struct { > @@ -620,21 +619,19 @@ static void > async_inited (GObject *source, GAsyncResult *result, gpointer user_data) > { > NMObjectTypeAsyncData *async_data = user_data; > GObject *object = G_OBJECT (source); > GError *error = NULL; > > if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, > &error)) { > - if (!g_error_matches (error, DBUS_GERROR, > DBUS_GERROR_UNKNOWN_METHOD)) { > - g_warning ("Could not create object for %s: %s", > - nm_object_or_connection_get_path (object), > error->message); > - } > + dbgmsg ("Could not create object for %s: %s", > + nm_object_or_connection_get_path (object), > + error->message); > g_error_free (error); > - g_object_unref (object); > - object = NULL; > + g_clear_object (&object); > } > > create_async_complete (object, async_data); > } > > static void > async_got_type (GType type, gpointer user_data) > @@ -1024,18 +1021,18 @@ handle_property_changed (NMObject *self, const char > *dbus_name, GValue *value, g > if (!found) { > dbgmsg ("Property '%s' unhandled.", prop_name); > goto out; > } > > pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT > (self)), prop_name); > if (!pspec) { > - g_warning ("%s: property '%s' changed but wasn't defined by > object type %s.", > - __func__, > - prop_name, > - G_OBJECT_TYPE_NAME (self)); > + dbgmsg ("%s: property '%s' changed but wasn't defined by object > type %s.", > + __func__, > + prop_name, > + G_OBJECT_TYPE_NAME (self)); > goto out; > } > > if (G_UNLIKELY (debug)) { > char *s; > s = g_strdup_value_contents (value); > dbgmsg ("PC: (%p) %s::%s => '%s' (%s%s%s)", > @@ -1057,18 +1054,18 @@ handle_property_changed (NMObject *self, const char > *dbus_name, GValue *value, g > g_warn_if_reached (); > goto out; > } > } else > success = (*(pi->func)) (self, pspec, value, pi->field); > > if (!success) { > - g_warning ("%s: failed to update property '%s' of object type > %s.", > - __func__, > - prop_name, > - G_OBJECT_TYPE_NAME (self)); > + dbgmsg ("%s: failed to update property '%s' of object type %s.", > + __func__, > + prop_name, > + G_OBJECT_TYPE_NAME (self)); > } > > out: > g_free (prop_name); > } > > static void > @@ -1082,16 +1079,16 @@ process_properties_changed (NMObject *self, > GHashTable *properties, gboolean syn > return; > > g_hash_table_iter_init (&iter, properties); > while (g_hash_table_iter_next (&iter, &name, &value)) { > if (value) > handle_property_changed (self, name, value, > synchronously); > else { > - g_warning ("%s:%d %s(): object %s property '%s' value > is unexpectedly NULL", > - __FILE__, __LINE__, __func__, > G_OBJECT_TYPE_NAME (self), (const char *) name); > + dbgmsg ("%s:%d %s(): object %s property '%s' value is > unexpectedly NULL", > + __FILE__, __LINE__, __func__, > G_OBJECT_TYPE_NAME (self), (const char *) name); > } > } > } > > static void > properties_changed_proxy (DBusGProxy *proxy, > GHashTable *properties, > @@ -1143,27 +1140,29 @@ demarshal_generic (NMObject *object, > HANDLE_TYPE(INT, int, int) > HANDLE_TYPE(UINT, uint, uint) > HANDLE_TYPE(INT64, int, int) > HANDLE_TYPE(UINT64, uint, uint) > HANDLE_TYPE(LONG, long, long) > HANDLE_TYPE(ULONG, ulong, ulong) > } else { > - g_warning ("%s: %s/%s unhandled type %s.", > - __func__, G_OBJECT_TYPE_NAME (object), pspec->name, > - g_type_name (pspec->value_type)); > + dbgmsg ("%s: %s/%s unhandled type %s.", > + __func__, > + G_OBJECT_TYPE_NAME (object), > + pspec->name, > + g_type_name (pspec->value_type)); > success = FALSE; > } > > done: > if (success) { > _nm_object_queue_notify (object, pspec->name); > } else { > - g_warning ("%s: %s/%s (type %s) couldn't be set with type %s.", > - __func__, G_OBJECT_TYPE_NAME (object), pspec->name, > - g_type_name (pspec->value_type), G_VALUE_TYPE_NAME > (value)); > + dbgmsg ("%s: %s/%s (type %s) couldn't be set with type %s.", > + __func__, G_OBJECT_TYPE_NAME (object), pspec->name, > + g_type_name (pspec->value_type), G_VALUE_TYPE_NAME > (value)); > } > return success; > } > > void > _nm_object_register_properties (NMObject *object, > DBusGProxy *proxy, > @@ -1254,17 +1253,18 @@ void > _nm_object_ensure_inited (NMObject *object) > { > NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); > GError *error = NULL; > > if (!priv->inited) { > if (!g_initable_init (G_INITABLE (object), NULL, &error)) { > - g_warning ("Could not initialize %s %s: %s", > - G_OBJECT_TYPE_NAME (object), priv->path, > - error->message); > + dbgmsg ("Could not initialize %s %s: %s", > + G_OBJECT_TYPE_NAME (object), > + priv->path, > + error->message); > g_error_free (error); > > /* Only warn once */ > priv->inited = TRUE; > } > } > } > @@ -1287,25 +1287,20 @@ _nm_object_reload_property (NMObject *object, > if (!dbus_g_proxy_call_with_timeout (NM_OBJECT_GET_PRIVATE > (object)->properties_proxy, > "Get", 15000, &err, > G_TYPE_STRING, interface, > G_TYPE_STRING, prop_name, > G_TYPE_INVALID, > G_TYPE_VALUE, &value, > G_TYPE_INVALID)) { > - /* Don't warn about D-Bus no reply/timeout errors; it's mostly > noise and > - * happens for example when NM quits and the applet is still > running. > - */ > - if (!g_error_matches (err, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) { > - g_warning ("%s: Error getting '%s' for %s: (%d) %s\n", > - __func__, > - prop_name, > - nm_object_get_path (object), > - err->code, > - err->message); > - } > + dbgmsg ("%s: Error getting '%s' for %s: (%d) %s\n", > + __func__, > + prop_name, > + nm_object_get_path (object), > + err->code, > + err->message); > g_clear_error (&err); > return; > } > > handle_property_changed (object, prop_name, &value, TRUE); > g_value_unset (&value); > } > _______________________________________________ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list