I'm trying to bind the RGBA property of a ColorDialogButton in a GTK4 application in rust. However, Glib always throws me some variation of 'rgba' on class 'GtkColorDialogButton' has type 'GdkRGBA' which is not compatible with type 's' of key 'color'.
In the gschema file I've tried changing the type to tuples, arrays, dictionaries, tuples of floats, tuples of integers and variant but the error occurs and the widget is not bound correctly.
How can I create a type that accepts GtkRGBA?
Rust example:
use gtk::{
self,
gio::Settings,
glib::{self},
prelude::*,
Application, ApplicationWindow, ColorDialogButton,
};
const APP_ID: &str = "org.Waytrogen.Waytrogen";
fn main() -> glib::ExitCode {
// Create a new application
let app = Application::builder().application_id(APP_ID).build();
app.connect_activate(build_ui);
// Run the application
app.run()
}
fn build_ui(app: &Application) {
let window = ApplicationWindow::builder()
.application(app)
.title("Waytrogen")
.build();
window.present();
let settings = Settings::new(APP_ID);
let color_dialog_button = ColorDialogButton::builder().build();
settings.bind("color", &color_dialog_button, "rgba").build();
}
gschema example:
<?xml version="1.0" encoding="utf-8"?>
<schemalist>
<schema id="org.Waytrogen.Waytrogen" path="/org/Waytrogen/Waytrogen/">
<key name="color" type="s">
<default>"rgb(255,255,255)"</default>
<summary>Last set swaybg solid color</summary>
</key>
</schema>
</schemalist>
gdk4::RGBAfrom that string.