Added a small default config.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 27 Oct 2012 12:07:04 +0000 (14:07 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 27 Oct 2012 12:07:04 +0000 (14:07 +0200)
This allows to run the browser in a light was without aving keybinds definded
in config files.

src/config.h
src/main.c

index 87665e6..9c56a22 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef CONFIG_H
 #define CONFIG_H
 
+#include "stdlib.h"
+
 #define START_PAGE      "http://sourceforge.net/apps/trac/vimprobable"
 
 #define STATUS_BG_COLOR "#000000"           /* background color for status bar */
@@ -31,7 +33,6 @@ static const char *inputbox_font[] = { "monospace normal 8", "monospace bold 8"}
 static const char *inputbox_fg[]   = { "#000000",            "#000000" };
 static const char *inputbox_bg[]   = { "#ffffff",            "#ff0000" };
 
-
 #define SETTING_DEFAUL_FONT_SIZE    12
 #define SETTING_USER_AGENT          PROJECT "/" VERSION " (X11; Linux i686) AppleWebKit/535.22+ Compatible (Safari)"
 #define SETTING_MAX_CONNS           25
@@ -39,4 +40,14 @@ static const char *inputbox_bg[]   = { "#ffffff",            "#ff0000" };
 
 #define SCROLLSTEP (40) /* cursor difference in pixel for scrolling */
 
+const struct {
+    char *command;
+} default_config[] = {
+    {"nmap o inputopen"},
+    {"nmap O inputopencurrent"},
+    {"nmap : input"},
+    {"nmap d quit"},
+    {NULL}
+};
+
 #endif /* end of include guard: CONFIG_H */
index 7335b54..33f9b70 100644 (file)
@@ -416,6 +416,12 @@ static void vp_read_config(void)
     FILE* fp;
     gchar line[255];
 
+    /* load default config */
+    for (guint i = 0; default_config[i].command != NULL; i++) {
+        vp_process_input(default_config[i].command);
+    }
+
+    /* read config from config files */
     if (access(vp.files[FILES_CONFIG], F_OK) != 0) {
         fprintf(stderr, "Could not find config file");
         return;