From 3b498b3ec04cf3b8207cc377ce3a0f472fc3910c Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 7 Jun 2013 10:36:45 -0300 Subject: [PATCH] libnm-glib: fix the object creation warning for remote connections NMRemoteConnection is not a NMObject, so we can't always use nm_object_get_path(), https://bugzilla.gnome.org/show_bug.cgi?id=701762 --- libnm-glib/nm-object.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index d143520c6..7cf2f1bc9 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -619,6 +619,17 @@ create_async_complete (GObject *object, NMObjectTypeAsyncData *async_data) g_slice_free (NMObjectTypeAsyncData, async_data); } +static const char * +nm_object_or_connection_get_path (gpointer instance) +{ + if (NM_IS_OBJECT (instance)) + return nm_object_get_path (instance); + else if (NM_IS_CONNECTION (instance)) + return nm_connection_get_path (instance); + + g_assert_not_reached (); +} + static void async_inited (GObject *source, GAsyncResult *result, gpointer user_data) { @@ -628,7 +639,7 @@ async_inited (GObject *source, GAsyncResult *result, gpointer user_data) if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, &error)) { g_warning ("Could not create object for %s: %s", - nm_object_get_path (NM_OBJECT (object)), error->message); + nm_object_or_connection_get_path (object), error->message); g_error_free (error); g_object_unref (object); object = NULL;