From 6cb62a79aeaaa2377b57e47a3a4c68986f58e1c9 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 3 Jul 2019 18:52:18 +0100 Subject: [PATCH] wizard - missing bluez5 service checks for enabling bluez5 module we were missing this - add it in like connman for release. --- data/config/standard/e.src | 34 ++++-- data/config/tiling/e.src | 32 +++++- src/modules/wizard/meson.build | 1 + src/modules/wizard/page_115.c | 183 +++++++++++++++++++++++++++++++++ 4 files changed, 239 insertions(+), 11 deletions(-) create mode 100644 src/modules/wizard/page_115.c diff --git a/data/config/standard/e.src b/data/config/standard/e.src index f43f1933a..598b65a47 100644 --- a/data/config/standard/e.src +++ b/data/config/standard/e.src @@ -800,8 +800,8 @@ group "E_Config" struct { value "resizable" uchar: 0; } group "E_Config_Gadcon_Client" struct { - value "name" string: "tasks"; - value "id" string: "tasks.0"; + value "name" string: "bluez5"; + value "id" string: "bluez5"; value "geom.pos" int: 352; value "geom.size" int: 32; value "geom.res" int: 800; @@ -811,13 +811,13 @@ group "E_Config" struct { value "geom.size_h" double: 0.0; value "state_info.seq" int: 12; value "state_info.flags" int: 0; - value "style" string: "inset"; - value "autoscroll" uchar: 1; + value "style" string: "plain"; + value "autoscroll" uchar: 0; value "resizable" uchar: 0; } group "E_Config_Gadcon_Client" struct { - value "name" string: "xkbswitch"; - value "id" string: "xkbswitch"; + value "name" string: "tasks"; + value "id" string: "tasks.0"; value "geom.pos" int: 384; value "geom.size" int: 32; value "geom.res" int: 800; @@ -827,6 +827,22 @@ group "E_Config" struct { value "geom.size_h" double: 0.0; value "state_info.seq" int: 13; value "state_info.flags" int: 0; + value "style" string: "inset"; + value "autoscroll" uchar: 1; + value "resizable" uchar: 0; + } + group "E_Config_Gadcon_Client" struct { + value "name" string: "xkbswitch"; + value "id" string: "xkbswitch"; + value "geom.pos" int: 416; + value "geom.size" int: 32; + value "geom.res" int: 800; + value "geom.pos_x" double: 0.0; + value "geom.pos_y" double: 0.0; + value "geom.size_w" double: 0.0; + value "geom.size_h" double: 0.0; + value "state_info.seq" int: 14; + value "state_info.flags" int: 0; value "style" string: "plain"; value "autoscroll" uchar: 0; value "resizable" uchar: 0; @@ -1096,6 +1112,12 @@ group "E_Config" struct { value "delayed" uchar: 1; value "priority" int: 0; } + group "E_Config_Module" struct { + value "name" string: "bluez5"; + value "enabled" uchar: 1; + value "delayed" uchar: 1; + value "priority" int: 0; + } } group "xkb.used_layouts" list { group "E_Config_XKB_Layout" struct { diff --git a/data/config/tiling/e.src b/data/config/tiling/e.src index eff658c80..1a9eb0d07 100644 --- a/data/config/tiling/e.src +++ b/data/config/tiling/e.src @@ -797,10 +797,26 @@ group "E_Config" struct { value "autoscroll" uchar: 0; value "resizable" uchar: 0; } + group "E_Config_Gadcon_Client" struct { + value "name" string: "bluez5"; + value "id" string: "bluez5"; + value "geom.pos" int: 352; + value "geom.size" int: 32; + value "geom.res" int: 800; + value "geom.pos_x" double: 0.0; + value "geom.pos_y" double: 0.0; + value "geom.size_w" double: 0.0; + value "geom.size_h" double: 0.0; + value "state_info.seq" int: 12; + value "state_info.flags" int: 0; + value "style" string: "plain"; + value "autoscroll" uchar: 0; + value "resizable" uchar: 0; + } group "E_Config_Gadcon_Client" struct { value "name" string: "tasks"; value "id" string: "tasks.0"; - value "geom.pos" int: 352; + value "geom.pos" int: 384; value "geom.size" int: 32; value "geom.res" int: 800; value "geom.pos_x" double: 0.0; @@ -816,7 +832,7 @@ group "E_Config" struct { group "E_Config_Gadcon_Client" struct { value "name" string: "xkbswitch"; value "id" string: "xkbswitch"; - value "geom.pos" int: 384; + value "geom.pos" int: 416; value "geom.size" int: 32; value "geom.res" int: 800; value "geom.pos_x" double: 0.0; @@ -832,14 +848,14 @@ group "E_Config" struct { group "E_Config_Gadcon_Client" struct { value "name" string: "tiling"; value "id" string: "Tiling 0"; - value "geom.pos" int: 588; + value "geom.pos" int: 768; value "geom.size" int: 40; - value "geom.res" int: 955; + value "geom.res" int: 800; value "geom.pos_x" double: 0.0000000000000000000000000; value "geom.pos_y" double: 0.0000000000000000000000000; value "geom.size_w" double: 0.0000000000000000000000000; value "geom.size_h" double: 0.0000000000000000000000000; - value "state_info.seq" int: 3; + value "state_info.seq" int: 14; value "state_info.flags" int: 3; value "orient" int: 0; value "autoscroll" uchar: 0; @@ -1111,6 +1127,12 @@ group "E_Config" struct { value "delayed" uchar: 1; value "priority" int: 0; } + group "E_Config_Module" struct { + value "name" string: "bluez5"; + value "enabled" uchar: 1; + value "delayed" uchar: 1; + value "priority" int: 0; + } group "E_Config_Module" struct { value "name" string: "tiling"; value "enabled" uchar: 1; diff --git a/src/modules/wizard/meson.build b/src/modules/wizard/meson.build index 63a8c9ff1..5028e6ead 100644 --- a/src/modules/wizard/meson.build +++ b/src/modules/wizard/meson.build @@ -22,6 +22,7 @@ if get_option(m) == true 'page_090', 'page_100', 'page_110', + 'page_115', 'page_120', 'page_130', 'page_150', diff --git a/src/modules/wizard/page_115.c b/src/modules/wizard/page_115.c new file mode 100644 index 000000000..a5d17671d --- /dev/null +++ b/src/modules/wizard/page_115.c @@ -0,0 +1,183 @@ +/* Setup if we need bluez5? */ +#include "e_wizard.h" +#include "e_wizard_api.h" + +static void +_recommend_bluez5(E_Wizard_Page *pg EINA_UNUSED) +{ + Evas_Object *of, *ob; + + api->wizard_title_set(_("Bluetooth Management")); + + of = elm_frame_add(e_comp->elm); + ob = elm_label_add(of); + elm_object_content_set(of, ob); +#if defined(USE_MODULE_BLUEZ5) + elm_object_text_set(of, _("BlueZ Bluetooth service not found")); + + + elm_object_text_set(ob, _("Install/Enable BlueZ 5 / bluetoothd service for network management support")); +#else + elm_object_text_set(of, _("Bluez5 module disabled")); + elm_object_text_set(ob, _("Install it for Bluetooth management support")); +#endif + evas_object_show(ob); + evas_object_show(of); + + api->wizard_page_show(of); +// pg->data = o; + + api->wizard_button_next_enable_set(1); +} + +static Eldbus_Connection *conn; +static Eldbus_Pending *pending_bluez5; +static Ecore_Timer *bluez5_timeout = NULL; + +static Eina_Bool +_bluez5_fail(void *data) +{ + E_Wizard_Page *pg = data; + E_Config_Module *em; + Eina_List *l; + + EINA_LIST_FOREACH(e_config->modules, l, em) + { + if (!em->name) continue; + if (!strcmp(em->name, "bluez5")) + { + e_config->modules = eina_list_remove_list + (e_config->modules, l); + if (em->name) eina_stringshare_del(em->name); + free(em); + break; + } + } + + e_config_save_queue(); + + bluez5_timeout = NULL; + _recommend_bluez5(pg); + return EINA_FALSE; +} + +static Eina_Bool +_page_next_call(void *data EINA_UNUSED) +{ + api->wizard_next(); + return ECORE_CALLBACK_CANCEL; +} + +static void +_check_bluez5_owner(void *data, const Eldbus_Message *msg, + Eldbus_Pending *pending EINA_UNUSED) +{ + const char *id; + pending_bluez5 = NULL; + + if (bluez5_timeout) + { + ecore_timer_del(bluez5_timeout); + bluez5_timeout = NULL; + } + + if (eldbus_message_error_get(msg, NULL, NULL)) + goto fail; + + if (!eldbus_message_arguments_get(msg, "s", &id)) + goto fail; + + if (id[0] != ':') + goto fail; + + api->wizard_button_next_enable_set(1); + ecore_idler_add(_page_next_call, NULL); + return; + +fail: + _bluez5_fail(data); +} +/* + +E_API int +wizard_page_init(E_Wizard_Page *pg EINA_UNUSED, Eina_Bool *need_xdg_desktops EINA_UNUSED, Eina_Bool *need_xdg_icons EINA_UNUSED) +{ + return 1; +} + +E_API int +wizard_page_shutdown(E_Wizard_Page *pg EINA_UNUSED) +{ + return 1; +} +*/ +E_API int +wizard_page_show(E_Wizard_Page *pg) +{ + Eina_Bool have_bluez5 = EINA_FALSE; + +#if defined(USE_MODULE_BLUEZ5) + conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM); +#endif + if (conn) + { + if (pending_bluez5) + eldbus_pending_cancel(pending_bluez5); + + pending_bluez5 = eldbus_name_owner_get(conn, "org.bluez", + _check_bluez5_owner, pg); + if (bluez5_timeout) + ecore_timer_del(bluez5_timeout); + bluez5_timeout = ecore_timer_loop_add(0.5, _bluez5_fail, pg); + have_bluez5 = EINA_TRUE; + api->wizard_button_next_enable_set(0); + } + if (!have_bluez5) + { + E_Config_Module *em; + Eina_List *l; + EINA_LIST_FOREACH(e_config->modules, l, em) + { + if (!em->name) continue; + if (!strcmp(em->name, "bluez5")) + { + e_config->modules = eina_list_remove_list + (e_config->modules, l); + if (em->name) eina_stringshare_del(em->name); + free(em); + break; + } + } + e_config_save_queue(); + _recommend_bluez5(pg); + } + api->wizard_title_set(_("Checking to see if BlueZ exists")); + return 1; /* 1 == show ui, and wait for user, 0 == just continue */ +} + +E_API int +wizard_page_hide(E_Wizard_Page *pg EINA_UNUSED) +{ + if (pending_bluez5) + { + eldbus_pending_cancel(pending_bluez5); + pending_bluez5 = NULL; + } + if (bluez5_timeout) + { + ecore_timer_del(bluez5_timeout); + bluez5_timeout = NULL; + } + if (conn) + eldbus_connection_unref(conn); + conn = NULL; + + return 1; +} +/* +E_API int +wizard_page_apply(E_Wizard_Page *pg EINA_UNUSED) +{ + return 1; +} +*/