theme: add theme_path_default_get()

This commit is contained in:
Boris Faure 2020-10-17 23:49:33 +02:00
parent 886bce509f
commit 458f9a6da6
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
3 changed files with 9 additions and 26 deletions

View File

@ -111,7 +111,7 @@ options_theme_preview_add(Evas_Object *parent,
oe = elm_layout_edje_get(o);
obg = oe;
if (!edje_object_file_set(oe, file, "terminology/background"))
theme_apply_default(oe, config, "terminology/background");
edje_object_file_set(oe, theme_path_default_get(), "terminology/background");
if (config->translucent)
edje_object_signal_emit(oe, "translucent,on", "terminology");
else
@ -133,7 +133,7 @@ options_theme_preview_add(Evas_Object *parent,
o = elm_layout_add(parent);
oe = elm_layout_edje_get(o);
if (!edje_object_file_set(oe, file, "terminology/core"))
theme_apply_default(oe, config, "terminology/core");
edje_object_file_set(oe, theme_path_default_get(), "terminology/core");
if (config->translucent)
edje_object_signal_emit(oe, "translucent,on", "terminology");
else
@ -209,7 +209,7 @@ options_theme_preview_add(Evas_Object *parent,
o = elm_layout_add(parent);
oe = elm_layout_edje_get(o);
if (!edje_object_file_set(oe, file, "terminology/cursor"))
theme_apply_default(oe, config, "terminology/cursor");
edje_object_file_set(oe, theme_path_default_get(), "terminology/cursor");
edje_object_signal_emit(oe, "focus,in", "terminology");
evas_object_show(o);
evas_object_data_set(oo, "cursor", o);
@ -219,7 +219,7 @@ options_theme_preview_add(Evas_Object *parent,
o = edje_object_add(evas);
oe = o;
if (!edje_object_file_set(oe, file, "terminology/selection"))
theme_apply_default(oe, config, "terminology/selection");
edje_object_file_set(oe, theme_path_default_get(), "terminology/selection");
edje_object_signal_emit(oe, "focus,in", "terminology");
edje_object_signal_emit(oe, "mode,oneline", "terminology");
evas_object_show(o);

View File

@ -41,8 +41,8 @@ config_theme_path_get(const Config *config)
return theme_path_get(config->theme);
}
static const char *
_theme_path_default_get(void)
const char *
theme_path_default_get(void)
{
static char path[PATH_MAX] = "";
@ -74,7 +74,7 @@ theme_apply(Evas_Object *edje, const Config *config, const char *group)
config_theme_path_get(config), group, errmsg);
}
if (edje_object_file_set(edje, _theme_path_default_get(), group))
if (edje_object_file_set(edje, theme_path_default_get(), group))
goto done;
errmsg = edje_load_error_str(edje_object_load_error_get(edje));
@ -110,7 +110,7 @@ theme_apply_elm(Evas_Object *layout, const Config *config, const char *group)
INF(_("Could not find theme: file=%s group=%s error='%s', trying default theme"),
config_theme_path_get(config), group, errmsg);
if (elm_layout_file_set(layout, _theme_path_default_get(), group))
if (elm_layout_file_set(layout, theme_path_default_get(), group))
goto done;
errmsg = edje_load_error_str(edje_object_load_error_get(edje));
@ -122,23 +122,6 @@ done:
return EINA_TRUE;
}
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, _theme_path_default_get(), group))
return EINA_TRUE;
errmsg = edje_load_error_str(edje_object_load_error_get(edje));
ERR(_("Could not load default theme for group=%s: %s"), group, errmsg);
return EINA_FALSE;
}
void
theme_reload(Evas_Object *edje)
{

View File

@ -6,10 +6,10 @@
Eina_Bool theme_apply(Evas_Object *edje, const Config *config, const char *group);
Eina_Bool theme_apply_elm(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);
const char *theme_path_default_get(void);
Eina_Bool utils_need_scale_wizard(void);