billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=69c8824caf1dd2db7364fd52946ccf721de5b077

commit 69c8824caf1dd2db7364fd52946ccf721de5b077
Author: wonguk.jeong <wonguk.je...@samsung.com>
Date:   Tue Jun 24 21:39:19 2014 +0200

    option_font: selected standard font bug fix
    
    Summary:
    Fallback of selected font finding logic is wrong.
    As Is: set selcted font if full name is exactly same or just font name 
without style is same
    To Be: find font which is exactly same full name. If failed to find, use 
find font with same font name
    
    Fixes T1368
    
    Test Plan: terminology -> set font in setting (as Dejavu Mono) -> open 
setting -> check whether font is Dejavu Mono or not
    
    Reviewers: billiob, raster
    
    Reviewed By: billiob
    
    CC: seoz
    
    Maniphest Tasks: T1368
    
    Differential Revision: https://phab.enlightenment.org/D1076
---
 src/bin/options_font.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/bin/options_font.c b/src/bin/options_font.c
index 98c15ff..c0797b7 100644
--- a/src/bin/options_font.c
+++ b/src/bin/options_font.c
@@ -340,7 +340,7 @@ options_font(Evas_Object *opbox, Evas_Object *term)
    char buf[4096], *file, *fname;
    Eina_List *files, *fontlist, *l;
    Font *f;
-   Elm_Object_Item *it, *sel_it = NULL, *grp_it = NULL;
+   Elm_Object_Item *it, *sel_it = NULL, *sel_it2 = NULL, *grp_it = NULL;
    Elm_Genlist_Item_Class *it_class, *it_group;
    Config *config = termio_config_get(term);
 
@@ -432,7 +432,7 @@ options_font(Evas_Object *opbox, Evas_Object *term)
         f->item = it = elm_genlist_item_append(o, it_class, f, grp_it,
                                      ELM_GENLIST_ITEM_NONE,
                                      _cb_op_font_sel, f);
-        if ((config->font.bitmap) && (config->font.name) &&
+        if ((!sel_it) && (config->font.bitmap) && (config->font.name) &&
             ((!strcmp(config->font.name, f->full_name)) ||
              (!strcmp(config->font.name, file))))
           {
@@ -474,23 +474,26 @@ options_font(Evas_Object *opbox, Evas_Object *term)
              f->item = it = elm_genlist_item_append(o, it_class, f, grp_it,
                                           ELM_GENLIST_ITEM_NONE,
                                           _cb_op_font_sel, f);
-             if ((!config->font.bitmap) && (config->font.name))
+             if ((!sel_it) && (!config->font.bitmap) && (config->font.name))
                {
                   char *s = strchr(fname, ':');
                   size_t len;
 
                   len = (s == NULL) ? strlen(fname) : (size_t)(s - fname);
-                  if (!strcmp(config->font.name, f->full_name) ||
-                      !strncmp(config->font.name, fname, len))
-                    {
-                       sel_it = it;
-                    }
+                  if (!strcmp(config->font.name, f->full_name))
+                    sel_it = it;
+                  else if ((!sel_it2) &&
+                           (!strncmp(config->font.name, fname, len)))
+                    sel_it2 = it;
                }
           }
      }
+
    if (fontlist)
      evas_font_available_list_free(evas_object_evas_get(opbox), fontlist);
 
+   if (!sel_it && sel_it2)
+      sel_it = sel_it2;
    if (sel_it)
      {
         elm_genlist_item_selected_set(sel_it, EINA_TRUE);

-- 


Reply via email to