Skip to content

Commit

Permalink
Automatically compile and use gsettings schema
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Mar 12, 2017
1 parent e8f1117 commit dbbe5e3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
##Build
./configure
make
glib-compile-schemas libdino/data
env GSETTINGS_SCHEMA_DIR=libdino/data/ build/dino
build/dino
12 changes: 12 additions & 0 deletions libdino/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
File renamed without changes.
2 changes: 1 addition & 1 deletion main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
9 changes: 8 additions & 1 deletion main/src/main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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"}) {
Expand Down

0 comments on commit dbbe5e3

Please sign in to comment.