From b0a8522466a3fbb932050d8109d9b0eb8f59bec7 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 22 Dec 2007 20:55:17 +0100 Subject: [PATCH] rename a bunch of widget functions --- statusbar.c | 2 +- widget.c | 14 +++++++------- widget.h | 6 +++--- widgets/focustitle.c | 10 +++++----- widgets/iconbox.c | 10 +++++----- widgets/layoutinfo.c | 10 +++++----- widgets/netwmicon.c | 10 +++++----- widgets/taglist.c | 10 +++++----- widgets/textbox.c | 10 +++++----- 9 files changed, 41 insertions(+), 41 deletions(-) diff --git a/statusbar.c b/statusbar.c index 9ca81107..780e406c 100644 --- a/statusbar.c +++ b/statusbar.c @@ -170,7 +170,7 @@ statusbar_init(int screen) statusbar->window, globalconf.cursor[CurNormal]); - calculate_alignments(statusbar->widgets); + widget_calculate_alignments(statusbar->widgets); statusbar_update_position(globalconf.display, statusbar, diff --git a/widget.c b/widget.c index 6af297a0..3de5c6a0 100644 --- a/widget.c +++ b/widget.c @@ -38,7 +38,7 @@ const NameFuncLink WidgetList[] = }; void -calculate_alignments(Widget *widget) +widget_calculate_alignments(Widget *widget) { for(; widget; widget = widget->next) { @@ -61,7 +61,7 @@ calculate_alignments(Widget *widget) } int -calculate_offset(int barwidth, int widgetwidth, int offset, int alignment) +widget_calculate_offset(int barwidth, int widgetwidth, int offset, int alignment) { if (alignment == AlignLeft || alignment == AlignFlex) return offset; @@ -69,7 +69,7 @@ calculate_offset(int barwidth, int widgetwidth, int offset, int alignment) } static Widget * -find_widget(char *name, int screen) +widget_find(char *name, int screen) { Widget *widget; widget = globalconf.screens[screen].statusbar->widgets; @@ -80,20 +80,20 @@ find_widget(char *name, int screen) } static void -common_tell(Widget *widget, char *command __attribute__ ((unused))) +widget_common_tell(Widget *widget, char *command __attribute__ ((unused))) { warn("%s widget does not accept commands.\n", widget->name); } void -common_new(Widget *widget, Statusbar *statusbar, cfg_t* config) +widget_common_new(Widget *widget, Statusbar *statusbar, cfg_t* config) { const char *name; widget->statusbar = statusbar; name = cfg_title(config); widget->name = p_new(char, strlen(name)+1); - widget->tell = common_tell; + widget->tell = widget_common_tell; strncpy(widget->name, name, strlen(name)); } @@ -123,7 +123,7 @@ uicb_widget_tell(int screen, char *arg) return; } - widget = find_widget(p, screen); + widget = widget_find(p, screen); if (!widget) { warn("No such widget: %s\n", p); diff --git a/widget.h b/widget.h index 8d111650..a24de5ad 100644 --- a/widget.h +++ b/widget.h @@ -32,9 +32,9 @@ enum { AlignLeft, AlignRight, AlignFlex }; typedef Widget *(WidgetConstructor)(Statusbar *, cfg_t *); -int calculate_offset(int, int, int, int); -void calculate_alignments(Widget *); -void common_new(Widget*, Statusbar *, cfg_t *); +int widget_calculate_offset(int, int, int, int); +void widget_calculate_alignments(Widget *); +void widget_common_new(Widget*, Statusbar *, cfg_t *); WidgetConstructor layoutinfo_new; WidgetConstructor taglist_new; diff --git a/widgets/focustitle.c b/widgets/focustitle.c index 97938d99..d515c270 100644 --- a/widgets/focustitle.c +++ b/widgets/focustitle.c @@ -13,10 +13,10 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used) VirtScreen vscreen = globalconf.screens[widget->statusbar->screen]; Client *sel = focus_get_latest_client_for_tag(widget->statusbar->screen, get_current_tag(widget->statusbar->screen)); - int location = calculate_offset(vscreen.statusbar->width, - 0, - offset, - widget->alignment); + int location = widget_calculate_offset(vscreen.statusbar->width, + 0, + offset, + widget->alignment); if(sel) { @@ -43,7 +43,7 @@ focustitle_new(Statusbar *statusbar, cfg_t *config) { Widget *w; w = p_new(Widget, 1); - common_new(w, statusbar, config); + widget_common_new(w, statusbar, config); w->draw = focustitle_draw; w->alignment = AlignFlex; return w; diff --git a/widgets/iconbox.c b/widgets/iconbox.c index 3ce47629..9c5df97b 100644 --- a/widgets/iconbox.c +++ b/widgets/iconbox.c @@ -34,10 +34,10 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset, width = draw_get_image_width(widget->data); - location = calculate_offset(vscreen.statusbar->width, - width, - offset, - widget->alignment); + location = widget_calculate_offset(vscreen.statusbar->width, + width, + offset, + widget->alignment); draw_image(ctx, location, 0, widget->data); @@ -59,7 +59,7 @@ iconbox_new(Statusbar *statusbar, cfg_t *config) Widget *w; w = p_new(Widget, 1); - common_new(w, statusbar, config); + widget_common_new(w, statusbar, config); w->draw = iconbox_draw; w->tell = iconbox_tell; w->data = (void *) a_strdup(cfg_getstr(config, "image")); diff --git a/widgets/layoutinfo.c b/widgets/layoutinfo.c index 5ed82d5e..8d672119 100644 --- a/widgets/layoutinfo.c +++ b/widgets/layoutinfo.c @@ -37,10 +37,10 @@ layoutinfo_draw(Widget *widget, Layout *l; for(l = vscreen.layouts ; l; l = l->next) width = MAX(width, (textwidth(ctx, vscreen.font, l->symbol))); - location = calculate_offset(vscreen.statusbar->width, - width, - offset, - widget->alignment); + location = widget_calculate_offset(vscreen.statusbar->width, + width, + offset, + widget->alignment); draw_text(ctx, location, 0, width, vscreen.statusbar->height, @@ -56,7 +56,7 @@ layoutinfo_new(Statusbar *statusbar, cfg_t* config) { Widget *w; w = p_new(Widget, 1); - common_new(w, statusbar, config); + widget_common_new(w, statusbar, config); w->draw = (void*) layoutinfo_draw; return w; } diff --git a/widgets/netwmicon.c b/widgets/netwmicon.c index 7b1d0eb0..228b918d 100644 --- a/widgets/netwmicon.c +++ b/widgets/netwmicon.c @@ -78,10 +78,10 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset, imgdata[2] = pixel & 0xff; /* B */ } - location = calculate_offset(vscreen.statusbar->width, - width, - offset, - widget->alignment); + location = widget_calculate_offset(vscreen.statusbar->width, + width, + offset, + widget->alignment); draw_image_from_argb_data(ctx, location, 0, width, height, vscreen.statusbar->height, image); @@ -97,7 +97,7 @@ netwmicon_new(Statusbar *statusbar, cfg_t *config) Widget *w; w = p_new(Widget, 1); - common_new(w, statusbar, config); + widget_common_new(w, statusbar, config); w->draw = netwmicon_draw; return w; diff --git a/widgets/taglist.c b/widgets/taglist.c index 4ebe0324..cc145479 100644 --- a/widgets/taglist.c +++ b/widgets/taglist.c @@ -62,10 +62,10 @@ taglist_draw(Widget *widget, for(tag = vscreen.tags; tag; tag = tag->next) width += textwidth(ctx, vscreen.font, tag->name); - location = calculate_offset(vscreen.statusbar->width, - width, - offset, - widget->alignment); + location = widget_calculate_offset(vscreen.statusbar->width, + width, + offset, + widget->alignment); width = 0; for(tag = vscreen.tags; tag; tag = tag->next) @@ -97,7 +97,7 @@ taglist_new(Statusbar *statusbar, cfg_t *config) { Widget *w; w = p_new(Widget, 1); - common_new(w, statusbar, config); + widget_common_new(w, statusbar, config); w->draw = taglist_draw; return w; } diff --git a/widgets/textbox.c b/widgets/textbox.c index 2a79b3a9..9f516f41 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -51,10 +51,10 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset, Data *d = widget->data; width = textwidth(ctx, vscreen.font, d->text); - location = calculate_offset(vscreen.statusbar->width, - width, - offset, - widget->alignment); + location = widget_calculate_offset(vscreen.statusbar->width, + width, + offset, + widget->alignment); draw_text(ctx, location, 0, width, vscreen.statusbar->height, vscreen.font, d->text, d->fg, d->bg); @@ -75,7 +75,7 @@ textbox_new(Statusbar *statusbar, cfg_t *config) char *color; w = p_new(Widget, 1); - common_new(w, statusbar, config); + widget_common_new(w, statusbar, config); w->draw = textbox_draw; w->tell = textbox_tell;