room-history: Add spell checker to message entry

This commit is contained in:
Kévin Commaille 2023-10-29 15:18:19 +01:00
parent 24fe938cae
commit 2295e8a9d1
No known key found for this signature in database
GPG key ID: 29A48C1F03620416
7 changed files with 86 additions and 0 deletions

View file

@ -38,6 +38,21 @@
}
]
},
{
"name" : "libspelling",
"buildsystem" : "meson",
"config-opts" : [
"-Ddocs=false",
"-Dvapi=false"
],
"sources" : [
{
"type" : "archive",
"url" : "https://download.gnome.org/sources/libspelling/0.2/libspelling-0.2.0.tar.xz",
"sha256" : "fdc5609e02818eca6fc172ff164caa8e52dba638d7590130af3dfb1f28b53421"
}
]
},
{
"name": "fractal",
"buildsystem": "meson",

30
Cargo.lock generated
View file

@ -1527,6 +1527,7 @@ dependencies = [
"indexmap 2.0.2",
"libadwaita",
"libshumate",
"libspelling",
"matrix-sdk",
"matrix-sdk-ui",
"mime",
@ -3051,6 +3052,35 @@ dependencies = [
"system-deps",
]
[[package]]
name = "libspelling"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "850363056ea48497686407e7e583c50c793896c151bbe7139ad4ea02fbf15e76"
dependencies = [
"gio",
"glib",
"gtk4",
"libc",
"libspelling-sys",
"sourceview5",
]
[[package]]
name = "libspelling-sys"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "377675d9465da676ebc05742743d5e5bc53a49be1138f463583181aea97da3c6"
dependencies = [
"gio-sys",
"glib-sys",
"gobject-sys",
"gtk4-sys",
"libc",
"sourceview5-sys",
"system-deps",
]
[[package]]
name = "libsqlite3-sys"
version = "0.26.0"

View file

@ -72,6 +72,7 @@ gst_video = { version = "0.21", package = "gstreamer-video" }
gtk = { package = "gtk4", version = "0.7", features = ["v4_10"] }
shumate = { package = "libshumate", version = "0.4" }
sourceview = { package = "sourceview5", version = "0.7" }
spelling = { package = "libspelling", version = "0.1" }
[dependencies.matrix-sdk]
git = "https://github.com/zecakeh/matrix-rust-sdk.git"

View file

@ -47,6 +47,21 @@
}
]
},
{
"name" : "libspelling",
"buildsystem" : "meson",
"config-opts" : [
"-Ddocs=false",
"-Dvapi=false"
],
"sources" : [
{
"type" : "archive",
"url" : "https://download.gnome.org/sources/libspelling/0.2/libspelling-0.2.0.tar.xz",
"sha256" : "fdc5609e02818eca6fc172ff164caa8e52dba638d7590130af3dfb1f28b53421"
}
]
},
{
"name": "fractal",
"buildsystem": "meson",

View file

@ -53,6 +53,21 @@
}
]
},
{
"name" : "libspelling",
"buildsystem" : "meson",
"config-opts" : [
"-Ddocs=false",
"-Dvapi=false"
],
"sources" : [
{
"type" : "archive",
"url" : "https://download.gnome.org/sources/libspelling/0.2/libspelling-0.2.0.tar.xz",
"sha256" : "fdc5609e02818eca6fc172ff164caa8e52dba638d7590130af3dfb1f28b53421"
}
]
},
{
"name": "fractal",
"buildsystem": "meson",

View file

@ -33,6 +33,7 @@ dependency(
default_options: ['gtk_doc=false', 'sysprof=false', 'gir=false', 'vapi=false', 'install_tests=false']
)
dependency('libpipewire-0.3', version: '>= 0.3.0')
dependency('libspelling-1', version: '>= 0.2.0')
dependency('openssl', version: '>= 1.0.1')
dependency('shumate-1.0', version: '>= 1.0.0')
dependency('sqlite3', version: '>= 3.24.0')

View file

@ -507,6 +507,15 @@ mod imp {
// Tab auto-completion.
self.completion.set_parent(&*self.message_entry);
// Spellchecker.
let spell_checker = spelling::Checker::default();
let adapter = spelling::TextBufferAdapter::new(&buffer, &spell_checker);
let extra_menu = adapter.menu_model();
self.message_entry.set_extra_menu(Some(&extra_menu));
self.message_entry
.insert_action_group("spelling", Some(&adapter));
adapter.set_enabled(true);
}
fn setup_drop_target(&self) {