Code

hscroll: wrap attribute access added helper functions
authorMax Kellermann <max@duempel.org>
Sat, 3 Oct 2009 19:44:22 +0000 (21:44 +0200)
committerMax Kellermann <max@duempel.org>
Sat, 3 Oct 2009 19:44:22 +0000 (21:44 +0200)
src/hscroll.h
src/screen_play.c

index 8b643830de5dca63fccc3f9622f6b7c0669d2295..cad3f17ddae93404c79774a9a4e4a76feafd607a 100644 (file)
@@ -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);
 
index 3690dd341e3c84dbc2dee34a2918398ad19b6e3b..96c295633b85245a7ce5fda542da0d29d5a979a9 100644 (file)
@@ -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;