Moved default config from config.h to own file.
authorDaniel Carl <danielcarl@gmx.de>
Wed, 17 Jul 2013 22:23:35 +0000 (00:23 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 17 Jul 2013 22:34:40 +0000 (00:34 +0200)
This make the inclusion if the config.h file easier.

Makefile
config.mk
src/config.h
src/default.h [new file with mode: 0644]
src/hints.c
src/main.c
src/session.c

index 57cf4a3..40cdebf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ $(DTARGET): $(DOBJ)
        @echo "$(CC) $@"
        @$(CC) $(DFLAGS) $(DOBJ) -o $(DTARGET) $(LDFLAGS)
 
-%.do: %.c $(HEAD)
+%.do: %.c %.h
        @echo "${CC} $<"
        @$(CC) -c -o $@ $< $(CPPFLAGS) $(DFLAGS)
 
index 3217c87..460e588 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -59,7 +59,6 @@ DFLAGS += -g
 #----------------end of options----------------------
 OBJ       = $(patsubst %.c, %.o, $(wildcard src/*.c))
 DOBJ      = $(patsubst %.c, %.do, $(wildcard src/*.c))
-HEAD      = $(wildcard src/*.h)
 DEPS      = $(OBJ:%.o=%.d)
 
 TARGET    = $(PROJECT)
index 75cfe35..f6645e0 100644 (file)
 #ifndef _CONFIG_H
 #define _CONFIG_H
 
-#include "stdlib.h"
-
 /* time in seconds after that message will be removed from inputbox if the
  * message where only temporary */
-#define MESSAGE_TIMEOUT             5
-const unsigned int SETTING_MAX_CONNS          = 25;
-const unsigned int SETTING_MAX_CONNS_PER_HOST = 5;
-const unsigned int MAXIMUM_HINTS = 500;
+#define MESSAGE_TIMEOUT              5
+
+#define SETTING_MAX_CONNS           25
+#define SETTING_MAX_CONNS_PER_HOST   5
 
-const char *default_config[] = {
-    "nmap gf=source",
-    "nmap gF=inspect",
-    "nmap :=input",
-    "nmap /=input /",
-    "nmap ?=input ?",
-    "nmap n=search-forward",
-    "nmap N=search-backward",
-    "nmap *=search-selection-forward",
-    "nmap #=search-selection-backward",
-    "nmap o=input :open ",
-    "nmap t=input :tabopen ",
-    "nmap O=inputuri :open ",
-    "nmap T=inputuri :tabopen ",
-    "nmap gh=open",
-    "nmap gH=tabopen",
-    "nmap u=open-closed",
-    "nmap U=tabopen-closed",
-    "nmap <ctrl-q>=quit",
-    "nmap <ctrl-o>=back",
-    "nmap <ctrl-i>=forward",
-    "nmap r=reload",
-    "nmap R=reload!",
-    "nmap C=stop",
-    "nmap <ctrl-f>=pagedown",
-    "nmap <ctrl-b>=pageup",
-    "nmap <ctrl-d>=halfpagedown",
-    "nmap <ctrl-u>=halfpageup",
-    "nmap gg=jumptop",
-    "nmap G=jumpbottom",
-    "nmap 0=jumpleft",
-    "nmap $=jumpright",
-    "nmap h=scrollleft",
-    "nmap l=scrollright",
-    "nmap k=scrollup",
-    "nmap j=scrolldown",
-    "nmap f=hint-link",
-    "nmap F=hint-link-new",
-    "nmap ;o=hint-input-open",
-    "nmap ;t=hint-input-tabopen",
-    "nmap ;y=hint-yank",
-    "nmap ;i=hint-image-open",
-    "nmap ;I=hint-image-tabopen",
-    "nmap ;e=hint-editor",
-    "nmap ;s=hint-save",
-    "nmap y=yank-uri",
-    "nmap Y=yank-selection",
-    "nmap p=open-clipboard",
-    "nmap P=tabopen-clipboard",
-    "nmap zi=zoomin",
-    "nmap zI=zoominfull",
-    "nmap zo=zoomout",
-    "nmap zO=zoomoutfull",
-    "nmap zz=zoomreset",
-    "nmap gu=descent",
-    "nmap gU=descent!",
-    "cmap <tab>=next",
-    "cmap <shift-tab>=prev",
-    "cmap <up>=hist-prev",
-    "cmap <down>=hist-next",
-    "imap <ctrl-t>=editor",
-    "shortcut-add dl=https://duckduckgo.com/lite/?q=$0",
-    "shortcut-add dd=https://duckduckgo.com/?q=$0",
-    "shortcut-default dl",
-    "set images=on",
-    "set cursivfont=serif",
-    "set defaultencondig=utf-8",
-    "set defaultfont=sans-serif",
-    "set fontsize=11",
-    "set monofontsize=11",
-    "set caret=off",
-    "set webinspector=off",
-    "set offlinecache=on",
-    "set pagecache=on",
-    "set plugins=on",
-    "set scripts=on",
-    "set xssauditor=on",
-    "set minimumfontsize=5",
-    "set monofont=monospace",
-    "set backgrounds=on",
-    "set sansfont=sens-serif",
-    "set seriffont=serif",
-    "set useragent=vimb/" VERSION " (X11; Linux i686) AppleWebKit/535.22+ Compatible (Safari)",
-    "set stylesheet=on",
-    "set proxy=on",
-    "set cookie-timeout=4800",
-    "set strict-ssl=on",
-    "set scrollstep=40",
-    "set status-color-bg=#000",
-    "set status-color-fg=#fff",
-    "set status-font=monospace bold 8",
-    "set status-ssl-color-bg=#95e454",
-    "set status-ssl-color-fg=#000",
-    "set status-ssl-font=monospace bold 8",
-    "set status-sslinvalid-color-bg=#f08080",
-    "set status-sslinvalid-color-fg=#000",
-    "set status-sslinvalid-font=monospace bold 8",
-    "set input-bg-normal=#fff",
-    "set input-bg-error=#f00",
-    "set input-fg-normal=#000",
-    "set input-fg-error=#000",
-    "set input-font-normal=monospace normal 8",
-    "set input-font-error=monospace bold 8",
-    "set completion-font=monospace normal 8",
-    "set completion-fg-normal=#f6f3e8",
-    "set completion-fg-active=#fff",
-    "set completion-bg-normal=#656565",
-    "set completion-bg-active=#777",
-    "set ca-bundle=/etc/ssl/certs/ca-certificates.crt",
-    "set home-page=https://github.com/fanglingsu/vimb",
-    "set download-path=",
-    "set history-max-items=2000",
-    "set editor-command=x-terminal-emulator -e vi %s",
-#if WEBKIT_CHECK_VERSION(2, 0, 0)
-    "set insecure-content-show=off",
-    "set insecure-content-run=off",
-#endif
-    NULL
-};
+#define MAXIMUM_HINTS              500
 
 #endif /* end of include guard: _CONFIG_H */
diff --git a/src/default.h b/src/default.h
new file mode 100644 (file)
index 0000000..de1a5a3
--- /dev/null
@@ -0,0 +1,145 @@
+/**
+ * vimb - a webkit based vim like browser.
+ *
+ * Copyright (C) 2012-2013 Daniel Carl
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ */
+
+#ifndef _DEFAULT_H
+#define _DEFAULT_H
+
+#include "stdlib.h"
+
+static char *default_config[] = {
+    "nmap gf=source",
+    "nmap gF=inspect",
+    "nmap :=input",
+    "nmap /=input /",
+    "nmap ?=input ?",
+    "nmap n=search-forward",
+    "nmap N=search-backward",
+    "nmap *=search-selection-forward",
+    "nmap #=search-selection-backward",
+    "nmap o=input :open ",
+    "nmap t=input :tabopen ",
+    "nmap O=inputuri :open ",
+    "nmap T=inputuri :tabopen ",
+    "nmap gh=open",
+    "nmap gH=tabopen",
+    "nmap u=open-closed",
+    "nmap U=tabopen-closed",
+    "nmap <ctrl-q>=quit",
+    "nmap <ctrl-o>=back",
+    "nmap <ctrl-i>=forward",
+    "nmap r=reload",
+    "nmap R=reload!",
+    "nmap C=stop",
+    "nmap <ctrl-f>=pagedown",
+    "nmap <ctrl-b>=pageup",
+    "nmap <ctrl-d>=halfpagedown",
+    "nmap <ctrl-u>=halfpageup",
+    "nmap gg=jumptop",
+    "nmap G=jumpbottom",
+    "nmap 0=jumpleft",
+    "nmap $=jumpright",
+    "nmap h=scrollleft",
+    "nmap l=scrollright",
+    "nmap k=scrollup",
+    "nmap j=scrolldown",
+    "nmap f=hint-link",
+    "nmap F=hint-link-new",
+    "nmap ;o=hint-input-open",
+    "nmap ;t=hint-input-tabopen",
+    "nmap ;y=hint-yank",
+    "nmap ;i=hint-image-open",
+    "nmap ;I=hint-image-tabopen",
+    "nmap ;e=hint-editor",
+    "nmap ;s=hint-save",
+    "nmap y=yank-uri",
+    "nmap Y=yank-selection",
+    "nmap p=open-clipboard",
+    "nmap P=tabopen-clipboard",
+    "nmap zi=zoomin",
+    "nmap zI=zoominfull",
+    "nmap zo=zoomout",
+    "nmap zO=zoomoutfull",
+    "nmap zz=zoomreset",
+    "nmap gu=descent",
+    "nmap gU=descent!",
+    "cmap <tab>=next",
+    "cmap <shift-tab>=prev",
+    "cmap <up>=hist-prev",
+    "cmap <down>=hist-next",
+    "imap <ctrl-t>=editor",
+    "shortcut-add dl=https://duckduckgo.com/lite/?q=$0",
+    "shortcut-add dd=https://duckduckgo.com/?q=$0",
+    "shortcut-default dl",
+    "set images=on",
+    "set cursivfont=serif",
+    "set defaultencondig=utf-8",
+    "set defaultfont=sans-serif",
+    "set fontsize=11",
+    "set monofontsize=11",
+    "set caret=off",
+    "set webinspector=off",
+    "set offlinecache=on",
+    "set pagecache=on",
+    "set plugins=on",
+    "set scripts=on",
+    "set xssauditor=on",
+    "set minimumfontsize=5",
+    "set monofont=monospace",
+    "set backgrounds=on",
+    "set sansfont=sens-serif",
+    "set seriffont=serif",
+    "set useragent=vimb/" VERSION " (X11; Linux i686) AppleWebKit/535.22+ Compatible (Safari)",
+    "set stylesheet=on",
+    "set proxy=on",
+    "set cookie-timeout=4800",
+    "set strict-ssl=on",
+    "set scrollstep=40",
+    "set status-color-bg=#000",
+    "set status-color-fg=#fff",
+    "set status-font=monospace bold 8",
+    "set status-ssl-color-bg=#95e454",
+    "set status-ssl-color-fg=#000",
+    "set status-ssl-font=monospace bold 8",
+    "set status-sslinvalid-color-bg=#f08080",
+    "set status-sslinvalid-color-fg=#000",
+    "set status-sslinvalid-font=monospace bold 8",
+    "set input-bg-normal=#fff",
+    "set input-bg-error=#f00",
+    "set input-fg-normal=#000",
+    "set input-fg-error=#000",
+    "set input-font-normal=monospace normal 8",
+    "set input-font-error=monospace bold 8",
+    "set completion-font=monospace normal 8",
+    "set completion-fg-normal=#f6f3e8",
+    "set completion-fg-active=#fff",
+    "set completion-bg-normal=#656565",
+    "set completion-bg-active=#777",
+    "set ca-bundle=/etc/ssl/certs/ca-certificates.crt",
+    "set home-page=https://github.com/fanglingsu/vimb",
+    "set download-path=",
+    "set history-max-items=2000",
+    "set editor-command=x-terminal-emulator -e vi %s",
+#if WEBKIT_CHECK_VERSION(2, 0, 0)
+    "set insecure-content-show=off",
+    "set insecure-content-run=off",
+#endif
+    NULL
+};
+
+#endif /* end of include guard: _DEFAULT_H */
index 701c4e6..6d9c146 100644 (file)
@@ -20,6 +20,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdkkeysyms-compat.h>
 #include "hints.h"
+#include "config.h"
 #include "dom.h"
 #include "command.h"
 #include "hints.js.h"
@@ -36,7 +37,6 @@ static struct {
 } hints;
 
 extern VbCore vb;
-extern const unsigned int MAXIMUM_HINTS;
 
 static void run_script(char *js);
 static void fire();
index 3da038d..11e1dc3 100644 (file)
 #include <sys/stat.h>
 #include <math.h>
 #include "main.h"
+#include "config.h"
 #include "util.h"
 #include "command.h"
 #include "keybind.h"
 #include "setting.h"
-#include "config.h"
 #include "completion.h"
 #include "dom.h"
 #include "hints.h"
 #include "shortcut.h"
 #include "history.h"
 #include "session.h"
+#include "default.h"
 
 /* variables */
 static char **args;
index 632ced1..4da9783 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <sys/file.h>
 #include "main.h"
+#include "config.h"
 #include "session.h"
 
 #ifdef FEATURE_COOKIE
@@ -49,8 +50,6 @@ static void cookiejar_set_property(GObject *self, guint prop_id,
 #endif
 
 extern VbCore vb;
-extern const unsigned int SETTING_MAX_CONNS;
-extern const unsigned int SETTING_MAX_CONNS_PER_HOST;
 
 
 void session_init(void)