billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=458f9a6da6381ffb388c6a4d7a8eee8197afe064

commit 458f9a6da6381ffb388c6a4d7a8eee8197afe064
Author: Boris Faure <[email protected]>
Date:   Sat Oct 17 23:49:33 2020 +0200

    theme: add theme_path_default_get()
---
 src/bin/options_themepv.c |  8 ++++----
 src/bin/theme.c           | 25 ++++---------------------
 src/bin/theme.h           |  2 +-
 3 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/src/bin/options_themepv.c b/src/bin/options_themepv.c
index bb6c0c0..661a70c 100644
--- a/src/bin/options_themepv.c
+++ b/src/bin/options_themepv.c
@@ -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);
diff --git a/src/bin/theme.c b/src/bin/theme.c
index c401226..069c48f 100644
--- a/src/bin/theme.c
+++ b/src/bin/theme.c
@@ -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)
 {
diff --git a/src/bin/theme.h b/src/bin/theme.h
index 89d1bd4..c0976b8 100644
--- a/src/bin/theme.h
+++ b/src/bin/theme.h
@@ -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);
 

-- 


Reply via email to