Commit c0336970 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Start to use more CSS for styling

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 8311d511
......@@ -8,6 +8,7 @@ tests/girara_test-gtk*
.depend
*.pc
version.h
css-definitions.c
*.info
*.gcno
*.gcda
......
......@@ -6,6 +6,7 @@ include common.mk
PROJECTNV = girara
PROJECT = girara-gtk3
SOURCE = $(wildcard *.c)
CSOURCE = $(filter-out css-defintions.c, $(SOURCE))
OBJECTS = ${SOURCE:.c=.o}
DOBJECTS = ${SOURCE:.c=.do}
HEADERS = $(filter-out version.h,$(filter-out internal.h,$(wildcard *.h)))
......@@ -46,6 +47,13 @@ version.h: version.h.in config.mk
version.h.in > version.h.tmp
$(QUIET)mv version.h.tmp version.h
css-definitions.c: data/girara.css_t
$(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
$(ECHO) CC $<
......@@ -76,7 +84,8 @@ clean:
${DOBJECTS} lib${PROJECT}.a lib${PROJECT}-debug.a ${PROJECT}.pc doc \
lib$(PROJECT).so.${SOVERSION} lib${PROJECT}-debug.so.${SOVERSION} .depend \
${PROJECTNV}-${VERSION}.tar.gz version.h *gcda *gcno $(PROJECT).info gcov \
.version-checks version.h.tmp ${PROJECT}.pc.tmp
.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
......@@ -111,10 +120,12 @@ dist: clean
$(QUIET)mkdir -p ${PROJECTNV}-${VERSION}
$(QUIET)mkdir -p ${PROJECTNV}-${VERSION}/tests
$(QUIET)mkdir -p ${PROJECTNV}-${VERSION}/po
$(QUIET)mkdir -p $(PROJECTNV)-$(VERSION)/data
$(QUIET)cp LICENSE Makefile config.mk common.mk ${PROJECTNV}.pc.in \
${HEADERS} internal.h version.h.in README AUTHORS Doxyfile \
${SOURCE} ${PROJECTNV}-${VERSION}
${CSOURCE} ${PROJECTNV}-${VERSION}
$(QUIET)cp tests/*.c tests/Makefile tests/config.mk ${PROJECTNV}-${VERSION}/tests
$(QUIET)cp data/*.css_t $(PROJECTNV)-$(VERSION)/data
$(QUIET)cp po/Makefile po/*.po ${PROJECTNV}-${VERSION}/po
$(QUIET)tar -cf ${PROJECTNV}-${VERSION}.tar ${PROJECTNV}-${VERSION}
$(QUIET)gzip ${PROJECTNV}-${VERSION}.tar
......
/* See LICENSE file for license and copyright information */
#ifndef GIRARA_CSS_DEFINITIONS_H
#define GIRARA_CSS_DEFINITIONS_H
const char* CSS_TEMPLATE;
#endif
/* No resize grip on GtkWindows */
#@SESSION@ GtkWindow {
-GtkWindow-resize-grip-height: 0;
-GtkWindow-resize-grip-width: 0;
}
/* Hide scrollbars from GtkScrolledWindow */
#@SESSION@ GtkScrolledWindow GtkScrollbar:insensitive {
-GtkRange-slider-width: 0;
-GtkRange-trough-border: 0;
}
#@SESSION@ * {
color: @DEFAULT-FG@;
background-color: @DEFAULT-BG@;
}
#@SESSION@ #bottom_box {
border-style: none;
margin: 0px 0px 0px 0px;
padding: @BOTTOMBOX-PADDING1@px @BOTTOMBOX-PADDING2@px @BOTTOMBOX-PADDING3@px
@BOTTOMBOX-PADDING4@px;
}
This diff is collapsed.
......@@ -483,6 +483,51 @@ girara_escape_string(const char* value)
return g_string_free(str, FALSE);
}
char*
girara_replace_substring(const char* string, const char* old, const char* new)
{
if (string == NULL || old == NULL || new == NULL) {
return NULL;
}
size_t old_len = strlen(old);
size_t new_len = strlen(new);
/* count occurrences */
size_t count = 0;
size_t i = 0;
for (i = 0; string[i] != '\0'; i++) {
if (strstr(&string[i], old) == &string[i]) {
i += (old_len - 1);
count++;
}
}
if (count == 0) {
return g_strdup(string);
}
char* ret = g_try_malloc0(sizeof(char) * (i - count * old_len + count * new_len + 1));
if (ret == NULL) {
return NULL;
}
/* replace */
char* iter = ret;
while (*string != '\0') {
if (strstr(string, old) == string) {
strncpy(iter, new, new_len);
iter += new_len;
string += old_len;
} else {
*iter++ = *string++;
}
}
return ret;
}
bool
girara_exec_with_argument_list(girara_session_t* session, girara_list_t* argument_list)
{
......
......@@ -163,6 +163,18 @@ void girara_set_debug_level(girara_debug_level_t level);
*/
char* girara_escape_string(const char* value);
/**
* Replaces all occurences of \ref old in \ref string with \ref new and returns
* a new allocated string
*
* @param string The original string
* @param old String to replace
* @param new Replacement string
*
* @return new allocated string, needs to be freed with g_free
*/
char* girara_replace_substring(const char* string, const char* old, const char* new);
/**
* Execute command from argument list
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment