Commit b6ec0135 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge branch 'release/0.3.0'

parents e4da7cf8 b543d124
......@@ -39,6 +39,22 @@ cb_font(girara_session_t* session, const char* UNUSED(name),
css_template_fill_font(session->private_data->csstemplate, value);
}
static void
cb_color(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{
g_return_if_fail(session != NULL && value != NULL);
const char* str_value = value;
GdkRGBA color = { 0, 0, 0, 0 };
gdk_rgba_parse(&color, str_value);
char* colorstr = gdk_rgba_to_string(&color);
girara_template_set_variable_value(session->private_data->csstemplate, name, colorstr);
g_free(colorstr);
}
static void
cb_guioptions(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
......@@ -170,26 +186,26 @@ girara_config_load_default(girara_session_t* session)
/* settings */
girara_setting_add(session, "font", "monospace normal 9", STRING, FALSE, _("Font"), cb_font, NULL);
girara_setting_add(session, "default-fg", "#DDDDDD", STRING, TRUE, _("Default foreground color"), NULL, NULL);
girara_setting_add(session, "default-bg", "#000000", STRING, TRUE, _("Default background color"), NULL, NULL);
girara_setting_add(session, "inputbar-fg", "#9FBC00", STRING, TRUE, _("Inputbar foreground color"), NULL, NULL);
girara_setting_add(session, "inputbar-bg", "#131313", STRING, TRUE, _("Inputbar background color"), NULL, NULL);
girara_setting_add(session, "statusbar-fg", "#FFFFFF", STRING, TRUE, _("Statusbar foreground color"), NULL, NULL);
girara_setting_add(session, "statusbar-bg", "#000000", STRING, TRUE, _("Statsubar background color"), NULL, NULL);
girara_setting_add(session, "completion-fg", "#DDDDDD", STRING, TRUE, _("Completion foreground color"), NULL, NULL);
girara_setting_add(session, "completion-bg", "#232323", STRING, TRUE, _("Completion background color"), NULL, NULL);
girara_setting_add(session, "completion-group-fg", "#DEDEDE", STRING, TRUE, _("Completion group foreground color"), NULL, NULL);
girara_setting_add(session, "completion-group-bg", "#000000", STRING, TRUE, _("Completion group background color"), NULL, NULL);
girara_setting_add(session, "completion-highlight-fg", "#232323", STRING, TRUE, _("Completion highlight foreground color"), NULL, NULL);
girara_setting_add(session, "completion-highlight-bg", "#9FBC00", STRING, TRUE, _("Completion highlight background color"), NULL, NULL);
girara_setting_add(session, "notification-error-fg", "#FFFFFF", STRING, TRUE, _("Error notification foreground color"), NULL, NULL);
girara_setting_add(session, "notification-error-bg", "#FF1212", STRING, TRUE, _("Error notification background color"), NULL, NULL);
girara_setting_add(session, "notification-warning-fg", "#000000", STRING, TRUE, _("Warning notification foreground color"), NULL, NULL);
girara_setting_add(session, "notification-warning-bg", "#F3F000", STRING, TRUE, _("Warning notifaction background color"), NULL, NULL);
girara_setting_add(session, "notification-fg", "#000000", STRING, TRUE, _("Notification foreground color"), NULL, NULL);
girara_setting_add(session, "notification-bg", "#FFFFFF", STRING, TRUE, _("Notification background color"), NULL, NULL);
girara_setting_add(session, "scrollbar-fg", "#DDDDDD", STRING, TRUE, _("Scrollbar foreground color"), NULL, NULL);
girara_setting_add(session, "scrollbar-bg", "#000000", STRING, TRUE, _("Scrollbar background color"), NULL, NULL);
girara_setting_add(session, "default-fg", "#DDDDDD", STRING, FALSE, _("Default foreground color"), cb_color, NULL);
girara_setting_add(session, "default-bg", "#000000", STRING, FALSE, _("Default background color"), cb_color, NULL);
girara_setting_add(session, "inputbar-fg", "#9FBC00", STRING, FALSE, _("Inputbar foreground color"), cb_color, NULL);
girara_setting_add(session, "inputbar-bg", "#131313", STRING, FALSE, _("Inputbar background color"), cb_color, NULL);
girara_setting_add(session, "statusbar-fg", "#FFFFFF", STRING, FALSE, _("Statusbar foreground color"), cb_color, NULL);
girara_setting_add(session, "statusbar-bg", "#000000", STRING, FALSE, _("Statsubar background color"), cb_color, NULL);
girara_setting_add(session, "completion-fg", "#DDDDDD", STRING, FALSE, _("Completion foreground color"), cb_color, NULL);
girara_setting_add(session, "completion-bg", "#232323", STRING, FALSE, _("Completion background color"), cb_color, NULL);
girara_setting_add(session, "completion-group-fg", "#DEDEDE", STRING, FALSE, _("Completion group foreground color"), cb_color, NULL);
girara_setting_add(session, "completion-group-bg", "#000000", STRING, FALSE, _("Completion group background color"), cb_color, NULL);
girara_setting_add(session, "completion-highlight-fg", "#232323", STRING, FALSE, _("Completion highlight foreground color"), cb_color, NULL);
girara_setting_add(session, "completion-highlight-bg", "#9FBC00", STRING, FALSE, _("Completion highlight background color"), cb_color, NULL);
girara_setting_add(session, "notification-error-fg", "#FFFFFF", STRING, FALSE, _("Error notification foreground color"), cb_color, NULL);
girara_setting_add(session, "notification-error-bg", "#FF1212", STRING, FALSE, _("Error notification background color"), cb_color, NULL);
girara_setting_add(session, "notification-warning-fg", "#000000", STRING, FALSE, _("Warning notification foreground color"), cb_color, NULL);
girara_setting_add(session, "notification-warning-bg", "#F3F000", STRING, FALSE, _("Warning notifaction background color"), cb_color, NULL);
girara_setting_add(session, "notification-fg", "#000000", STRING, FALSE, _("Notification foreground color"), cb_color, NULL);
girara_setting_add(session, "notification-bg", "#FFFFFF", STRING, FALSE, _("Notification background color"), cb_color, NULL);
girara_setting_add(session, "scrollbar-fg", "#DDDDDD", STRING, FALSE, _("Scrollbar foreground color"), cb_color, NULL);
girara_setting_add(session, "scrollbar-bg", "#000000", STRING, FALSE, _("Scrollbar background color"), cb_color, NULL);
girara_setting_add(session, "word-separator", " /.-=&#?", STRING, TRUE, NULL, NULL, NULL);
girara_setting_add(session, "window-width", &window_width, INT, TRUE, _("Initial window width"), NULL, NULL);
girara_setting_add(session, "window-height", &window_height, INT, TRUE, _("Initial window height"), NULL, NULL);
......
......@@ -379,7 +379,10 @@ girara_list_sort(girara_list_t* list, girara_compare_function_t compare)
void
girara_list_foreach(girara_list_t* list, girara_list_callback_t callback, void* data)
{
g_return_if_fail(list && list->start && callback);
g_return_if_fail(list != NULL && callback != NULL);
if (list->start == NULL) {
return;
}
g_list_foreach(list->start, callback, data);
}
......@@ -394,9 +397,7 @@ list_append(void* data, void* userdata)
girara_list_t*
girara_list_merge(girara_list_t* list, girara_list_t* other)
{
if (list == NULL) {
return other;
}
g_return_val_if_fail(list != NULL, NULL);
if (other == NULL) {
return list;
}
......
......@@ -17,7 +17,8 @@ girara_input_history_io_append(GiraraInputHistoryIO* io, const char* input)
GIRARA_INPUT_HISTORY_IO_GET_INTERFACE(io)->append(io, input);
}
girara_list_t* girara_input_history_io_read(GiraraInputHistoryIO* io)
girara_list_t*
girara_input_history_io_read(GiraraInputHistoryIO* io)
{
g_return_val_if_fail(GIRARA_IS_INPUT_HISTORY_IO(io) == true, NULL);
return GIRARA_INPUT_HISTORY_IO_GET_INTERFACE(io)->read(io);
......
......@@ -214,7 +214,7 @@ find_next(GiraraInputHistory* history, const char* current_input, bool next)
size_t i = 0;
const char* command = NULL;
while (i < length) {
for (; i < length; ++i) {
if (priv->reset == true || next == false) {
if (priv->current < 1) {
priv->reset = false;
......@@ -247,8 +247,6 @@ find_next(GiraraInputHistory* history, const char* current_input, bool next)
priv->current_match = priv->current;
break;
}
++i;
}
if (i == length) {
......
......@@ -9,7 +9,7 @@
struct girara_input_history_io_interface_s {
GTypeInterface parent_iface;
/* interface methords */
/* interface methods */
/**
* Write a line of input to the input history storage.
......@@ -111,7 +111,7 @@ struct girara_input_history_class_s {
};
#define GIRARA_TYPE_INPUT_HISTORY \
(girara_input_history_get_type ())
(girara_input_history_get_type())
#define GIRARA_INPUT_HISTORY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GIRARA_TYPE_INPUT_HISTORY, GiraraInputHistory))
#define GIRARA_INPUT_HISTORY_CLASS(obj) \
......
......@@ -6,9 +6,19 @@
#include <glib.h>
#include <stdarg.h>
#include "types.h"
#include "macros.h"
/**
* Log levels
*/
typedef enum girara_log_level_e
{
GIRARA_DEBUG, /**> Debug messages */
GIRARA_INFO, /**> Information debug output */
GIRARA_WARNING, /**> Warning level */
GIRARA_ERROR /**> Error */
} girara_log_level_t;
/**
* Prints a debug message. The arguments are passed to @ref girara_log as
* last argument.
......
......@@ -16,6 +16,7 @@
#include "utils.h"
#include <glib/gi18n-lib.h>
#include <pango/pango-font.h>
#include <stdlib.h>
#ifdef WITH_LIBNOTIFY
......@@ -287,7 +288,7 @@ scrolled_window_set_scrollbar_visibility(GtkScrolledWindow* window,
girara_session_t*
girara_session_create()
girara_session_create(void)
{
ensure_gettext_initialized();
......@@ -380,15 +381,16 @@ girara_session_init(girara_session_t* session, const char* sessionname)
return false;
}
/* set session name */
session->private_data->session_name = g_strdup(
(sessionname == NULL) ? "girara" : sessionname);
bool smooth_scroll = false;
girara_setting_get(session, "smooth-scroll", &smooth_scroll);
if (smooth_scroll == true) {
gtk_widget_add_events(session->gtk.viewport, GDK_SMOOTH_SCROLL_MASK);
}
session->private_data->session_name = g_strdup(
(sessionname == NULL) ? "girara" : sessionname);
/* load CSS style */
fill_template_with_values(session);
g_signal_connect(G_OBJECT(session->private_data->csstemplate), "changed",
......@@ -679,7 +681,6 @@ girara_libnotify(girara_session_t* session, const char *summary,
}
#ifdef WITH_LIBNOTIFY
const bool was_initialized = notify_is_initted();
if (was_initialized == false) {
......@@ -719,11 +720,8 @@ girara_libnotify(girara_session_t* session, const char *summary,
if (was_initialized == false) {
notify_uninit();
}
#else
girara_notify(session, GIRARA_WARNING, "Girara was compiled without libnotify support.");
#endif
}
......@@ -890,25 +888,27 @@ girara_set_window_icon(girara_session_t* session, const char* name)
return false;
}
char* path = girara_fix_path(name);
GtkWindow* window = GTK_WINDOW(session->gtk.window);
char* path = girara_fix_path(name);
bool success = true;
girara_debug("Loading window icon from file: %s", path);
GError* error = NULL;
gtk_window_set_icon_from_file(window, path, &error);
free(path);
if (error == NULL) {
return true;
}
if (g_file_test(path, G_FILE_TEST_EXISTS) == TRUE) {
girara_debug("Loading window icon from file: %s", path);
girara_debug("Failed to load window icon (file): %s", error->message);
g_error_free(error);
GError* error = NULL;
success = gtk_window_set_icon_from_file(window, path, &error);
girara_debug("Loading window icon with name: %s", name);
gtk_window_set_icon_name(window, name);
if (success == false) {
girara_debug("Failed to load window icon (file): %s", error->message);
g_error_free(error);
}
} else {
girara_debug("Loading window icon with name: %s", name);
gtk_window_set_icon_name(window, name);
}
return true;
g_free(path);
return success;
}
girara_list_t*
......
......@@ -91,7 +91,7 @@ struct girara_session_s
* @return A valid session object
* @return NULL when an error occurred
*/
girara_session_t* girara_session_create();
girara_session_t* girara_session_create(void);
/**
* Initializes an girara session
......
......@@ -52,17 +52,6 @@ enum
GIRARA_GOTO_END /**< Go to end of the line */
};
/**
* Log levels
*/
typedef enum girara_log_level_e
{
GIRARA_DEBUG, /**> Debug messages */
GIRARA_INFO, /**> Information debug output */
GIRARA_WARNING, /**> Warning level */
GIRARA_ERROR /**> Error */
} girara_log_level_t;
/**
* Mode identifier
*/
......
project('girara', 'c',
version: '0.2.9',
version: '0.3.0',
meson_version: '>=0.43',
default_options: 'c_std=c11',
)
......@@ -30,11 +30,12 @@ prefix = get_option('prefix')
localedir = get_option('localedir')
# required dependencies
libm = cc.find_library('libm')
libm = cc.find_library('libm', required: false)
glib = dependency('glib-2.0', version: '>=2.50')
gtk3 = dependency('gtk+-3.0', version: '>=3.20')
pango = dependency('pango', version: '>=1.14')
build_dependencies = [libm, glib, gtk3]
build_dependencies = [libm, glib, gtk3, pango]
pc_requires = ['glib-2.0', 'gtk+-3.0']
# defines
......@@ -56,7 +57,7 @@ flags = [
flags = cc.get_supported_arguments(flags)
# optional dependencies
pc_requires_private = []
pc_requires_private = ['pango']
libnotify = dependency('libnotify', version: '>=0.7.0', required: false)
jsonc = dependency('json-c', required: false)
......
......@@ -2,13 +2,15 @@
# See LICENSE file for license and copyright information
#
# Translators:
# salmora8 <shorterfire@gmail.com>, 2012-2013
# Alexandro Casanova <shorterfire@gmail.com>, 2013-2014
# Alexandro Casanova <shorterfire@gmail.com>, 2012-2013
# Alexandro Casanova <shorterfire@gmail.com>, 2012
msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-25 17:52+0100\n"
"PO-Revision-Date: 2015-12-14 21:36+0100\n"
"PO-Revision-Date: 2018-02-04 10:06+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/"
"girara/language/pt_BR/)\n"
......@@ -181,7 +183,7 @@ msgstr "Altura de janela inicial"
#: girara/config.c:196
msgid "Horizontal padding for the status input and notification bars"
msgstr ""
msgstr "Preenchimento horizontal para a entrada de status e barras de notificações"
#: girara/config.c:197
msgid "Vertical padding for the status input and notification bars"
......@@ -218,7 +220,7 @@ msgstr "Mostrar ou ocultar certos elementos da GUI"
#: girara/config.c:205
msgid "Enable smooth scrolling and zooming"
msgstr ""
msgstr "Ativar rolagem suave e zoom"
#. commands
#: girara/config.c:241
......
......@@ -32,7 +32,11 @@ if check.found()
env = environment()
env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())
env.set('HOME', '/home/test')
test('tests-with-home', tests, env: env)
test('tests-with-home', tests,
env: env,
timeout: 60*60,
is_parallel: false
)
env_bin = find_program('env', required: false)
if env_bin.found()
......@@ -41,6 +45,9 @@ if check.found()
test('tests-without-home', env_bin,
args: ['-u', 'HOME', tests],
env: env)
env: env,
timeout: 60*60,
is_parallel: false
)
endif
endif
......@@ -106,7 +106,7 @@ START_TEST(test_datastructures_list_merge) {
fail_unless((girara_list_merge(NULL, NULL) == NULL), NULL);
fail_unless((girara_list_merge(list1, NULL) == list1), NULL);
fail_unless((girara_list_merge(NULL, list2) == list2), NULL);
fail_unless((girara_list_merge(NULL, list2) == NULL), NULL);
girara_list_append(list1, (void*)0);
girara_list_append(list2, (void*)1);
......@@ -227,30 +227,6 @@ START_TEST(test_datastructures_sorted_list) {
girara_list_free(unsorted_list);
} END_TEST
START_TEST(test_datastructures_list_iterator_remove) {
girara_list_t* list = girara_list_new();
for (intptr_t i = 0; i != 10; ++i) {
girara_list_append(list, (void*)i);
}
fail_unless(girara_list_size(list) == 10);
intptr_t next = 0;
GIRARA_LIST_FOREACH(list, intptr_t, iter, data)
fail_unless(next++ == data);
if (data == 5) {
/* this is broken … this will cause an invalid read */
girara_list_remove(list, (void*) data);
}
GIRARA_LIST_FOREACH_END(list, intptr_t, iter, data);
for (intptr_t s = 0; s != 5; ++s) {
fail_unless((intptr_t)girara_list_nth(list, s) == s);
}
for (intptr_t s = 5; s != 9; ++s) {
fail_unless((intptr_t)girara_list_nth(list, s) == s + 1);
}
} END_TEST
static void
node_free(void* data)
{
......
......@@ -256,13 +256,6 @@ START_TEST(test_strings_replace_substrings_3) {
g_free(result);
} END_TEST
START_TEST(test_strings_replace_substrings_4) {
char* result = girara_replace_substring("test test", "t", "es");
fail_unless(result != NULL);
fail_unless(strncmp(result, "eseses eseses", 14) == 0);
g_free(result);
} END_TEST
Suite* suite_utils(void)
{
TCase* tcase = NULL;
......
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