diff --git a/TODO b/TODO index 432da28e..8654f391 100644 --- a/TODO +++ b/TODO @@ -37,7 +37,7 @@ make it a first-class terminal: [ ] improve selection text extraction logic [X] font selector should include font previews in the list - preferably ONLY be a list of previews -[ ] options widgets should be deleted once they are hidden. they stay +[X] options widgets should be deleted once they are hidden. they stay in memory at the moment [ ] clicking with ANY mouse button while options is up outside of options should dismiss it. diff --git a/src/bin/options.c b/src/bin/options.c index 02cd5fe5..140e93aa 100644 --- a/src/bin/options.c +++ b/src/bin/options.c @@ -8,6 +8,7 @@ static Evas_Object *op_frame, *op_box = NULL, *op_toolbar = NULL, *op_opbox = NULL, *op_tbox = NULL, *op_temp = NULL; static Eina_Bool op_out = EINA_FALSE; +static Ecore_Timer *op_del_timer = NULL; static void _cb_op_font(void *data, Evas_Object *obj, void *event) @@ -50,6 +51,17 @@ _cb_op_tmp_chg(void *data, Evas_Object *obj, void *event) config_tmp = elm_check_state_get(obj); } +static Eina_Bool +_cb_op_del_delay(void *data) +{ + evas_object_del(op_frame); + options_font_clear(); + op_frame = NULL; + op_del_timer = NULL; + elm_cache_all_flush(); + return EINA_FALSE; +} + void options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term) { @@ -126,11 +138,18 @@ options_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term) { edje_object_signal_emit(bg, "options,show", "terminology"); op_out = EINA_TRUE; + if (op_del_timer) + { + ecore_timer_del(op_del_timer); + op_del_timer = NULL; + } } else { edje_object_signal_emit(bg, "options,hide", "terminology"); op_out = EINA_FALSE; elm_object_focus_set(term, EINA_TRUE); + if (op_del_timer) ecore_timer_del(op_del_timer); + op_del_timer = ecore_timer_add(10.0, _cb_op_del_delay, NULL); } } diff --git a/src/bin/options_font.c b/src/bin/options_font.c index 734f3c33..9d72bb0f 100644 --- a/src/bin/options_font.c +++ b/src/bin/options_font.c @@ -162,14 +162,9 @@ _cb_op_font_group_text_get(void *data, Evas_Object *obj, const char *part) } void -options_font(Evas_Object *opbox, Evas_Object *term) +options_font_clear(void) { - Evas_Object *o, *bx; - char buf[4096], *file, *fname, *s; - Eina_List *files, *fontlist, *l; Font *f; - Elm_Object_Item *it, *sel_it = NULL, *grp_it = NULL; - Elm_Genlist_Item_Class *it_class, *it_group; EINA_LIST_FREE(fonts, f) { @@ -181,7 +176,20 @@ options_font(Evas_Object *opbox, Evas_Object *term) eina_hash_free(fonthash); fonthash = NULL; } +} +void +options_font(Evas_Object *opbox, Evas_Object *term) +{ + Evas_Object *o, *bx; + char buf[4096], *file, *fname, *s; + Eina_List *files, *fontlist, *l; + Font *f; + Elm_Object_Item *it, *sel_it = NULL, *grp_it = NULL; + Elm_Genlist_Item_Class *it_class, *it_group; + + options_font_clear(); + bx = o = elm_box_add(opbox); elm_box_horizontal_set(o, EINA_TRUE); diff --git a/src/bin/options_font.h b/src/bin/options_font.h index bd880146..2798f543 100644 --- a/src/bin/options_font.h +++ b/src/bin/options_font.h @@ -1 +1,2 @@ +void options_font_clear(void); void options_font(Evas_Object *opbox, Evas_Object *term);