2011-08-15 02:21:12 -07:00
|
|
|
/* Setup if we need connman? */
|
2012-11-30 06:38:34 -08:00
|
|
|
#include "e_wizard.h"
|
2018-05-27 06:51:15 -07:00
|
|
|
#include "e_wizard_api.h"
|
2011-08-15 02:21:12 -07:00
|
|
|
|
|
|
|
static void
|
2016-03-11 14:14:17 -08:00
|
|
|
_recommend_connman(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
2016-03-11 14:14:17 -08:00
|
|
|
Evas_Object *of, *ob;
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_title_set(_("Network Management"));
|
2011-08-15 02:21:12 -07:00
|
|
|
|
2016-03-11 14:14:17 -08:00
|
|
|
of = elm_frame_add(e_comp->elm);
|
|
|
|
ob = elm_label_add(of);
|
|
|
|
elm_object_content_set(of, ob);
|
2016-03-11 10:59:14 -08:00
|
|
|
#if defined(USE_MODULE_CONNMAN) || defined(USE_MODULE_WIRELESS)
|
2016-03-11 14:14:17 -08:00
|
|
|
elm_object_text_set(of, _("Connman network service not found"));
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2016-03-11 14:14:17 -08:00
|
|
|
|
|
|
|
elm_object_text_set(ob, _("Install/Enable Connman service for network management support"));
|
2012-11-26 03:30:16 -08:00
|
|
|
#else
|
2016-03-11 14:14:17 -08:00
|
|
|
elm_object_text_set(of, _("Connman and Wireless modules disabled"));
|
|
|
|
elm_object_text_set(ob, _("Install one of these modules for network management support"));
|
2012-11-26 03:30:16 -08:00
|
|
|
#endif
|
2011-08-15 02:21:12 -07:00
|
|
|
evas_object_show(ob);
|
|
|
|
evas_object_show(of);
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_page_show(of);
|
2011-08-30 17:05:44 -07:00
|
|
|
// pg->data = o;
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_button_next_enable_set(1);
|
2011-08-15 02:21:12 -07:00
|
|
|
}
|
|
|
|
|
2013-04-23 08:08:29 -07:00
|
|
|
static Eldbus_Connection *conn;
|
|
|
|
static Eldbus_Pending *pending_connman;
|
2012-09-03 14:57:16 -07:00
|
|
|
static Ecore_Timer *connman_timeout = NULL;
|
2011-08-15 02:21:12 -07:00
|
|
|
|
|
|
|
static Eina_Bool
|
2012-09-03 14:57:16 -07:00
|
|
|
_connman_fail(void *data)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
E_Wizard_Page *pg = data;
|
|
|
|
E_Config_Module *em;
|
|
|
|
Eina_List *l;
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
EINA_LIST_FOREACH(e_config->modules, l, em)
|
|
|
|
{
|
|
|
|
if (!em->name) continue;
|
|
|
|
if (!strcmp(em->name, "connman"))
|
|
|
|
{
|
|
|
|
e_config->modules = eina_list_remove_list
|
2012-06-28 06:12:13 -07:00
|
|
|
(e_config->modules, l);
|
2011-08-15 02:21:12 -07:00
|
|
|
if (em->name) eina_stringshare_del(em->name);
|
|
|
|
free(em);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-09-03 14:57:16 -07:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
e_config_save_queue();
|
2013-01-02 05:16:08 -08:00
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
connman_timeout = NULL;
|
2011-08-15 02:21:12 -07:00
|
|
|
_recommend_connman(pg);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2013-01-04 19:55:16 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_page_next_call(void *data EINA_UNUSED)
|
|
|
|
{
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_next();
|
2013-01-04 19:55:16 -08:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2012-09-03 14:57:16 -07:00
|
|
|
static void
|
2013-04-23 08:08:29 -07:00
|
|
|
_check_connman_owner(void *data, const Eldbus_Message *msg,
|
2015-03-18 15:09:09 -07:00
|
|
|
Eldbus_Pending *pending EINA_UNUSED)
|
2012-09-03 14:57:16 -07:00
|
|
|
{
|
2013-01-02 05:16:03 -08:00
|
|
|
const char *id;
|
2012-09-03 14:57:16 -07:00
|
|
|
pending_connman = NULL;
|
|
|
|
|
|
|
|
if (connman_timeout)
|
|
|
|
{
|
|
|
|
ecore_timer_del(connman_timeout);
|
|
|
|
connman_timeout = NULL;
|
|
|
|
}
|
|
|
|
|
2013-04-23 08:08:29 -07:00
|
|
|
if (eldbus_message_error_get(msg, NULL, NULL))
|
2013-01-02 05:16:03 -08:00
|
|
|
goto fail;
|
|
|
|
|
2013-04-23 08:08:29 -07:00
|
|
|
if (!eldbus_message_arguments_get(msg, "s", &id))
|
2013-01-02 05:16:03 -08:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (id[0] != ':')
|
|
|
|
goto fail;
|
2012-09-03 14:57:16 -07:00
|
|
|
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_button_next_enable_set(1);
|
2013-01-04 19:55:16 -08:00
|
|
|
ecore_idler_add(_page_next_call, NULL);
|
2014-01-22 00:50:19 -08:00
|
|
|
return;
|
|
|
|
|
2013-01-02 05:16:03 -08:00
|
|
|
fail:
|
|
|
|
_connman_fail(data);
|
2012-09-03 14:57:16 -07:00
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
/*
|
2013-01-02 05:16:03 -08:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_init(E_Wizard_Page *pg EINA_UNUSED, Eina_Bool *need_xdg_desktops EINA_UNUSED, Eina_Bool *need_xdg_icons EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_shutdown(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
*/
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2011-08-15 02:21:12 -07:00
|
|
|
wizard_page_show(E_Wizard_Page *pg)
|
|
|
|
{
|
2013-01-04 19:55:16 -08:00
|
|
|
Eina_Bool have_connman = EINA_FALSE;
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2016-03-11 10:59:14 -08:00
|
|
|
#if defined(USE_MODULE_CONNMAN) || defined(USE_MODULE_WIRELESS)
|
2013-04-23 08:08:29 -07:00
|
|
|
conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
|
2013-01-02 05:16:03 -08:00
|
|
|
#endif
|
|
|
|
if (conn)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
2012-09-03 14:57:16 -07:00
|
|
|
if (pending_connman)
|
2013-04-23 08:08:29 -07:00
|
|
|
eldbus_pending_cancel(pending_connman);
|
2012-09-03 14:57:16 -07:00
|
|
|
|
2013-04-23 08:08:29 -07:00
|
|
|
pending_connman = eldbus_name_owner_get(conn, "net.connman",
|
2013-01-02 05:16:03 -08:00
|
|
|
_check_connman_owner, pg);
|
2013-01-04 19:55:16 -08:00
|
|
|
if (connman_timeout)
|
|
|
|
ecore_timer_del(connman_timeout);
|
2017-02-03 13:52:28 -08:00
|
|
|
connman_timeout = ecore_timer_loop_add(0.5, _connman_fail, pg);
|
2013-01-04 19:55:16 -08:00
|
|
|
have_connman = EINA_TRUE;
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_button_next_enable_set(0);
|
2011-08-15 02:21:12 -07:00
|
|
|
}
|
2011-10-16 08:24:47 -07:00
|
|
|
if (!have_connman)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
E_Config_Module *em;
|
|
|
|
Eina_List *l;
|
|
|
|
EINA_LIST_FOREACH(e_config->modules, l, em)
|
|
|
|
{
|
|
|
|
if (!em->name) continue;
|
|
|
|
if (!strcmp(em->name, "connman"))
|
|
|
|
{
|
|
|
|
e_config->modules = eina_list_remove_list
|
2012-06-28 06:12:13 -07:00
|
|
|
(e_config->modules, l);
|
2011-08-15 02:21:12 -07:00
|
|
|
if (em->name) eina_stringshare_del(em->name);
|
|
|
|
free(em);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
e_config_save_queue();
|
|
|
|
_recommend_connman(pg);
|
|
|
|
}
|
2018-05-27 06:51:15 -07:00
|
|
|
api->wizard_title_set(_("Checking to see if Connman exists"));
|
2011-08-15 02:21:12 -07:00
|
|
|
return 1; /* 1 == show ui, and wait for user, 0 == just continue */
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_hide(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
2012-09-03 14:57:16 -07:00
|
|
|
if (pending_connman)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
2013-04-23 08:08:29 -07:00
|
|
|
eldbus_pending_cancel(pending_connman);
|
2012-09-03 14:57:16 -07:00
|
|
|
pending_connman = NULL;
|
2011-08-15 02:21:12 -07:00
|
|
|
}
|
|
|
|
if (connman_timeout)
|
|
|
|
{
|
|
|
|
ecore_timer_del(connman_timeout);
|
|
|
|
connman_timeout = NULL;
|
|
|
|
}
|
2013-01-02 05:16:08 -08:00
|
|
|
if (conn)
|
2013-04-23 08:08:29 -07:00
|
|
|
eldbus_connection_unref(conn);
|
2013-01-04 19:55:16 -08:00
|
|
|
conn = NULL;
|
2013-01-02 05:16:08 -08:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
/*
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_apply(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
*/
|