Commit 9f5880aa authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.4'

parents 711405b1 45f105d2
......@@ -14,5 +14,7 @@ css-definitions.c
*.gcda
gcov/
*.swp
doc/
.version-checks/
doc/doxygen
build
tests/build
Copyright (c) 2010-2014 pwmt.org
Copyright (c) 2010-2015 pwmt.org
This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use of
......
# See LICENSE file for license and copyright information
include config.mk
include common.mk
include colors.mk
include common.mk
PROJECTNV = girara
PROJECT = girara-gtk3
SOURCE = $(wildcard ${PROJECTNV}/*.c)
CSOURCE = $(filter-out ${PROJECTNV}/css-definitions.c, ${SOURCE})
PROJECTNV = girara
PROJECT = girara-gtk3
SOURCE = $(wildcard *.c)
CSOURCE = $(filter-out css-definitions.c, $(SOURCE))
OBJECTS = ${CSOURCE:.c=.o} css-definitions.o
DOBJECTS = ${OBJECTS:.o=.do}
GCDA = ${SOURCE:.c=.gcda}
GCNO = ${SOURCE:.c=.gcno}
HEADERS = $(filter-out version.h,$(filter-out internal.h,$(wildcard *.h)))
HEADERS_INSTALL = ${HEADERS} version.h
OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${CSOURCE:.c=.o}) \
${BUILDDIR_RELEASE}/${PROJECTNV}/css-definitions.o
OBJECTS_DEBUG = $(addprefix ${BUILDDIR_DEBUG}/,${CSOURCE:.c=.o}) \
${BUILDDIR_DEBUG}/${PROJECTNV}/css-definitions.o
OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${CSOURCE:.c=.o}) \
${BUILDDIR_GCOV}/${PROJECTNV}/css-definitions.o
HEADERS = $(filter-out ${PROJECTNV}/internal.h, $(wildcard ${PROJECTNV}/*.h))
ifneq (${WITH_LIBNOTIFY},0)
INCS += $(LIBNOTIFY_INC)
LIBS += $(LIBNOTIFY_LIB)
CPPFLAGS += -DWITH_LIBNOTIFY
LIBNOTIFY_PC_NAME = libnotify
else
LIBNOTIFY_PC_NAME =
endif
ifneq (${WITH_JSON},0)
CPPFLAGS += -DWITH_JSON
endif
ifeq (,$(findstring -DGETTEXT_PACKAGE,${CPPFLAGS}))
CPPFLAGS += -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\"
endif
......@@ -31,162 +37,234 @@ ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
endif
UNAME := $(shell uname -s)
ifeq ($(UNAME), Darwin)
SONAME_FLAG = -install_name
SHARED_FLAG = -dynamiclib
endif
all: ${PROJECT} po ${PROJECT}.pc
all: ${PROJECTNV} ${BUILDDIR}/${PROJECT}.pc po
# pkg-config based version checks
.version-checks/%: config.mk
$(QUIET)test $($(*)_VERSION_CHECK) -eq 0 || \
pkg-config --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \
echo "The minium required version of $(*) is $($(*)_MIN_VERSION)" && \
${PKG_CONFIG} --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \
echo "The minimum required version of $(*) is $($(*)_MIN_VERSION)" && \
false \
)
@mkdir -p .version-checks
$(QUIET)touch $@
options:
@echo ${PROJECT} build options:
@echo ${PROJECTNV} build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "DFLAGS = ${DFLAGS}"
@echo "CC = ${CC}"
version.h: version.h.in config.mk
$(QUIET)sed -e 's,@GVMAJOR@,${GIRARA_VERSION_MAJOR},' \
# generated files
${PROJECTNV}/version.h: ${PROJECTNV}/version.h.in config.mk
$(call colorecho,GEN,$@)
$(QUIET)sed \
-e 's,@GVMAJOR@,${GIRARA_VERSION_MAJOR},' \
-e 's,@GVMINOR@,${GIRARA_VERSION_MINOR},' \
-e 's,@GVREV@,${GIRARA_VERSION_REV},' \
version.h.in > version.h.tmp
$(QUIET)mv version.h.tmp version.h
${PROJECTNV}/version.h.in > ${PROJECTNV}/version.h.tmp
$(QUIET)mv ${PROJECTNV}/version.h.tmp ${PROJECTNV}/version.h
css-definitions.c: data/girara.css_t
${PROJECTNV}/css-definitions.c: data/girara.css_t
$(call colorecho,GEN,$@)
$(QUIET)echo '#include "css-definitions.h"' > $@.tmp
$(QUIET)echo 'const char* CSS_TEMPLATE =' >> $@.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' $< >> $@.tmp
$(QUIET)echo ';' >> $@.tmp
$(QUIET)mv $@.tmp $@
%.o: %.c
@mkdir -p .depend
$(call colorecho,CC,$<)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
${BUILDDIR}/${PROJECT}.pc: ${PROJECTNV}.pc.in config.mk
$(call colorecho,GEN,$(shell basename $@))
@mkdir -p ${BUILDDIR}
$(QUIET)sed -e 's,@PROJECT@,${PROJECT},' \
-e 's,@VERSION@,${VERSION},' \
-e 's,@INCLUDEDIR@,${INCLUDEDIR},' \
-e 's,@LIBDIR@,${LIBDIR},' \
-e 's,@LIBNOTIFY_PC_NAME@,${LIBNOTIFY_PC_NAME},' \
${PROJECTNV}.pc.in > $@.tmp
$(QUIET)mv $@.tmp $@
%.do: %.c
@mkdir -p .depend
# release build
${OBJECTS}: config.mk \
${PROJECTNV}/version.h \
.version-checks/GTK \
.version-checks/GLIB
${BUILDDIR_RELEASE}/%.o: %.c
$(call colorecho,CC,$<)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< \
-MMD -MF ${DEPENDDIR}/$(abspath $@).dep
${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.a: ${OBJECTS}
$(call colorecho,AR,$@)
@mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
$(QUIET)ar rcs $@ ${OBJECTS}
${OBJECTS} ${DOBJECTS}: config.mk version.h \
.version-checks/GTK .version-checks/GLIB
${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS}
$(call colorecho,LD,$@)
@mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
$(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} \
${SHARED_FLAG} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
${PROJECT}: static shared
static: lib${PROJECT}.a
shared: lib${PROJECT}.so.${SOVERSION}
${PROJECTNV}: ${PROJECT}
static: ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.a
shared: ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}
release: ${PROJECT}
# debug build
${OBJECT_DEBUG}: config.mk \
${PROJECTNV}/version.h \
.version-checks/GTK \
.version-checks/GLIB
lib${PROJECT}.a: ${OBJECTS}
${BUILDDIR_DEBUG}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< \
-MMD -MF ${DEPENDDIR}/$(abspath $@).dep
${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.a: ${OBJECTS_DEBUG}
$(call colorecho,AR,$@)
$(QUIET)ar rcs $@ ${OBJECTS}
@mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
$(QUIET)${AR} rcs $@ ${OBJECTS_DEBUG}
lib${PROJECT}.so.${SOVERSION}: ${OBJECTS}
${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS_DEBUG}
$(call colorecho,LD,$@)
$(QUIET)${CC} -Wl,-soname,lib${PROJECT}.so.${SOMAJOR} -shared ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
@mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
$(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} ${SHARED_FLAG} ${LDFLAGS} -o $@ ${OBJECTS_DEBUG} ${LIBS}
${PROJECT}-debug: \
${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.a \
${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}
debug: ${PROJECT}-debug
# gcov build
${OBJECTS_GCOV}: config.mk \
${PROJECTNV}/version.h \
.version-checks/GLIB \
.version-checks/GTK
${BUILDDIR_GCOV}/%.o: %.c
$(call colorecho,CC,$<)
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.a: ${OBJECTS_GCOV}
$(call colorecho,AR,$@)
@mkdir -p ${BUILDDIR_GCOV}/${BINDIR}
$(QUIET)${AR} rcs $@ ${OBJECTS_GCOV}
${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS_GCOV}
$(call colorecho,LD,$@)
@mkdir -p ${BUILDDIR_GCOV}/${BINDIR}
$(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} ${SHARED_FLAG} \
${GCOV_LDFLAGS} -o $@ ${OBJECTS_GCOV} ${LIBS}
${PROJECT}-gcov: ${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.a
gcov: ${PROJECT}-gcov
run-gcov: options gcov
$(QUIET)${MAKE} -C tests run-gcov
$(call colorecho,LCOV,"Analyse data")
$(QUIET)${LCOV_EXEC} ${LCOV_FLAGS}
$(call colorecho,LCOV,"Generate report")
$(QUIET)${GENHTML_EXEC} ${GENHTML_FLAGS}
# clean
clean:
$(QUIET)rm -rf \
${OBJECTS} \
${DOBJECTS} \
${BUILDDIR} \
${DEPENDDIR} \
${TARFILE} \
${TARDIR} \
lib${PROJECT}.a \
lib${PROJECT}-debug.a \
${PROJECT}.pc \
doc \
lib$(PROJECT).so.${SOVERSION} \
lib${PROJECT}-debug.so.${SOVERSION} \
.depend \
version.h \
${GCDA} \
${GCNO} \
$(PROJECT).info \
gcov \
.version-checks \
version.h.tmp \
${PROJECT}.pc.tmp \
css-definitions.c \
css-definitions.c.tmp
$(QUIET)${MAKE} -C tests clean
$(QUIET)${MAKE} -C po clean
${PROJECTNV}/version.h \
${PROJECTNV}/version.h.tmp \
${PROJECTNV}/css-definitions.c \
${PROJECTNV}/css-definitions.c.tmp
$(QUIET)$(MAKE) -C tests clean
$(QUIET)$(MAKE) -C po clean
$(QUIET)$(MAKE) -C doc clean
${PROJECT}-debug: lib${PROJECT}-debug.a lib${PROJECT}-debug.so.${SOVERSION}
# translations
lib${PROJECT}-debug.a: ${DOBJECTS}
$(call colorecho,AR,$@)
$(QUIET)ar rc $@ ${DOBJECTS}
po:
$(QUIET)${MAKE} -C po
lib${PROJECT}-debug.so.${SOVERSION}: ${DOBJECTS}
$(call colorecho,LD,$@)
$(QUIET)${CC} -Wl,-soname,lib${PROJECT}.so.${SOMAJOR} -shared ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
update-po:
$(QUIET)${MAKE} -C po update-po
debug: options ${PROJECT}-debug
# documentation
doc:
$(QUIET)doxygen Doxyfile
$(QUIET)$(MAKE) -C doc
gcov: clean
$(QUIET)CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" LDFLAGS="${LDFLAGS} -fprofile-arcs" ${MAKE} $(PROJECT)
$(QUIET)CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" LDFLAGS="${LDFLAGS} -fprofile-arcs" ${MAKE} test
$(QUIET)lcov --directory . --capture --output-file $(PROJECT).info
$(QUIET)genhtml --output-directory gcov $(PROJECT).info
# tests
test: ${PROJECT}
$(QUIET)${MAKE} -C tests run
$(QUIET)$(MAKE) -C tests run
test-debug: ${PROJECT}-debug
$(QUIET)$(MAKE) -C tests run-debug
test-debug: debug
$(QUIET)${MAKE} -C tests run-debug
# create taball
dist: clean
dist:
$(QUIET)tar -czf $(TARFILE) --exclude=.gitignore \
--transform 's,^,$(PROJECTNV)-$(VERSION)/,' \
`git ls-files`
${PROJECT}.pc: ${PROJECTNV}.pc.in config.mk
$(QUIET)sed -e 's,@PROJECT@,${PROJECT},' \
-e 's,@VERSION@,${VERSION},' \
-e 's,@INCLUDEDIR@,${INCLUDEDIR},' \
-e 's,@LIBDIR@,${LIBDIR},' \
-e 's,@LIBNOTIFY_PC_NAME@,${LIBNOTIFY_PC_NAME},' \
${PROJECTNV}.pc.in > ${PROJECT}.pc.tmp
$(QUIET)mv ${PROJECT}.pc.tmp ${PROJECT}.pc
po:
$(QUIET)${MAKE} -C po
update-po:
$(QUIET)${MAKE} -C po update-po
# install
install-static: static
$(call colorecho,INSTALL,"Install static library")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}
$(QUIET)install -m 644 lib${PROJECT}.a ${DESTDIR}${LIBDIR}
$(QUIET)install -m 644 ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.a ${DESTDIR}${LIBDIR}
install-shared: shared
$(call colorecho,INSTALL,"Install shared library")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}
$(QUIET)install -m 644 lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}
$(QUIET)install -m 644 ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}
$(QUIET)ln -sf lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}/lib${PROJECT}.so.${SOMAJOR} || \
echo "Failed to create lib${PROJECT}.so.${SOMAJOR}. Please check if it exists and points to the correct version of lib${PROJECT}.so."
$(QUIET)ln -sf lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}/lib${PROJECT}.so || \
echo "Failed to create lib${PROJECT}.so. Please check if it exists and points to the correct version of lib${PROJECT}.so."
install: options po install-static install-shared install-headers
$(QUIET)${MAKE} -C po install
install-headers: version.h ${PROJECT}.pc
install-headers: ${PROJECTNV}/version.h ${BUILDDIR}/${PROJECT}.pc
$(call colorecho,INSTALL,"Install pkg-config file")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${BUILDDIR}/${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
$(call colorecho,INSTALL,"Install header files")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/girara
$(QUIET)install -m 644 ${HEADERS_INSTALL} ${DESTDIR}${INCLUDEDIR}/girara
$(QUIET)install -m 644 ${HEADERS} ${DESTDIR}${INCLUDEDIR}/girara
install-po:
$(QUIET)${MAKE} -C po install
install: install-po install-static install-shared install-headers
# uninstall
uninstall: uninstall-headers
$(call colorecho,UNINSTALL,"Remove library files")
......@@ -196,14 +274,12 @@ uninstall: uninstall-headers
uninstall-headers:
$(call colorecho,UNINSTALL,"Remove header files")
$(QUIET)rm -rf ${INCLUDEDIR}/girara
$(QUIET)rm -rf ${DESTDIR}${INCLUDEDIR}/girara
$(call colorecho,UNINSTALL,"Remove pkg-config file")
$(QUIET)rm -f ${LIBDIR}/pkgconfig/${PROJECT}.pc
$(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc
.PHONY: all options clean debug doc test dist install install-headers uninstall \
uninstall-headers ${PROJECT} ${PROJECT}-debug po update-po \
static shared install-static install-shared
TDEPENDS = ${OBJECTS:.o=.o.dep}
DEPENDS = ${TDEPENDS:^=.depend/}
-include ${DEPENDS}
-include $(wildcard ${DEPENDDIR}/*.dep)
......@@ -2,7 +2,7 @@
GIRARA_VERSION_MAJOR = 0
GIRARA_VERSION_MINOR = 2
GIRARA_VERSION_REV = 3
GIRARA_VERSION_REV = 4
VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV}
# Rules for the SOMAJOR and SOMINOR.
......@@ -12,12 +12,18 @@ VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV}
# * If any of the exported datastructures have changed in a incompatible way
# bump SOMAJOR and set SOMINOR to 0.
# * If a function has been added bump SOMINOR.
SOMAJOR = 1
SOMINOR = 1
SOMAJOR = 2
SOMINOR = 0
SOVERSION = ${SOMAJOR}.${SOMINOR}
# pkg-config binary
PKG_CONFIG ?= pkg-config
# libnotify
WITH_LIBNOTIFY ?= $(shell (pkg-config libnotify && echo 1) || echo 0)
WITH_LIBNOTIFY ?= $(shell (${PKG_CONFIG} libnotify --atleast-version=0.7.0 && echo 1) || echo 0)
# libjson-c
WITH_JSON ?= $(shell (${PKG_CONFIG} json-c --exists && echo 1) || echo 0)
# paths
PREFIX ?= /usr
......@@ -27,6 +33,14 @@ INCLUDEDIR ?= ${PREFIX}/include
# locale directory
LOCALEDIR ?= ${PREFIX}/share/locale
# build directories
DEPENDDIR ?= .depend
BUILDDIR ?= build
BUILDDIR_RELEASE ?= ${BUILDDIR}/release
BUILDDIR_DEBUG ?= ${BUILDDIR}/debug
BUILDDIR_GCOV ?= ${BUILDDIR}/gcov
BINDIR ?= bin
# version checks
# If you want to disable any of the checks, set *_VERSION_CHECK to 0.
......@@ -40,16 +54,21 @@ GLIB_MIN_VERSION = 2.28
GLIB_PKG_CONFIG_NAME = glib-2.0
# libs
GTK_INC ?= $(shell pkg-config --cflags gtk+-3.0)
GTK_LIB ?= $(shell pkg-config --libs gtk+-3.0)
GTK_INC ?= $(shell ${PKG_CONFIG} --cflags gtk+-3.0)
GTK_LIB ?= $(shell ${PKG_CONFIG} --libs gtk+-3.0)
ifneq (${WITH_LIBNOTIFY},0)
LIBNOTIFY_INC ?= $(shell pkg-config --cflags libnotify)
LIBNOTIFY_LIB ?= $(shell pkg-config --libs libnotify)
LIBNOTIFY_INC ?= $(shell ${PKG_CONFIG} --cflags libnotify)
LIBNOTIFY_LIB ?= $(shell ${PKG_CONFIG} --libs libnotify)
endif
ifneq (${WITH_JSON},0)
JSON_INC ?= $(shell ${PKG_CONFIG} --cflags json-c)
JSON_LIB ?= $(shell ${PKG_CONFIG} --libs json-c)
endif
INCS = ${GTK_INC} ${LIBNOTIFY_INC}
LIBS = ${GTK_LIB} ${LIBNOTIFY_LIB} -lm
INCS = ${GTK_INC} ${LIBNOTIFY_INC} ${JSON_INC}
LIBS = ${GTK_LIB} ${LIBNOTIFY_LIB} ${JSON_LIB} -lm
# flags
CFLAGS += -std=c99 -pedantic -Wall -Wextra -fPIC $(INCS)
......@@ -63,9 +82,16 @@ DFLAGS = -O0 -g
# compiler
CC ?= gcc
# archiver
AR ?= ar
# strip
SFLAGS ?= -s
# soname
SONAME_FLAG ?= -soname
SHARED_FLAG ?= -shared
# set to something != 0 if you want verbose build output
VERBOSE ?= 0
......@@ -75,9 +101,18 @@ GETTEXT_PACKAGE ?= lib${PROJECT}-${SOMAJOR}
# msgfmt
MSGFMT ?= msgfmt
# gcov & lcov
GCOV_CFLAGS=-fprofile-arcs -ftest-coverage
GCOV_LDFLAGS=-fprofile-arcs
LCOV_OUTPUT=gcov
LCOV_EXEC=lcov
LCOV_FLAGS=--base-directory . --directory ${BUILDDIR_GCOV} --capture --rc \
lcov_branch_coverage=1 --output-file ${BUILDDIR_GCOV}/$(PROJECT).info
GENHTML_EXEC=genhtml
GENHTML_FLAGS=--rc lcov_branch_coverage=1 --output-directory ${LCOV_OUTPUT} ${BUILDDIR_GCOV}/$(PROJECT).info
# colors
COLOR ?= 1
# dist
TARFILE = ${PROJECTNV}-${VERSION}.tar.gz
TARDIR = ${PROJECTNV}-${VERSION}
......@@ -97,3 +97,14 @@
padding: @bottombox-padding1@px @bottombox-padding2@px @bottombox-padding3@px
@bottombox-padding4@px;
}
#@session@ GtkScrolledWindow .undershoot.top,
#@session@ GtkScrolledWindow .undershoot.top:backdrop,
#@session@ GtkScrolledWindow .undershoot.bottom,
#@session@ GtkScrolledWindow .undershoot.bottom:backdrop,
#@session@ GtkScrolledWindow .undershoot.left,
#@session@ GtkScrolledWindow .undershoot.left:backdrop,
#@session@ GtkScrolledWindow .undershoot.right,
#@session@ GtkScrolledWindow .undershoot.right:backdrop {
background-color: transparent;
}
......@@ -2,7 +2,7 @@
# General information
PROJECT_NAME = girara
OUTPUT_DIRECTORY = ./doc/
OUTPUT_DIRECTORY = build
OUTPUT_LANGUAGE = English
TAB_SIZE = 2
EXTRACT_ALL = YES
......@@ -16,9 +16,9 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
# Input files
INPUT =
EXCLUDE = ./tests
FILE_PATTERNS = *.h *.c
INPUT = ../
EXCLUDE = ../tests
FILE_PATTERNS = *.h
RECURSIVE = YES
# Output files
......@@ -28,3 +28,6 @@ GENERATE_RTF = NO
GENERATE_XML = NO
SOURCE_BROWSER = YES
# HTML settings
HTML_TIMESTAMP = NO
# See LICENSE file for license and copyright information
include ../config.mk
include ../common.mk
include ../colors.mk
include config.mk
DOXYGEN_SOURCES=$(wildcard ../*.h) Doxyfile
all: html
html: ${DOXYGEN_BUILDDIR}/html/index.html
clean:
$(call colorecho,RM,doc/${DOXYGEN_BUILDDIR})
$(QUIET)rm -rf ${DOXYGEN_BUILDDIR}
${DOXYGEN_BUILDDIR}/html/index.html:
$(call colorecho,DOC,"Build HTML documentation")
$(QUIET)${DOXYGEN_BIN} Doxyfile
.PHONY: clean html all
# See LICENSE file for license and copyright information
DOXYGEN_BIN ?= doxygen
DOXYGEN_BUILDDIR ?= build
......@@ -50,18 +50,8 @@ cb_font(girara_session_t* session, const char* UNUSED(name),
{
g_return_if_fail(session != NULL && value != NULL);
GIRARA_IGNORE_DEPRECATED
pango_font_description_free(session->style.font);
/* parse font */
PangoFontDescription* font = pango_font_description_from_string(value);
session->style.font = font;
char* fontname = pango_font_description_to_string(session->style.font);
girara_template_set_variable_value(session->private_data->csstemplate, "font",
fontname);
g_free(fontname);
GIRARA_UNIGNORE
value);
}
static void
......@@ -280,11 +270,14 @@ girara_config_load_default(girara_session_t* session)
girara_inputbar_shortcut_add(session, GDK_CONTROL_MASK, GDK_KEY_n, girara_isc_command_history, GIRARA_NEXT, NULL);
/* commands */
girara_inputbar_command_add(session, "exec", NULL, girara_cmd_exec, NULL, _("Execute a command"));
girara_inputbar_command_add(session, "map", "m", girara_cmd_map, NULL, _("Map a key sequence"));
girara_inputbar_command_add(session, "quit", "q", girara_cmd_quit, NULL, _("Quit the program"));
girara_inputbar_command_add(session, "set", "s", girara_cmd_set, girara_cc_set, _("Set an option"));
girara_inputbar_command_add(session, "unmap", NULL, girara_cmd_unmap, NULL, _("Unmap a key sequence"));
girara_inputbar_command_add(session, "exec", NULL, girara_cmd_exec, NULL, _("Execute a command"));
girara_inputbar_command_add(session, "map", "m", girara_cmd_map, NULL, _("Map a key sequence"));
girara_inputbar_command_add(session, "quit", "q", girara_cmd_quit, NULL, _("Quit the program"));
girara_inputbar_command_add(session, "set", "s", girara_cmd_set, girara_cc_set, _("Set an option"));
girara_inputbar_command_add(session, "unmap", NULL, girara_cmd_unmap, NULL, _("Unmap a key sequence"));
#ifdef WITH_JSON
girara_inputbar_command_add(session, "dump", NULL, girara_cmd_dump_config, NULL, _("Dump settings to a file"));
#endif
/* config handle */
girara_config_handle_add(session, "map", girara_cmd_map);
......@@ -352,30 +345,31 @@ config_parse(girara_session_t* session, const char* path)
while ((line = girara_file_read_line(file)) != NULL) {
/* skip empty lines and comments */
if (strlen(line) == 0 || strchr(COMMENT_PREFIX, line[0]) != NULL) {
free(line);
g_free(line);
continue;
}
gchar** argv = NULL;
gint argc = 0;
girara_list_t* argument_list = girara_list_new();
if (argument_list == NULL) {
free(line);
g_free(line);
fclose(file);
return false;
}
girara_list_set_free_function(argument_list, g_free);
gchar** argv = NULL;
gint argc = 0;
if (g_shell_parse_argv(line, &argc, &argv, NULL) != FALSE) {
for(int i = 1; i < argc; i++) {
for (int i = 1; i < argc; i++) {
char* argument = g_strdup(argv[i]);
girara_list_append(argument_list, (void*) argument);
}
} else {
girara_list_free(argument_list);
fclose(file);
free(line);
g_free(line);
return false;
}
......@@ -399,7 +393,7 @@ config_parse(girara_session_t* session, const char* path)
girara_warning("Could not process line %d in '%s': trying to include itself.", line_number, path);
} else {
girara_debug("Loading config file '%s'.", newpath);
if (config_parse(session, newpath) == FALSE) {
if (config_parse(session, newpath) == false) {
girara_warning("Could not process line %d in '%s': failed to load '%s'.", line_number, path, newpath);
}
}
......@@ -426,7 +420,7 @@ config_parse(girara_session_t* session, const char* path)
line_number++;
girara_list_free(argument_list);
g_strfreev(argv);
free(line);
g_free(line);
}
fclose(file);
......
......@@ -52,6 +52,8 @@ HIDDEN void update_state_by_keyval(int *state, int keyval);
HIDDEN void widget_add_class(GtkWidget* widget, const char* styleclass);
HIDDEN void widget_remove_class(GtkWidget* widget, const char* styleclass);
/**
* Default complection function for the settings
*
......@@ -107,7 +109,8 @@ HIDDEN bool girara_cmd_set(girara_session_t* session,
/**
* Execute an external command
* * @param session The used girara session
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return TRUE No error occured
* @return FALSE An error occured
......@@ -115,6 +118,19 @@ HIDDEN bool girara_cmd_set(girara_session_t* session,
HIDDEN bool girara_cmd_exec(girara_session_t* session,
girara_list_t* argument_list);
#ifdef WITH_JSON
/**
* Dump current settings to a JSON file
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return TRUE No error occured
* @return FALSE An error occured
*/
HIDDEN bool girara_cmd_dump_config(girara_session_t* session,
girara_list_t* argument_list);
#endif
/**
* Process argument as a sequence of keys that were typed by the user
*
......
......@@ -89,67 +89,52 @@ fill_template_with_values(girara_session_t* session)
char* font = NULL;
girara_setting_get(session, "font", &font);
if (font != NULL) {