{"id":17041152,"url":"https://github.com/seadve/gsettings-macro","last_synced_at":"2025-09-07T04:35:05.627Z","repository":{"id":40444920,"uuid":"488795076","full_name":"SeaDve/gsettings-macro","owner":"SeaDve","description":"Macro for typesafe GSettings key access","archived":false,"fork":false,"pushed_at":"2025-08-25T00:35:27.000Z","size":3877,"stargazers_count":3,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-06T10:43:22.274Z","etag":null,"topics":["gio","glib","gtk","gtk-rs","macro","rust","settings"],"latest_commit_sha":null,"homepage":"https://seadve.github.io/gsettings-macro/gsettings_macro/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SeaDve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"SeaDve","custom":["https://www.buymeacoffee.com/seadve"]}},"created_at":"2022-05-05T01:33:06.000Z","updated_at":"2025-08-25T00:35:30.000Z","dependencies_parsed_at":"2023-10-02T03:21:38.574Z","dependency_job_id":"3cf22be8-7ca4-48c8-b00e-4dba9282406f","html_url":"https://github.com/SeaDve/gsettings-macro","commit_stats":{"total_commits":169,"total_committers":2,"mean_commits":84.5,"dds":"0.011834319526627168","last_synced_commit":"c6b3b5d8362a3bf27eae9fa3138df2b9ff1ff2af"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/SeaDve/gsettings-macro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaDve%2Fgsettings-macro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaDve%2Fgsettings-macro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaDve%2Fgsettings-macro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaDve%2Fgsettings-macro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SeaDve","download_url":"https://codeload.github.com/SeaDve/gsettings-macro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaDve%2Fgsettings-macro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273997054,"owners_count":25204473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gio","glib","gtk","gtk-rs","macro","rust","settings"],"created_at":"2024-10-14T09:11:31.154Z","updated_at":"2025-09-07T04:35:05.619Z","avatar_url":"https://github.com/SeaDve.png","language":"Rust","funding_links":["https://github.com/sponsors/SeaDve","https://www.buymeacoffee.com/seadve"],"categories":[],"sub_categories":[],"readme":"# GSettings Macro\n\n[![github](https://img.shields.io/badge/github-seadve/gsettings-macro)](https://github.com/SeaDve/gsettings-macro)\n[![crates.io](https://img.shields.io/crates/v/gsettings-macro)](https://crates.io/crates/gsettings-macro)\n[![docs](https://docs.rs/gsettings-macro/badge.svg)](https://docs.rs/gsettings-macro/)\n[![CI](https://github.com/SeaDve/gsettings-macro/actions/workflows/ci.yml/badge.svg)](https://github.com/SeaDve/gsettings-macro/actions/workflows/ci.yml)\n\nMacro for typesafe GSettings key access\n\nThe macro's main purpose is to reduce the risk of mistyping a key,\nusing the wrong method to access values, inputting incorrect values,\nand to reduce boilerplate. Additionally, the summary, description,\nand default value are included in the documentation of each generated\nmethod. This would be beneficial if you use tools like\n[`rust-analyzer`](https://rust-analyzer.github.io/).\n\n## Example\n\n```rust,ignore\nuse gsettings_macro::gen_settings;\nuse gio::glib;\n\nuse std::path::{Path, PathBuf};\n\n#[gen_settings(\n    file = \"./tests/io.github.seadve.test.gschema.xml\",\n    id = \"io.github.seadve.test\"\n)]\n#[gen_settings_define(\n    key_name = \"cache-dir\",\n    arg_type = \"\u0026Path\",\n    ret_type = \"PathBuf\"\n)]\n#[gen_settings_skip(signature = \"(ss)\")]\npub struct ApplicationSettings;\n\nlet settings = ApplicationSettings::default();\n\n// `i` D-Bus type\nsettings.set_window_width(100);\nassert_eq!(settings.window_width(), 100);\n\n// enums\nsettings.set_alert_sound(AlertSound::Glass);\nassert_eq!(settings.alert_sound(), AlertSound::Glass);\n\n// bitflags\nsettings.set_space_style(SpaceStyle::BEFORE_COLON | SpaceStyle::BEFORE_COMMA);\nassert_eq!(\n    settings.space_style(),\n    SpaceStyle::BEFORE_COLON | SpaceStyle::BEFORE_COMMA\n);\n\n// customly defined\nsettings.set_cache_dir(Path::new(\"/some_dir/\"));\nassert_eq!(settings.cache_dir(), PathBuf::from(\"/some_dir/\"));\n```\n\nFor more examples and detailed information see the\n[documentation](https://seadve.github.io/gsettings-macro/gsettings_macro/attr.gen_settings.html).\n\nThere are also real-world examples of this library being used in [Mousai](https://github.com/SeaDve/Mousai)\nand [Kooha](https://github.com/SeaDve/Kooha), a music recognizer and a screen recorder application, respectively.\n\n## Generated methods\n\nThe procedural macro generates the following [`gio::Settings`](https://docs.rs/gio/latest/gio/struct.Settings.html) methods\nfor each key in the schema:\n\n* `set` -\u003e `set_${key}`, which panics when writing in a readonly\n  key, and `try_set_${key}`, which behaves the same as the original method.\n* `get` -\u003e `${key}`\n* `connect_changed` -\u003e `connect_${key}_changed`\n* `bind` -\u003e `bind_${key}`\n* `create_action` -\u003e `create_${key}_action`\n* `default_value` -\u003e `${key}_default_value`\n* `reset` -\u003e `reset_${key}`\n\n## Known issues\n\n* Not updating when the gschema file is modified\n  * Use hacks like `include_str!`\n  * See [#73921](https://github.com/rust-lang/rust/issues/73921) or [#55904](https://github.com/rust-lang/rust/issues/55904)\n\n## License\n\nCopyright 2023 Dave Patrick Caberto\n\nThis software is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at [this site](http://mozilla.org/MPL/2.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseadve%2Fgsettings-macro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseadve%2Fgsettings-macro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseadve%2Fgsettings-macro/lists"}