core/dispatcher: add and use nm_dispatcher_call_hostname()

This commit is contained in:
Thomas Haller 2017-03-08 14:11:22 +01:00
parent 2b72cc2693
commit d2064be787
4 changed files with 27 additions and 2 deletions

View file

@ -693,6 +693,27 @@ done:
return success;
}
/**
* nm_dispatcher_call_hostname:
* @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 always invokes the dispatcher action asynchronously.
*
* Returns: %TRUE if the action was dispatched, %FALSE on failure
*/
gboolean
nm_dispatcher_call_hostname (NMDispatcherFunc callback,
gpointer user_data,
guint *out_call_id)
{
return _dispatcher_call (NM_DISPATCHER_ACTION_HOSTNAME, FALSE, NULL, NULL, NULL,
NM_CONNECTIVITY_UNKNOWN, NULL, NULL, NULL, NULL,
callback, user_data, out_call_id);
}
/**
* nm_dispatcher_call:
* @action: the %NMDispatcherAction

View file

@ -41,6 +41,10 @@ typedef enum {
typedef void (*NMDispatcherFunc) (guint call_id, gpointer user_data);
gboolean nm_dispatcher_call_hostname (NMDispatcherFunc callback,
gpointer user_data,
guint *out_call_id);
gboolean nm_dispatcher_call (NMDispatcherAction action,
NMSettingsConnection *settings_connection,
NMConnection *applied_connection,

View file

@ -428,7 +428,7 @@ settings_set_hostname_cb (const char *hostname,
}
if (!ret)
nm_dispatcher_call (NM_DISPATCHER_ACTION_HOSTNAME, NULL, NULL, NULL, NULL, NULL, NULL);
nm_dispatcher_call_hostname (NULL, NULL, NULL);
}
static void

View file

@ -2143,7 +2143,7 @@ hostnamed_properties_changed (GDBusProxy *proxy,
g_free (priv->hostname.value);
priv->hostname.value = g_strdup (hostname);
_notify (self, PROP_HOSTNAME);
nm_dispatcher_call (NM_DISPATCHER_ACTION_HOSTNAME, NULL, NULL, NULL, NULL, NULL, NULL);
nm_dispatcher_call_hostname (NULL, NULL, NULL);
}
g_variant_unref (v_hostname);