From: Daniel Carl Date: Thu, 1 Nov 2012 15:29:45 +0000 (+0100) Subject: Allow to set scrollstep on runtime. X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=c24ae0407026c0c76a6b7f88780c013ffc0d3788;p=vimb.git Allow to set scrollstep on runtime. --- diff --git a/src/command.c b/src/command.c index 403f355..f1328f8 100644 --- a/src/command.c +++ b/src/command.c @@ -181,8 +181,7 @@ gboolean command_scroll(const Arg* arg) gdouble value; gint count = vp.state.count ? vp.state.count : 1; if (arg->i & VP_SCROLL_UNIT_LINE) { - /* make scroll step configurable */ - value = 40; + value = vp.config.scrollstep; } else if (arg->i & VP_SCROLL_UNIT_HALFPAGE) { value = gtk_adjustment_get_page_size(adjust) / 2; } else { diff --git a/src/main.h b/src/main.h index 719f205..28af613 100644 --- a/src/main.h +++ b/src/main.h @@ -154,6 +154,7 @@ typedef struct { typedef struct { time_t cookie_timeout; + gint scrollstep; } Config; /* core struct */ diff --git a/src/setting.c b/src/setting.c index b64bb31..e701bf5 100644 --- a/src/setting.c +++ b/src/setting.c @@ -22,6 +22,7 @@ static gboolean setting_webkit(const Setting* s); static gboolean setting_cookie_timeout(const Setting* s); +static gboolean setting_scrollstep(const Setting* s); static Setting default_settings[] = { /* webkit settings */ @@ -71,6 +72,7 @@ static Setting default_settings[] = { {"zoom-step", TYPE_DOUBLE, setting_webkit, {.i = 100}}, /* internal variables */ {"cookie-timeout", TYPE_INTEGER, setting_cookie_timeout, {.i = 4800}}, + {"scrollstep", TYPE_INTEGER, setting_scrollstep, {.i = 40}}, }; static GHashTable* settings = NULL; @@ -171,3 +173,10 @@ static gboolean setting_cookie_timeout(const Setting* s) return TRUE; } + +static gboolean setting_scrollstep(const Setting* s) +{ + vp.config.scrollstep = s->arg.i; + + return TRUE; +}