diff --git a/src/bin/options_themepv.c b/src/bin/options_themepv.c index a40cd3e6..8fbbdf8c 100644 --- a/src/bin/options_themepv.c +++ b/src/bin/options_themepv.c @@ -108,7 +108,7 @@ options_theme_preview_add(Evas_Object *parent, Config *config, const char *file, oe = elm_layout_edje_get(o); obg = oe; if (!edje_object_file_set(oe, file, "terminology/background")) - theme_apply(oe, config, "terminology/background"); + theme_apply_default(oe, config, "terminology/background"); if (config->translucent) edje_object_signal_emit(oe, "translucent,on", "terminology"); else @@ -127,7 +127,7 @@ options_theme_preview_add(Evas_Object *parent, Config *config, const char *file, o = elm_layout_add(parent); oe = elm_layout_edje_get(o); if (!edje_object_file_set(oe, file, "terminology/core")) - theme_apply(oe, config, "terminology/core"); + theme_apply_default(oe, config, "terminology/core"); if (config->translucent) edje_object_signal_emit(oe, "translucent,on", "terminology"); else @@ -203,7 +203,7 @@ options_theme_preview_add(Evas_Object *parent, Config *config, const char *file, o = elm_layout_add(parent); oe = elm_layout_edje_get(o); if (!edje_object_file_set(oe, file, "terminology/cursor")) - theme_apply(oe, config, "terminology/cursor"); + theme_apply_default(oe, config, "terminology/cursor"); edje_object_signal_emit(oe, "focus,in", "terminology"); evas_object_show(o); evas_object_data_set(oo, "cursor", o); @@ -213,7 +213,7 @@ options_theme_preview_add(Evas_Object *parent, Config *config, const char *file, o = edje_object_add(evas); oe = o; if (!edje_object_file_set(oe, file, "terminology/selection")) - theme_apply(oe, config, "terminology/selection"); + theme_apply_default(oe, config, "terminology/selection"); edje_object_signal_emit(oe, "focus,in", "terminology"); edje_object_signal_emit(oe, "mode,oneline", "terminology"); evas_object_show(o); diff --git a/src/bin/utils.c b/src/bin/utils.c index 648f017f..c7dd1e0b 100644 --- a/src/bin/utils.c +++ b/src/bin/utils.c @@ -51,6 +51,23 @@ theme_apply(Evas_Object *edje, const Config *config, const char *group) return EINA_FALSE; } +Eina_Bool +theme_apply_default(Evas_Object *edje, const Config *config, const char *group) +{ + const char *errmsg; + + EINA_SAFETY_ON_NULL_RETURN_VAL(edje, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(config, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(group, EINA_FALSE); + + if (edje_object_file_set(edje, config_theme_path_default_get(config), group)) + return EINA_TRUE; + + errmsg = edje_load_error_str(edje_object_load_error_get(edje)); + ERR(_("Could not load any theme for group=%s: %s"), group, errmsg); + return EINA_FALSE; +} + void theme_reload(Evas_Object *edje) { diff --git a/src/bin/utils.h b/src/bin/utils.h index cbdcdd5e..688dd37e 100644 --- a/src/bin/utils.h +++ b/src/bin/utils.h @@ -5,6 +5,7 @@ #include "config.h" Eina_Bool theme_apply(Evas_Object *edje, const Config *config, const char *group); +Eina_Bool theme_apply_default(Evas_Object *edje, const Config *config, const char *group); void theme_reload(Evas_Object *edje); void theme_auto_reload_enable(Evas_Object *edje); const char *theme_path_get(const char *name);