From: Max Kellermann Date: Sat, 3 Oct 2009 19:44:22 +0000 (+0200) Subject: hscroll: wrap attribute access added helper functions X-Git-Tag: release-0.16~183 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f443c9ad383221f825b46771a2657f83cce44a06;p=ncmpc.git hscroll: wrap attribute access added helper functions --- diff --git a/src/hscroll.h b/src/hscroll.h index 8b64383..cad3f17 100644 --- a/src/hscroll.h +++ b/src/hscroll.h @@ -27,6 +27,12 @@ struct hscroll { GTime t; /* GTime is equivalent to time_t */ }; +static inline void +hscroll_reset(struct hscroll *hscroll) +{ + hscroll->offset = 0; +} + char * strscroll(struct hscroll *hscroll, char *str, char *separator, unsigned width); diff --git a/src/screen_play.c b/src/screen_play.c index 3690dd3..96c2956 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -155,7 +155,7 @@ list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED must_scroll = true; if (current_song != lw->selected) { - hscroll.offset = 0; + hscroll_reset(&hscroll); current_song = lw->selected; } @@ -165,7 +165,7 @@ list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED g_free(tmp); } else - hscroll.offset = 0; + hscroll_reset(&hscroll); } #else (void)second_column;