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.
This commit is contained in:
@@ -105,8 +105,7 @@ update_state (NMConnectivity *self, NMConnectivityState state)
|
|||||||
priv->state = state;
|
priv->state = state;
|
||||||
_notify (self, PROP_STATE);
|
_notify (self, PROP_STATE);
|
||||||
|
|
||||||
/* Notify dispatcher scripts of a connectivity state change */
|
nm_dispatcher_call_connectivity (state, NULL, NULL, NULL);
|
||||||
nm_dispatcher_call_connectivity (NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE, state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -837,19 +837,25 @@ nm_dispatcher_call_vpn_sync (NMDispatcherAction action,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_dispatcher_call_connectivity():
|
* nm_dispatcher_call_connectivity():
|
||||||
* @action: the %NMDispatcherAction
|
|
||||||
* @connectivity_state: the #NMConnectivityState value
|
* @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.
|
* This method does not block the caller.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the action was dispatched, %FALSE on failure
|
* Returns: %TRUE if the action was dispatched, %FALSE on failure
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
nm_dispatcher_call_connectivity (NMDispatcherAction action,
|
nm_dispatcher_call_connectivity (NMConnectivityState connectivity_state,
|
||||||
NMConnectivityState connectivity_state)
|
NMDispatcherFunc callback,
|
||||||
|
gpointer user_data,
|
||||||
|
guint *out_call_id)
|
||||||
{
|
{
|
||||||
return _dispatcher_call (action, FALSE, NULL, NULL, NULL, connectivity_state,
|
return _dispatcher_call (NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE, FALSE, NULL, NULL, NULL, connectivity_state,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL,
|
||||||
|
callback, user_data, out_call_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -79,8 +79,11 @@ gboolean nm_dispatcher_call_vpn_sync (NMDispatcherAction action,
|
|||||||
NMIP4Config *vpn_ip4_config,
|
NMIP4Config *vpn_ip4_config,
|
||||||
NMIP6Config *vpn_ip6_config);
|
NMIP6Config *vpn_ip6_config);
|
||||||
|
|
||||||
gboolean nm_dispatcher_call_connectivity (NMDispatcherAction action,
|
gboolean nm_dispatcher_call_connectivity (NMConnectivityState state,
|
||||||
NMConnectivityState state);
|
NMDispatcherFunc callback,
|
||||||
|
gpointer user_data,
|
||||||
|
guint *out_call_id);
|
||||||
|
|
||||||
|
|
||||||
void nm_dispatcher_call_cancel (guint call_id);
|
void nm_dispatcher_call_cancel (guint call_id);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user