summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-03-23 17:26:22 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2015-05-08 09:07:20 +0200
commitd492a7b3ab3d18c51c7e8430bbf92c97893d531c (patch)
treefc16640d3d275b1a45178fce7fc78beecb90fb47
parent591b0927f8c5b0bea94c3b95c9718b6ee69fad8c (diff)
downloadNetworkManager-d492a7b3ab3d18c51c7e8430bbf92c97893d531c.tar.gz
trivial: factor out monitor initialization from nm_settings_new()
-rw-r--r--src/settings/nm-settings.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index ff9aea4e4f..5bab22e328 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -2003,29 +2003,12 @@ nm_settings_get_startup_complete (NMSettings *self)
/***************************************************************/
-NMSettings *
-nm_settings_new (GError **error)
+static void
+setup_hostname_file_monitors (NMSettings *self)
{
- NMSettings *self;
- NMSettingsPrivate *priv;
- GFile *file;
+ NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
GFileMonitor *monitor;
-
- self = g_object_new (NM_TYPE_SETTINGS, NULL);
-
- priv = NM_SETTINGS_GET_PRIVATE (self);
-
- priv->config = nm_config_get ();
- priv->dbus_mgr = nm_dbus_manager_get ();
-
- /* Load the plugins; fail if a plugin is not found. */
- if (!load_plugins (self, nm_config_get_plugins (priv->config), error)) {
- g_object_unref (self);
- return NULL;
- }
-
- load_connections (self);
- check_startup_complete (self);
+ GFile *file;
priv->hostname.file = HOSTNAME_FILE;
priv->hostname.value = nm_settings_get_hostname (self);
@@ -2054,6 +2037,29 @@ nm_settings_new (GError **error)
}
#endif
+NMSettings *
+nm_settings_new (GError **error)
+{
+ NMSettings *self;
+ NMSettingsPrivate *priv;
+
+ self = g_object_new (NM_TYPE_SETTINGS, NULL);
+
+ priv = NM_SETTINGS_GET_PRIVATE (self);
+
+ priv->config = nm_config_get ();
+ priv->dbus_mgr = nm_dbus_manager_get ();
+
+ /* Load the plugins; fail if a plugin is not found. */
+ if (!load_plugins (self, nm_config_get_plugins (priv->config), error)) {
+ g_object_unref (self);
+ return NULL;
+ }
+
+ load_connections (self);
+ check_startup_complete (self);
+ setup_hostname_file_monitors (self);
+
nm_dbus_manager_register_object (priv->dbus_mgr, NM_DBUS_PATH_SETTINGS, self);
return self;
}