diff --git a/src/bin/about.c b/src/bin/about.c index 4e864bdd..fa544179 100644 --- a/src/bin/about.c +++ b/src/bin/about.c @@ -1,24 +1,28 @@ #include "private.h" #include +#include #include "about.h" #include "config.h" #include "termio.h" -static Evas_Object *ab_layout = NULL, *ab_over = NULL; -static Eina_Bool ab_out = EINA_FALSE; -static Ecore_Timer *ab_del_timer = NULL; -static Evas_Object *saved_win = NULL; -static Evas_Object *saved_bg = NULL; -static void (*ab_donecb) (void *data) = NULL; -static void *ab_donedata = NULL; + +struct about_ctx { + Evas_Object *layout; + Evas_Object *over; + Evas_Object *win; + Evas_Object *bg; + Evas_Object *term; + void (*donecb) (void *data); + void *donedata; +}; + static Eina_Bool -_cb_ab_del_delay(void *_data EINA_UNUSED) +_cb_del_delay(void *data) { - evas_object_del(ab_layout); - ab_layout = NULL; - ab_del_timer = NULL; + Evas_Object *layout = data; + evas_object_del(layout); elm_cache_all_flush(); return EINA_FALSE; } @@ -29,170 +33,166 @@ _cb_mouse_down(void *data, Evas_Object *_obj EINA_UNUSED, void *_ev EINA_UNUSED) { - about_toggle(saved_win, saved_bg, data, ab_donecb, ab_donedata); + struct about_ctx *ctx = data; + + if (ctx->over) + { + evas_object_del(ctx->over); + } + elm_object_focus_set(ctx->layout, EINA_FALSE); + edje_object_signal_emit(ctx->bg, "about,hide", "terminology"); + + ecore_timer_add(10.0, _cb_del_delay, ctx->layout); + ctx->layout = NULL; + + if (ctx->donecb) + ctx->donecb(ctx->donedata); + + free(ctx); } void -about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term, +about_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term, void (*donecb) (void *data), void *donedata) { Evas_Object *o; + struct about_ctx *ctx; + Config *config = termio_config_get(term); + char buf[PATH_MAX]; + const char *txt; - saved_win = win; - saved_bg = bg; - if (!ab_layout) - { - Config *config = termio_config_get(term); - char buf[PATH_MAX]; - const char *txt; + ctx = malloc(sizeof(*ctx)); + assert(ctx); - ab_layout = o = elm_layout_add(win); - if (elm_layout_file_set(o, config_theme_path_get(config), - "terminology/about") == 0) - { - snprintf(buf, sizeof(buf), "%s/themes/default.edj", - elm_app_data_dir_get()); - elm_layout_file_set(o, buf, "terminology/about"); - } + ctx->win = win; + ctx->bg = bg; + ctx->term = term; + ctx->donecb = donecb; + ctx->donedata = donedata; - txt = eina_stringshare_printf(_( - "Terminology %s
" - "Why should terminals be boring?
" - "
" - "This terminal was written for Enlightenment, to use EFL " - "and otherwise push the boundaries of what a modern terminal " - "emulator should be. We hope you enjoy it.
" - "
" - "Copyright © 2012-%d by:
" - "
" - "%s" // AUTHORS - "
" - "
" - "Distributed under the 2-clause BSD license detailed below:
" - "
" - "%s" // LICENSE - ), - PACKAGE_VERSION, 2017, - "Boris Faure
" - "Carsten Haitzler
" - "Gustavo Sverzut Barbieri
" - "Cedric BAIL
" - "Sebastian Dransfeld
" - "Wonguk Jeong
" - "Christopher Michael
" - "Daniel Juyung Seo
" - "Panagiotis Galatsanos
" - "Mike Blumenkrantz
" - "Aleksandar Popadić
" - "Massimo Maiurana
" - "Stefan Schmidt
" - "Davide Andreoli
" - "Gustavo Lima Chaves
" - "Jean-Philippe ANDRÉ
" - "Tom Hacohen
" - "Alex-P. Natsios
" - "Lee Gwang-O
" - "Jean Guyomarc'h
" - "Jihoon Kim
" - "Kai Huuhko
" - "Mike McCormack
" - "Iván Briano
" - "Jerome Pinot
" - "José Roberto de Souza
" - "Leandro Pereira
" - "Leif Middelschulte
" - "Markus Törnqvist
" - "Thibaut Broggi
" - "Lucas De Marchi
" - "Marcel Hollerbach
" - "Anisse Astier
" - "Daniel Zaoui
" - "Doug Newgard
" - "Flavio Vinicius Alvares Ceolin
" - "Samuel F. Baggen
" - "Amitesh Singh
" - "Anthony F McInerney
" - "Aurélien Larcher
" - "Bruno Dilly
" - "Conrad Meyer
" - "Daniel Kolesa
" - "Eduardo Lima
" - "Flavio Ceolin
" - "Jason L. Cook
" - "Jérémy Anger
" - "Michael BOUCHAUD
" - "Michael Jennings
" - "Nicholas Hughart
" - "Rafael Antognolli
" - "Rui Seabra
" - "Sanjeev BA
" - "Theodor van Nahl
" - "Vincent Torri
" - "tantSinnister
", - "All rights reserved.
" - "
" - "Redistribution and use in source and binary forms, with or " - "without modification, are permitted provided that the " - "following conditions are met:
" - "
" - "1. Redistributions of source code must retain the above " - "copyright notice, this list of conditions and the following " - "disclaimer.
" - "2. Redistributions in binary form must reproduce the above " - "copyright notice, this list of conditions and the following " - "disclaimer in the documentation and/or other materials " - "provided with the distribution.
" - "
" - "THIS SOFTWARE IS PROVIDED \"AS IS\" AND ANY EXPRESS OR " - "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED " - "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR " - "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER " - "OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, " - "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES " - "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE " - "GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS " - "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " - "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING " - "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF " - "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH " - "DAMAGE."); - elm_object_part_text_set(o, "terminology.text", txt); - eina_stringshare_del(txt); - evas_object_show(o); - edje_object_part_swallow(bg, "terminology.about", ab_layout); - } - if (!ab_out) + ctx->layout = o = elm_layout_add(win); + if (elm_layout_file_set(o, config_theme_path_get(config), + "terminology/about") == 0) { - ab_over = o = evas_object_rectangle_add(evas_object_evas_get(win)); - evas_object_color_set(o, 0, 0, 0, 0); - edje_object_part_swallow(bg, "terminology.dismiss", o); - evas_object_show(o); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, - _cb_mouse_down, term); - - edje_object_signal_emit(bg, "about,show", "terminology"); - elm_object_signal_emit(ab_layout, "begin" ,"terminology"); - ab_out = EINA_TRUE; - ab_donecb = donecb; - ab_donedata = donedata; - elm_object_focus_set(ab_layout, EINA_TRUE); - if (ab_del_timer) - { - ecore_timer_del(ab_del_timer); - ab_del_timer = NULL; - } - } - else - { - evas_object_del(ab_over); - ab_over = NULL; - - edje_object_signal_emit(bg, "about,hide", "terminology"); - ab_out = EINA_FALSE; - elm_object_focus_set(ab_layout, EINA_FALSE); - if (ab_donecb) ab_donecb(ab_donedata); -// elm_object_focus_set(term, EINA_TRUE); - if (ab_del_timer) ecore_timer_del(ab_del_timer); - ab_del_timer = ecore_timer_add(10.0, _cb_ab_del_delay, NULL); + snprintf(buf, sizeof(buf), "%s/themes/default.edj", + elm_app_data_dir_get()); + elm_layout_file_set(o, buf, "terminology/about"); } + + txt = eina_stringshare_printf(_( + "Terminology %s
" + "Why should terminals be boring?
" + "
" + "This terminal was written for Enlightenment, to use EFL " + "and otherwise push the boundaries of what a modern terminal " + "emulator should be. We hope you enjoy it.
" + "
" + "Copyright © 2012-%d by:
" + "
" + "%s" // AUTHORS + "
" + "
" + "Distributed under the 2-clause BSD license detailed below:
" + "
" + "%s" // LICENSE + ), + PACKAGE_VERSION, 2017, + "Boris Faure
" + "Carsten Haitzler
" + "Gustavo Sverzut Barbieri
" + "Cedric BAIL
" + "Sebastian Dransfeld
" + "Wonguk Jeong
" + "Christopher Michael
" + "Daniel Juyung Seo
" + "Panagiotis Galatsanos
" + "Mike Blumenkrantz
" + "Aleksandar Popadić
" + "Massimo Maiurana
" + "Stefan Schmidt
" + "Davide Andreoli
" + "Gustavo Lima Chaves
" + "Jean-Philippe ANDRÉ
" + "Tom Hacohen
" + "Alex-P. Natsios
" + "Lee Gwang-O
" + "Jean Guyomarc'h
" + "Jihoon Kim
" + "Kai Huuhko
" + "Mike McCormack
" + "Iván Briano
" + "Jerome Pinot
" + "José Roberto de Souza
" + "Leandro Pereira
" + "Leif Middelschulte
" + "Markus Törnqvist
" + "Thibaut Broggi
" + "Lucas De Marchi
" + "Marcel Hollerbach
" + "Anisse Astier
" + "Daniel Zaoui
" + "Doug Newgard
" + "Flavio Vinicius Alvares Ceolin
" + "Samuel F. Baggen
" + "Amitesh Singh
" + "Anthony F McInerney
" + "Aurélien Larcher
" + "Bruno Dilly
" + "Conrad Meyer
" + "Daniel Kolesa
" + "Eduardo Lima
" + "Flavio Ceolin
" + "Jason L. Cook
" + "Jérémy Anger
" + "Michael BOUCHAUD
" + "Michael Jennings
" + "Nicholas Hughart
" + "Rafael Antognolli
" + "Rui Seabra
" + "Sanjeev BA
" + "Theodor van Nahl
" + "Vincent Torri
" + "tantSinnister
", + "All rights reserved.
" + "
" + "Redistribution and use in source and binary forms, with or " + "without modification, are permitted provided that the " + "following conditions are met:
" + "
" + "1. Redistributions of source code must retain the above " + "copyright notice, this list of conditions and the following " + "disclaimer.
" + "2. Redistributions in binary form must reproduce the above " + "copyright notice, this list of conditions and the following " + "disclaimer in the documentation and/or other materials " + "provided with the distribution.
" + "
" + "THIS SOFTWARE IS PROVIDED \"AS IS\" AND ANY EXPRESS OR " + "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED " + "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR " + "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER " + "OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, " + "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES " + "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE " + "GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS " + "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " + "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING " + "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF " + "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH " + "DAMAGE."); + elm_object_part_text_set(o, "terminology.text", txt); + eina_stringshare_del(txt); + evas_object_show(o); + edje_object_part_swallow(bg, "terminology.about", ctx->layout); + + ctx->over = o = evas_object_rectangle_add(evas_object_evas_get(win)); + evas_object_color_set(o, 0, 0, 0, 0); + edje_object_part_swallow(bg, "terminology.dismiss", o); + evas_object_show(o); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _cb_mouse_down, ctx); + + edje_object_signal_emit(bg, "about,show", "terminology"); + elm_object_signal_emit(ctx->layout, "begin" ,"terminology"); + elm_object_focus_set(ctx->layout, EINA_TRUE); } diff --git a/src/bin/about.h b/src/bin/about.h index 54e03acd..71138e15 100644 --- a/src/bin/about.h +++ b/src/bin/about.h @@ -1,7 +1,7 @@ #ifndef _ABOUT_H__ #define _ABOUT_H__ 1 -void about_toggle(Evas_Object *win, Evas_Object *bg, Evas_Object *term, +void about_show(Evas_Object *win, Evas_Object *bg, Evas_Object *term, void (*donecb) (void *data), void *donedata); #endif diff --git a/src/bin/controls.c b/src/bin/controls.c index d16e29e0..15335a53 100644 --- a/src/bin/controls.c +++ b/src/bin/controls.c @@ -49,7 +49,7 @@ _cb_sel_off(void *data, } static Eina_Bool -_cb_ct_del_delay(void *data) +_cb_del_delay(void *data) { Evas_Object *frame = data; evas_object_del(frame); @@ -159,7 +159,7 @@ _cb_ct_about(void *data, { struct controls_ctx *ctx = data; - about_toggle(ctx->win, ctx->bg, ctx->term, ctx->donecb, ctx->donedata); + about_show(ctx->win, ctx->bg, ctx->term, ctx->donecb, ctx->donedata); controls_hide(ctx, EINA_FALSE); } @@ -259,7 +259,7 @@ controls_hide(struct controls_ctx *ctx, Eina_Bool call_cb) } elm_object_focus_set(ctx->frame, EINA_FALSE); - ecore_timer_add(10.0, _cb_ct_del_delay, ctx->frame); + ecore_timer_add(10.0, _cb_del_delay, ctx->frame); ctx->frame = NULL; if (call_cb && ctx->donecb)