eiwd/src/e_mod_main.c
Pierre-Olivier Mercier e66a3effa6 Phase 3: popup UI with network list and passphrase dialog
e_gadcon_popup hosts a status label, a scrollable list of networks
(snapshotted from iwd_manager and sorted: connected → known → alpha),
and Rescan/Enable/Disable action buttons. Clicking a network calls
Network.Connect; iwd then asks our Agent for a passphrase, which is
routed to a modal elm_popup via iwd_manager_set_passphrase_handler.

The passphrase handler is installed at module init so iwd-initiated
auth works even when the popup is closed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:45:09 +07:00

58 lines
1.1 KiB
C

#include "e_mod_main.h"
#include "iwd/iwd_manager.h"
#include "e_mod_gadget.h"
#include "e_mod_popup.h"
#include "e_mod_config.h"
E_Iwd_Module *e_iwd = NULL;
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "iwd" };
EAPI void *
e_modapi_init(E_Module *m)
{
e_iwd = E_NEW(E_Iwd_Module, 1);
e_iwd->module = m;
if (!eldbus_init())
{
E_FREE(e_iwd);
return NULL;
}
e_iwd->conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
if (!e_iwd->conn)
{
eldbus_shutdown();
E_FREE(e_iwd);
return NULL;
}
e_iwd_config_load();
e_iwd->manager = iwd_manager_new(e_iwd->conn);
e_iwd_popup_install_passphrase_handler();
e_iwd_gadget_init();
return m;
}
EAPI int
e_modapi_shutdown(E_Module *m EINA_UNUSED)
{
if (!e_iwd) return 1;
e_iwd_gadget_shutdown();
if (e_iwd->manager) iwd_manager_free(e_iwd->manager);
e_iwd_config_save();
if (e_iwd->conn) eldbus_connection_unref(e_iwd->conn);
eldbus_shutdown();
E_FREE(e_iwd);
return 1;
}
EAPI int
e_modapi_save(E_Module *m EINA_UNUSED)
{
e_iwd_config_save();
return 1;
}