From 30141db28d3008a9a4a0bc0f15c609ab3b65e3d0 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Sat, 4 Jun 2022 13:26:30 +0000 Subject: [PATCH] main: Dry-load layout in response to the layout command --- src/data/mod.rs | 2 +- src/main.rs | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/data/mod.rs b/src/data/mod.rs index 4bf66bd6..9ee1be7c 100644 --- a/src/data/mod.rs +++ b/src/data/mod.rs @@ -4,7 +4,7 @@ /*! Combined module for dealing with layout files */ -mod loading; +pub mod loading; pub mod parsing; use std::io; diff --git a/src/main.rs b/src/main.rs index ff12a96a..884505a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,8 +3,10 @@ */ /*! Glue for the main loop. */ -use crate::panel; +use crate::animation; use crate::debug; +use crate::data::loading; +use crate::panel; use crate::state; use glib::{Continue, MainContext, PRIORITY_DEFAULT, Receiver}; @@ -179,8 +181,18 @@ mod c { } if let Some(commands::SetLayout { description }) = msg.layout_selection { - //loading:: - dbg!(description); + dbg!(&description); + let animation::Contents { + name, + kind, + overlay_name, + purpose, + } = description; + let layout = loading::load_layout(name, kind, purpose, overlay_name); + let layout = Box::into_raw(Box::new(layout)); + unsafe { + //eekboard_context_service_set_layout(hint_manager, layout, 0); + } } } }