huchi pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=8ba6a7313999fe0e32153b8ca9243a12617ac211

commit 8ba6a7313999fe0e32153b8ca9243a12617ac211
Author: Wonguk Jeong <[email protected]>
Date:   Wed Aug 13 19:34:57 2014 +0200

    options: theme preview cursor/selection bug fix
    
    Default theme is used for fallback when we apply theme.
    But, in the preview, current theme has been used for fallback.
    
    Fixes T1535
---
 src/bin/options_themepv.c |  8 ++++----
 src/bin/utils.c           | 17 +++++++++++++++++
 src/bin/utils.h           |  1 +
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/bin/options_themepv.c b/src/bin/options_themepv.c
index a40cd3e..8fbbdf8 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 648f017..c7dd1e0 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 cbdcdd5..688dd37 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);

-- 


Reply via email to