summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2013-07-29 20:43:41 +0200
committerDaniel Carl <danielcarl@gmx.de>2013-07-29 20:43:41 +0200
commita7a5cc7f38783031b22ee1a07515bf647a7497f3 (patch)
tree8e474a40e2a7634c6b0278ceaf001f299ab161ec
parentc034020225ab30edf39377189b6992559e2bdcc0 (diff)
Use PROJECT variable instead of hard wired "vimb".
-rw-r--r--Makefile1
-rw-r--r--config.mk11
-rw-r--r--doc/vimb.12
-rw-r--r--src/default.h2
-rw-r--r--src/main.c10
-rw-r--r--src/util.c5
6 files changed, 18 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 0a9ca1a..3f32bbd 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,7 @@ install: $(TARGET) doc/$(MAN1)
@echo "install -m 644 src/$(MAN1) $(DESTDIR)$(MANDIR1)/$(MAN1)"
@sed -e "s/VERSION/$(VERSION)/g" \
-e "s/DATE/`date +'%m %Y'`/g" \
+ -e "s/PROJECT_UCFIRST/$(PROJECT_UCFIRST)/g" \
-e "s/PROJECT/$(PROJECT)/g" < doc/$(MAN1) > $(DESTDIR)$(MANDIR1)/$(MAN1)
@chmod 644 $(DESTDIR)$(MANDIR1)/$(MAN1)
diff --git a/config.mk b/config.mk
index e11bf30..4e48882 100644
--- a/config.mk
+++ b/config.mk
@@ -2,9 +2,9 @@
VERSION = 0.1.9
PROJECT = vimb
-PREFIX ?= /usr/local
-BINDIR ?= $(PREFIX)/bin
-MANDIR ?= $(PREFIX)/share/man
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/share/man
#----------------compile options---------------------
@@ -24,8 +24,11 @@ else
LIBS += $(GTK2LIBS)
endif
+# generate a first char upper case project name
+PROJECT_UCFIRST = $(shell echo '${PROJECT}' | sed 's/\([a-z]\)\([a-zA-Z0-9]*\)/\u\1\2/')
+
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE -D_XOPEN_SOURCE=500
-CPPFLAGS += -DPROJECT=\"${PROJECT}\"
+CPPFLAGS += -DPROJECT=\"${PROJECT}\" -DPROJECT_UCFIRST=\"${PROJECT_UCFIRST}\"
ifeq ($(USEGTK3), 1)
CPPFLAGS += -DHAS_GTK3
endif
diff --git a/doc/vimb.1 b/doc/vimb.1
index f22404e..27e0f04 100644
--- a/doc/vimb.1
+++ b/doc/vimb.1
@@ -1,7 +1,7 @@
.\" vim: ft=groff
.\" Process this file with
.\" groff -man -Tascii vimb.1
-.TH PROJECT 1 "DATE" "PROJECT/VERSION" "Vimb Manual"
+.TH PROJECT 1 "DATE" "PROJECT/VERSION" "PROJECT_UCFIRST Manual"
.SH NAME
PROJECT - Vim Browser - A modal web browser based on webkit thats inspired by
diff --git a/src/default.h b/src/default.h
index de1a5a3..a78c71a 100644
--- a/src/default.h
+++ b/src/default.h
@@ -104,7 +104,7 @@ static char *default_config[] = {
"set backgrounds=on",
"set sansfont=sens-serif",
"set seriffont=serif",
- "set useragent=vimb/" VERSION " (X11; Linux i686) AppleWebKit/535.22+ Compatible (Safari)",
+ "set useragent=" PROJECT "/" VERSION " (X11; Linux i686) AppleWebKit/535.22+ Compatible (Safari)",
"set stylesheet=on",
"set proxy=on",
"set cookie-timeout=4800",
diff --git a/src/main.c b/src/main.c
index 441469c..b6cd352 100644
--- a/src/main.c
+++ b/src/main.c
@@ -653,16 +653,16 @@ static void init_core(void)
#ifdef HAS_GTK3
gtk_window_set_has_resize_grip(GTK_WINDOW(gui->window), false);
#endif
- gtk_window_set_wmclass(GTK_WINDOW(gui->window), "vimb", "Vimb");
- gtk_window_set_role(GTK_WINDOW(gui->window), "Vimb");
+ gtk_window_set_wmclass(GTK_WINDOW(gui->window), PROJECT, PROJECT_UCFIRST);
+ gtk_window_set_role(GTK_WINDOW(gui->window), PROJECT_UCFIRST);
}
GdkGeometry hints = {10, 10};
gtk_window_set_default_size(GTK_WINDOW(gui->window), WIN_WIDTH, WIN_HEIGHT);
- gtk_window_set_title(GTK_WINDOW(gui->window), "vimb");
+ gtk_window_set_title(GTK_WINDOW(gui->window), PROJECT);
gtk_window_set_geometry_hints(GTK_WINDOW(gui->window), NULL, &hints, GDK_HINT_MIN_SIZE);
gtk_window_set_icon(GTK_WINDOW(gui->window), NULL);
- gtk_widget_set_name(GTK_WIDGET(gui->window), "vimb");
+ gtk_widget_set_name(GTK_WIDGET(gui->window), PROJECT);
/* Create a browser instance */
gui->webview = WEBKIT_WEB_VIEW(webkit_web_view_new());
@@ -970,7 +970,7 @@ gboolean vb_download(WebKitWebView *view, WebKitDownload *download, const char *
} else {
path = webkit_download_get_suggested_filename(download);
if (!path) {
- path = "vimb_donwload";
+ path = PROJECT "-donwload";
}
file = util_build_path(path, vb.config.download_dir);
}
diff --git a/src/util.c b/src/util.c
index daca1dd..8b536a1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -17,13 +17,14 @@
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
+#include "config.h"
#include <stdio.h>
#include "ctype.h"
#include "util.h"
char *util_get_config_dir(void)
{
- char *path = g_build_filename(g_get_user_config_dir(), "vimb", NULL);
+ char *path = g_build_filename(g_get_user_config_dir(), PROJECT, NULL);
util_create_dir_if_not_exists(path);
return path;
@@ -31,7 +32,7 @@ char *util_get_config_dir(void)
char *util_get_cache_dir(void)
{
- char *path = g_build_filename(g_get_user_cache_dir(), "vimb", NULL);
+ char *path = g_build_filename(g_get_user_cache_dir(), PROJECT, NULL);
util_create_dir_if_not_exists(path);
return path;