Commit 09e275dc authored by Thomas Haller's avatar Thomas Haller

libnm: implement nm_client_reload() by using GDBusConnection directly

parent b1871a75
...@@ -2898,22 +2898,6 @@ nm_client_checkpoint_adjust_rollback_timeout_finish (NMClient *client, ...@@ -2898,22 +2898,6 @@ nm_client_checkpoint_adjust_rollback_timeout_finish (NMClient *client,
return g_task_propagate_boolean (G_TASK (result), error); return g_task_propagate_boolean (G_TASK (result), error);
} }
static void
reload_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
gs_unref_object GSimpleAsyncResult *simple = user_data;
GError *error = NULL;
if (nm_manager_reload_finish (NM_MANAGER (object), result, &error))
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
else
g_simple_async_result_take_error (simple, error);
g_simple_async_result_complete (simple);
}
/** /**
* nm_client_reload: * nm_client_reload:
* @client: the %NMClient * @client: the %NMClient
...@@ -2937,23 +2921,21 @@ nm_client_reload (NMClient *client, ...@@ -2937,23 +2921,21 @@ nm_client_reload (NMClient *client,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *simple;
GError *error = NULL;
g_return_if_fail (NM_IS_CLIENT (client)); g_return_if_fail (NM_IS_CLIENT (client));
if (!_nm_client_check_nm_running (client, &error)) { _nm_object_dbus_call (client,
g_simple_async_report_take_gerror_in_idle (G_OBJECT (client), callback, user_data, error); nm_client_reload,
return; cancellable,
} callback,
user_data,
simple = g_simple_async_result_new (G_OBJECT (client), callback, user_data, NM_DBUS_PATH,
nm_client_reload); NM_DBUS_INTERFACE,
if (cancellable) "Reload",
g_simple_async_result_set_check_cancellable (simple, cancellable); g_variant_new ("(u)", (guint32) flags),
nm_manager_reload (NM_CLIENT_GET_PRIVATE (client)->manager, G_VARIANT_TYPE ("()"),
flags, G_DBUS_CALL_FLAGS_NONE,
cancellable, reload_cb, simple); NM_DBUS_DEFAULT_TIMEOUT_MSEC,
nm_dbus_connection_call_finish_void_strip_dbus_error_cb);
} }
/** /**
...@@ -2974,10 +2956,9 @@ nm_client_reload_finish (NMClient *client, ...@@ -2974,10 +2956,9 @@ nm_client_reload_finish (NMClient *client,
GError **error) GError **error)
{ {
g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE); g_return_val_if_fail (nm_g_task_is_valid (result, client, nm_client_reload), FALSE);
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), return g_task_propagate_boolean (G_TASK (result), error);
error);
} }
/****************************************************************/ /****************************************************************/
......
...@@ -1076,64 +1076,6 @@ nm_manager_wait_for_checkpoint (NMManager *self, ...@@ -1076,64 +1076,6 @@ nm_manager_wait_for_checkpoint (NMManager *self,
} }
} }
static void
reload_cb (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
gs_unref_object GSimpleAsyncResult *simple = user_data;
GError *error = NULL;
if (nmdbus_manager_call_reload_finish (NMDBUS_MANAGER (object),
result,
&error))
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
else {
g_dbus_error_strip_remote_error (error);
g_simple_async_result_take_error (simple, error);
}
g_simple_async_result_complete (simple);
}
void
nm_manager_reload (NMManager *manager,
NMManagerReloadFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *simple;
g_return_if_fail (NM_IS_MANAGER (manager));
simple = g_simple_async_result_new (G_OBJECT (manager), callback, user_data,
nm_manager_reload);
if (cancellable)
g_simple_async_result_set_check_cancellable (simple, cancellable);
nmdbus_manager_call_reload (NM_MANAGER_GET_PRIVATE (manager)->proxy,
flags,
cancellable,
reload_cb,
simple);
}
gboolean
nm_manager_reload_finish (NMManager *manager,
GAsyncResult *result,
GError **error)
{
GSimpleAsyncResult *simple;
g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (manager),
nm_manager_reload),
FALSE);
simple = G_SIMPLE_ASYNC_RESULT (result);
return !g_simple_async_result_propagate_error (simple, error);
}
/*****************************************************************************/ /*****************************************************************************/
static void static void
......
...@@ -164,13 +164,4 @@ NM_AUTO_DEFINE_FCN0 (_NMActivateResult *, _nm_auto_free_activate_result, _nm_act ...@@ -164,13 +164,4 @@ NM_AUTO_DEFINE_FCN0 (_NMActivateResult *, _nm_auto_free_activate_result, _nm_act
/*****************************************************************************/ /*****************************************************************************/
void nm_manager_reload (NMManager *manager,
NMManagerReloadFlags flags,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean nm_manager_reload_finish (NMManager *manager,
GAsyncResult *result,
GError **error);
#endif /* __NM_MANAGER_H__ */ #endif /* __NM_MANAGER_H__ */
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