Commit c92eb66d authored by Thomas Haller's avatar Thomas Haller

libnm: implement nm_client_save_hostname() by using GDBusConnection directly

parent 356f1f6f
......@@ -882,12 +882,18 @@ nm_client_save_hostname (NMClient *client,
GError **error)
{
g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE);
if (!_nm_client_check_nm_running (client, error))
return FALSE;
return nm_remote_settings_save_hostname (NM_CLIENT_GET_PRIVATE (client)->settings,
hostname, cancellable, error);
return _nm_object_dbus_call_sync_void (client,
cancellable,
NM_DBUS_PATH_SETTINGS,
NM_DBUS_INTERFACE_SETTINGS,
"SaveHostname",
g_variant_new ("(s)", hostname ?: ""),
G_DBUS_CALL_FLAGS_NONE,
NM_DBUS_DEFAULT_TIMEOUT_MSEC,
TRUE,
error);
}
static void
......
......@@ -394,27 +394,6 @@ nm_remote_settings_add_connection2 (NMRemoteSettings *self,
}
}
gboolean
nm_remote_settings_save_hostname (NMRemoteSettings *settings,
const char *hostname,
GCancellable *cancellable,
GError **error)
{
NMRemoteSettingsPrivate *priv;
gboolean ret;
g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
ret = nmdbus_settings_call_save_hostname_sync (priv->proxy,
hostname ?: "",
cancellable, error);
if (error && *error)
g_dbus_error_strip_remote_error (*error);
return ret;
}
static void
save_hostname_cb (GObject *proxy,
GAsyncResult *result,
......
......@@ -75,12 +75,6 @@ void nm_remote_settings_add_connection2 (NMRemoteSettings *self,
NMRemoteSettingAddConnection2Callback callback,
gpointer user_data);
_NM_DEPRECATED_SYNC_METHOD_INTERNAL
gboolean nm_remote_settings_save_hostname (NMRemoteSettings *settings,
const char *hostname,
GCancellable *cancellable,
GError **error);
void nm_remote_settings_save_hostname_async (NMRemoteSettings *settings,
const char *hostname,
GCancellable *cancellable,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment