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 ...@@ -14,5 +14,7 @@ css-definitions.c
*.gcda *.gcda
gcov/ gcov/
*.swp *.swp
doc/
.version-checks/ .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 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 no event will the authors be held liable for any damages arising from the use of
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
GIRARA_VERSION_MAJOR = 0 GIRARA_VERSION_MAJOR = 0
GIRARA_VERSION_MINOR = 2 GIRARA_VERSION_MINOR = 2
GIRARA_VERSION_REV = 3 GIRARA_VERSION_REV = 4
VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV} VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV}
# Rules for the SOMAJOR and SOMINOR. # Rules for the SOMAJOR and SOMINOR.
...@@ -12,12 +12,18 @@ VERSION = ${GIRARA_VERSION_MAJOR}.${GIRARA_VERSION_MINOR}.${GIRARA_VERSION_REV} ...@@ -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 # * If any of the exported datastructures have changed in a incompatible way
# bump SOMAJOR and set SOMINOR to 0. # bump SOMAJOR and set SOMINOR to 0.
# * If a function has been added bump SOMINOR. # * If a function has been added bump SOMINOR.
SOMAJOR = 1 SOMAJOR = 2
SOMINOR = 1 SOMINOR = 0
SOVERSION = ${SOMAJOR}.${SOMINOR} SOVERSION = ${SOMAJOR}.${SOMINOR}
# pkg-config binary
PKG_CONFIG ?= pkg-config
# libnotify # 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 # paths
PREFIX ?= /usr PREFIX ?= /usr
...@@ -27,6 +33,14 @@ INCLUDEDIR ?= ${PREFIX}/include ...@@ -27,6 +33,14 @@ INCLUDEDIR ?= ${PREFIX}/include
# locale directory # locale directory
LOCALEDIR ?= ${PREFIX}/share/locale 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 # version checks
# If you want to disable any of the checks, set *_VERSION_CHECK to 0. # If you want to disable any of the checks, set *_VERSION_CHECK to 0.
...@@ -40,16 +54,21 @@ GLIB_MIN_VERSION = 2.28 ...@@ -40,16 +54,21 @@ GLIB_MIN_VERSION = 2.28
GLIB_PKG_CONFIG_NAME = glib-2.0 GLIB_PKG_CONFIG_NAME = glib-2.0
# libs # libs
GTK_INC ?= $(shell pkg-config --cflags gtk+-3.0) GTK_INC ?= $(shell ${PKG_CONFIG} --cflags gtk+-3.0)
GTK_LIB ?= $(shell pkg-config --libs gtk+-3.0) GTK_LIB ?= $(shell ${PKG_CONFIG} --libs gtk+-3.0)
ifneq (${WITH_LIBNOTIFY},0) ifneq (${WITH_LIBNOTIFY},0)
LIBNOTIFY_INC ?= $(shell pkg-config --cflags libnotify) LIBNOTIFY_INC ?= $(shell ${PKG_CONFIG} --cflags libnotify)
LIBNOTIFY_LIB ?= $(shell pkg-config --libs 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 endif
INCS = ${GTK_INC} ${LIBNOTIFY_INC} INCS = ${GTK_INC} ${LIBNOTIFY_INC} ${JSON_INC}
LIBS = ${GTK_LIB} ${LIBNOTIFY_LIB} -lm LIBS = ${GTK_LIB} ${LIBNOTIFY_LIB} ${JSON_LIB} -lm
# flags # flags
CFLAGS += -std=c99 -pedantic -Wall -Wextra -fPIC $(INCS) CFLAGS += -std=c99 -pedantic -Wall -Wextra -fPIC $(INCS)
...@@ -63,9 +82,16 @@ DFLAGS = -O0 -g ...@@ -63,9 +82,16 @@ DFLAGS = -O0 -g
# compiler # compiler
CC ?= gcc CC ?= gcc
# archiver
AR ?= ar
# strip # strip
SFLAGS ?= -s SFLAGS ?= -s
# soname
SONAME_FLAG ?= -soname
SHARED_FLAG ?= -shared
# set to something != 0 if you want verbose build output # set to something != 0 if you want verbose build output
VERBOSE ?= 0 VERBOSE ?= 0
...@@ -75,9 +101,18 @@ GETTEXT_PACKAGE ?= lib${PROJECT}-${SOMAJOR} ...@@ -75,9 +101,18 @@ GETTEXT_PACKAGE ?= lib${PROJECT}-${SOMAJOR}
# msgfmt # msgfmt
MSGFMT ?= 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 # colors
COLOR ?= 1 COLOR ?= 1
# dist # dist
TARFILE = ${PROJECTNV}-${VERSION}.tar.gz TARFILE = ${PROJECTNV}-${VERSION}.tar.gz
TARDIR = ${PROJECTNV}-${VERSION}
...@@ -97,3 +97,14 @@ ...@@ -97,3 +97,14 @@
padding: @bottombox-padding1@px @bottombox-padding2@px @bottombox-padding3@px padding: @bottombox-padding1@px @bottombox-padding2@px @bottombox-padding3@px
@bottombox-padding4@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 @@ ...@@ -2,7 +2,7 @@
# General information # General information
PROJECT_NAME = girara PROJECT_NAME = girara
OUTPUT_DIRECTORY = ./doc/ OUTPUT_DIRECTORY = build
OUTPUT_LANGUAGE = English OUTPUT_LANGUAGE = English
TAB_SIZE = 2 TAB_SIZE = 2
EXTRACT_ALL = YES EXTRACT_ALL = YES
...@@ -16,9 +16,9 @@ WARNINGS = YES ...@@ -16,9 +16,9 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES WARN_IF_UNDOCUMENTED = YES
# Input files # Input files
INPUT = INPUT = ../
EXCLUDE = ./tests EXCLUDE = ../tests
FILE_PATTERNS = *.h *.c FILE_PATTERNS = *.h
RECURSIVE = YES RECURSIVE = YES
# Output files # Output files
...@@ -28,3 +28,6 @@ GENERATE_RTF = NO ...@@ -28,3 +28,6 @@ GENERATE_RTF = NO
GENERATE_XML = NO GENERATE_XML = NO
SOURCE_BROWSER = YES 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), ...@@ -50,18 +50,8 @@ cb_font(girara_session_t* session, const char* UNUSED(name),
{ {
g_return_if_fail(session != NULL && value != NULL); 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", girara_template_set_variable_value(session->private_data->csstemplate, "font",
fontname); value);
g_free(fontname);
GIRARA_UNIGNORE
} }
static void static void
...@@ -280,11 +270,14 @@ girara_config_load_default(girara_session_t* session) ...@@ -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); girara_inputbar_shortcut_add(session, GDK_CONTROL_MASK, GDK_KEY_n, girara_isc_command_history, GIRARA_NEXT, NULL);
/* commands */ /* commands */
girara_inputbar_command_add(session, "exec", NULL, girara_cmd_exec, NULL, _("Execute a command")); 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, "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, "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, "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, "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 */ /* config handle */
girara_config_handle_add(session, "map", girara_cmd_map); girara_config_handle_add(session, "map", girara_cmd_map);
...@@ -352,30 +345,31 @@ config_parse(girara_session_t* session, const char* path) ...@@ -352,30 +345,31 @@ config_parse(girara_session_t* session, const char* path)
while ((line = girara_file_read_line(file)) != NULL) { while ((line = girara_file_read_line(file)) != NULL) {
/* skip empty lines and comments */ /* skip empty lines and comments */
if (strlen(line) == 0 || strchr(COMMENT_PREFIX, line[0]) != NULL) { if (strlen(line) == 0 || strchr(COMMENT_PREFIX, line[0]) != NULL) {
free(line); g_free(line);
continue; continue;
} }
gchar** argv = NULL;
gint argc = 0;
girara_list_t* argument_list = girara_list_new(); girara_list_t* argument_list = girara_list_new();
if (argument_list == NULL) { if (argument_list == NULL) {
free(line); g_free(line);
fclose(file); fclose(file);
return false; return false;
} }
girara_list_set_free_function(argument_list, g_free); 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) { 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]); char* argument = g_strdup(argv[i]);
girara_list_append(argument_list, (void*) argument); girara_list_append(argument_list, (void*) argument);
} }
} else { } else {
girara_list_free(argument_list); girara_list_free(argument_list);
fclose(file); fclose(file);
free(line); g_free(line);
return false; return false;
} }
...@@ -399,7 +393,7 @@ config_parse(girara_session_t* session, const char* path) ...@@ -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); girara_warning("Could not process line %d in '%s': trying to include itself.", line_number, path);
} else { } else {
girara_debug("Loading config file '%s'.", newpath); 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); 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) ...@@ -426,7 +420,7 @@ config_parse(girara_session_t* session, const char* path)
line_number++; line_number++;
girara_list_free(argument_list); girara_list_free(argument_list);
g_strfreev(argv); g_strfreev(argv);
free(line); g_free(line);
} }
fclose(file); fclose(file);
......
...@@ -52,6 +52,8 @@ HIDDEN void update_state_by_keyval(int *state, int keyval); ...@@ -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_add_class(GtkWidget* widget, const char* styleclass);
HIDDEN void widget_remove_class(GtkWidget* widget, const char* styleclass);
/** /**
* Default complection function for the settings * Default complection function for the settings
* *
...@@ -107,7 +109,8 @@ HIDDEN bool girara_cmd_set(girara_session_t* session, ...@@ -107,7 +109,8 @@ HIDDEN bool girara_cmd_set(girara_session_t* session,
/** /**
* Execute an external command * Execute an external command
* * @param session The used girara session *
* @param session The used girara session
* @param argument_list List of passed arguments * @param argument_list List of passed arguments
* @return TRUE No error occured * @return TRUE No error occured
* @return FALSE An error occured * @return FALSE An error occured
...@@ -115,6 +118,19 @@ HIDDEN bool girara_cmd_set(girara_session_t* session, ...@@ -115,6 +118,19 @@ HIDDEN bool girara_cmd_set(girara_session_t* session,
HIDDEN bool girara_cmd_exec(girara_session_t* session, HIDDEN bool girara_cmd_exec(girara_session_t* session,
girara_list_t* argument_list); 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 * 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) ...@@ -89,67 +89,52 @@ fill_template_with_values(girara_session_t* session)
char* font = NULL; char* font = NULL;
girara_setting_get(session, "font", &font); girara_setting_get(session, "font", &font);
if (font != NULL) { if (font != NULL) {
GIRARA_IGNORE_DEPRECATED girara_template_set_variable_value(csstemplate, "font", font);
pango_font_description_free(session->style.font);
session->style.font = pango_font_description_from_string(font);
GIRARA_UNIGNORE
g_free(font); g_free(font);
}
GIRARA_IGNORE_DEPRECATED
if (session->style.font == NULL) {
girara_template_set_variable_value(csstemplate, "font", "monospace normal 9");
} else { } else {
char* fontname = pango_font_description_to_string(session->style.font); girara_template_set_variable_value(csstemplate, "font", "monospace normal 9");
girara_template_set_variable_value(csstemplate, "font", fontname); };
g_free(fontname);
}
GIRARA_UNIGNORE
/* parse color values */ /* parse color values */
typedef struct color_setting_mapping_s { const char* color_settings[] = {
const char* identifier; "default-fg",
GdkRGBA *color; "default-bg",
} color_setting_mapping_t; "inputbar-fg",
"inputbar-bg",
GIRARA_IGNORE_DEPRECATED "statusbar-fg",
const color_setting_mapping_t color_setting_mappings[] = { "statusbar-bg",
{"default-fg", &(session->style.default_foreground)}, "completion-fg",
{"default-bg", &(session->style.default_background)}, "completion-bg",
{"inputbar-fg", &(session->style.inputbar_foreground)}, "completion-group-fg",
{"inputbar-bg", &(session->style.inputbar_background)}, "completion-group-bg",
{"statusbar-fg", &(session->style.statusbar_foreground)}, "completion-highlight-fg",
{"statusbar-bg", &(session->style.statusbar_background)}, "completion-highlight-bg",
{"completion-fg", &(session->style.completion_foreground)}, "notification-error-fg",
{"completion-bg", &(session->style.completion_background)}, "notification-error-bg",
{"completion-group-fg", &(session->style.completion_group_foreground)}, "notification-warning-fg",
{"completion-group-bg", &(session->style.completion_group_background)}, "notification-warning-bg",
{"completion-highlight-fg", &(session->style.completion_highlight_foreground)}, "notification-fg",
{"completion-highlight-bg", &(session->style.completion_highlight_background)}, "notification-bg",
{"notification-error-fg", &(session->style.notification_error_foreground)}, "tabbar-fg",
{"notification-error-bg", &(session->style.notification_error_background)}, "tabbar-bg",
{"notification-warning-fg", &(session->style.notification_warning_foreground)}, "tabbar-focus-fg",
{"notification-warning-bg", &(session->style.notification_warning_background)}, "tabbar-focus-bg",
{"notification-fg", &(session->style.notification_default_foreground)},
{"notification-bg", &(session->style.notification_default_background)},
{"tabbar-fg", &(session->style.tabbar_foreground)},
{"tabbar-bg", &(session->style.tabbar_background)},
{"tabbar-focus-fg", &(session->style.tabbar_focus_foreground)},
{"tabbar-focus-bg", &(session->style.tabbar_focus_background)},
}; };
GIRARA_UNIGNORE
for (size_t i = 0; i < LENGTH(color_setting_mappings); i++) { for (size_t i = 0; i < LENGTH(color_settings); i++) {
char* tmp_value = NULL; char* tmp_value = NULL;
girara_setting_get(session, color_setting_mappings[i].identifier, &tmp_value); girara_setting_get(session, color_settings[i], &tmp_value);
GdkRGBA color = { 0, 0, 0, 0 };
if (tmp_value != NULL) { if (tmp_value != NULL) {
gdk_rgba_parse(color_setting_mappings[i].color, tmp_value); gdk_rgba_parse(&color, tmp_value);
g_free(tmp_value); g_free(tmp_value);
} }
char* color = gdk_rgba_to_string(color_setting_mappings[i].color); char* colorstr = gdk_rgba_to_string(&color);
girara_template_set_variable_value(csstemplate, girara_template_set_variable_value(csstemplate, color_settings[i],
color_setting_mappings[i].identifier, color); colorstr);
g_free(color); g_free(colorstr);
} }
/* we want inputbar_entry the same height as notification_text and statusbar, /* we want inputbar_entry the same height as notification_text and statusbar,
...@@ -283,7 +268,7 @@ girara_session_create() ...@@ -283,7 +268,7 @@ girara_session_create()
gtk_box_set_homogeneous(session->gtk.inputbar_box, TRUE); gtk_box_set_homogeneous(session->gtk.inputbar_box, TRUE);
session->gtk.view = gtk_scrolled_window_new(NULL, NULL); session->gtk.view = gtk_scrolled_window_new(NULL, NULL);
session->gtk.viewport = gtk_viewport_new(NULL, NULL); session->gtk.viewport = gtk_viewport_new(NULL, NULL);
#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4 #if GTK_CHECK_VERSION(3, 4, 0)
gtk_widget_add_events(session->gtk.viewport, GDK_SCROLL_MASK); gtk_widget_add_events(session->gtk.viewport, GDK_SCROLL_MASK);
#endif #endif
session->gtk.statusbar = gtk_event_box_new(); session->gtk.statusbar = gtk_event_box_new();
...@@ -294,12 +279,6 @@ girara_session_create() ...@@ -294,12 +279,6 @@ girara_session_create()
session->gtk.inputbar = gtk_event_box_new(); session->gtk.inputbar = gtk_event_box_new();
session->gtk.tabs = GTK_NOTEBOOK(gtk_notebook_new()); session->gtk.tabs = GTK_NOTEBOOK(gtk_notebook_new());
/* deprecated members */
GIRARA_IGNORE_DEPRECATED
session->settings = session->private_data->settings;
session->global.command_history = girara_get_command_history(session);
GIRARA_UNIGNORE
return session; return session;
} }
...@@ -310,7 +289,7 @@ girara_session_init(girara_session_t* session, const char* sessionname) ...@@ -310,7 +289,7 @@ girara_session_init(girara_session_t* session, const char* sessionname)
return false; return false;
} }
#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 4 #if GTK_CHECK_VERSION(3, 4, 0)
bool smooth_scroll = false; bool smooth_scroll = false;
girara_setting_get(session, "smooth-scroll", &smooth_scroll); girara_setting_get(session, "smooth-scroll", &smooth_scroll);
if (smooth_scroll) { if (smooth_scroll) {
...@@ -327,11 +306,15 @@ girara_session_init(girara_session_t* session, const char* sessionname) ...@@ -327,11 +306,15 @@ girara_session_init(girara_session_t* session, const char* sessionname)
G_CALLBACK(css_template_changed), session); G_CALLBACK(css_template_changed), session);
/* window */ /* window */
#ifdef GDK_WINDOWING_X11
if (session->gtk.embed != 0) { if (session->gtk.embed != 0) {
session->gtk.window = gtk_plug_new(session->gtk.embed); session->gtk.window = gtk_plug_new(session->gtk.embed);
} else { } else {
#endif
session->gtk.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); session->gtk.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
#ifdef GDK_WINDOWING_X11
} }
#endif
gtk_widget_set_name(GTK_WIDGET(session->gtk.window), gtk_widget_set_name(GTK_WIDGET(session->gtk.window),
session->private_data->session_name); session->private_data->session_name);
...@@ -475,8 +458,6 @@ girara_session_init(girara_session_t* session, const char* sessionname) ...@@ -475,8 +458,6 @@ girara_session_init(girara_session_t* session, const char* sessionname)
/* notification area */ /* notification area */
widget_add_class(session->gtk.notification_area, "notification"); widget_add_class(session->gtk.notification_area, "notification");
widget_add_class(session->gtk.notification_text, "notification"); widget_add_class(session->gtk.notification_text, "notification");
gtk_style_context_save(gtk_widget_get_style_context(session->gtk.notification_area));
gtk_style_context_save(gtk_widget_get_style_context(session->gtk.notification_text));
/* set window size */ /* set window size */
int window_width = 0; int window_width = 0;
...@@ -545,13 +526,6 @@ girara_session_destroy(girara_session_t* session) ...@@ -545,13 +526,6 @@ girara_session_destroy(girara_session_t* session)
{ {
g_return_val_if_fail(session != NULL, FALSE); g_return_val_if_fail(session != NULL, FALSE);
/* clean up style */
GIRARA_IGNORE_DEPRECATED
if (session->style.font != NULL) {
pango_font_description_free(session->style.font);
}
GIRARA_UNIGNORE
/* clean up shortcuts */ /* clean up shortcuts */
girara_list_free(session->bindings.shortcuts); girara_list_free(session->bindings.shortcuts);
session->bindings.shortcuts = NULL; session->bindings.shortcuts = NULL;
...@@ -611,9 +585,6 @@ girara_session_destroy(girara_session_t* session) ...@@ -611,9 +585,6 @@ girara_session_destroy(girara_session_t* session)
/* clean up private data */ /* clean up private data */
girara_session_private_free(session->private_data); girara_session_private_free(session->private_data);
session->private_data = NULL; session->private_data = NULL;
GIRARA_IGNORE_DEPRECATED
session->settings = NULL;
GIRARA_UNIGNORE
/* clean up session */ /* clean up session */
g_slice_free(girara_session_t, session); g_slice_free(girara_session_t, session);
...@@ -699,21 +670,15 @@ girara_notify(girara_session_t* session, int level, const char* format, ...) ...@@ -699,21 +670,15 @@ girara_notify(girara_session_t* session, int level, const char* format, ...)
return; return;
} }
GtkStyleContext* area_context = gtk_widget_get_style_context(session->gtk.notification_area); bool error_class = false;
GtkStyleContext* text_context = gtk_widget_get_style_context(session->gtk.notification_text); bool warning_class = false;
gtk_style_context_restore(area_context);
gtk_style_context_restore(text_context);
gtk_style_context_save(area_context);
gtk_style_context_save(text_context);
const char* cssclass = NULL;
switch (level) { switch (level) {
case GIRARA_ERROR: case GIRARA_ERROR:
cssclass = "notification-error"; error_class = true;
break; break;
case GIRARA_WARNING: case GIRARA_WARNING:
cssclass = "notification-warning"; warning_class = true;
break; break;
case GIRARA_INFO: case GIRARA_INFO:
break; break;
...@@ -721,9 +686,19 @@ girara_notify(girara_session_t* session, int level, const char* format, ...) ...@@ -721,9 +686,19 @@ girara_notify(girara_session_t* session, int level, const char* format, ...)
return; return;
} }
if (cssclass != NULL) { if (error_class == true) {
widget_add_class(session->gtk.notification_area, cssclass); widget_add_class(session->gtk.notification_area, "notification-error");
widget_add_class(session->gtk.notification_text, cssclass); widget_add_class(session->gtk.notification_text, "notification-error");
} else {
widget_remove_class(session->gtk.notification_area, "notification-error");
widget_remove_class(session->gtk.notification_text, "notification-error");
}
if (warning_class == true) {
widget_add_class(session->gtk.notification_area, "notification-warning");
widget_add_class(session->gtk.notification_text, "notification-warning");