Commit d5929b47 authored by Sebastian Ramacher's avatar Sebastian Ramacher
Browse files

Merge branch 'release/0.3.8'

parents 5c3c13cf 9aa8983a
Pipeline #556 passed with stages
in 1 minute and 8 seconds
......@@ -32,12 +32,12 @@ test:archlinux:
except:
- tags
# Debian 10 (Buster)
build:debian-buster:
# Debian 11 (bullseye)
build:debian-bullseye:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:buster
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bullseye
script:
- mkdir -p build && cd build
- meson ..
......@@ -49,25 +49,25 @@ build:debian-buster:
except:
- tags
test:debian-buster:
test:debian-bullseye:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:buster
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bullseye
script:
- cd build
- ninja test
dependencies:
- build:debian-buster
- build:debian-bullseye
except:
- tags
# Ubuntu 18.04 LTS (Bionic Beaver)
build:ubuntu-bionic:
# Debian 12 (bookworm)
build:debian-bookworm:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:bionic
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bookworm
script:
- mkdir -p build && cd build
- meson ..
......@@ -79,25 +79,25 @@ build:ubuntu-bionic:
except:
- tags
test:ubuntu-bionic:
test:debian-bookworm:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:bionic
image: registry.pwmt.org/pwmt/gitlab-runner-images/debian:bookworm
script:
- cd build
- ninja test
dependencies:
- build:ubuntu-bionic
- build:debian-bookworm
except:
- tags
# Ubuntu 19.10 (Eoan Ermine)
build:ubuntu-eoan:
# Ubuntu 20.04 LTS (focal)
build:ubuntu-focal:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:eoan
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:focal
script:
- mkdir -p build && cd build
- meson ..
......@@ -109,15 +109,46 @@ build:ubuntu-eoan:
except:
- tags
test:ubuntu-eoan:
test:ubuntu-focal:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:eoan
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:focal
script:
- cd build
- ninja test
dependencies:
- build:ubuntu-eoan
- build:ubuntu-focal
except:
- tags
# Ubuntu 22.04 LTS (jammy)
build:ubuntu-jammy:
tags:
- pwmt
stage: build
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:jammy
script:
- mkdir -p build && cd build
- meson ..
- ninja
artifacts:
expire_in: 1 day
paths:
- build
except:
- tags
test:ubuntu-jammy:
tags:
- pwmt
stage: test
image: registry.pwmt.org/pwmt/gitlab-runner-images/ubuntu:jammy
script:
- cd build
- ninja test
dependencies:
- build:ubuntu-jammy
except:
- tags
......@@ -18,21 +18,22 @@ The following dependencies are required:
The following dependencies are optional:
* `libnotify`: notification support
* `json-c`: configuration dumping support
* `libnotify`: notification support (deprecated, disabled by default)
* `json-glib-1.0`: configuration dumping support
For building girara, the following dependencies are also required:
* `meson` (>= 0.56)
* `gettext`
* `pkgconf`
The following dependencies are optional build-time only dependencies:
* `check` (>= 0.11): for tests
* `doxygen`: HTML documentation
To disable the optional support for `libnotify` and `json-c`, configure the build
system with `-Dnotify=disabled` or `-Djson=disabled`.
To disable the optional support for `json-glib-1.0`, configure the build system
with `-Djson=disabled`.
Installation
------------
......
......@@ -140,7 +140,7 @@ char* girara_buffer_get(girara_session_t* session) GIRARA_VISIBLE;
* @param body The content
*/
void girara_libnotify(girara_session_t* session, const char *summary,
const char *body) GIRARA_VISIBLE;
const char *body) GIRARA_VISIBLE GIRARA_DEPRECATED_;
/**
* Displays a notification for the user. It is possible to pass GIRARA_INFO,
......
......@@ -5,7 +5,7 @@
#include <glib/gi18n-lib.h>
#include <string.h>
#ifdef WITH_JSON
#include <json.h>
#include <json-glib/json-glib.h>
#endif
#include "settings.h"
......@@ -236,6 +236,47 @@ girara_cc_set(girara_session_t* session, const char* input)
}
#ifdef WITH_JSON
static void dump_setting(JsonBuilder* builder, const girara_setting_t* setting) {
json_builder_set_member_name(builder, setting->name);
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "value");
const char* type = NULL;
switch (setting->type) {
case BOOLEAN:
json_builder_add_boolean_value(builder, setting->value.b);
type = "boolean";
break;
case FLOAT:
json_builder_add_double_value(builder, setting->value.f);
type = "float";
break;
case INT:
json_builder_add_int_value(builder, setting->value.i);
type = "int";
break;
case STRING:
json_builder_add_string_value(builder,
setting->value.s ? setting->value.s : "");
type = "string";
break;
default:
girara_debug("Invalid setting: %s", setting->name);
}
if (type != NULL) {
json_builder_set_member_name(builder, "type");
json_builder_add_string_value(builder, type);
}
if (setting->description != NULL) {
json_builder_set_member_name(builder, "description");
json_builder_add_string_value(builder, setting->description);
}
json_builder_set_member_name(builder, "init-only");
json_builder_add_boolean_value(builder, setting->init_only);
json_builder_end_object(builder);
}
bool
girara_cmd_dump_config(girara_session_t* session, girara_list_t* argument_list)
{
......@@ -253,52 +294,31 @@ girara_cmd_dump_config(girara_session_t* session, girara_list_t* argument_list)
return false;
}
json_object* json_config = json_object_new_object();
JsonBuilder* builder = json_builder_new();
json_builder_begin_object(builder);
GIRARA_LIST_FOREACH_BODY(session->private_data->settings, girara_setting_t*, setting,
json_object* json_setting = json_object_new_object();
json_object* json_value = NULL;
json_object* json_type = NULL;
switch(setting->type) {
case BOOLEAN:
json_value = json_object_new_boolean(setting->value.b);
json_type = json_object_new_string("boolean");
break;
case FLOAT:
json_value = json_object_new_double(setting->value.f);
json_type = json_object_new_string("float");
break;
case INT:
json_value = json_object_new_int(setting->value.i);
json_type = json_object_new_string("int");
break;
case STRING:
json_value = json_object_new_string(setting->value.s ? setting->value.s : "");
json_type = json_object_new_string("string");
break;
default:
girara_debug("Invalid setting: %s", setting->name);
}
if (json_value != NULL) {
json_object_object_add(json_setting, "value", json_value);
json_object_object_add(json_setting, "type", json_type);
}
if (setting->description != NULL) {
json_object_object_add(json_setting, "description",
json_object_new_string(setting->description));
}
json_object_object_add(json_setting, "init-only",
json_object_new_boolean(setting->init_only));
json_object_object_add(json_config, setting->name, json_setting);
dump_setting(builder, setting);
);
json_builder_end_object(builder);
JsonGenerator* gen = json_generator_new();
json_generator_set_pretty(gen, true);
JsonNode* root = json_builder_get_root(builder);
json_generator_set_root(gen, root);
bool ret = true;
GError* error = NULL;
if (!json_generator_to_file(gen, girara_list_nth(argument_list, 0), &error)) {
girara_warning("Failed to write JSON: %s", error->message);
girara_notify(session, GIRARA_ERROR, _("Failed to write JSON: %s"), error->message);
g_error_free(error);
ret = false;
}
json_object_to_file_ext(girara_list_nth(argument_list, 0), json_config,
JSON_C_TO_STRING_PRETTY);
json_object_put(json_config);
json_node_free(root);
g_object_unref(gen);
g_object_unref(builder);
return true;
return ret;
}
#endif
......@@ -409,7 +409,7 @@ girara_escape_string(const char* value)
GString* str = g_string_new("");
while (*value != '\0') {
const char c = *value++;
if (strchr("\\ \t\"\'", c) != NULL) {
if (strchr("\\ \t\"\'#", c) != NULL) {
g_string_append_c(str, '\\');
}
g_string_append_c(str, c);
......
project('girara', 'c',
version: '0.3.7',
version: '0.3.8',
meson_version: '>=0.56',
default_options: ['c_std=c11', 'warning_level=3'],
)
......@@ -63,7 +63,7 @@ flags = cc.get_supported_arguments(flags)
# optional dependencies
pc_requires_private = ['pango']
libnotify = dependency('libnotify', version: '>=0.7.0', required: get_option('notify'))
jsonc = dependency('json-c', required: get_option('json'))
jsonc = dependency('json-glib-1.0', required: get_option('json'))
if libnotify.found()
build_dependencies += libnotify
......@@ -74,7 +74,7 @@ endif
if jsonc.found()
build_dependencies += jsonc
defines += '-DWITH_JSON'
pc_requires_private += 'json-c'
pc_requires_private += 'json-glib-1.0'
endif
# generate version header file
......
......@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 15:12+0000\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2012-03-26 16:41+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Arabic (http://www.transifex.com/pwmt/girara/language/ar/)\n"
"Language: ar\n"
......@@ -226,11 +226,16 @@ msgstr ""
msgid "Dump settings to a file"
msgstr ""
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr ""
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr ""
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -11,9 +11,9 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 15:12+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"POT-Creation-Date: 2022-11-27 16:25+0100\n"
"PO-Revision-Date: 2022-09-10 11:36+0200\n"
"Language-Team: German (http://www.transifex.com/pwmt/girara/language/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
......@@ -234,11 +234,16 @@ msgstr "Tastenfolge entbinden"
msgid "Dump settings to a file"
msgstr "Speichere Einstellungen in einer Datei"
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr "Ungültige Anzahl an Argumente übergeben: %zu anstatt von 1"
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr "Konnte JSON-Datei nicht schreiben: %s"
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -8,9 +8,9 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 15:12+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2022-09-10 11:36+0200\n"
"Last-Translator: Nisok Kosin <nisok@in.gr>, 2012\n"
"Language-Team: Greek (http://www.transifex.com/pwmt/girara/language/el/)\n"
"Language: el\n"
"MIME-Version: 1.0\n"
......@@ -227,11 +227,16 @@ msgstr "Απόχαρτογράφηση / unmap αλληλουχίας πλήκτ
msgid "Dump settings to a file"
msgstr ""
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr ""
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr ""
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-07-13 09:01+0200\n"
"PO-Revision-Date: 2019-06-01 09:25+0000\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2022-09-10 11:37+0200\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Esperanto (http://www.transifex.com/pwmt/girara/language/"
"eo/)\n"
......@@ -226,11 +226,16 @@ msgstr "Malmapu klavan sinsekvon"
msgid "Dump settings to a file"
msgstr ""
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr ""
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr ""
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -8,15 +8,16 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 15:12+0000\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2022-09-10 11:37+0200\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Spanish (http://www.transifex.com/pwmt/girara/language/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? "
"1 : 2;\n"
#: girara/commands.c:111 girara/commands.c:311
#, c-format
......@@ -227,11 +228,16 @@ msgstr "Quitar el mapeo de una secuencia de teclas"
msgid "Dump settings to a file"
msgstr ""
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr ""
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr ""
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 15:12+0000\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2012-03-26 16:41+0000\n"
"Last-Translator: Goudarz Jafari <goudarz.jafari@gmail.com>\n"
"Language-Team: Persian (Iran) (http://www.transifex.com/pwmt/girara/language/"
"fa_IR/)\n"
......@@ -227,11 +227,16 @@ msgstr ""
msgid "Dump settings to a file"
msgstr ""
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr ""
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr ""
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -9,15 +9,16 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 15:12+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2022-09-10 11:38+0200\n"
"Last-Translator: rike, 2013\n"
"Language-Team: French (http://www.transifex.com/pwmt/girara/language/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % "
"1000000 == 0 ? 1 : 2;\n"
#: girara/commands.c:111 girara/commands.c:311
#, c-format
......@@ -230,11 +231,16 @@ msgstr "Désassocier une séquence de touches"
msgid "Dump settings to a file"
msgstr ""
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr ""
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr ""
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 15:12+0000\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2012-03-26 16:41+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"Language-Team: Hebrew (http://www.transifex.com/pwmt/girara/language/he/)\n"
"Language: he\n"
......@@ -227,11 +227,16 @@ msgstr ""
msgid "Dump settings to a file"
msgstr ""
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr ""
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr ""
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -7,15 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 15:12+0000\n"
"Last-Translator: Sebastian Ramacher <sebastian+dev@ramacher.at>\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2022-09-10 11:38+0200\n"
"Last-Translator: TheLemonMan <segnalazionidalweb@gmail.com>, 2012,2015\n"
"Language-Team: Italian (http://www.transifex.com/pwmt/girara/language/it/)\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? "
"1 : 2;\n"
#: girara/commands.c:111 girara/commands.c:311
#, c-format
......@@ -226,11 +227,16 @@ msgstr "Cancella mappatura di una sequenza di tasti"
msgid "Dump settings to a file"
msgstr ""
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"
msgstr "Numero degli argomenti non valido: %zu immessi, 1 attesi"
#: girara/settings.c:313
#, c-format
msgid "Failed to write JSON: %s"
msgstr ""
#: girara/utils.c:473
#, c-format
msgid "Failed to execute command: %s"
......
......@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: girara\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-06 14:42+0100\n"
"PO-Revision-Date: 2021-07-14 17:37+0000\n"
"POT-Creation-Date: 2022-09-10 11:35+0200\n"
"PO-Revision-Date: 2012-03-26 16:41+0000\n"
"Last-Translator: Heimen Stoffels <vistausss@fastmail.com>\n"
"Language-Team: Dutch (http://www.transifex.com/pwmt/girara/language/nl/)\n"
"Language: nl\n"
......@@ -227,11 +227,16 @@ msgstr "Toetsaanslag wissen"
msgid "Dump settings to a file"
msgstr "Instellingen opslaan naar een bestand"
#: girara/settings.c:251
#: girara/settings.c:292
#, c-format
msgid "Invalid number of arguments passed: %zu instead of 1"