Compare commits

..

No commits in common. "efa5858859440bcb4d85d4dc67f5b2d5be9456f1" and "d44616bd72d4c4c40297617065f3f34c096001f7" have entirely different histories.

15 changed files with 282 additions and 1252 deletions

View File

@ -1,11 +0,0 @@
{
"configurations": [
{
"type": "cargo",
"cargoArgs": [
"run"
],
"name": "Cargo configuration"
}
]
}

845
Cargo.lock generated
View File

@ -2,851 +2,6 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "anyhow"
version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
[[package]]
name = "cairo-rs"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d859b656775a6b1dd078d3e5924884e6ea88aa649a7fdde03d5b2ec56ffcc10b"
dependencies = [
"bitflags",
"cairo-sys-rs",
"glib",
"libc",
"once_cell",
"thiserror",
]
[[package]]
name = "cairo-sys-rs"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd4d115132e01c0165e3bf5f56aedee8980b0b96ede4eb000b693c05a8adb8ff"
dependencies = [
"glib-sys",
"libc",
"system-deps",
]
[[package]]
name = "cfg-expr"
version = "0.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "215c0072ecc28f92eeb0eea38ba63ddfcb65c2828c46311d646f1a3ff5f9841c"
dependencies = [
"smallvec",
"target-lexicon",
]
[[package]]
name = "config-manager-client"
version = "0.1.0"
dependencies = [
"glib-build-tools",
"gtk4",
"libadwaita",
"log",
"simplelog",
]
[[package]]
name = "equivalent"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1"
[[package]]
name = "field-offset"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
dependencies = [
"memoffset",
"rustc_version",
]
[[package]]
name = "futures-channel"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
[[package]]
name = "futures-executor"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
[[package]]
name = "futures-macro"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
]
[[package]]
name = "futures-task"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
[[package]]
name = "futures-util"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
dependencies = [
"futures-core",
"futures-macro",
"futures-task",
"pin-project-lite",
"pin-utils",
"slab",
]
[[package]]
name = "gdk-pixbuf"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbc9c2ed73a81d556b65d08879ba4ee58808a6b1927ce915262185d6d547c6f3"
dependencies = [
"gdk-pixbuf-sys",
"gio",
"glib",
"libc",
"once_cell",
]
[[package]]
name = "gdk-pixbuf-sys"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7"
dependencies = [
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
]
[[package]]
name = "gdk4"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8965ed5455cbfa1eb45c14a3b971cbacb43481913a3a5b9078b2ef0d9a01bd4b"
dependencies = [
"cairo-rs",
"gdk-pixbuf",
"gdk4-sys",
"gio",
"glib",
"libc",
"pango",
]
[[package]]
name = "gdk4-sys"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aeffd4a7d68046c28666d817071bf025254aaed4df35099443f0c306ca6177f3"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"pango-sys",
"pkg-config",
"system-deps",
]
[[package]]
name = "gio"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7884cba6b1c5db1607d970cadf44b14a43913d42bc68766eea6a5e2fe0891524"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-util",
"gio-sys",
"glib",
"libc",
"once_cell",
"pin-project-lite",
"smallvec",
"thiserror",
]
[[package]]
name = "gio-sys"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
"winapi",
]
[[package]]
name = "glib"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "331156127e8166dd815cf8d2db3a5beb492610c716c03ee6db4f2d07092af0a7"
dependencies = [
"bitflags",
"futures-channel",
"futures-core",
"futures-executor",
"futures-task",
"futures-util",
"gio-sys",
"glib-macros",
"glib-sys",
"gobject-sys",
"libc",
"memchr",
"once_cell",
"smallvec",
"thiserror",
]
[[package]]
name = "glib-build-tools"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3431c56f463443cba9bc3600248bc6d680cb614c2ee1cdd39dab5415bd12ac5c"
[[package]]
name = "glib-macros"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "179643c50bf28d20d2f6eacd2531a88f2f5d9747dd0b86b8af1e8bb5dd0de3c0"
dependencies = [
"heck",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.22",
]
[[package]]
name = "glib-sys"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898"
dependencies = [
"libc",
"system-deps",
]
[[package]]
name = "gobject-sys"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44"
dependencies = [
"glib-sys",
"libc",
"system-deps",
]
[[package]]
name = "graphene-rs"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2228cda1505613a7a956cca69076892cfbda84fc2b7a62b94a41a272c0c401"
dependencies = [
"glib",
"graphene-sys",
"libc",
]
[[package]]
name = "graphene-sys"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc4144cee8fc8788f2a9b73dc5f1d4e1189d1f95305c4cb7bd9c1af1cfa31f59"
dependencies = [
"glib-sys",
"libc",
"pkg-config",
"system-deps",
]
[[package]]
name = "gsk4"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53b3b9e8090acb325d08cde84b30fc29b963a75fbac93160e9c5a30d2b335742"
dependencies = [
"cairo-rs",
"gdk4",
"glib",
"graphene-rs",
"gsk4-sys",
"libc",
"pango",
]
[[package]]
name = "gsk4-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0770d1ede7189092748c4ef5b6921264eb945fd2318a58e8f59dc273000810f8"
dependencies = [
"cairo-sys-rs",
"gdk4-sys",
"glib-sys",
"gobject-sys",
"graphene-sys",
"libc",
"pango-sys",
"system-deps",
]
[[package]]
name = "gtk4"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0973f9b9ade10fc22403810b7283d47b533033715f2aaa36288cd3bf90d63efc"
dependencies = [
"cairo-rs",
"field-offset",
"futures-channel",
"gdk-pixbuf",
"gdk4",
"gio",
"glib",
"graphene-rs",
"gsk4",
"gtk4-macros",
"gtk4-sys",
"libc",
"pango",
]
[[package]]
name = "gtk4-macros"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae9f2c4530f3168fe506b0be7bc15f7a93ef38d020edb27d81a921a26cbca851"
dependencies = [
"anyhow",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "gtk4-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19fde71ef2e78ac8fb18073c345b5f29609048d4045a345613645aa1163243c1"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gdk4-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"graphene-sys",
"gsk4-sys",
"libc",
"pango-sys",
"system-deps",
]
[[package]]
name = "hashbrown"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "indexmap"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "itoa"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
[[package]]
name = "libadwaita"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06444f4ca05a60693da6e9e2b591bd40a298e65a118a8d5e830771718b3e0253"
dependencies = [
"gdk-pixbuf",
"gdk4",
"gio",
"glib",
"gtk4",
"libadwaita-sys",
"libc",
"pango",
]
[[package]]
name = "libadwaita-sys"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "021cfe3d1fcfa82411765a791f7e9b32f35dd98ce88d2e3fa10e7320f5cc8ce7"
dependencies = [
"gdk4-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"gtk4-sys",
"libc",
"pango-sys",
"system-deps",
]
[[package]]
name = "libc"
version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "log"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [
"autocfg",
]
[[package]]
name = "num_threads"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
dependencies = [
"libc",
]
[[package]]
name = "once_cell"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "pango"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06a9e54b831d033206160096b825f2070cf5fda7e35167b1c01e9e774f9202d1"
dependencies = [
"gio",
"glib",
"libc",
"once_cell",
"pango-sys",
]
[[package]]
name = "pango-sys"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
]
[[package]]
name = "pin-project-lite"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "proc-macro-crate"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [
"once_cell",
"toml_edit",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.109",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver",
]
[[package]]
name = "semver"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
[[package]]
name = "serde"
version = "1.0.164"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
[[package]]
name = "serde_spanned"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186"
dependencies = [
"serde",
]
[[package]]
name = "simplelog"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acee08041c5de3d5048c8b3f6f13fafb3026b24ba43c6a695a0c76179b844369"
dependencies = [
"log",
"termcolor",
"time",
]
[[package]]
name = "slab"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
dependencies = [
"autocfg",
]
[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "system-deps"
version = "6.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30c2de8a4d8f4b823d634affc9cd2a74ec98c53a756f317e529a48046cbf71f3"
dependencies = [
"cfg-expr",
"heck",
"pkg-config",
"toml",
"version-compare",
]
[[package]]
name = "target-lexicon"
version = "0.12.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac"
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
]
[[package]]
name = "time"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
dependencies = [
"itoa",
"libc",
"num_threads",
"serde",
"time-core",
"time-macros",
]
[[package]]
name = "time-core"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
[[package]]
name = "time-macros"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b"
dependencies = [
"time-core",
]
[[package]]
name = "toml"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ebafdf5ad1220cb59e7d17cf4d2c72015297b75b19a10472f99b89225089240"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "unicode-ident"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
[[package]]
name = "version-compare"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "winnow"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448"
dependencies = [
"memchr",
]

