static void set_state_from_string (NMSupplicantInterface *self, const char *new_state) { int state; state = wpas_state_string_to_enum (new_state); g_warn_if_fail (state > 0); if (state > 0) set_state (self, (guint32) state); }
static void iface_state_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data) { GError *err = NULL; char *state_str = NULL; if (!dbus_g_proxy_end_call (proxy, call_id, &err, G_TYPE_STRING, &state_str, G_TYPE_INVALID)) { nm_log_warn (LOGD_SUPPLICANT, "could not get interface state: %s.", err->message); g_error_free (err); } else { NMSupplicantInfo *info = (NMSupplicantInfo *) user_data; NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (info->interface); priv->con_state = wpas_state_string_to_enum (state_str); g_free (state_str); nm_supplicant_interface_set_state (info->interface, NM_SUPPLICANT_INTERFACE_STATE_READY); } }
static void wpas_iface_handle_state_change (DBusGProxy *proxy, const char *str_new_state, const char *str_old_state, gpointer user_data) { NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (user_data); guint32 old_state, enum_new_state; enum_new_state = wpas_state_string_to_enum (str_new_state); old_state = priv->con_state; priv->con_state = enum_new_state; if (priv->con_state != old_state) { g_signal_emit (user_data, nm_supplicant_interface_signals[CONNECTION_STATE], 0, priv->con_state, old_state); } }