Giter Site home page Giter Site logo

seadve / gsettings-macro Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 3.11 MB

Macro for typesafe GSettings key access

Home Page: https://seadve.github.io/gsettings-macro/gsettings_macro/

License: Mozilla Public License 2.0

Rust 100.00%
gio macro rust glib gtk settings gtk-rs

gsettings-macro's People

Contributors

seadve avatar vhdirk avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vhdirk

gsettings-macro's Issues

`connect_#key_changed` ergonomics could be improved

Currently the closure passed in to connect_#key_changed functions must be a Fn(&gio::Settings) closure, however this isn't nice as you lose all the benefits of this macro once you're inside that closure.

This is a snippet from my project where I use your macro

            settings.connect_is_history_enabled_changed(clone!(@strong stack => move |settings| {
                    let is_history_enabled = settings.boolean("is-history-enabled");
                    if is_history_enabled {
                        stack.set_visible_child_name("image-grid");
                    } else {
                        stack.set_visible_child_name("message");
                    }
            }));

and I don't really like it.

I think making it be Fn(&GeneratedSettingsStruct), or Fn(&GeneratedSettingsStruct, TypeOf#key) would improve its ergonomics.

Automatically convert dbus types into rust types

Currently, we do them manually as seen in the link. It would be great to automatically map them and create exceptions for cases like &[&str].

// Built ins
this.insert_type("b", Context::new("bool"));
this.insert_type("i", Context::new("i32"));
this.insert_type("u", Context::new("u32"));
this.insert_type("x", Context::new("i64"));
this.insert_type("t", Context::new("u64"));
this.insert_type("d", Context::new("f64"));
this.insert_type("(ii)", Context::new("(i32, i32)"));
this.insert_type("as", Context::new_dissimilar("&[&str]", "Vec<String>"));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.