summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-remote-settings.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2013-05-23 19:05:40 -0300
committerDan Winship <danw@gnome.org>2013-06-14 12:57:47 -0300
commit1f81851017578086f7c502844ab24d0ecb730fad (patch)
tree02c3ff279b2a63b55274ca6bef8613a59a878a3d /libnm-glib/nm-remote-settings.c
parent4b74009b234afc98d1e57bae4f74b1918258498c (diff)
downloadNetworkManager-1f81851017578086f7c502844ab24d0ecb730fad.tar.gz
core: add monitor-connection-files=false and ReloadConnections
Add a "monitor-connection-files" config option, which can be set to "false" to disable automatic reloading of connections on file change. To go with this, add a new ReloadConnections method on o.fd.NM.Settings that can be used to manually reload connections, and add an nm-cli command to call it.
Diffstat (limited to 'libnm-glib/nm-remote-settings.c')
-rw-r--r--libnm-glib/nm-remote-settings.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c
index 9dc74ef934..589d755653 100644
--- a/libnm-glib/nm-remote-settings.c
+++ b/libnm-glib/nm-remote-settings.c
@@ -629,6 +629,47 @@ nm_remote_settings_add_connection_unsaved (NMRemoteSettings *settings,
return TRUE;
}
+/**
+ * nm_remote_settings_reload_connections:
+ * @settings: the #NMRemoteSettings
+ * @error: return location for #GError
+ *
+ * Requests that the remote settings service reload all connection
+ * files from disk, adding, updating, and removing connections until
+ * the in-memory state matches the on-disk state.
+ *
+ * Return value: %TRUE on success, %FALSE on failure
+ *
+ * Since: 0.9.10
+ **/
+gboolean
+nm_remote_settings_reload_connections (NMRemoteSettings *settings,
+ GError **error)
+{
+ NMRemoteSettingsPrivate *priv;
+ gboolean success;
+
+ g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
+
+ priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
+
+ _nm_remote_settings_ensure_inited (settings);
+
+ if (!priv->service_running) {
+ g_set_error_literal (error, NM_REMOTE_SETTINGS_ERROR,
+ NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE,
+ "NetworkManager is not running.");
+ return FALSE;
+ }
+
+ if (!dbus_g_proxy_call (priv->proxy, "ReloadConnections", error,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &success,
+ G_TYPE_INVALID))
+ return FALSE;
+ return success;
+}
+
static void
clear_one_hash (GHashTable *table)
{