libnm-glib: merge branch 'libnm-glib-warnings'

https://bugzilla.gnome.org/show_bug.cgi?id=778610
This commit is contained in:
Thomas Haller 2017-02-15 16:31:52 +01:00
commit 0cad8307a5
5 changed files with 28 additions and 3 deletions

View file

@ -174,6 +174,9 @@ nm_dhcp4_config_class_init (NMDHCP4ConfigClass *config_class)
GObject *
nm_dhcp4_config_new (DBusGConnection *connection, const char *object_path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
return (GObject *) g_object_new (NM_TYPE_DHCP4_CONFIG,
NM_OBJECT_DBUS_CONNECTION, connection,
NM_OBJECT_DBUS_PATH, object_path,

View file

@ -174,6 +174,9 @@ nm_dhcp6_config_class_init (NMDHCP6ConfigClass *config_class)
GObject *
nm_dhcp6_config_new (DBusGConnection *connection, const char *object_path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
return (GObject *) g_object_new (NM_TYPE_DHCP6_CONFIG,
NM_OBJECT_DBUS_CONNECTION, connection,
NM_OBJECT_DBUS_PATH, object_path,

View file

@ -330,6 +330,9 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
GObject *
nm_ip4_config_new (DBusGConnection *connection, const char *object_path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
return (GObject *) g_object_new (NM_TYPE_IP4_CONFIG,
NM_OBJECT_DBUS_CONNECTION, connection,
NM_OBJECT_DBUS_PATH, object_path,

View file

@ -69,6 +69,9 @@ enum {
GObject *
nm_ip6_config_new (DBusGConnection *connection, const char *object_path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
return (GObject *) g_object_new (NM_TYPE_IP6_CONFIG,
NM_OBJECT_DBUS_CONNECTION, connection,
NM_OBJECT_DBUS_PATH, object_path,

View file

@ -175,7 +175,22 @@ constructor (GType type,
priv = NM_OBJECT_GET_PRIVATE (object);
if (priv->connection == NULL || priv->path == NULL) {
if (priv->connection == NULL) {
GError *error = NULL;
priv->connection = _nm_dbus_new_connection (&error);
if (priv->connection == NULL) {
g_warning ("Error connecting to system bus: %s", error->message);
g_clear_error (&error);
g_object_unref (object);
return NULL;
}
}
g_assert (priv->connection != NULL);
if (priv->path == NULL) {
g_warn_if_reached ();
g_object_unref (object);
return NULL;
@ -356,8 +371,6 @@ set_property (GObject *object, guint prop_id,
case PROP_DBUS_CONNECTION:
/* Construct only */
priv->connection = g_value_dup_boxed (value);
if (!priv->connection)
priv->connection = _nm_dbus_new_connection (NULL);
break;
case PROP_DBUS_PATH:
/* Construct only */