summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-08 14:11:22 +0100
committerThomas Haller <thaller@redhat.com>2017-03-08 15:06:22 +0100
commit619bcf7a1a6a171eb12e0ec906c9b7fa0cfdac21 (patch)
tree12df042a998f8b4ab11e8826061782043683ffbf
parent2022410377f607820215cc41b0c8ba456467d3a0 (diff)
downloadNetworkManager-619bcf7a1a6a171eb12e0ec906c9b7fa0cfdac21.tar.gz
core/dispatcher: cleanup nm_dispatcher_call_connectivity()
Remove the redundant action argument. It is clear, that nm_dispatcher_call_connectivity() is called with action NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE. On the other hand, add the async callbacks. Altough they are not used at the moment, it seems more correct that an async API has a callback and a call-id to cancel the invocation.
-rw-r--r--src/nm-connectivity.c3
-rw-r--r--src/nm-dispatcher.c16
-rw-r--r--src/nm-dispatcher.h7
3 files changed, 17 insertions, 9 deletions
diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c
index 491099bf96..ac13b2ca85 100644
--- a/src/nm-connectivity.c
+++ b/src/nm-connectivity.c
@@ -105,8 +105,7 @@ update_state (NMConnectivity *self, NMConnectivityState state)
priv->state = state;
_notify (self, PROP_STATE);
- /* Notify dispatcher scripts of a connectivity state change */
- nm_dispatcher_call_connectivity (NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE, state);
+ nm_dispatcher_call_connectivity (state, NULL, NULL, NULL);
}
}
diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c
index 1bea957fde..561950cff9 100644
--- a/src/nm-dispatcher.c
+++ b/src/nm-dispatcher.c
@@ -837,19 +837,25 @@ nm_dispatcher_call_vpn_sync (NMDispatcherAction action,
/**
* nm_dispatcher_call_connectivity():
- * @action: the %NMDispatcherAction
* @connectivity_state: the #NMConnectivityState value
+ * @callback: a caller-supplied callback to execute when done
+ * @user_data: caller-supplied pointer passed to @callback
+ * @out_call_id: on success, a call identifier which can be passed to
+ * nm_dispatcher_call_cancel()
*
* This method does not block the caller.
*
* Returns: %TRUE if the action was dispatched, %FALSE on failure
*/
gboolean
-nm_dispatcher_call_connectivity (NMDispatcherAction action,
- NMConnectivityState connectivity_state)
+nm_dispatcher_call_connectivity (NMConnectivityState connectivity_state,
+ NMDispatcherFunc callback,
+ gpointer user_data,
+ guint *out_call_id)
{
- return _dispatcher_call (action, FALSE, NULL, NULL, NULL, connectivity_state,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ return _dispatcher_call (NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE, FALSE, NULL, NULL, NULL, connectivity_state,
+ NULL, NULL, NULL, NULL,
+ callback, user_data, out_call_id);
}
void
diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h
index 111085124e..743cf44a19 100644
--- a/src/nm-dispatcher.h
+++ b/src/nm-dispatcher.h
@@ -79,8 +79,11 @@ gboolean nm_dispatcher_call_vpn_sync (NMDispatcherAction action,
NMIP4Config *vpn_ip4_config,
NMIP6Config *vpn_ip6_config);
-gboolean nm_dispatcher_call_connectivity (NMDispatcherAction action,
- NMConnectivityState state);
+gboolean nm_dispatcher_call_connectivity (NMConnectivityState state,
+ NMDispatcherFunc callback,
+ gpointer user_data,
+ guint *out_call_id);
+
void nm_dispatcher_call_cancel (guint call_id);