keep-alive: drop "floating" argument from nm_keep_alive_new()

All callers only want to create floating instances at first.
Also, it seems to make generally more sense this way: you create
a floating instance, set it up, and then arm it.

This simplifies nm_keep_alive_new(), which previously was adding
additional code that wasn't accessible via plain g_object_new().
This commit is contained in:
Thomas Haller 2018-11-20 13:16:54 +01:00
parent 15033be1a3
commit a1e811b427
3 changed files with 10 additions and 11 deletions

View file

@ -1446,7 +1446,7 @@ nm_active_connection_init (NMActiveConnection *self)
priv->activation_type = NM_ACTIVATION_TYPE_MANAGED;
priv->version_id = _version_id_new ();
priv->keep_alive = nm_keep_alive_new (TRUE);
priv->keep_alive = nm_keep_alive_new ();
g_signal_connect_object (priv->keep_alive, "notify::" NM_KEEP_ALIVE_ALIVE,
(GCallback) keep_alive_alive_changed,
self,

View file

@ -382,19 +382,18 @@ get_property (GObject *object,
static void
nm_keep_alive_init (NMKeepAlive *self)
{
nm_assert (NM_KEEP_ALIVE_GET_PRIVATE (self)->alive == _is_alive (self));
NMKeepAlivePrivate *priv = NM_KEEP_ALIVE_GET_PRIVATE (self);
priv->floating = TRUE;
priv->alive = TRUE;
nm_assert (priv->alive == _is_alive (self));
}
NMKeepAlive *
nm_keep_alive_new (gboolean floating)
nm_keep_alive_new (void)
{
NMKeepAlive *self = g_object_new (NM_TYPE_KEEP_ALIVE, NULL);
NMKeepAlivePrivate *priv = NM_KEEP_ALIVE_GET_PRIVATE (self);
priv->floating = floating;
priv->alive = TRUE;
nm_assert (priv->alive == _is_alive (self));
return self;
return g_object_new (NM_TYPE_KEEP_ALIVE, NULL);
}
static void

View file

@ -36,7 +36,7 @@ typedef struct _NMKeepAliveClass NMKeepAliveClass;
GType nm_keep_alive_get_type (void) G_GNUC_CONST;
NMKeepAlive* nm_keep_alive_new (gboolean floating);
NMKeepAlive* nm_keep_alive_new (void);
gboolean nm_keep_alive_is_alive (NMKeepAlive *self);