Allow to set scrollstep on runtime.
authorDaniel Carl <danielcarl@gmx.de>
Thu, 1 Nov 2012 15:29:45 +0000 (16:29 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 10 Nov 2012 13:43:03 +0000 (14:43 +0100)
src/command.c
src/main.h
src/setting.c

index 403f355..f1328f8 100644 (file)
@@ -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 {
index 719f205..28af613 100644 (file)
@@ -154,6 +154,7 @@ typedef struct {
 
 typedef struct {
     time_t cookie_timeout;
+    gint   scrollstep;
 } Config;
 
 /* core struct */
index b64bb31..e701bf5 100644 (file)
@@ -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;
+}