From e62a297610c234e8e0c3a13575c61d97b8188e3c Mon Sep 17 00:00:00 2001 From: Al Poole Date: Tue, 2 May 2017 22:02:54 +0100 Subject: [PATCH] debugpanel: update icons if process is resumed from the "console" Reviewers: ajwillia.ms Reviewed By: ajwillia.ms Differential Revision: https://phab.enlightenment.org/D4843 --- src/bin/edi_debugpanel.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/bin/edi_debugpanel.c b/src/bin/edi_debugpanel.c index b1483d3..8288f01 100644 --- a/src/bin/edi_debugpanel.c +++ b/src/bin/edi_debugpanel.c @@ -261,29 +261,36 @@ _edi_debugpanel_bt_sigterm_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS kill(pid, SIGTERM); } +static void +_edi_debugpanel_icons_update(int state) +{ + Evas_Object *ico_int; + + ico_int = elm_icon_add(_button_int); + + if (state == DEBUG_PROCESS_ACTIVE) + elm_icon_standard_set(ico_int, "media-playback-pause"); + else + elm_icon_standard_set(ico_int, "media-playback-start"); + + elm_object_part_content_set(_button_int, "icon", ico_int); +} + static void _edi_debugpanel_bt_sigint_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { pid_t pid; int state; - Evas_Object *ico_int; pid = _edi_debug_process_id(&state); if (pid <= 0) return; - ico_int = elm_icon_add(_button_int); - if (state == DEBUG_PROCESS_ACTIVE) - { - kill(pid, SIGINT); - elm_icon_standard_set(ico_int, "media-playback-start"); - } + kill(pid, SIGINT); else - { - ecore_exe_send(_debug_exe, "c\n", 2); - elm_icon_standard_set(ico_int, "media-playback-pause"); - } - elm_object_part_content_set(_button_int, "icon", ico_int); + ecore_exe_send(_debug_exe, "c\n", 2); + + _edi_debugpanel_icons_update(state); } static void @@ -301,7 +308,8 @@ _edi_debugpanel_button_start_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UN static Eina_Bool _edi_debug_active_check_cb(void *data EINA_UNUSED) { - int pid = ecore_exe_pid_get(_debug_exe); + int state, pid = ecore_exe_pid_get(_debug_exe); + if (pid == -1) { if (_debug_exe) ecore_exe_free(_debug_exe); @@ -311,6 +319,12 @@ _edi_debug_active_check_cb(void *data EINA_UNUSED) elm_object_disabled_set(_button_int, EINA_TRUE); elm_object_disabled_set(_button_term, EINA_TRUE); } + else + { + if (_edi_debug_process_id(&state) > 0) + _edi_debugpanel_icons_update(state); + } + return ECORE_CALLBACK_RENEW; }