[widgets] Check for no value in uicb_widget_tell and only update sbar on no error
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
2456f6d62a
commit
c582f4397b
19
widget.c
19
widget.c
|
@ -187,6 +187,7 @@ uicb_widget_tell(int screen, char *arg)
|
|||
Widget *widget;
|
||||
char *p, *property = NULL, *command;
|
||||
ssize_t len;
|
||||
widget_tell_status_t status;
|
||||
|
||||
if (!arg)
|
||||
{
|
||||
|
@ -228,7 +229,13 @@ uicb_widget_tell(int screen, char *arg)
|
|||
len = a_strlen(p);
|
||||
command = p_new(char, len + 1);
|
||||
a_strncpy(command, len + 1, p, len);
|
||||
switch(widget->tell(widget, property, command))
|
||||
status = widget->tell(widget, property, command);
|
||||
p_delete(&command);
|
||||
}
|
||||
else
|
||||
status = WIDGET_ERROR_NOVALUE;
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case WIDGET_ERROR:
|
||||
warn("error changing property %s of widget %s\n",
|
||||
|
@ -255,17 +262,11 @@ uicb_widget_tell(int screen, char *arg)
|
|||
property, widget->name);
|
||||
break;
|
||||
case WIDGET_NOERROR:
|
||||
widget->cache.needs_update = True;
|
||||
break;
|
||||
case WIDGET_ERROR_CUSTOM:
|
||||
break;
|
||||
}
|
||||
p_delete(&command);
|
||||
}
|
||||
else
|
||||
widget->tell(widget, property, NULL);
|
||||
|
||||
widget->cache.needs_update = True;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
|
@ -271,9 +271,6 @@ graph_tell(Widget *widget, char *property, char *command)
|
|||
if(!d->data_items)
|
||||
return WIDGET_ERROR_CUSTOM; /* error already printed on _new */
|
||||
|
||||
if(!command)
|
||||
return WIDGET_ERROR_NOVALUE;
|
||||
|
||||
if(!a_strcmp(property, "data"))
|
||||
{
|
||||
title = strtok(command, " ");
|
||||
|
|
|
@ -388,9 +388,6 @@ progressbar_tell(Widget *widget, char *property, char *command)
|
|||
if(!d->data_items)
|
||||
return WIDGET_ERROR_CUSTOM; /* error already printed on _new */
|
||||
|
||||
if(!command)
|
||||
return WIDGET_ERROR_NOVALUE;
|
||||
|
||||
if(!a_strcmp(property, "data"))
|
||||
{
|
||||
title = strtok(command, " ");
|
||||
|
|
|
@ -74,9 +74,6 @@ textbox_tell(Widget *widget, char *property, char *command)
|
|||
p_delete(&d->text);
|
||||
d->text = a_strdup(command);
|
||||
}
|
||||
/* !command means a not existing string. So return here */
|
||||
else if(!command)
|
||||
return WIDGET_ERROR_NOVALUE;
|
||||
else if(!a_strcmp(property, "fg"))
|
||||
if(draw_color_new(globalconf.display, widget->statusbar->screen, command, &d->style.fg))
|
||||
return WIDGET_NOERROR;
|
||||
|
|
Loading…
Reference in New Issue