From dbbe5e39d069196aa17951b12575492cfa8c7976 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 12 Mar 2017 14:42:04 +0100 Subject: Automatically compile and use gsettings schema --- README.md | 3 +-- libdino/CMakeLists.txt | 12 ++++++++++++ libdino/data/dino.gschema.xml | 15 +++++++++++++++ libdino/data/settings.gschema.xml | 15 --------------- main/CMakeLists.txt | 2 +- main/src/main.vala | 9 ++++++++- 6 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 libdino/data/dino.gschema.xml delete mode 100644 libdino/data/settings.gschema.xml diff --git a/README.md b/README.md index d5acd31b..fa2d73ad 100644 --- a/README.md +++ b/README.md @@ -4,5 +4,4 @@ ##Build ./configure make - glib-compile-schemas libdino/data - env GSETTINGS_SCHEMA_DIR=libdino/data/ build/dino + build/dino diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt index 08bf88d6..a2b47381 100644 --- a/libdino/CMakeLists.txt +++ b/libdino/CMakeLists.txt @@ -72,3 +72,15 @@ add_custom_target(dino-vapi DEPENDS ${CMAKE_BINARY_DIR}/exports/dino.vapi ) + +add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gschemas.compiled +COMMAND + glib-compile-schemas --targetdir=${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/data +DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/data/dino.gschema.xml +) + +add_custom_target(dino-gsettings-schema-compiled +DEPENDS + ${CMAKE_BINARY_DIR}/gschemas.compiled +) \ No newline at end of file diff --git a/libdino/data/dino.gschema.xml b/libdino/data/dino.gschema.xml new file mode 100644 index 00000000..f3d342cf --- /dev/null +++ b/libdino/data/dino.gschema.xml @@ -0,0 +1,15 @@ + + + + + true + Whether to confirm that a message was received per default + + + + true + Whether to convert common ascii smileys into unicode + + + + \ No newline at end of file diff --git a/libdino/data/settings.gschema.xml b/libdino/data/settings.gschema.xml deleted file mode 100644 index f3d342cf..00000000 --- a/libdino/data/settings.gschema.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - true - Whether to confirm that a message was received per default - - - - true - Whether to convert common ascii smileys into unicode - - - - \ No newline at end of file diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 34d26c3f..839d5c50 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -112,5 +112,5 @@ OPTIONS set(CFLAGS ${VALA_CFLAGS} ${MAIN_CFLAGS}) add_definitions(${CFLAGS}) add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET}) -add_dependencies(dino dino-vapi) +add_dependencies(dino dino-vapi dino-gsettings-schema-compiled) target_link_libraries(dino libdino ${MAIN_LIBRARIES}) \ No newline at end of file diff --git a/main/src/main.vala b/main/src/main.vala index bec2d752..ba326ad8 100644 --- a/main/src/main.vala +++ b/main/src/main.vala @@ -5,7 +5,14 @@ namespace Dino { void main(string[] args) { try{ - Plugins.Loader loader = new Plugins.Loader(args.length > 0 ? args[0] : null); + string? exec_path = args.length > 0 ? args[0] : null; + if (exec_path != null && exec_path.contains(Path.DIR_SEPARATOR_S)) { + string bindir = Path.get_dirname(exec_path); + if (FileUtils.test(Path.build_filename(bindir, "gschemas.compiled"), FileTest.IS_REGULAR)) { + Environment.set_variable("GSETTINGS_SCHEMA_DIR", Path.get_dirname(exec_path), false); + } + } + Plugins.Loader loader = new Plugins.Loader(exec_path); Gtk.init(ref args); Dino.Ui.Application app = new Dino.Ui.Application(); foreach (string plugin in new string[]{"omemo", "openpgp"}) { -- cgit v1.2.3-70-g09d2