replace 'command' with 'new_value'

Describes it somebit better

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
marco candrian 2008-04-23 23:44:55 +02:00 committed by Julien Danjou
parent ce8d1ff89e
commit 8fa33698d2
6 changed files with 42 additions and 42 deletions

View File

@ -125,12 +125,12 @@ widget_common_button_press(widget_t *widget, xcb_button_press_event_t *ev)
/** Common tell function for widget, which only warn user that widget /** Common tell function for widget, which only warn user that widget
* cannot be told anything * cannot be told anything
* \param widget the widget * \param widget the widget
* \param command unused argument * \param new_value unused argument
* \return widget_tell_status_t enum (see structs.h) * \return widget_tell_status_t enum (see structs.h)
*/ */
static widget_tell_status_t static widget_tell_status_t
widget_common_tell(widget_t *widget, char *property __attribute__ ((unused)), widget_common_tell(widget_t *widget, char *property __attribute__ ((unused)),
char *command __attribute__ ((unused))) char *new_value __attribute__ ((unused)))
{ {
warn("%s widget does not accept commands.\n", widget->name); warn("%s widget does not accept commands.\n", widget->name);
return WIDGET_ERROR_CUSTOM; return WIDGET_ERROR_CUSTOM;
@ -184,7 +184,7 @@ uicb_widget_tell(int screen, char *arg)
{ {
statusbar_t *statusbar; statusbar_t *statusbar;
widget_t *widget; widget_t *widget;
char *p, *property = NULL, *command; char *p, *property = NULL, *new_value;
ssize_t len; ssize_t len;
widget_tell_status_t status; widget_tell_status_t status;
@ -212,14 +212,14 @@ uicb_widget_tell(int screen, char *arg)
/* arg + len points to the finishing \0. /* arg + len points to the finishing \0.
* p to the char right of the first space (strtok delimiter) * p to the char right of the first space (strtok delimiter)
* *
* \0 is on the right(>) of p pointer => some text (command) */ * \0 is on the right(>) of p pointer => some text (new_value) */
if(arg + len > p) if(arg + len > p)
{ {
len = a_strlen(p); len = a_strlen(p);
command = p_new(char, len + 1); new_value = p_new(char, len + 1);
a_strncpy(command, len + 1, p, len); a_strncpy(new_value, len + 1, p, len);
status = widget->tell(widget, property, command); status = widget->tell(widget, property, new_value);
p_delete(&command); p_delete(&new_value);
} }
else else
status = widget->tell(widget, property, NULL); status = widget->tell(widget, property, NULL);

View File

@ -25,11 +25,11 @@
extern AwesomeConf globalconf; extern AwesomeConf globalconf;
widget_tell_status_t widget_tell_status_t
widget_set_color_for_data(widget_t *widget, xcolor_t *color, char *command, int data_items, char ** data_title) widget_set_color_for_data(widget_t *widget, xcolor_t *color, char *new_value, int data_items, char ** data_title)
{ {
char *title, *setting; char *title, *setting;
int i; int i;
title = strtok(command, " "); title = strtok(new_value, " ");
if(!(setting = strtok(NULL, " "))) if(!(setting = strtok(NULL, " ")))
return WIDGET_ERROR_NOVALUE; return WIDGET_ERROR_NOVALUE;
for(i = 0; i < data_items; i++) for(i = 0; i < data_items; i++)
@ -45,12 +45,12 @@ widget_set_color_for_data(widget_t *widget, xcolor_t *color, char *command, int
return WIDGET_ERROR_FORMAT_SECTION; return WIDGET_ERROR_FORMAT_SECTION;
} }
widget_tell_status_t widget_tell_status_t
widget_set_color_pointer_for_data(widget_t *widget, xcolor_t **color, char *command, int data_items, char ** data_title) widget_set_color_pointer_for_data(widget_t *widget, xcolor_t **color, char *new_value, int data_items, char ** data_title)
{ {
char *title, *setting; char *title, *setting;
int i; int i;
bool flag; bool flag;
title = strtok(command, " "); title = strtok(new_value, " ");
if(!(setting = strtok(NULL, " "))) if(!(setting = strtok(NULL, " ")))
return WIDGET_ERROR_NOVALUE; return WIDGET_ERROR_NOVALUE;
for(i = 0; i < data_items; i++) for(i = 0; i < data_items; i++)

View File

@ -276,7 +276,7 @@ graph_draw(widget_t *widget, DrawCtx *ctx, int offset,
} }
static widget_tell_status_t static widget_tell_status_t
graph_tell(widget_t *widget, char *property, char *command) graph_tell(widget_t *widget, char *property, char *new_value)
{ {
Data *d = widget->data; Data *d = widget->data;
int i, u; int i, u;
@ -286,12 +286,12 @@ graph_tell(widget_t *widget, char *property, char *command)
if(!d->data_items) if(!d->data_items)
return WIDGET_ERROR_CUSTOM; /* error already printed on _new */ return WIDGET_ERROR_CUSTOM; /* error already printed on _new */
if(command == NULL) if(new_value == NULL)
return WIDGET_ERROR_NOVALUE; return WIDGET_ERROR_NOVALUE;
if(!a_strcmp(property, "data")) if(!a_strcmp(property, "data"))
{ {
title = strtok(command, " "); title = strtok(new_value, " ");
if(!(setting = strtok(NULL, " "))) if(!(setting = strtok(NULL, " ")))
return WIDGET_ERROR_NOVALUE; return WIDGET_ERROR_NOVALUE;
@ -347,23 +347,23 @@ graph_tell(widget_t *widget, char *property, char *command)
return WIDGET_ERROR_FORMAT_SECTION; return WIDGET_ERROR_FORMAT_SECTION;
} }
else if(!a_strcmp(property, "height")) else if(!a_strcmp(property, "height"))
d->height = atof(command); d->height = atof(new_value);
else if(!a_strcmp(property, "bg")) else if(!a_strcmp(property, "bg"))
{ {
if(!draw_color_new(globalconf.connection, if(!draw_color_new(globalconf.connection,
widget->statusbar->phys_screen, widget->statusbar->phys_screen,
command, &d->bg)) new_value, &d->bg))
return WIDGET_ERROR_FORMAT_COLOR; return WIDGET_ERROR_FORMAT_COLOR;
} }
else if(!a_strcmp(property, "bordercolor")) else if(!a_strcmp(property, "bordercolor"))
{ {
if(!draw_color_new(globalconf.connection, if(!draw_color_new(globalconf.connection,
widget->statusbar->phys_screen, widget->statusbar->phys_screen,
command, &d->bordercolor)) new_value, &d->bordercolor))
return WIDGET_ERROR_FORMAT_COLOR; return WIDGET_ERROR_FORMAT_COLOR;
} }
else if(!a_strcmp(property, "grow")) else if(!a_strcmp(property, "grow"))
switch((d->grow = position_get_from_str(command))) switch((d->grow = position_get_from_str(new_value)))
{ {
case Left: case Left:
case Right: case Right:

View File

@ -65,23 +65,23 @@ iconbox_draw(widget_t *widget, DrawCtx *ctx, int offset,
} }
static widget_tell_status_t static widget_tell_status_t
iconbox_tell(widget_t *widget, char *property, char *command) iconbox_tell(widget_t *widget, char *property, char *new_value)
{ {
bool b; bool b;
Data *d = widget->data; Data *d = widget->data;
if(command == NULL) if(new_value == NULL)
return WIDGET_ERROR_NOVALUE; return WIDGET_ERROR_NOVALUE;
if(!a_strcmp(property, "image")) if(!a_strcmp(property, "image"))
{ {
if(d->image) if(d->image)
p_delete(&d->image); p_delete(&d->image);
d->image = a_strdup(command); d->image = a_strdup(new_value);
} }
else if(!a_strcmp(property, "resize")) else if(!a_strcmp(property, "resize"))
{ {
if((b = cfg_parse_boolean(command)) != -1) if((b = cfg_parse_boolean(new_value)) != -1)
d->resize = b; d->resize = b;
else else
return WIDGET_ERROR_FORMAT_BOOL; return WIDGET_ERROR_FORMAT_BOOL;

View File

@ -383,7 +383,7 @@ progressbar_draw(widget_t *widget, DrawCtx *ctx, int offset,
} }
static widget_tell_status_t static widget_tell_status_t
progressbar_tell(widget_t *widget, char *property, char *command) progressbar_tell(widget_t *widget, char *property, char *new_value)
{ {
Data *d = widget->data; Data *d = widget->data;
int i = 0, percent, tmp; int i = 0, percent, tmp;
@ -393,12 +393,12 @@ progressbar_tell(widget_t *widget, char *property, char *command)
if(!d->data_items) if(!d->data_items)
return WIDGET_ERROR_CUSTOM; /* error already printed on _new */ return WIDGET_ERROR_CUSTOM; /* error already printed on _new */
if(command == NULL) if(new_value == NULL)
return WIDGET_ERROR_NOVALUE; return WIDGET_ERROR_NOVALUE;
if(!a_strcmp(property, "data")) if(!a_strcmp(property, "data"))
{ {
title = strtok(command, " "); title = strtok(new_value, " ");
if(!(setting = strtok(NULL, " "))) if(!(setting = strtok(NULL, " ")))
return WIDGET_ERROR_NOVALUE; return WIDGET_ERROR_NOVALUE;
for(i = 0; i < d->data_items; i++) for(i = 0; i < d->data_items; i++)
@ -411,23 +411,23 @@ progressbar_tell(widget_t *widget, char *property, char *command)
return WIDGET_ERROR_FORMAT_SECTION; return WIDGET_ERROR_FORMAT_SECTION;
} }
else if(!a_strcmp(property, "fg")) else if(!a_strcmp(property, "fg"))
return widget_set_color_for_data(widget, d->fg, command, d->data_items, d->data_title); return widget_set_color_for_data(widget, d->fg, new_value, d->data_items, d->data_title);
else if(!a_strcmp(property, "fg_off")) else if(!a_strcmp(property, "fg_off"))
return widget_set_color_for_data(widget, d->fg_off, command, d->data_items, d->data_title); return widget_set_color_for_data(widget, d->fg_off, new_value, d->data_items, d->data_title);
else if(!a_strcmp(property, "bg")) else if(!a_strcmp(property, "bg"))
return widget_set_color_for_data(widget, d->bg, command, d->data_items, d->data_title); return widget_set_color_for_data(widget, d->bg, new_value, d->data_items, d->data_title);
else if(!a_strcmp(property, "bordercolor")) else if(!a_strcmp(property, "bordercolor"))
return widget_set_color_for_data(widget, d->bordercolor, command, d->data_items, d->data_title); return widget_set_color_for_data(widget, d->bordercolor, new_value, d->data_items, d->data_title);
else if(!a_strcmp(property, "fg_center")) else if(!a_strcmp(property, "fg_center"))
return widget_set_color_pointer_for_data(widget, d->pfg_center, command, d->data_items, d->data_title); return widget_set_color_pointer_for_data(widget, d->pfg_center, new_value, d->data_items, d->data_title);
else if(!a_strcmp(property, "fg_end")) else if(!a_strcmp(property, "fg_end"))
return widget_set_color_pointer_for_data(widget, d->pfg_end, command, d->data_items, d->data_title); return widget_set_color_pointer_for_data(widget, d->pfg_end, new_value, d->data_items, d->data_title);
else if(!a_strcmp(property, "gap")) else if(!a_strcmp(property, "gap"))
d->gap = atoi(command); d->gap = atoi(new_value);
else if(!a_strcmp(property, "width")) else if(!a_strcmp(property, "width"))
{ {
tmp = d->width; tmp = d->width;
d->width = atoi(command); d->width = atoi(new_value);
if(!check_settings(d, widget->statusbar->height)) if(!check_settings(d, widget->statusbar->height))
{ {
d->width = tmp; /* restore */ d->width = tmp; /* restore */
@ -437,7 +437,7 @@ progressbar_tell(widget_t *widget, char *property, char *command)
else if(!a_strcmp(property, "height")) else if(!a_strcmp(property, "height"))
{ {
tmpf = d->height; tmpf = d->height;
d->height = atof(command); d->height = atof(new_value);
if(!check_settings(d, widget->statusbar->height)) if(!check_settings(d, widget->statusbar->height))
{ {
d->height = tmpf; /* restore */ d->height = tmpf; /* restore */

View File

@ -64,7 +64,7 @@ textbox_draw(widget_t *widget, DrawCtx *ctx, int offset, int used)
} }
static widget_tell_status_t static widget_tell_status_t
textbox_tell(widget_t *widget, char *property, char *command) textbox_tell(widget_t *widget, char *property, char *new_value)
{ {
Data *d = widget->data; Data *d = widget->data;
font_t *newfont; font_t *newfont;
@ -73,21 +73,21 @@ textbox_tell(widget_t *widget, char *property, char *command)
{ {
if (d->text) if (d->text)
p_delete(&d->text); p_delete(&d->text);
d->text = a_strdup(command); d->text = a_strdup(new_value);
} }
else if(!a_strcmp(property, "fg")) else if(!a_strcmp(property, "fg"))
if(draw_color_new(globalconf.connection, widget->statusbar->screen, command, &d->style.fg)) if(draw_color_new(globalconf.connection, widget->statusbar->screen, new_value, &d->style.fg))
return WIDGET_NOERROR; return WIDGET_NOERROR;
else else
return WIDGET_ERROR_FORMAT_COLOR; return WIDGET_ERROR_FORMAT_COLOR;
else if(!a_strcmp(property, "bg")) else if(!a_strcmp(property, "bg"))
if(draw_color_new(globalconf.connection, widget->statusbar->screen, command, &d->style.bg)) if(draw_color_new(globalconf.connection, widget->statusbar->screen, new_value, &d->style.bg))
return WIDGET_NOERROR; return WIDGET_NOERROR;
else else
return WIDGET_ERROR_FORMAT_COLOR; return WIDGET_ERROR_FORMAT_COLOR;
else if(!a_strcmp(property, "font")) else if(!a_strcmp(property, "font"))
{ {
if((newfont = draw_font_new(globalconf.connection, globalconf.default_screen, command))) if((newfont = draw_font_new(globalconf.connection, globalconf.default_screen, new_value)))
{ {
if(d->style.font != globalconf.screens[widget->statusbar->screen].styles.normal.font) if(d->style.font != globalconf.screens[widget->statusbar->screen].styles.normal.font)
draw_font_delete(&d->style.font); draw_font_delete(&d->style.font);
@ -97,9 +97,9 @@ textbox_tell(widget_t *widget, char *property, char *command)
return WIDGET_ERROR_FORMAT_FONT; return WIDGET_ERROR_FORMAT_FONT;
} }
else if(!a_strcmp(property, "width")) else if(!a_strcmp(property, "width"))
d->width = atoi(command); d->width = atoi(new_value);
else if(!a_strcmp(property, "text_align")) else if(!a_strcmp(property, "text_align"))
d->align = draw_align_get_from_str(command); d->align = draw_align_get_from_str(new_value);
else else
return WIDGET_ERROR; return WIDGET_ERROR;