From 41144d619c123833b86789ed3888893dd3aa79ba Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Fri, 10 Jun 2016 14:39:28 +0300 Subject: [PATCH] (widget_set_state): return cb_ret_t instead of gboolean. Signed-off-by: Andrew Borodin --- lib/widget/widget-common.c | 15 +++++++-------- lib/widget/widget-common.h | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/widget/widget-common.c b/lib/widget/widget-common.c index 040c18393..3382e962a 100644 --- a/lib/widget/widget-common.c +++ b/lib/widget/widget-common.c @@ -213,12 +213,12 @@ widget_set_options (Widget * w, widget_options_t options, gboolean enable) * @param state widget state flag to modify * @param enable specifies whether to turn the flag on (TRUE) or off (FALSE). * Only one flag per call can be modified. - * @return TRUE if set was handled successfully, FALSE otherwise + * @return MSG_HANDLED if set was handled successfully, MSG_NOT_HANDLED otherwise. */ -gboolean +cb_ret_t widget_set_state (Widget * w, widget_state_t state, gboolean enable) { - gboolean ret = TRUE; + gboolean ret = MSG_HANDLED; if (enable) w->state |= state; @@ -239,15 +239,14 @@ widget_set_state (Widget * w, widget_state_t state, gboolean enable) } if (w->owner == NULL) - return FALSE; + return MSG_NOT_HANDLED; switch (state) { case WST_DISABLED: - if (send_message (w, NULL, enable ? MSG_DISABLE : MSG_ENABLE, 0, NULL) != MSG_HANDLED) - ret = FALSE; - if (ret) - send_message (w, NULL, MSG_DRAW, 0, NULL); + ret = send_message (w, NULL, enable ? MSG_DISABLE : MSG_ENABLE, 0, NULL); + if (ret == MSG_HANDLED) + ret = send_message (w, NULL, MSG_DRAW, 0, NULL); break; default: diff --git a/lib/widget/widget-common.h b/lib/widget/widget-common.h index f5fe24484..c98fb7273 100644 --- a/lib/widget/widget-common.h +++ b/lib/widget/widget-common.h @@ -177,7 +177,7 @@ void widget_init (Widget * w, int y, int x, int lines, int cols, cb_ret_t widget_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data); void widget_set_options (Widget * w, widget_options_t options, gboolean enable); -gboolean widget_set_state (Widget * w, widget_state_t state, gboolean enable); +cb_ret_t widget_set_state (Widget * w, widget_state_t state, gboolean enable); void widget_set_size (Widget * widget, int y, int x, int lines, int cols); /* select color for widget in dependance of state */ void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey); -- 2.11.4.GIT