gtk_estate 0.1.3

A GTK and libadwaita state association library
docs.rs failed to build gtk_estate-0.1.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

GTK Estate

GTK Estate is a state association library using the excellent GTK 4 and libadwaita libraries.

The core of what GTK Estate does is associate user-defined state objects with GTK and libadwaita container widgets and windows. It also contains objects and functions such as TimeOut that make working with GTK and libadwaita a bit easier.

It basically helps you to build dynamic GUIs based on GTK in Rust.

The StateContainers struct contains widget and window state association hashmaps and is a singleton that needs to be initialised before it is used:


mod applicaion_state;

use gtk_estate::{adw::{prelude::*, Application}, StateContainers};

use crate::applicaion_state::ApplicattionState;

fn main()
{

    let app = Application::builder().application_id("org.example_gui").build();

    //This instance of the State containers is needed for it to be accessible elsewhere

    let _sc = StateContainers::new();

    //The ApplicattionState can now add itself to the StateContainers instance from within its own constructor

    ApplicattionState::new(app.clone());

    //Run the application

    _ = app.run();

}

The reason why StateContainers is a singleton is because it's easier to considate all GTK and libadwaita related state into one set of maps than handle this state discretely.

Also this is only a single-threaded singleton which should only be dealing with UI and inter-thread-communication related tasks probably using a crate like act_rs for the latter.

Building Requirements

Requires the GTK4 and libadwaita C based library binaries on your system (See The GTK Book for GTK installation instructions).

Search your software repositories to find the libadwaita libraries.

Additionally

GTK Estate Re-exposes:

  • GTK4
  • libadwaita
  • Corlib

Todo

  • Make each widget storage map a compliation feature.
  • Re-wite the Timeout objects.
  • Add more GTK/adw helper functions and helper objects.
  • Add example projects

Coding Style

This project uses a coding style the emphasises the use of white space over keeping the line and column counts as low as possible.

So this:

fn foo()
{

    bar();

}

Not this:

fn foo()
{
    bar();
}

License

Licensed under either of:

at your discretion

Contributing

Please clone the repository and create an issue explaining what feature or features you'd like to add or bug or bugs you'd like to fix and perhaps how you intend to implement these additions or fixes. Try to include details though it doesn't need to be exhaustive and we'll take it from there (dependant on availability).

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.