summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-02-21 16:14:20 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-02-21 16:18:15 +0900
commitaac07ca6c1840cf6ad347134147582427af79e2e (patch)
tree42d4c8d24aa156a5e490807dc2585f3d9e4959db /src/lib/elementary
parent3cb6d55ef0b1526062b1a444b260104b4fce069d (diff)
elm: Make clock widget more resilient to invalid config
I was in a situation where my elm_config had the proper version but did not contain a proper module name for the clock widget. This resulted in not being able to create any field object in the clock widget... in other words it made for a very useless clock :) Ideally the config should be updated at this point. I'm not sure how to proceed exactly, though :(
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_clock.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/elementary/efl_ui_clock.c b/src/lib/elementary/efl_ui_clock.c
index 7a61acdf14..fbdec4b7cc 100644
--- a/src/lib/elementary/efl_ui_clock.c
+++ b/src/lib/elementary/efl_ui_clock.c
@@ -81,9 +81,23 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
81static Clock_Mod_Api * 81static Clock_Mod_Api *
82_dt_mod_init() 82_dt_mod_init()
83{ 83{
84 static int tried_fallback = 0;
84 Elm_Module *mod = NULL; 85 Elm_Module *mod = NULL;
85 86
86 if (!(mod = _elm_module_find_as("clock/api"))) return NULL; 87 if (!(mod = _elm_module_find_as("clock/api")))
88 {
89 if (!tried_fallback &&
90 (!_elm_config->modules || !strstr(_elm_config->modules, "clock/api")))
91 {
92 // See also _config_update(): we hardcode here the default module
93 ERR("Elementary config does not contain the required module "
94 "name for the clock widget! Verify your installation.");
95 _elm_module_add("clock_input_ctxpopup", "clock/api");
96 mod = _elm_module_find_as("clock/api");
97 tried_fallback = EINA_TRUE;
98 }
99 if (!mod) return NULL;
100 }
87 101
88 mod->api = malloc(sizeof(Clock_Mod_Api)); 102 mod->api = malloc(sizeof(Clock_Mod_Api));
89 if (!mod->api) return NULL; 103 if (!mod->api) return NULL;
@@ -896,6 +910,7 @@ _efl_ui_clock_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Clock_Data *priv)
896 } 910 }
897 } 911 }
898 } 912 }
913 else WRN("Failed to load clock module, clock widget may not show properly!");
899 914
900 priv->freeze_sizing = EINA_TRUE; 915 priv->freeze_sizing = EINA_TRUE;
901 if (!elm_layout_theme_set(obj, "uiclock", "base", 916 if (!elm_layout_theme_set(obj, "uiclock", "base",