From aa9820ee5660fdbab433859a80a30ac42b6a825e Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sat, 27 Oct 2012 14:07:04 +0200 Subject: [PATCH] Added a small default config. This allows to run the browser in a light was without aving keybinds definded in config files. --- src/config.h | 13 ++++++++++++- src/main.c | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/config.h b/src/config.h index 87665e6..9c56a22 100644 --- a/src/config.h +++ b/src/config.h @@ -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 */ diff --git a/src/main.c b/src/main.c index 7335b54..33f9b70 100644 --- a/src/main.c +++ b/src/main.c @@ -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; -- 2.20.1