void
cc_network_panel_connect_to_hidden_network (GtkWidget        *toplevel,
                                            NMClient         *client)
{
        g_debug ("connect to hidden wifi");
        show_wireless_dialog (toplevel, client,
                              nma_wifi_dialog_new_for_hidden (client));
}
void
cc_network_panel_connect_to_hidden_network (CcNetworkPanel   *panel,
        NMClient         *client,
        NMRemoteSettings *settings)
{
    g_debug ("connect to hidden wifi");
    show_wireless_dialog (panel, client, settings,
                          nma_wireless_dialog_new_for_other (client, settings));
}
void
cc_network_panel_create_wifi_network (GtkWidget        *toplevel,
				      NMClient         *client)
{
  if (wifi_can_create_wifi_network (client)) {
          show_wireless_dialog (toplevel, client,
                                nma_wifi_dialog_new_for_create (client));
  }
}
void
cc_network_panel_create_wifi_network (CcNetworkPanel   *panel,
                                      NMClient         *client,
                                      NMRemoteSettings *settings)
{
    if (wifi_can_create_wifi_network (client)) {
        show_wireless_dialog (panel, client, settings,
                              nma_wireless_dialog_new_for_create (client, settings));
    }
}
void
cc_network_panel_connect_to_8021x_network (CcNetworkPanel   *panel,
        NMClient         *client,
        NMRemoteSettings *settings,
        NMDevice         *device,
        const gchar      *arg_access_point)
{
    NMConnection *connection;
    NMSettingConnection *s_con;
    NMSettingWireless *s_wifi;
    NMSettingWirelessSecurity *s_wsec;
    NMSetting8021x *s_8021x;
    NM80211ApSecurityFlags wpa_flags, rsn_flags;
    GtkWidget *dialog;
    char *uuid;
    NMAccessPoint *ap;

    g_debug ("connect to 8021x wifi");
    ap = nm_device_wifi_get_access_point_by_path (NM_DEVICE_WIFI (device), arg_access_point);
    if (ap == NULL) {
        g_warning ("didn't find access point with path %s", arg_access_point);
        return;
    }

    /* If the AP is WPA[2]-Enterprise then we need to set up a minimal 802.1x
    * setting and ask the user for more information.
     */
    rsn_flags = nm_access_point_get_rsn_flags (ap);
    wpa_flags = nm_access_point_get_wpa_flags (ap);
    if (!(rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
            && !(wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
        g_warning ("Network panel loaded with connect-8021x-wifi but the "
                   "access point does not support 802.1x");
        return;
    }

    connection = nm_connection_new ();

    /* Need a UUID for the "always ask" stuff in the Dialog of Doom */
    s_con = (NMSettingConnection *) nm_setting_connection_new ();
    uuid = nm_utils_uuid_generate ();
    g_object_set (s_con, NM_SETTING_CONNECTION_UUID, uuid, NULL);
    g_free (uuid);
    nm_connection_add_setting (connection, NM_SETTING (s_con));

    s_wifi = (NMSettingWireless *) nm_setting_wireless_new ();
    nm_connection_add_setting (connection, NM_SETTING (s_wifi));
    g_object_set (s_wifi,
                  NM_SETTING_WIRELESS_SSID, nm_access_point_get_ssid (ap),
                  NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
                  NULL);

    s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
    g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL);
    nm_connection_add_setting (connection, NM_SETTING (s_wsec));

    s_8021x = (NMSetting8021x *) nm_setting_802_1x_new ();
    nm_setting_802_1x_add_eap_method (s_8021x, "ttls");
    g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "mschapv2", NULL);
    nm_connection_add_setting (connection, NM_SETTING (s_8021x));

    dialog = nma_wireless_dialog_new (client, settings, connection, device, ap, FALSE);
    show_wireless_dialog (panel, client, settings, dialog);
}