summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-23 00:20:58 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-23 00:20:58 +0100
commit48a83c733caa374c4be45d331b04d04f759da6cc (patch)
tree27f2ae9313f7730242bfbd6938ba5fac153bcb15 /src/modules
parented924301b3cb19378d0b7ce8bab62e464a12798a (diff)
bluez5 - track rfkill sysaction exe to tell user if something went wrong
IF we don't do this, the error will be "silent" and the user never know. The user should know if things are configured incorrectly.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/bluez5/e_mod_main.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/modules/bluez5/e_mod_main.c b/src/modules/bluez5/e_mod_main.c
index ad576bf..a581c46 100644
--- a/src/modules/bluez5/e_mod_main.c
+++ b/src/modules/bluez5/e_mod_main.c
@@ -9,6 +9,9 @@ static E_Config_DD *conf_device_edd = NULL;
9static E_Config_DD *conf_edd = NULL; 9static E_Config_DD *conf_edd = NULL;
10Config *ebluez5_config = NULL; 10Config *ebluez5_config = NULL;
11 11
12static Ecore_Event_Handler *_exe_exit_handler = NULL;
13static Ecore_Exe *_rfkill_exe = NULL;
14
12E_API E_Module_Api e_modapi = {E_MODULE_API_VERSION, "Bluez5"}; 15E_API E_Module_Api e_modapi = {E_MODULE_API_VERSION, "Bluez5"};
13 16
14static void 17static void
@@ -285,6 +288,29 @@ ebluez5_popups_show(void)
285 } 288 }
286} 289}
287 290
291static Eina_Bool
292_exe_cb_exit(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
293{
294 Ecore_Exe_Event_Del *ev = event;
295
296 if (!ev->exe) return ECORE_CALLBACK_PASS_ON;
297 if (ev->exe == _rfkill_exe)
298 {
299 if ((ev->exited) && (ev->exit_code != EXIT_SUCCESS))
300 {
301 e_util_dialog_show
302 (_("Bluetooth rfkill run Error"),
303 _("Trying to rfkill unblock the bluetooth adapter failed.<br>"
304 "Do you have rfkill installed? Check sysactions.conf<br>"
305 "to ensure the command is right and your user is<br>"
306 "permitted to use the rfkill unblock action. Check the<br>"
307 "users and groups there to be sure."));
308 }
309 _rfkill_exe = NULL;
310 }
311 return ECORE_CALLBACK_PASS_ON;
312}
313
288void 314void
289ebluez5_rfkill_unblock(const char *name) 315ebluez5_rfkill_unblock(const char *name)
290{ 316{
@@ -297,7 +323,7 @@ ebluez5_rfkill_unblock(const char *name)
297 eina_strbuf_append_printf 323 eina_strbuf_append_printf
298 (buf, "%s/enlightenment/utils/enlightenment_sys rfkill-unblock %s", 324 (buf, "%s/enlightenment/utils/enlightenment_sys rfkill-unblock %s",
299 e_prefix_lib_get(), name); 325 e_prefix_lib_get(), name);
300 ecore_exe_run(eina_strbuf_string_get(buf), NULL); 326 _rfkill_exe = ecore_exe_run(eina_strbuf_string_get(buf), NULL);
301 eina_strbuf_free(buf); 327 eina_strbuf_free(buf);
302 } 328 }
303} 329}
@@ -449,6 +475,9 @@ e_modapi_init(E_Module *m)
449 E_CONFIG_LIST(D, T, adapters, conf_adapter_edd); 475 E_CONFIG_LIST(D, T, adapters, conf_adapter_edd);
450 E_CONFIG_LIST(D, T, devices, conf_device_edd); 476 E_CONFIG_LIST(D, T, devices, conf_device_edd);
451 477
478 _exe_exit_handler =
479 ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _exe_cb_exit, NULL);
480
452 ebluez5_config = e_config_domain_load("module.ebluez5", conf_edd); 481 ebluez5_config = e_config_domain_load("module.ebluez5", conf_edd);
453 if (!ebluez5_config) ebluez5_config = E_NEW(Config, 1); 482 if (!ebluez5_config) ebluez5_config = E_NEW(Config, 1);
454 483
@@ -467,9 +496,6 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
467 Config_Adapter *ad; 496 Config_Adapter *ad;
468 Config_Device *dev; 497 Config_Device *dev;
469 498
470 E_CONFIG_DD_FREE(conf_edd);
471 E_CONFIG_DD_FREE(conf_adapter_edd);
472
473 EINA_LIST_FREE(ebluez5_config->adapters, ad) 499 EINA_LIST_FREE(ebluez5_config->adapters, ad)
474 { 500 {
475 eina_stringshare_del(ad->addr); 501 eina_stringshare_del(ad->addr);
@@ -488,6 +514,14 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
488 514
489 e_gadget_type_del("Bluetooth"); 515 e_gadget_type_del("Bluetooth");
490 e_gadcon_provider_unregister(&_gc_class); 516 e_gadcon_provider_unregister(&_gc_class);
517
518 if (_exe_exit_handler)
519 {
520 ecore_event_handler_del(_exe_exit_handler);
521 _exe_exit_handler = NULL;
522 }
523 E_CONFIG_DD_FREE(conf_edd);
524 E_CONFIG_DD_FREE(conf_adapter_edd);
491 return 1; 525 return 1;
492} 526}
493 527