Commit a92d9d14 authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.1'

parents bcfbb9d6 9f3d66a4
......@@ -8,6 +8,7 @@ tests/girara_test-gtk*
.depend
*.pc
version.h
css-definitions.c
*.info
*.gcno
*.gcda
......
......@@ -12,3 +12,5 @@ Maxime de Roucy <maxime.deroucy@gmail.com>
Marwan Tanager <marwan.tngr@gmail.com>
Benoît Knecht <benoit.knecht@fsfe.org>
Abdó Roig-Maranges <abdo.roig@gmail.com>
Alexey Galakhov <agalakhov@gmail.com>
Benoît Taine <ork@olol.eu>
......@@ -2,15 +2,25 @@
include config.mk
include common.mk
include colors.mk
PROJECTNV = girara
PROJECT = girara-gtk3
SOURCE = $(wildcard *.c)
OBJECTS = ${SOURCE:.c=.o}
DOBJECTS = ${SOURCE:.c=.do}
CSOURCE = $(filter-out css-definitions.c, $(SOURCE))
OBJECTS = ${CSOURCE:.c=.o} css-definitions.o
DOBJECTS = ${OBJECTS:.o=.do}
HEADERS = $(filter-out version.h,$(filter-out internal.h,$(wildcard *.h)))
HEADERS_INSTALL = ${HEADERS} version.h
ifneq (${WITH_LIBNOTIFY},0)
INCS += $(LIBNOTIFY_INC)
LIBS += $(LIBNOTIFY_LIB)
CPPFLAGS += -DWITH_LIBNOTIFY
LIBNOTIFY_PC_NAME = libnotify
else
LIBNOTIFY_PC_NAME =
endif
ifeq (,$(findstring -DGETTEXT_PACKAGE,${CPPFLAGS}))
CPPFLAGS += -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\"
......@@ -20,7 +30,7 @@ CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
endif
all: options ${PROJECT} po ${PROJECT}.pc
all: ${PROJECT} po ${PROJECT}.pc
# pkg-config based version checks
.version-checks/%: config.mk
......@@ -40,18 +50,27 @@ options:
@echo "CC = ${CC}"
version.h: version.h.in config.mk
$(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
$(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
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 $<
$(call colorecho,CC,$<)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
%.do: %.c
@mkdir -p .depend
$(ECHO) CC $<
$(call colorecho,CC,$<)
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
${OBJECTS} ${DOBJECTS}: config.mk version.h \
......@@ -62,11 +81,11 @@ static: lib${PROJECT}.a
shared: lib${PROJECT}.so.${SOVERSION}
lib${PROJECT}.a: ${OBJECTS}
$(ECHO) AR rcs $@
$(call colorecho,AR,$@)
$(QUIET)ar rcs $@ ${OBJECTS}
lib${PROJECT}.so.${SOVERSION}: ${OBJECTS}
$(ECHO) LD $@
$(call colorecho,LD,$@)
$(QUIET)${CC} -Wl,-soname,lib${PROJECT}.so.${SOMAJOR} -shared ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
clean:
......@@ -74,18 +93,19 @@ 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-checks version.h.tmp ${PROJECT}.pc.tmp \
css-definitions.c css-definitions.c.tmp
$(QUIET)${MAKE} -C tests clean
$(QUIET)${MAKE} -C po clean
${PROJECT}-debug: lib${PROJECT}-debug.a lib${PROJECT}-debug.so.${SOVERSION}
lib${PROJECT}-debug.a: ${DOBJECTS}
$(ECHO) AR rcs $@
$(call colorecho,AR,$@)
$(QUIET)ar rc $@ ${DOBJECTS}
lib${PROJECT}-debug.so.${SOVERSION}: ${DOBJECTS}
$(ECHO) LD $@
$(call colorecho,LD,$@)
$(QUIET)${CC} -Wl,-soname,lib${PROJECT}.so.${SOMAJOR} -shared ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
debug: options ${PROJECT}-debug
......@@ -109,10 +129,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
......@@ -123,7 +145,9 @@ ${PROJECT}.pc: ${PROJECTNV}.pc.in config.mk
-e 's,@VERSION@,${VERSION},' \
-e 's,@INCLUDEDIR@,${INCLUDEDIR},' \
-e 's,@LIBDIR@,${LIBDIR},' \
${PROJECTNV}.pc.in > ${PROJECT}.pc
-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
......@@ -132,12 +156,12 @@ update-po:
$(QUIET)${MAKE} -C po update-po
install-static: static
$(ECHO) installing static library
$(call colorecho,INSTALL,"Install static library")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}
$(QUIET)install -m 644 lib${PROJECT}.a ${DESTDIR}${LIBDIR}
install-shared: shared
$(ECHO) installing shared library
$(call colorecho,INSTALL,"Install shared library")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}
$(QUIET)install -m 644 lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}
$(QUIET)ln -sf lib${PROJECT}.so.${SOVERSION} ${DESTDIR}${LIBDIR}/lib${PROJECT}.so.${SOMAJOR} || \
......@@ -149,23 +173,23 @@ install: options po install-static install-shared install-headers
$(QUIET)${MAKE} -C po install
install-headers: version.h ${PROJECT}.pc
$(ECHO) installing pkgconfig file
$(call colorecho,INSTALL,"Install pkg-config file")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
$(ECHO) installing header files
$(call colorecho,INSTALL,"Install header files")
$(QUIET)mkdir -m 755 -p ${DESTDIR}${INCLUDEDIR}/girara
$(QUIET)install -m 644 ${HEADERS_INSTALL} ${DESTDIR}${INCLUDEDIR}/girara
uninstall: uninstall-headers
$(ECHO) removing library file
$(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)${MAKE} -C po uninstall
uninstall-headers:
$(ECHO) removing header files
$(call colorecho,UNINSTALL,"Remove header files")
$(QUIET)rm -rf ${INCLUDEDIR}/girara
$(ECHO) removing pkgconfig file
$(call colorecho,UNINSTALL,"Remove pkg-config file")
$(QUIET)rm -f ${LIBDIR}/pkgconfig/${PROJECT}.pc
.PHONY: all options clean debug doc test dist install install-headers uninstall \
......
......@@ -12,6 +12,7 @@ Requirements
glib (>= 2.28)
gtk3 (>= 3.2)
intltool
libnotify (optional, for notification support)
Please note that you need to have a working pkg-config installation
and that the Makefile is only compatible with GNU make.
......
# See LICENSE file for license and copyright information
#
TPUT ?= /usr/bin/tput
TPUT_AVAILABLE ?= $(shell ${TPUT} -V 2>/dev/null)
ifdef TPUT_AVAILABLE
ifeq ($(COLOR),1)
COLOR_NORMAL = `$(TPUT) sgr0`
COLOR_ACTION = `$(TPUT) bold``$(TPUT) setaf 3`
COLOR_COMMENT = `$(TPUT) bold``$(TPUT) setaf 2`
COLOR_BRACKET = `$(TPUT) setaf 4`
define colorecho
@echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] "$(COLOR_COMMENT)$2$(COLOR_BRACKET) $(COLOR_NORMAL)
endef
else
define colorecho
@echo " [$1]" $2
endef
endif
else
define colorecho
@echo " [$1]" $2
endef
endif
......@@ -51,7 +51,8 @@ girara_cmd_map_unmap(girara_session_t* session, girara_list_t* argument_list,
{"Super", GDK_KEY_Super_L},
{"Tab", GDK_KEY_Tab},
{"ShiftTab", GDK_KEY_ISO_Left_Tab},
{"Up", GDK_KEY_Up}
{"Up", GDK_KEY_Up},
{"Print", GDK_KEY_Print}
};
typedef struct gdk_mouse_button_s
......
......@@ -11,7 +11,7 @@
#include "datastructures.h"
#include "utils.h"
static GtkEventBox* girara_completion_row_create(girara_session_t*, const char*, const char*, bool);
static GtkEventBox* girara_completion_row_create(const char*, const char*, bool);
static void girara_completion_row_set_color(girara_session_t*, GtkEventBox*, int);
/* completion */
......@@ -60,7 +60,7 @@ completion_element_free(girara_completion_element_t* element)
/* free element */
g_free(element->value);
g_free(element->description);
g_slice_free(girara_completion_element_t, element);
g_slice_free(girara_completion_element_t, element);
}
girara_completion_t*
......@@ -244,6 +244,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
*/
if (session->gtk.results == NULL) {
session->gtk.results = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 0));
widget_add_class(GTK_WIDGET(session->gtk.results), "completion-box");
if (session->gtk.results == NULL) {
g_free(current_command);
......@@ -268,7 +269,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
girara_internal_completion_entry_t* entry = g_slice_new(girara_internal_completion_entry_t);
entry->group = FALSE;
entry->value = g_strdup(command->command);
entry->widget = girara_completion_row_create(session, command->command, command->description, FALSE);
entry->widget = girara_completion_row_create(command->command, command->description, FALSE);
entries = g_list_append(entries, entry);
......@@ -322,7 +323,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
girara_internal_completion_entry_t* entry = g_slice_new(girara_internal_completion_entry_t);
entry->group = FALSE;
entry->value = g_strdup(command->command);
entry->widget = girara_completion_row_create(session, command->command, command->description, FALSE);
entry->widget = girara_completion_row_create(command->command, command->description, FALSE);
entries = g_list_append(entries, entry);
......@@ -349,7 +350,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
girara_internal_completion_entry_t* entry = g_slice_new(girara_internal_completion_entry_t);
entry->group = TRUE;
entry->value = g_strdup(group->value);
entry->widget = girara_completion_row_create(session, group->value, NULL, TRUE);
entry->widget = girara_completion_row_create(group->value, NULL, TRUE);
entries = g_list_append(entries, entry);
......@@ -360,7 +361,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
girara_internal_completion_entry_t* entry = g_slice_new(girara_internal_completion_entry_t);
entry->group = FALSE;
entry->value = g_strdup(element->value);
entry->widget = girara_completion_row_create(session, element->value, element->description, FALSE);
entry->widget = girara_completion_row_create(element->value, element->description, FALSE);
entries = g_list_append(entries, entry);
......@@ -480,7 +481,7 @@ girara_isc_completion(girara_session_t* session, girara_argument_t* argument, gi
}
static GtkEventBox*
girara_completion_row_create(girara_session_t* session, const char* command, const char* description, bool group)
girara_completion_row_create(const char* command, const char* description, bool group)
{
GtkBox *col = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
......@@ -492,14 +493,6 @@ girara_completion_row_create(girara_session_t* session, const char* command, con
gtk_misc_set_alignment(GTK_MISC(show_command), 0.0, 0.0);
gtk_misc_set_alignment(GTK_MISC(show_description), 1.0, 0.0);
if (group == true) {
gtk_misc_set_padding(GTK_MISC(show_command), 2, 4);
gtk_misc_set_padding(GTK_MISC(show_description), 2, 4);
} else {
gtk_misc_set_padding(GTK_MISC(show_command), 1, 1);
gtk_misc_set_padding(GTK_MISC(show_description), 1, 1);
}
gtk_label_set_use_markup(show_command, TRUE);
gtk_label_set_use_markup(show_description, TRUE);
......@@ -513,21 +506,13 @@ girara_completion_row_create(girara_session_t* session, const char* command, con
g_free(c);
g_free(d);
if (group == true) {
gtk_widget_override_color(GTK_WIDGET(show_command), GTK_STATE_NORMAL, &(session->style.completion_group_foreground));
gtk_widget_override_color(GTK_WIDGET(show_description), GTK_STATE_NORMAL, &(session->style.completion_group_foreground));
gtk_widget_override_background_color(GTK_WIDGET(row), GTK_STATE_NORMAL, &(session->style.completion_group_background));
} else {
gtk_widget_override_color(GTK_WIDGET(show_command), GTK_STATE_NORMAL, &(session->style.completion_foreground));
gtk_widget_override_color(GTK_WIDGET(show_description), GTK_STATE_NORMAL, &(session->style.completion_foreground));
gtk_widget_override_background_color(GTK_WIDGET(row), GTK_STATE_NORMAL, &(session->style.completion_background));
}
gtk_widget_override_font(GTK_WIDGET(show_command), session->style.font);
gtk_widget_override_font(GTK_WIDGET(show_description), session->style.font);
const char* class = group == true ? "completion-group" : "completion";
widget_add_class(GTK_WIDGET(show_command), class);
widget_add_class(GTK_WIDGET(show_description), class);
widget_add_class(GTK_WIDGET(row), class);
gtk_box_pack_start(GTK_BOX(col), GTK_WIDGET(show_command), TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(col), GTK_WIDGET(show_description), TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(col), GTK_WIDGET(show_command), TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(col), GTK_WIDGET(show_description), TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(row), GTK_WIDGET(col));
gtk_widget_show_all(GTK_WIDGET(row));
......@@ -541,23 +526,19 @@ girara_completion_row_set_color(girara_session_t* session, GtkEventBox* row, int
g_return_if_fail(session != NULL);
g_return_if_fail(row != NULL);
GtkBox* col = GTK_BOX(gtk_bin_get_child(GTK_BIN(row)));
GList* items = gtk_container_get_children(GTK_CONTAINER(col));
GtkBox* col = GTK_BOX(gtk_bin_get_child(GTK_BIN(row)));
GList* items = gtk_container_get_children(GTK_CONTAINER(col));
GtkWidget* cmd = GTK_WIDGET(g_list_nth_data(items, 0));
GtkWidget* desc = GTK_WIDGET(g_list_nth_data(items, 1));
if (mode == GIRARA_HIGHLIGHT) {
gtk_widget_override_color(cmd, GTK_STATE_NORMAL, &(session->style.completion_highlight_foreground));
gtk_widget_override_color(desc, GTK_STATE_NORMAL, &(session->style.completion_highlight_foreground));
gtk_widget_override_background_color(cmd, GTK_STATE_NORMAL, &(session->style.completion_highlight_background));
gtk_widget_override_background_color(desc, GTK_STATE_NORMAL, &(session->style.completion_highlight_background));
gtk_widget_override_background_color(GTK_WIDGET(row), GTK_STATE_NORMAL, &(session->style.completion_highlight_background));
gtk_widget_set_state_flags(cmd, GTK_STATE_FLAG_SELECTED, false);
gtk_widget_set_state_flags(desc, GTK_STATE_FLAG_SELECTED, false);
gtk_widget_set_state_flags(GTK_WIDGET(row), GTK_STATE_FLAG_SELECTED, false);
} else {
gtk_widget_override_color(cmd, GTK_STATE_NORMAL, &(session->style.completion_foreground));
gtk_widget_override_color(desc, GTK_STATE_NORMAL, &(session->style.completion_foreground));
gtk_widget_override_background_color(cmd, GTK_STATE_NORMAL, &(session->style.completion_background));
gtk_widget_override_background_color(desc, GTK_STATE_NORMAL, &(session->style.completion_background));
gtk_widget_override_background_color(GTK_WIDGET(row), GTK_STATE_NORMAL, &(session->style.completion_background));
gtk_widget_unset_state_flags(cmd, GTK_STATE_FLAG_SELECTED);
gtk_widget_unset_state_flags(desc, GTK_STATE_FLAG_SELECTED);
gtk_widget_unset_state_flags(GTK_WIDGET(row), GTK_STATE_FLAG_SELECTED);
}
g_list_free(items);
......
......@@ -12,6 +12,7 @@
#include "settings.h"
#include "shortcuts.h"
#include "utils.h"
#include "template.h"
#define COMMENT_PREFIX "\"#"
......@@ -21,18 +22,26 @@ cb_window_icon(girara_session_t* session, const char* UNUSED(name),
{
g_return_if_fail(session != NULL && value != NULL);
if (session->gtk.window != NULL) {
char* path = girara_fix_path(value); // value != NULL
if (session->gtk.window == NULL) {
return;
}
GError* error = NULL;
gtk_window_set_icon_from_file(GTK_WINDOW(session->gtk.window), path, &error);
if (error != NULL) {
girara_error("failed to load window icon: %s", error->message);
g_error_free(error);
}
char* path = girara_fix_path(value);
GtkWindow* window = GTK_WINDOW(session->gtk.window);
free(path);
GError* error = NULL;
gtk_window_set_icon_from_file(window, path, &error);
free(path);
if (error == NULL) {
return;
}
girara_debug("Failed to load window icon (file): %s", error->message);
girara_debug("Trying name instead.");
g_error_free(error);
gtk_window_set_icon_name(window, value);
}
static void
......@@ -41,31 +50,18 @@ 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;
/* inputbar */
if (session->gtk.inputbar_entry != NULL) {
gtk_widget_override_font(GTK_WIDGET(session->gtk.inputbar_entry), font);
}
if (session->gtk.inputbar_dialog != NULL) {
gtk_widget_override_font(GTK_WIDGET(session->gtk.inputbar_dialog), font);
}
/* notification area */
if (session->gtk.notification_text != NULL) {
gtk_widget_override_font(GTK_WIDGET(session->gtk.notification_text), font);
}
GIRARA_LIST_FOREACH(session->elements.statusbar_items, girara_statusbar_item_t *, iter, item)
if (item != NULL){
gtk_widget_override_font(GTK_WIDGET(item->text), font);
}
GIRARA_LIST_FOREACH_END(session->elements.statusbar_items, girara_statusbar_item_t *, iter, item);
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
}
static void
......@@ -124,11 +120,18 @@ cb_guioptions(girara_session_t* session, const char* UNUSED(name),
GtkWidget* hscrollbar = gtk_scrolled_window_get_hscrollbar(GTK_SCROLLED_WINDOW(session->gtk.view));
if (vscrollbar != NULL) {
gtk_widget_set_visible(vscrollbar, show_vscrollbar);
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) {
gtk_widget_set_visible(hscrollbar, show_hscrollbar);
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);
}
}
}
......
......@@ -2,7 +2,7 @@
GIRARA_VERSION_MAJOR = 0
GIRARA_VERSION_MINOR = 2
GIRARA_VERSION_REV = 0
GIRARA_VERSION_REV = 1
VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV}
# Rules for the SOMAJOR and SOMINOR.
......@@ -16,6 +16,9 @@ SOMAJOR = 1
SOMINOR = 1
SOVERSION = ${SOMAJOR}.${SOMINOR}
# libnotify
WITH_LIBNOTIFY ?= $(shell (pkg-config libnotify && echo 1) || echo 0)
# paths
PREFIX ?= /usr
LIBDIR ?= ${PREFIX}/lib
......@@ -40,8 +43,13 @@ GLIB_PKG_CONFIG_NAME = glib-2.0
GTK_INC ?= $(shell pkg-config --cflags gtk+-3.0)
GTK_LIB ?= $(shell pkg-config --libs gtk+-3.0)
INCS = ${GTK_INC}
LIBS = ${GTK_LIB} -lm
ifneq (${WITH_LIBNOTIFY},0)
LIBNOTIFY_INC ?= $(shell pkg-config --cflags libnotify)
LIBNOTIFY_LIB ?= $(shell pkg-config --libs libnotify)
endif
INCS = ${GTK_INC} ${LIBNOTIFY_INC}
LIBS = ${GTK_LIB} ${LIBNOTIFY_LIB} -lm
# flags
CFLAGS += -std=c99 -pedantic -Wall -Wextra -fPIC $(INCS)
......@@ -66,3 +74,6 @@ GETTEXT_PACKAGE ?= lib${PROJECT}-${SOMAJOR}
# msgfmt
MSGFMT ?= msgfmt
# colors
COLOR ?= 1
/* See LICENSE file for license and copyright information */
#ifndef GIRARA_CSS_DEFINITIONS_H
#define GIRARA_CSS_DEFINITIONS_H
extern 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@;
font: @font@;
}
/* Inputbar */
#@session@ GtkEntry.inputbar {
background-color: @inputbar-bg@;
}
#@session@ .inputbar {
color: @inputbar-fg@;
background-color: @inputbar-bg@;
}
/* 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@ GtkLabel.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;
}
......@@ -87,7 +87,7 @@ girara_list_clear(girara_list_t* list)
return;
}
if (list->free) {
if (list->free != NULL) {
g_list_free_full(list->start, list->free);
} else {
g_list_free(list->start);
......@@ -152,11 +152,11 @@ girara_list_remove(girara_list_t* list, void* data)
void*
girara_list_nth(girara_list_t* list, size_t n)
{
g_return_val_if_fail(list, NULL);
g_return_val_if_fail(!list->start || (n < g_list_length(list->start)), NULL);
g_return_val_if_fail(list != NULL, NULL);
g_return_val_if_fail(list->start != NULL && (n < g_list_length(list->start)), NULL);
GList* tmp = g_list_nth(list->start, n);
g_return_val_if_fail(tmp, NULL);
g_return_val_if_fail(tmp != NULL, NULL);
return tmp->data;
}
......@@ -164,14 +164,13 @@ girara_list_nth(girara_list_t* list, size_t n)
bool
girara_list_contains(girara_list_t* list, void* data)
{
g_return_val_if_fail(list, false);
g_return_val_if_fail(list != NULL, false);
if (!list->start) {
return false;
}
GList* tmp = g_list_find(list->start, data);
if (!tmp) {
if (tmp == NULL) {
return false;
}
......@@ -181,7 +180,7 @@ girara_list_contains(girara_list_t* list, void* data)
void*
girara_list_find(girara_list_t* list, girara_compare_function_t compare, const void* data)
{
g_return_val_if_fail(list && compare, NULL);
g_return_val_if_fail(list != NULL && compare != NULL, NULL);
if (list->start == NULL) {
return NULL;
}
......@@ -233,13 +232,12 @@ girara_list_iterator_copy(girara_list_iterator_t* iter)
girara_list_iterator_t*
girara_list_iterator_next(girara_list_iterator_t* iter)
{
if (!iter || !iter->element) {
if (girara_list_iterator_is_valid(iter) == false) {
return NULL;
}
iter->element = g_list_next(iter->element);
if (!iter->element) {
if (iter->element == NULL) {
return NULL;
}
......@@ -249,19 +247,22 @@ girara_list_iterator_next(girara_list_iterator_t* iter)
bool
girara_list_iterator_has_next(girara_list_iterator_t* iter)
{
return iter && iter->element && g_list_next(iter->element);
if (girara_list_iterator_is_valid(iter) == false) {
return false;
}
return g_list_next(iter->element);
}
girara_list_iterator_t*
girara_list_iterator_previous(girara_list_iterator_t* iter)
{
if (!iter || !iter->element) {
if (girara_list_iterator_is_valid(iter) == false) {
return NULL;
}
iter->element = g_list_previous(iter->element);
if (!iter->element) {
if (iter->element == NULL) {
return NULL;
}
......@@ -271,32 +272,38 @@ girara_list_iterator_previous(girara_list_iterator_t* iter)
bool
girara_list_iterator_has_previous(girara_list_iterator_t* iter)
{
return iter && iter->element && g_list_previous(iter->element);
if (girara_list_iterator_is_valid(iter) == false) {
return false;
}
return g_list_previous(iter->element);
}
void
girara_list_iterator_remove(girara_list_iterator_t* iter) {
if (iter && iter->element) {
GList *el = iter->element;
if (iter->list && iter->list->free) {
(iter->list->free)(iter->element->data);
}
if (girara_list_iterator_is_valid(iter) == false) {
return;
}
iter->element = el->next;
iter->list->start = g_list_delete_link(iter->list->start, el);