Can close the dialogue now
This commit is contained in:
parent
02b218fddd
commit
aa982bbeac
22
src/main.rs
22
src/main.rs
@ -2,7 +2,6 @@ extern crate libusb;
|
|||||||
extern crate colored;
|
extern crate colored;
|
||||||
extern crate json;
|
extern crate json;
|
||||||
|
|
||||||
use colored::Colorize;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use gtk::{prelude::*, Window};
|
use gtk::{prelude::*, Window};
|
||||||
@ -31,6 +30,15 @@ struct KeyboardConfig {
|
|||||||
lighting: KeyboardLighting
|
lighting: KeyboardLighting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct LightingMessage {
|
||||||
|
row: u16,
|
||||||
|
col: u16,
|
||||||
|
red: u8,
|
||||||
|
green: u8,
|
||||||
|
blue: u8
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_config(config_path: &Path) -> KeyboardConfig{
|
fn parse_config(config_path: &Path) -> KeyboardConfig{
|
||||||
let mut parsed_json = json::parse(&std::fs::read_to_string(config_path).unwrap()).unwrap();
|
let mut parsed_json = json::parse(&std::fs::read_to_string(config_path).unwrap()).unwrap();
|
||||||
|
|
||||||
@ -171,8 +179,16 @@ fn build_ui(app: &Application) {
|
|||||||
|
|
||||||
color.display();
|
color.display();
|
||||||
|
|
||||||
color.connect_color_activated(move |color, rgba| {
|
color.connect_close(move |color| {
|
||||||
println!("The selected color is: {}", rgba);
|
println!("The user requested to close the window with a keybind");
|
||||||
|
println!("{}", color.rgba());
|
||||||
|
});
|
||||||
|
|
||||||
|
println!("My button label is {:?}", button.label());
|
||||||
|
color.connect_response(move |color, response| {
|
||||||
|
println!("The user responded to the window with response type {}", response);
|
||||||
|
println!("{}", color.rgba());
|
||||||
|
color.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
println!("The label of the button is {}", button.label().unwrap());
|
println!("The label of the button is {}", button.label().unwrap());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user