From 8fa33698d2a52711e54cb7d135e72be11065b054 Mon Sep 17 00:00:00 2001 From: marco candrian Date: Wed, 23 Apr 2008 23:44:55 +0200 Subject: [PATCH] replace 'command' with 'new_value' Describes it somebit better Signed-off-by: Julien Danjou --- widget.c | 16 ++++++++-------- widgets/common.c | 8 ++++---- widgets/graph.c | 14 +++++++------- widgets/iconbox.c | 8 ++++---- widgets/progressbar.c | 24 ++++++++++++------------ widgets/textbox.c | 14 +++++++------- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/widget.c b/widget.c index d08169da9..2bd3f4fa4 100644 --- a/widget.c +++ b/widget.c @@ -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 * cannot be told anything * \param widget the widget - * \param command unused argument + * \param new_value unused argument * \return widget_tell_status_t enum (see structs.h) */ static widget_tell_status_t 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); return WIDGET_ERROR_CUSTOM; @@ -184,7 +184,7 @@ uicb_widget_tell(int screen, char *arg) { statusbar_t *statusbar; widget_t *widget; - char *p, *property = NULL, *command; + char *p, *property = NULL, *new_value; ssize_t len; widget_tell_status_t status; @@ -212,14 +212,14 @@ uicb_widget_tell(int screen, char *arg) /* arg + len points to the finishing \0. * 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) { len = a_strlen(p); - command = p_new(char, len + 1); - a_strncpy(command, len + 1, p, len); - status = widget->tell(widget, property, command); - p_delete(&command); + new_value = p_new(char, len + 1); + a_strncpy(new_value, len + 1, p, len); + status = widget->tell(widget, property, new_value); + p_delete(&new_value); } else status = widget->tell(widget, property, NULL); diff --git a/widgets/common.c b/widgets/common.c index 9e66a385f..b20b13c9d 100644 --- a/widgets/common.c +++ b/widgets/common.c @@ -25,11 +25,11 @@ extern AwesomeConf globalconf; 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; int i; - title = strtok(command, " "); + title = strtok(new_value, " "); if(!(setting = strtok(NULL, " "))) return WIDGET_ERROR_NOVALUE; 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; } 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; int i; bool flag; - title = strtok(command, " "); + title = strtok(new_value, " "); if(!(setting = strtok(NULL, " "))) return WIDGET_ERROR_NOVALUE; for(i = 0; i < data_items; i++) diff --git a/widgets/graph.c b/widgets/graph.c index 293023b5b..22bbea827 100644 --- a/widgets/graph.c +++ b/widgets/graph.c @@ -276,7 +276,7 @@ graph_draw(widget_t *widget, DrawCtx *ctx, int offset, } 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; int i, u; @@ -286,12 +286,12 @@ graph_tell(widget_t *widget, char *property, char *command) if(!d->data_items) return WIDGET_ERROR_CUSTOM; /* error already printed on _new */ - if(command == NULL) + if(new_value == NULL) return WIDGET_ERROR_NOVALUE; if(!a_strcmp(property, "data")) { - title = strtok(command, " "); + title = strtok(new_value, " "); if(!(setting = strtok(NULL, " "))) return WIDGET_ERROR_NOVALUE; @@ -347,23 +347,23 @@ graph_tell(widget_t *widget, char *property, char *command) return WIDGET_ERROR_FORMAT_SECTION; } else if(!a_strcmp(property, "height")) - d->height = atof(command); + d->height = atof(new_value); else if(!a_strcmp(property, "bg")) { if(!draw_color_new(globalconf.connection, widget->statusbar->phys_screen, - command, &d->bg)) + new_value, &d->bg)) return WIDGET_ERROR_FORMAT_COLOR; } else if(!a_strcmp(property, "bordercolor")) { if(!draw_color_new(globalconf.connection, widget->statusbar->phys_screen, - command, &d->bordercolor)) + new_value, &d->bordercolor)) return WIDGET_ERROR_FORMAT_COLOR; } 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 Right: diff --git a/widgets/iconbox.c b/widgets/iconbox.c index 5593b305b..1625bccb1 100644 --- a/widgets/iconbox.c +++ b/widgets/iconbox.c @@ -65,23 +65,23 @@ iconbox_draw(widget_t *widget, DrawCtx *ctx, int offset, } 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; Data *d = widget->data; - if(command == NULL) + if(new_value == NULL) return WIDGET_ERROR_NOVALUE; if(!a_strcmp(property, "image")) { if(d->image) p_delete(&d->image); - d->image = a_strdup(command); + d->image = a_strdup(new_value); } else if(!a_strcmp(property, "resize")) { - if((b = cfg_parse_boolean(command)) != -1) + if((b = cfg_parse_boolean(new_value)) != -1) d->resize = b; else return WIDGET_ERROR_FORMAT_BOOL; diff --git a/widgets/progressbar.c b/widgets/progressbar.c index a972bce1f..32dc288d8 100644 --- a/widgets/progressbar.c +++ b/widgets/progressbar.c @@ -383,7 +383,7 @@ progressbar_draw(widget_t *widget, DrawCtx *ctx, int offset, } 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; int i = 0, percent, tmp; @@ -393,12 +393,12 @@ progressbar_tell(widget_t *widget, char *property, char *command) if(!d->data_items) return WIDGET_ERROR_CUSTOM; /* error already printed on _new */ - if(command == NULL) + if(new_value == NULL) return WIDGET_ERROR_NOVALUE; if(!a_strcmp(property, "data")) { - title = strtok(command, " "); + title = strtok(new_value, " "); if(!(setting = strtok(NULL, " "))) return WIDGET_ERROR_NOVALUE; 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; } 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")) - 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")) - 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")) - 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")) - 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")) - 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")) - d->gap = atoi(command); + d->gap = atoi(new_value); else if(!a_strcmp(property, "width")) { tmp = d->width; - d->width = atoi(command); + d->width = atoi(new_value); if(!check_settings(d, widget->statusbar->height)) { d->width = tmp; /* restore */ @@ -437,7 +437,7 @@ progressbar_tell(widget_t *widget, char *property, char *command) else if(!a_strcmp(property, "height")) { tmpf = d->height; - d->height = atof(command); + d->height = atof(new_value); if(!check_settings(d, widget->statusbar->height)) { d->height = tmpf; /* restore */ diff --git a/widgets/textbox.c b/widgets/textbox.c index 4ada84cda..5c195c2f4 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -64,7 +64,7 @@ textbox_draw(widget_t *widget, DrawCtx *ctx, int offset, int used) } 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; font_t *newfont; @@ -73,21 +73,21 @@ textbox_tell(widget_t *widget, char *property, char *command) { if (d->text) p_delete(&d->text); - d->text = a_strdup(command); + d->text = a_strdup(new_value); } 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; else return WIDGET_ERROR_FORMAT_COLOR; 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; else return WIDGET_ERROR_FORMAT_COLOR; 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) draw_font_delete(&d->style.font); @@ -97,9 +97,9 @@ textbox_tell(widget_t *widget, char *property, char *command) return WIDGET_ERROR_FORMAT_FONT; } else if(!a_strcmp(property, "width")) - d->width = atoi(command); + d->width = atoi(new_value); 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 return WIDGET_ERROR;