summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Ceolin <flavio.ceolin@gmail.com>2014-09-16 11:51:28 -0300
committerFlavio Ceolin <flavio.ceolin@gmail.com>2014-09-16 23:53:02 -0300
commitb3ee061a1f1c9478661c4eaba2882fd50eec6a69 (patch)
tree4e7283e488eeae7212ce324be222423521d1f4af
parent1e61ab2a9689a70ddfc6220ebe821c8604974703 (diff)
module: Fallback to other backend in case of fail
-rw-r--r--src/module/e_mod_config.c7
-rw-r--r--src/module/e_mod_config.h1
-rw-r--r--src/module/e_mod_main.c22
3 files changed, 29 insertions, 1 deletions
diff --git a/src/module/e_mod_config.c b/src/module/e_mod_config.c
index 7e54961..6dd33ac 100644
--- a/src/module/e_mod_config.c
+++ b/src/module/e_mod_config.c
@@ -38,6 +38,13 @@ emix_config_backend_get(void)
38 return _config->backend; 38 return _config->backend;
39} 39}
40 40
41void
42emix_config_backend_set(const char *backend)
43{
44 eina_stringshare_replace(&_config->backend, backend);
45 e_config_domain_save("module.emix", cd, _config);
46}
47
41Eina_Bool 48Eina_Bool
42emix_config_notify_get(void) 49emix_config_notify_get(void)
43{ 50{
diff --git a/src/module/e_mod_config.h b/src/module/e_mod_config.h
index 9962ea8..4058618 100644
--- a/src/module/e_mod_config.h
+++ b/src/module/e_mod_config.h
@@ -8,6 +8,7 @@ typedef void (*emix_config_backend_changed)(const char *backend, void *data);
8void emix_config_init(emix_config_backend_changed cb, const void *userdata); 8void emix_config_init(emix_config_backend_changed cb, const void *userdata);
9void emix_config_shutdown(void); 9void emix_config_shutdown(void);
10const char *emix_config_backend_get(void); 10const char *emix_config_backend_get(void);
11void emix_config_backend_set(const char *backend);
11Eina_Bool emix_config_notify_get(void); 12Eina_Bool emix_config_notify_get(void);
12E_Config_Dialog* emix_config_popup_new(E_Comp *comp, const char*p); 13E_Config_Dialog* emix_config_popup_new(E_Comp *comp, const char*p);
13 14
diff --git a/src/module/e_mod_main.c b/src/module/e_mod_main.c
index 8ff5238..a74c13c 100644
--- a/src/module/e_mod_main.c
+++ b/src/module/e_mod_main.c
@@ -745,8 +745,10 @@ _volume_meter_cb(Emix_Sink *sink, double value, void *data EINA_UNUSED)
745EAPI void * 745EAPI void *
746e_modapi_init(E_Module *m) 746e_modapi_init(E_Module *m)
747{ 747{
748 Eina_List *l;
748 char buf[4096]; 749 char buf[4096];
749 const char *backend; 750 const char *backend;
751 Eina_Bool backend_loaded = EINA_FALSE;
750 752
751 _e_emix_log_domain = eina_log_domain_register("emix_module", EINA_COLOR_RED); 753 _e_emix_log_domain = eina_log_domain_register("emix_module", EINA_COLOR_RED);
752 754
@@ -758,7 +760,25 @@ e_modapi_init(E_Module *m)
758 goto err; 760 goto err;
759 761
760 if (emix_backend_set(backend) == EINA_FALSE) 762 if (emix_backend_set(backend) == EINA_FALSE)
761 goto err; 763 {
764 WRN("Could not load %s, trying another one ...", backend);
765 EINA_LIST_FOREACH((Eina_List *)emix_backends_available(), l,
766 backend)
767 {
768 if (emix_backend_set(backend) == EINA_TRUE)
769 {
770 DBG("Loaded backend: %s!", backend);
771 backend_loaded = EINA_TRUE;
772 emix_config_backend_set(backend);
773 break;
774 }
775 }
776 }
777 else
778 backend_loaded = EINA_TRUE;
779
780 if (backend_loaded == EINA_FALSE)
781 goto err;
762 782
763 emix_volume_meter_callback_set(_volume_meter_cb, NULL); 783 emix_volume_meter_callback_set(_volume_meter_cb, NULL);
764 784