Commit 6dc6fec2 authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.6'

parents b4797a62 094978d2
......@@ -44,6 +44,17 @@ UNAME := $(shell uname -s)
ifeq ($(UNAME), Darwin)
SONAME_FLAG = -install_name
SHARED_FLAG = -dynamiclib
SOFILE = lib${PROJECT}.dylib
SOVERSIONFILE = lib${PROJECT}.${SOVERSION}.dylib
SOMAJORFILE = lib${PROJECT}.${SOMAJOR}.dylib
BUILDSOMAJORFILE = ${LIBDIR}/${SOMAJORFILE}
PLATFORMFLAGS = -current_version ${SOVERSION} -compatibility_version ${SOMAJOR}
else
SOFILE = lib${PROJECT}.so
SOVERSIONFILE = ${SOFILE}.${SOVERSION}
SOMAJORFILE = ${SOFILE}.${SOMAJOR}
BUILDSOMAJORFILE = ${SOMAJORFILE}
PLATFORMFLAGS =
endif
all: ${PROJECTNV} ${BUILDDIR}/${PROJECT}.pc po
......@@ -60,10 +71,11 @@ all: ${PROJECTNV} ${BUILDDIR}/${PROJECT}.pc po
options:
@echo ${PROJECTNV} build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "DFLAGS = ${DFLAGS}"
@echo "CC = ${CC}"
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "DFLAGS = ${DFLAGS}"
@echo "CC = ${CC}"
@echo "PLATFORMFLAGS = ${PLATFORMFLAGS}"
# generated files
......@@ -76,12 +88,16 @@ ${PROJECTNV}/version.h: ${PROJECTNV}/version.h.in config.mk
${PROJECTNV}/version.h.in > ${PROJECTNV}/version.h.tmp
$(QUIET)mv ${PROJECTNV}/version.h.tmp ${PROJECTNV}/version.h
${PROJECTNV}/css-definitions.c: data/girara.css_t
${PROJECTNV}/css-definitions.c: data/girara-pre-3.20.css_t data/girara-post-3.20.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 'const char* CSS_TEMPLATE_PRE_3_20 =' >> $@.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/girara-pre-3.20.css_t >> $@.tmp
$(QUIET)echo ';' >> $@.tmp
$(QUIET)echo 'const char* CSS_TEMPLATE_POST_3_20 =' >> $@.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/girara-post-3.20.css_t >> $@.tmp
$(QUIET)echo ';' >> $@.tmp
$(QUIET)mv $@.tmp $@
${BUILDDIR}/${PROJECT}.pc: ${PROJECTNV}.pc.in config.mk
......@@ -115,16 +131,16 @@ ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.a: ${OBJECTS}
@mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
$(QUIET)${AR} rcs $@ ${OBJECTS}
${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS}
${BUILDDIR_RELEASE}/${BINDIR}/${SOVERSIONFILE}: ${OBJECTS}
$(call colorecho,LD,$@)
@mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
$(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} \
${SHARED_FLAG} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
$(QUIET)${CC} -Wl,${SONAME_FLAG},${BUILDSOMAJORFILE} \
${SHARED_FLAG} ${PLATFORMFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
${PROJECT}: static shared
${PROJECTNV}: ${PROJECT}
static: ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.a
shared: ${BUILDDIR_RELEASE}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}
shared: ${BUILDDIR_RELEASE}/${BINDIR}/${SOVERSIONFILE}
release: ${PROJECT}
# debug build
......@@ -146,14 +162,14 @@ ${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.a: ${OBJECTS_DEBUG}
@mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
$(QUIET)${AR} rcs $@ ${OBJECTS_DEBUG}
${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS_DEBUG}
${BUILDDIR_DEBUG}/${BINDIR}/${SOVERSIONFILE}: ${OBJECTS_DEBUG}
$(call colorecho,LD,$@)
@mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
$(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} ${SHARED_FLAG} ${LDFLAGS} -o $@ ${OBJECTS_DEBUG} ${LIBS}
$(QUIET)${CC} -Wl,${SONAME_FLAG},${BUILDSOMAJORFILE} ${SHARED_FLAG} ${PLATFORMFLAGS} ${LDFLAGS} -o $@ ${OBJECTS_DEBUG} ${LIBS}
${PROJECT}-debug: \
${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.a \
${BUILDDIR_DEBUG}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}
${BUILDDIR_DEBUG}/${BINDIR}/${SOVERSIONFILE}
debug: ${PROJECT}-debug
# gcov build
......@@ -175,11 +191,11 @@ ${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.a: ${OBJECTS_GCOV}
@mkdir -p ${BUILDDIR_GCOV}/${BINDIR}
$(QUIET)${AR} rcs $@ ${OBJECTS_GCOV}
${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.so.${SOVERSION}: ${OBJECTS_GCOV}
${BUILDDIR_GCOV}/${BINDIR}/${SOVERSIONFILE}: ${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}
$(QUIET)${CC} -Wl,${SONAME_FLAG},${BUILDSOMAJORFILE} ${SHARED_FLAG} \
${PLATFORMFLAGS} ${GCOV_LDFLAGS} -o $@ ${OBJECTS_GCOV} ${LIBS}
${PROJECT}-gcov: ${BUILDDIR_GCOV}/${BINDIR}/lib${PROJECT}.a
gcov: ${PROJECT}-gcov
......@@ -249,11 +265,11 @@ install-static: static
install-shared: shared
$(call colorecho,INSTALL,"Install shared library")
$(QUIET)mkdir -m 755 -p ${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."
$(QUIET)install -m 644 ${BUILDDIR_RELEASE}/${BINDIR}/${SOVERSIONFILE} ${DESTDIR}${LIBDIR}
$(QUIET)ln -sf ${SOVERSIONFILE} ${DESTDIR}${LIBDIR}/${SOMAJORFILE} || \
echo "Failed to create ${SOMAJORFILE}. Please check if it exists and points to the correct version of ${SOFILE}."
$(QUIET)ln -sf ${SOVERSIONFILE} ${DESTDIR}${LIBDIR}/${SOFILE} || \
echo "Failed to create ${SOFILE}. Please check if it exists and points to the correct version of ${SOFILE}."
install-headers: ${PROJECTNV}/version.h ${BUILDDIR}/${PROJECT}.pc
$(call colorecho,INSTALL,"Install pkg-config file")
......@@ -272,8 +288,8 @@ install: install-po install-static install-shared install-headers
uninstall: uninstall-headers
$(call colorecho,UNINSTALL,"Remove library files")
$(QUIET)rm -f ${LIBDIR}/lib${PROJECT}.a ${LIBDIR}/lib${PROJECT}.so.${SOVERSION} \
${LIBDIR}/lib${PROJECT}.so.${SOMAJOR} ${LIBDIR}/lib${PROJECT}.so
$(QUIET)rm -f ${LIBDIR}/lib${PROJECT}.a ${LIBDIR}/${SOVERSIONFILE} \
${LIBDIR}/${SOMAJORFILE} ${LIBDIR}/${SOFILE}
$(QUIET)${MAKE} -C po uninstall
uninstall-headers:
......@@ -282,6 +298,16 @@ uninstall-headers:
$(call colorecho,UNINSTALL,"Remove pkg-config file")
$(QUIET)rm -f ${DESTDIR}${LIBDIR}/pkgconfig/${PROJECT}.pc
# format and tidy
format:
clang-tidy -fix -checks=readability-braces-around-statements \
$(SOURCE) -- $(CPPFLAGS) $(CFLAGS)
clang-format-3.8 -i $(SOURCE) $(HEADERS)
tidy:
clang-tidy $(SOURCE) -- $(CPPFLAGS) $(CFLAGS)
DEPENDS = ${DEPENDDIRS:^=${DEPENDDIR}/}$(addprefix ${DEPENDDIR}/,${OBJECTS:.o=.o.dep})
-include ${DEPENDS}
......
......@@ -2,7 +2,7 @@
GIRARA_VERSION_MAJOR = 0
GIRARA_VERSION_MINOR = 2
GIRARA_VERSION_REV = 5
GIRARA_VERSION_REV = 6
VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV}
# Rules for the SOMAJOR and SOMINOR.
......
#@session@ scrolledwindow scrollbar {
background-color: @scrollbar-bg@;
}
#@session@ scrolledwindow scrollbar > slider {
background-color: @scrollbar-fg@;
}
#@session@ * {
color: @default-fg@;
background-color: @default-bg@;
background-image: none;
font: @font@;
}
/* Inputbar */
#@session@ entry.inputbar {
background-color: @inputbar-bg@;
}
#@session@ .inputbar {
color: @inputbar-fg@;
background-color: @inputbar-bg@;
box-shadow: none; /* maybe use some user-definable color here */
}
/* Completion entries and groups */
#@session@ .completion, .completion-box {
color: @completion-fg@;
background-color: @completion-bg@;
}
#@session@ .completion {
padding: 1px;
}
#@session@ .completion:selected {
color: @completion-highlight-fg@;
background-color: @completion-highlight-bg@;
}
#@session@ .completion-group {
color: @completion-group-fg@;
background-color: @completion-group-bg@;
padding: 2px 4px;
}
/* Statusbar */
#@session@ .statusbar {
color: @statusbar-fg@;
background-color: @statusbar-bg@;
}
/* Tabbar */
#@session@ .tab {
color: @tabbar-fg@;
background-color: @tabbar-bg@;
}
#@session@ label.tab {
padding: 4px;
}
#@session@ .tab:selected {
color: @tabbar-focus-fg@;
background-color: @tabbar-focus-bg@;
}
/* Notification area */
#@session@ .notification {
color: @notification-fg@;
background-color: @notification-bg@;
}
#@session@ .notification-error {
color: @notification-error-fg@;
background-color: @notification-error-bg@;
}
#@session@ .notification-warning {
color: @notification-warning-fg@;
background-color: @notification-warning-bg@;
}
/* Padding of the bottom box */
#@session@ .bottom_box {
border-style: none;
margin: 0px;
padding: @bottombox-padding1@px @bottombox-padding2@px @bottombox-padding3@px
@bottombox-padding4@px;
}
#@session@ scrolledwindow undershoot.top,
#@session@ scrolledwindow undershoot.top:backdrop,
#@session@ scrolledwindow undershoot.bottom,
#@session@ scrolledwindow undershoot.bottom:backdrop,
#@session@ scrolledwindow undershoot.left,
#@session@ scrolledwindow undershoot.left:backdrop,
#@session@ scrolledwindow undershoot.right,
#@session@ scrolledwindow undershoot.right:backdrop
#@session@ scrolledwindow overshoot.top,
#@session@ scrolledwindow overshoot.top:backdrop,
#@session@ scrolledwindow overshoot.bottom,
#@session@ scrolledwindow overshoot.bottom:backdrop,
#@session@ scrolledwindow overshoot.left,
#@session@ scrolledwindow overshoot.left:backdrop,
#@session@ scrolledwindow overshoot.right,
#@session@ scrolledwindow overshoot.right:backdrop {
background-color: transparent;
}
......@@ -12,7 +12,7 @@
* @param widget The widget
* @param event Event
* @param data Custom data
* @return true if no error occured
* @return true if no error occurred
*/
typedef bool (*girara_callback_inputbar_key_press_event_t)(GtkWidget* widget,
GdkEventKey* event, void* data);
......@@ -22,7 +22,7 @@ typedef bool (*girara_callback_inputbar_key_press_event_t)(GtkWidget* widget,
*
* @param entry The inputbar
* @param data Custom data
* @return true if no error occured
* @return true if no error occurred
*/
typedef bool (*girara_callback_inputbar_activate_t)(GtkEntry* entry,
void* data);
......@@ -31,10 +31,10 @@ typedef bool (*girara_callback_inputbar_activate_t)(GtkEntry* entry,
* Default callback for key press events in the view area
*
* @param widget The used widget
* @param event The occured event
* @param event The occurred event
* @param session The used girara session
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
bool girara_callback_view_key_press_event(GtkWidget* widget, GdkEventKey* event,
girara_session_t* session);
......@@ -92,8 +92,8 @@ bool girara_callback_view_scroll_event(GtkWidget* widget, GdkEventScroll* event,
*
* @param entry The inputbar entry
* @param session The used girara session
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
bool girara_callback_inputbar_activate(GtkEntry* entry,
girara_session_t* session);
......@@ -102,10 +102,10 @@ bool girara_callback_inputbar_activate(GtkEntry* entry,
* Default callback if an key in the input bar gets pressed
*
* @param widget The used widget
* @param event The occured event
* @param event The occurred event
* @param session The used girara session
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
bool girara_callback_inputbar_key_press_event(GtkWidget* widget,
GdkEventKey* event, girara_session_t* session);
......@@ -115,8 +115,8 @@ bool girara_callback_inputbar_key_press_event(GtkWidget* widget,
*
* @param widget The used widget
* @param session The used girara session
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
bool girara_callback_inputbar_changed_event(GtkEditable* widget,
girara_session_t* session);
......
......@@ -14,8 +14,8 @@
* @param function Executed function
* @param completion Completion function
* @param description Description of the command
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
bool girara_inputbar_command_add(girara_session_t* session,
const char* command, const char* abbreviation,
......@@ -32,8 +32,8 @@ bool girara_inputbar_command_add(girara_session_t* session,
* (e.g.: incremental search)
* @param argument_n Argument identifier
* @param argument_data Argument data
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
bool girara_special_command_add(girara_session_t* session, char identifier,
girara_inputbar_special_function_t function, bool always, int argument_n,
......
......@@ -9,7 +9,7 @@
* Creates an girara completion object
*
* @return Completion object
* @return NULL An error occured
* @return NULL An error occurred
*/
girara_completion_t* girara_completion_init();
......@@ -17,7 +17,7 @@ girara_completion_t* girara_completion_init();
* Creates an girara completion group
*
* @return Completion object
* @return NULL An error occured
* @return NULL An error occurred
*/
girara_completion_group_t* girara_completion_group_create(
girara_session_t* session, const char* name);
......
......@@ -106,23 +106,8 @@ cb_guioptions(girara_session_t* session, const char* UNUSED(name),
gtk_widget_hide(session->gtk.statusbar);
}
GtkWidget* vscrollbar = gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(session->gtk.view));
GtkWidget* hscrollbar = gtk_scrolled_window_get_hscrollbar(GTK_SCROLLED_WINDOW(session->gtk.view));
if (vscrollbar != NULL) {
if (show_vscrollbar == true) {
gtk_widget_unset_state_flags(vscrollbar, GTK_STATE_FLAG_INSENSITIVE);
} else {
gtk_widget_set_state_flags(vscrollbar, GTK_STATE_FLAG_INSENSITIVE, false);
}
}
if (hscrollbar != NULL) {
if (show_hscrollbar == true) {
gtk_widget_unset_state_flags(hscrollbar, GTK_STATE_FLAG_INSENSITIVE);
} else {
gtk_widget_set_state_flags(hscrollbar, GTK_STATE_FLAG_INSENSITIVE, false);
}
}
scrolled_window_set_scrollbar_visibility(
GTK_SCROLLED_WINDOW(session->gtk.view), show_hscrollbar, show_vscrollbar);
}
static void
......
......@@ -19,7 +19,7 @@ void girara_config_parse(girara_session_t* session, const char* path);
* @param session The girara session
* @param identifier Identifier of the handle
* @param handle Handle
* @return true if no error occured, otherwise false
* @return true if no error occurred, otherwise false
*/
bool girara_config_handle_add(girara_session_t* session, const char* identifier,
girara_command_function_t handle);
......
......@@ -5,6 +5,7 @@
#include "macros.h"
extern const char* CSS_TEMPLATE GIRARA_HIDDEN;
extern const char* CSS_TEMPLATE_PRE_3_20 GIRARA_HIDDEN;
extern const char* CSS_TEMPLATE_POST_3_20 GIRARA_HIDDEN;
#endif
......@@ -11,7 +11,7 @@
/**
* Create a new list.
*
* @return The girara list object or NULL if an error occured
* @return The girara list object or NULL if an error occurred
*/
girara_list_t* girara_list_new(void);
......@@ -19,7 +19,7 @@ girara_list_t* girara_list_new(void);
* Create a new list.
*
* @param gfree Pointer to the free function
* @return The girara list object or NULL if an error occured.
* @return The girara list object or NULL if an error occurred.
*/
girara_list_t* girara_list_new2(girara_free_function_t gfree);
......@@ -27,7 +27,7 @@ girara_list_t* girara_list_new2(girara_free_function_t gfree);
* Create a new (sorted) list.
*
* @param cmp Pointer to the compare function.
* @return The girara list object or NULL if an error occured.
* @return The girara list object or NULL if an error occurred.
*/
girara_list_t* girara_sorted_list_new(girara_compare_function_t cmp);
......@@ -36,7 +36,7 @@ girara_list_t* girara_sorted_list_new(girara_compare_function_t cmp);
*
* @param cmp Pointer to the compare function.
* @param gfree Pointer to the free function
* @return The girara list object or NULL if an error occured.
* @return The girara list object or NULL if an error occurred.
*/
girara_list_t* girara_sorted_list_new2(girara_compare_function_t cmp,
......@@ -94,7 +94,7 @@ void girara_list_remove(girara_list_t* list, void* data);
*
* @param list The girara list object
* @param n Index of the entry
* @return The nth element or NULL if an error occured
* @return The nth element or NULL if an error occurred
*/
void* girara_list_nth(girara_list_t* list, size_t n);
......@@ -147,7 +147,7 @@ void* girara_list_find(girara_list_t* list, girara_compare_function_t compare,
* Create an iterator pointing at the start of list.
*
* @param list The girara list object
* @return The list iterator or NULL if an error occured
* @return The list iterator or NULL if an error occurred
*/
girara_list_iterator_t* girara_list_iterator(girara_list_t* list);
......@@ -155,7 +155,7 @@ girara_list_iterator_t* girara_list_iterator(girara_list_t* list);
* Create an iterator pointing to the same element as iter.
*
* @param iter The girara list iterator to be copied
* @return The list iterator or NULL if an error occured
* @return The list iterator or NULL if an error occurred
*/
girara_list_iterator_t* girara_list_iterator_copy(girara_list_iterator_t* iter);
......@@ -163,7 +163,7 @@ girara_list_iterator_t* girara_list_iterator_copy(girara_list_iterator_t* iter);
* Move iterator to next element.
*
* @param iter The list iterator
* @return The moved iterator or NULL if an error occured
* @return The moved iterator or NULL if an error occurred
*/
girara_list_iterator_t* girara_list_iterator_next(girara_list_iterator_t* iter);
......@@ -179,7 +179,7 @@ bool girara_list_iterator_has_next(girara_list_iterator_t* iter);
* Move iterator to previous element.
*
* @param iter The list iterator
* @return The moved iterator or NULL if an error occured
* @return The moved iterator or NULL if an error occurred
*/
girara_list_iterator_t* girara_list_iterator_previous(girara_list_iterator_t* iter);
......@@ -267,7 +267,7 @@ girara_list_t* girara_list_merge(girara_list_t* list, girara_list_t* other);
* Create a new node.
*
* @param data Data of the new node
* @return A girara node object or NULL if an error occured
* @return A girara node object or NULL if an error occurred
*/
girara_tree_node_t* girara_node_new(void* data);
......@@ -301,7 +301,7 @@ void girara_node_append(girara_tree_node_t* parent, girara_tree_node_t* child);
*
* @param parent The parent node
* @param data The data of the node
* @return The node object or NULL if an error occured
* @return The node object or NULL if an error occurred
*/
girara_tree_node_t* girara_node_append_data(girara_tree_node_t* parent,
void* data);
......@@ -310,7 +310,7 @@ girara_tree_node_t* girara_node_append_data(girara_tree_node_t* parent,
* Get parent node.
*
* @param node The girara node object
* @return The parent node or NULL if an error occured or no parent exists
* @return The parent node or NULL if an error occurred or no parent exists
*/
girara_tree_node_t* girara_node_get_parent(girara_tree_node_t* node);
......@@ -318,7 +318,7 @@ girara_tree_node_t* girara_node_get_parent(girara_tree_node_t* node);
* Get root node.
*
* @param node The girara node object
* @return The root node or NULL if an error occured
* @return The root node or NULL if an error occurred
*/
girara_tree_node_t* girara_node_get_root(girara_tree_node_t* node);
......@@ -326,7 +326,7 @@ girara_tree_node_t* girara_node_get_root(girara_tree_node_t* node);
* Get list of children.
*
* @param node The girara node object
* @return List object containing all child nodes or NULL if an error occured
* @return List object containing all child nodes or NULL if an error occurred
*/
girara_list_t* girara_node_get_children(girara_tree_node_t* node);
......
......@@ -2,6 +2,7 @@
#include "utils.h"
#include <stdarg.h>
#include <stdio.h>
static girara_debug_level_t debug_level = GIRARA_DEBUG;
......
......@@ -310,7 +310,11 @@ girara_list_t*
girara_input_history_list(GiraraInputHistory* history)
{
g_return_val_if_fail(GIRARA_IS_INPUT_HISTORY(history) == true, NULL);
return GIRARA_INPUT_HISTORY_GET_CLASS(history)->list(history);
GiraraInputHistoryClass* klass = GIRARA_INPUT_HISTORY_GET_CLASS(history);
g_return_val_if_fail(klass != NULL && klass->list != NULL, NULL);
return klass->list(history);
}
const char*
......@@ -331,5 +335,9 @@ void
girara_input_history_reset(GiraraInputHistory* history)
{
g_return_if_fail(GIRARA_IS_INPUT_HISTORY(history) == true);
GIRARA_INPUT_HISTORY_GET_CLASS(history)->reset(history);
GiraraInputHistoryClass* klass = GIRARA_INPUT_HISTORY_GET_CLASS(history);
g_return_if_fail(klass != NULL && klass->reset != NULL);
klass->reset(history);
}
......@@ -54,6 +54,10 @@ HIDDEN void widget_add_class(GtkWidget* widget, const char* styleclass);
HIDDEN void widget_remove_class(GtkWidget* widget, const char* styleclass);
HIDDEN void scrolled_window_set_scrollbar_visibility(GtkScrolledWindow* window,
bool show_horizontal,
bool show_vertical);
/**
* Default complection function for the settings
*
......@@ -68,8 +72,8 @@ HIDDEN girara_completion_t* girara_cc_set(girara_session_t* session,
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
HIDDEN bool girara_cmd_map(girara_session_t* session,
girara_list_t* argument_list);
......@@ -79,8 +83,8 @@ HIDDEN bool girara_cmd_map(girara_session_t* session,
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
HIDDEN bool girara_cmd_unmap(girara_session_t* session,
girara_list_t* argument_list);
......@@ -90,8 +94,8 @@ HIDDEN bool girara_cmd_unmap(girara_session_t* session,
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
HIDDEN bool girara_cmd_quit(girara_session_t* session,
girara_list_t* argument_list);
......@@ -101,8 +105,8 @@ HIDDEN bool girara_cmd_quit(girara_session_t* session,
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
HIDDEN bool girara_cmd_set(girara_session_t* session,
girara_list_t* argument_list);
......@@ -112,8 +116,8 @@ HIDDEN bool girara_cmd_set(girara_session_t* session,
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
HIDDEN bool girara_cmd_exec(girara_session_t* session,
girara_list_t* argument_list);
......@@ -124,8 +128,8 @@ HIDDEN bool girara_cmd_exec(girara_session_t* session,
*
* @param session The used girara session
* @param argument_list List of passed arguments
* @return TRUE No error occured
* @return FALSE An error occured
* @return TRUE No error occurred
* @return FALSE An error occurred
*/
HIDDEN bool girara_cmd_dump_config(girara_session_t* session,
girara_list_t* argument_list);
......@@ -138,8 +142,8 @@ HIDDEN bool girara_cmd_dump_config(girara_session_t* session,
* @param argument The argument
* @param event Event type
* @param t Number of times
* @return true No error occured
* @return false An error occured
* @return true No error occurred
* @return false An error occurred
*/
HIDDEN bool girara_sc_feedkeys(girara_session_t* session, girara_argument_t* argument,
girara_event_t* event, unsigned int t);
......@@ -243,7 +247,7 @@ struct girara_config_handle_s
struct girara_statusbar_item_s
{
GtkWidget* box; /**< Event box */
GtkLabel *text; /**< Text label */
GtkLabel* text; /**< Text label */
};
/**
......
......@@ -205,6 +205,48 @@ css_template_changed(GiraraTemplate* csstemplate, girara_session_t* session)
session->private_data->gtk.cssprovider = provider;
}
void
scrolled_window_set_scrollbar_visibility(GtkScrolledWindow* window,
bool show_horizontal,
bool show_vertical)
{
#if GTK_CHECK_VERSION(3, 16, 0)
if (gtk_check_version(3, 16, 0) == NULL) {
GtkPolicyType hpolicy = GTK_POLICY_AUTOMATIC;
GtkPolicyType vpolicy = GTK_POLICY_AUTOMATIC;
if (show_horizontal == false) {
hpolicy = GTK_POLICY_EXTERNAL;
}
if (show_vertical == false) {
vpolicy = GTK_POLICY_EXTERNAL;
}
gtk_scrolled_window_set_policy(window, hpolicy, vpolicy);
return;
}
#endif
GtkWidget* vscrollbar = gtk_scrolled_window_get_vscrollbar(window);
GtkWidget* hscrollbar = gtk_scrolled_window_get_hscrollbar(window);
if (vscrollbar != NULL) {
if (show_vertical == true) {
gtk_widget_unset_state_flags(vscrollbar, GTK_STATE_FLAG_INSENSITIVE);
} else {
gtk_widget_set_state_flags(vscrollbar, GTK_STATE_FLAG_INSENSITIVE, false);
}
}
if (hscrollbar != NULL) {
if (show_horizontal == true) {
gtk_widget_unset_state_flags(hscrollbar, GTK_STATE_FLAG_INSENSITIVE);
} else {
gtk_widget_set_state_flags(hscrollbar, GTK_STATE_FLAG_INSENSITIVE, false);
}
}
}
girara_session_t*
girara_session_create()
{
......@@ -234,7 +276,11 @@ girara_session_create()
(girara_free_function_t) girara_setting_free);
/* CSS style provider */
session->private_data->csstemplate = girara_template_new(CSS_TEMPLATE);
if (gtk_check_version(3, 20, 0) == NULL) {
session->private_data->csstemplate = girara_template_new(CSS_TEMPLATE_POST_3_20);
} else {
session->private_data->csstemplate = girara_template_new(CSS_TEMPLATE_PRE_3_20);
}
session->private_data->gtk.cssprovider = NULL;
init_template_engine(session->private_data->csstemplate);
......@@ -356,20 +402,14 @@ girara_session_init(girara_session_t* session, const char* sessionname)
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(session->gtk.view), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
/* invisible scrollbars */
GtkWidget *vscrollbar = gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(session->gtk.view));
GtkWidget *hscrollbar = gtk_scrolled_window_get_hscrollbar(GTK_SCROLLED_WINDOW(session->gtk.view));
char* guioptions = NULL;
girara_setting_get(session, "guioptions", &guioptions);
if (vscrollbar != NULL && strchr(guioptions, 'v') == NULL) {
gtk_widget_set_state_flags(vscrollbar, GTK_STATE_FLAG_INSENSITIVE, false);
}
if (hscrollbar != NULL) {
if (strchr(guioptions, 'h') == NULL) {
gtk_widget_set_state_flags(hscrollbar, GTK_STATE_FLAG_INSENSITIVE, false);
}
}
const bool show_hscrollbar = strchr(guioptions, 'h') != NULL;
const bool show_vscrollbar = strchr(guioptions, 'v') != NULL;
scrolled_window_set_scrollbar_visibility(
GTK_SCROLLED_WINDOW(session->gtk.view), show_hscrollbar, show_vscrollbar);
g_free(guioptions);