View File

@ -6,10 +6,3 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
adw = { version = "0.5.2", package = "libadwaita", features = ["v1_2"] }
gtk = { version = "0.7.1", package = "gtk4", features = ["v4_10"] }
log = { version = "0.4", features = ["max_level_debug", "release_max_level_info"] }
simplelog = "^0.12.0"
[build-dependencies]
glib-build-tools = "0.18.0"

View File

@ -1,7 +0,0 @@
fn main() {
glib_build_tools::compile_resources(
&["resources"],
"resources/resources.gresource.xml",
"resources.gresource"
)
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<gresources>
<gresource prefix="/dev/fyloz/example/">
<file compressed="true" preprocess="xml-stripblanks">window.ui</file>
</gresource>
</gresources>

View File

@ -1,140 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="main-menu">
<!-- Menu -->
</menu>
<template class="ConfigManagerWindow" parent="AdwApplicationWindow">
<property name="default-height">720</property>
<property name="default-width">1280</property>
<property name="title">Config Manager</property>
<property name="content">
<object class="GtkStack" id="stack">
<property name="transition-type">crossfade</property>
<child>
<object class="GtkStackPage">
<property name="name">empty</property>
<property name="child">
<object class="GtkBox">
<!-- Placeholder -->
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar">
<style>
<class name="flat" />
</style>
</object>
</child>
<child>
<object class="GtkWindowHandle">
<property name="vexpand">True</property>
<property name="child">
<object class="AdwStatusPage">
<property name="icon-name">checkbox-checked-symbolic</property>
<property name="title" translatable="yes">No Applications</property>
<property name="description" translatable="yes">Add an application to start using this app.</property>
<property name="child">
<object class="GtkButton">
<property name="label" translatable="yes">_New Application</property>
<property name="use-underline">True</property>
<property name="halign">center</property>
<property name="action-name">win.new-app</property>
<style>
<class name="pill" />
<class name="suggested-action" />
</style>
</object>
</property>
</object>
</property>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">main</property>
<property name="child">
<object class="AdwLeaflet" id="leaflet">
<property name="can-navigate-back">True</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="width-request">199</property>
<child>
<object class="AdwHeaderBar">
<binding name="show-end-title-buttons">
<lookup name="folded">leaflet</lookup>
</binding>
<child type="start">
<object class="GtkToggleButton">
<property name="icon-name">list-add-symbolic</property>
<property name="tooltip-text" translatable="yes">New Application</property>
<property name="action-name">win.new-app</property>
</object>
</child>
</object>
</child>
<!-- Sidebar -->
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">True</property>
<property name="child">
<object class="GtkListBox" id="apps_list">
<style>
<class name="navigation-sidebar" />
</style>
</object>
</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwLeafletPage">
<property name="navigatable">False</property>
<property name="child">
<object class="GtkSeparator" />
</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="width-request">249</property>
<child>
<object class="AdwHeaderBar">
<property name="title-widget">
<object class="AdwWindowTitle" />
</property>
<child>
<object class="GtkButton">
<binding name="visible">
<lookup name="folded">leaflet</lookup>
</binding>
<property name="icon-name">go-previous-symbolic</property>
<property name="tooltip-text" translatable="yes">Back</property>
</object>
</child>
<child type="end">
<object class="GtkMenuButton">
<property name="icon-name">open-menu-symbolic</property>
<property name="menu-model">main-menu</property>
<property name="tooltip-text" translatable="yes">Main Menu</property>
</object>
</child>
</object>
</child>
<!-- Content -->
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</property>
</template>
</interface>

107
src/lcs.rs Normal file
View File

@ -0,0 +1,107 @@
use std::cmp::max;
use std::str::Chars;
use crate::matrix::Matrix;
pub fn diff(a: &str, b: &str) {
let m = build_matrix(a, b);
print_diff(m, a, b, a.len() - 1, b.len() - 1);
}
fn build_matrix(a: &str, b: &str) -> Matrix<i32> {
let mut m = Matrix::new(a.len(), b.len(), 0i32);
let mut i = 0;
let mut j = 0;
for x in a.chars() {
for y in b.chars() {
let v = if x == y {
if i == 0 || j == 0 {
0
} else {
m.get(i - 1, j - 1).unwrap() + 1
}
} else {
max(
if j == 0 { 0 } else { *m.get(i, j - 1).unwrap() },
if i == 0 { 0 } else { *m.get(i - 1, j).unwrap() })
};
m.set(v, i, j).unwrap();
j += 1;
}
i += 1;
j = 0;
}
m
}
fn print_diff(m: Matrix<i32>, a: &str, b: &str, i: usize, j: usize) {
let char_i = a.chars().nth(i).unwrap();
let char_j = b.chars().nth(j).unwrap();
println!("A: {char_i}, B: {char_j}");
if char_i == char_j {
println!(" {char_i}");
return;
}
if i > 0 {
let up = m.get(i - 1, j).unwrap();
if j > 0 && m.get(i, j - 1).unwrap() >= up {
println!("+ {char_i}");
return;
}
}
println!("- {char_i}");
}
// fn print_diff(m: Matrix<i32>, a: &str, b: &str, i: usize, j: usize) {
// // if i < 0 && j < 0 {
// // println!();
// // return;
// // }
//
// let char_i = a.chars().nth(i).unwrap();
// let char_j = b.chars().nth(j).unwrap();
//
// // if i < 0 {
// // print_diff(m, a, b, i, j - 1);
// // println!("+ {char_i}");
// // return;
// // }
// //
// // if j < 0 {
// // print_diff(m, a, b, i - 1, j);
// // println!("- {char_j}");
// // return;
// // }
//
// if char_i == char_j {
// if i > 0 && j > 0 {
// print_diff(m, a, b, i - 1, j - 1);
// }
//
// println!(" {char_i}");
// return;
// }
//
// if i > 0 && j > 0 && m.get(i, j - 1).unwrap() >= m.get(i - 1, j).unwrap() {
// print_diff(m, a, b, i, j - 1);
// println!("+ {char_j}");
// return;
// }
//
// if i > 0 {
// print_diff(m, a, b, i - 1, j);
// }
//
// println!("- {char_i}");
// }

View File

@ -1,25 +1,21 @@
use crate::ui::window::Window;
use adw::prelude::*;
use gtk::{gio, glib};
use std::fs::File;
use std::io;
use std::io::{BufRead, BufReader};
use crate::diff::diff;
mod matrix;
mod lcs;
mod diff;
mod ui;
const APP_ID: &str = "dev.fyloz.HelloWorld1";
fn main() -> io::Result<()> {
let file = File::open("test-data/config.jsonc")?;
let mut reader_a = BufReader::new(file);
fn main() -> glib::ExitCode {
gio::resources_register_include!("resources.gresource").expect("Failed to register resources.");
let file = File::open("test-data/config-old.jsonc")?;
let mut reader_b = BufReader::new(file);
let app = adw::Application::builder().application_id(APP_ID).build();
let result = diff(&mut reader_a, &mut reader_b);
dbg!(result);
app.connect_activate(build_ui);
app.run()
// TermLogger::init(LevelFilter::Debug, Config::default(), TerminalMode::Mixed, ColorChoice::Auto).unwrap();
}
fn build_ui(app: &adw::Application) {
let window = Window::new(app);
window.present();
Ok(())
}

161
src/matrix.rs Normal file
View File

@ -0,0 +1,161 @@
use std::fmt::{Debug, Display, Formatter};
use std::ops;
#[derive(Debug)]
pub struct Matrix<T> {
pub row_count: usize,
pub col_count: usize,
default_val: T,
rows: Vec<Vec<T>>,
}
#[derive(Debug)]
pub enum MatrixError {
RowIndexOutOfBound(usize),
ColIndexOutOfBound(usize),
IncompatibleSize,
}
impl<T> Matrix<T> where
T: Copy {
pub fn new(row_count: usize, col_count: usize, default_val: T) -> Self {
let rows = vec![vec![default_val; col_count]; row_count];
Matrix { row_count, col_count, default_val, rows }
}
pub fn new_with_size(matrix: &Self) -> Self {
Matrix::new(matrix.row_count, matrix.col_count, matrix.default_val)
}
pub fn get(&self, row: usize, col: usize) -> Option<&T> {
if row >= self.row_count || col >= self.col_count {
return None;
}
Some(&self.rows[row][col])
}
pub fn set(&mut self, val: T, row: usize, col: usize) -> Result<(), MatrixError> {
if row >= self.row_count {
return Err(MatrixError::RowIndexOutOfBound(row));
}
if col >= self.col_count {
return Err(MatrixError::ColIndexOutOfBound(col));
}
self.rows[row][col] = val;
Ok(())
}
fn size_equal(&self, other: &Self) -> bool {
self.row_count == other.row_count && self.col_count == other.col_count
}
}
impl<T> Matrix<T> where
T: Display, T: Copy {
pub fn print(&self) {
for row in 0..self.row_count {
for col in 0..self.col_count {
let val = self.rows[row][col];
print!(" {val} ");
}
print!("\n");
}
}
}
impl<T> ops::Add<Matrix<T>> for Matrix<T> where
T: ops::Add<Output=T>, T: Copy {
type Output = Result<Matrix<T>, MatrixError>;
fn add(self, rhs: Matrix<T>) -> Self::Output {
if !&self.size_equal(&rhs) {
return Err(MatrixError::IncompatibleSize);
}
let mut result_matrix = Matrix::new_with_size(&self);
for row in 0..self.row_count {
for col in 0..self.col_count {
// Since the sizes of the matrices are known, we can ignore errors
let val = self.rows[row][col] + rhs.rows[row][col];
result_matrix.set(val, row, col).unwrap();
}
}
Ok(result_matrix)
}
}
impl<T> ops::Sub<Matrix<T>> for Matrix<T> where
T: ops::Sub<Output=T>, T: Copy {
type Output = Result<Matrix<T>, MatrixError>;
fn sub(self, rhs: Matrix<T>) -> Self::Output {
if !&self.size_equal(&rhs) {
return Err(MatrixError::IncompatibleSize);
}
let mut result_matrix = Matrix::new_with_size(&self);
for row in 0..self.row_count {
for col in 0..self.col_count {
// Since the sizes of the matrices are known, we can ignore errors
let val = self.rows[row][col] - rhs.rows[row][col];
result_matrix.set(val, row, col).unwrap();
}
}
Ok(result_matrix)
}
}
impl<T> ops::Mul<T> for Matrix<T> where
T: ops::Mul<Output=T>, T: Copy {
type Output = Matrix<T>;
fn mul(self, rhs: T) -> Self::Output {
let mut result_matrix = Matrix::new_with_size(&self);
for row in 0..self.row_count {
for col in 0..self.col_count {
let val = self.rows[row][col] * rhs;
result_matrix.set(val, row, col).unwrap();
}
}
result_matrix
}
}
impl<T> ops::Mul<Matrix<T>> for Matrix<T> where
T: ops::Add<Output=T>, T: ops::Mul<Output=T>, T: Copy {
type Output = Result<Matrix<T>, MatrixError>;
fn mul(self, rhs: Matrix<T>) -> Self::Output {
if self.col_count != rhs.row_count {
return Err(MatrixError::IncompatibleSize);
}
let mut result_matrix = Matrix::new(self.row_count, rhs.col_count, self.default_val);
for row in 0..result_matrix.row_count {
for col in 0..result_matrix.col_count {
let mut val = self.default_val;
for i in 0..self.col_count {
let val_i = self.rows[row][i];
let val_j = rhs.rows[i][col];
val = val + val_i * val_j;
}
result_matrix.set(val, row, col).unwrap();
}
}
Ok(result_matrix)
}
}

View File

@ -1,2 +0,0 @@
pub mod objects;
pub mod window;

View File

@ -1,24 +0,0 @@
use std::cell::RefCell;
use adw::prelude::*;
use adw::subclass::prelude::*;
use glib::Properties;
use gtk::glib;
#[derive(Properties, Default)]
#[properties(wrapper_type = super::AppObject)]
pub struct AppObject {
#[property(get, set)]
pub name: RefCell<String>,
#[property(get, set)]
pub path: RefCell<String>,
}
#[glib::object_subclass]
impl ObjectSubclass for AppObject {
const NAME: &'static str = "AppObject";
type Type = super::AppObject;
}
#[glib::derived_properties]
impl ObjectImpl for AppObject {}

View File

@ -1,36 +0,0 @@
mod imp;
use adw::prelude::*;
use adw::subclass::prelude::*;
use glib::Object;
use gtk::glib;
glib::wrapper! {
pub struct AppObject(ObjectSubclass<imp::AppObject>);
}
impl AppObject {
pub fn new(name: &str, path: &str) -> Self {
Object::builder()
.property("name", name)
.property("path", path)
.build()
}
pub fn to_app_data(&self) -> AppData {
let name = self.imp().name.borrow().clone();
let path = self.imp().path.borrow().clone();
AppData { name, path }
}
pub fn from_app_data(app_data: &AppData) -> Self {
Self::new(&app_data.name, &app_data.path)
}
}
#[derive(Default, Clone)]
pub struct AppData {
pub name: String,
pub path: String
}

View File

@ -1 +0,0 @@
pub mod app;

View File

@ -1,52 +0,0 @@
use crate::ui::objects::app::AppObject;
use std::cell::RefCell;
use std::option::Option;
use adw::prelude::*;
use adw::subclass::prelude::*;
use glib::once_cell::sync::OnceCell;
use glib::subclass::InitializingObject;
use gtk::{gio, glib, CompositeTemplate, ListBox, TemplateChild};
#[derive(CompositeTemplate, Default)]
#[template(resource = "/dev/fyloz/example/window.ui")]
pub struct Window {
#[template_child]
pub apps_list: TemplateChild<ListBox>,
pub apps: OnceCell<gio::ListStore>,
pub current_app: RefCell<Option<AppObject>>,
}
#[glib::object_subclass]
impl ObjectSubclass for Window {
const NAME: &'static str = "ConfigManagerWindow";
type Type = super::Window;
type ParentType = adw::ApplicationWindow;
fn class_init(klass: &mut Self::Class) {
klass.bind_template();
}
fn instance_init(obj: &InitializingObject<Self>) {
obj.init_template();
}
}
impl ObjectImpl for Window {
fn constructed(&self) {
self.parent_constructed();
let obj = self.obj();
obj.setup_apps();
obj.restore_data();
}
}
impl WidgetImpl for Window {}
impl WindowImpl for Window {}
impl ApplicationWindowImpl for Window {}
impl AdwApplicationWindowImpl for Window {}

View File

@ -1,103 +0,0 @@
mod imp;
use crate::ui::objects::app::{AppData, AppObject};
use adw::prelude::*;
use adw::subclass::prelude::*;
use gtk::{gio, glib, ListBoxRow, Label, pango};
use glib::{clone, Object};
glib::wrapper! {
pub struct Window(ObjectSubclass<imp::Window>)
@extends adw::ApplicationWindow, gtk::Window, gtk::Widget,
@implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable,
gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
}
impl Window {
pub fn new(app: &adw::Application) -> Self {
Object::builder().property("application", app).build()
}
fn current_app(&self) -> AppObject {
self.imp()
.current_app
.borrow()
.clone()
.expect("`current_app` should be set in `set_current_app`.")
}
fn apps(&self) -> gio::ListStore {
self.imp()
.apps
.get()
.expect("`apps` should be set in `set_apps`.")
.clone()
}
fn create_app_row(&self, app_object: &AppObject) -> ListBoxRow {
let label = Label::builder()
.ellipsize(pango::EllipsizeMode::End)
.xalign(0.0)
.build();
app_object
.bind_property("name", &label, "label")
.sync_create()
.build();
ListBoxRow::builder().child(&label).build()
}
fn set_current_app(&self, app: AppObject) {
self.imp().current_app.replace(Some(app));
}
fn select_collection_row(&self) {
if let Some(index) = self.apps().find(&self.current_app()) {
let row = self.imp().apps_list.row_at_index(index as i32);
self.imp().apps_list.select_row(row.as_ref());
}
}
fn setup_apps(&self) {
let apps = gio::ListStore::new::<AppObject>();
self.imp()
.apps
.set(apps.clone())
.expect("Could not set apps");
self.imp().apps_list.bind_model(
Some(&apps),
clone!(@weak self as window => @default-panic, move |obj| {
let app_object = obj
.downcast_ref()
.expect("The object should be of type `AppObject`.");
let row = window.create_app_row(app_object);
row.upcast()
}),
)
}
fn restore_data(&self) {
let data = vec!(
AppData {
name: "IntelliJ".to_string(),
path: "/home/william/.config/jetbrains/intellij".to_string(),
},
AppData {
name: "Spotify".to_string(),
path: "/home/william/.config/spotify".to_string(),
});
let apps: Vec<AppObject> = data.iter()
.map(AppObject::from_app_data)
.collect();
self.apps().extend_from_slice(&apps);
if let Some(app) = apps.first() {
self.set_current_app(app.clone());
}
}
}