From d5749f75a4cbd885ac76f6e5af2a633c4d84eeaf Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Tue, 12 Apr 2022 01:18:38 +0200 Subject: [PATCH] Room history: Send/display static location events Fixes #952 --- Cargo.lock | 35 +++++- Cargo.toml | 4 + build-aux/org.gnome.Fractal.Devel.json | 16 +++ .../scalable/actions/map-marker-symbolic.svg | 28 +++++ data/resources/resources.gresource.xml | 2 + data/resources/style.css | 9 ++ data/resources/ui/content-message-location.ui | 23 ++++ data/resources/ui/content-room-history.ui | 29 +++-- po/POTFILES.in | 1 + .../room_history/message_row/location.rs | 118 ++++++++++++++++++ .../content/room_history/message_row/mod.rs | 16 ++- src/session/content/room_history/mod.rs | 77 +++++++++++- 12 files changed, 346 insertions(+), 12 deletions(-) create mode 100644 data/resources/icons/scalable/actions/map-marker-symbolic.svg create mode 100644 data/resources/ui/content-message-location.ui create mode 100644 src/session/content/room_history/message_row/location.rs diff --git a/Cargo.lock b/Cargo.lock index e6e80628..b821a10f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -140,9 +140,9 @@ dependencies = [ [[package]] name = "ashpd" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "098dee97729c0164b39a8a7de9c20e4b0eb9cd57f87c8bb465224587b44b1683" +checksum = "5eea0a7a98b3bd2832eb087e1078f6f58db5a54447574d3007cdac6309c1e9f1" dependencies = [ "enumflags2", "futures", @@ -1021,6 +1021,7 @@ dependencies = [ "indexmap", "libadwaita", "libsecret", + "libshumate", "log", "matrix-sdk", "mime", @@ -2204,6 +2205,36 @@ dependencies = [ "system-deps 6.0.2", ] +[[package]] +name = "libshumate" +version = "0.1.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5c0b7cb25a837204c7eda0879877e0716924c2f970c08e60228bd8410ddc372" +dependencies = [ + "gdk4", + "gio", + "glib", + "gtk4", + "libc", + "libshumate-sys", + "once_cell", +] + +[[package]] +name = "libshumate-sys" +version = "0.1.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9380bffe8a69af1cd5c6ae0b6dfd2942017d89d9565f64d0e3579629e3921f07" +dependencies = [ + "gdk4-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk4-sys", + "libc", + "system-deps 6.0.2", +] + [[package]] name = "libspa" version = "0.4.1" diff --git a/Cargo.toml b/Cargo.toml index 4e9f3b3f..ec4aa6c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,6 +63,10 @@ features = ["v4_6"] package = "libadwaita" version = "0.1.0" +[dependencies.shumate] +package = "libshumate" +version = "0.1.0-alpha.4" + [dependencies.matrix-sdk] git = "https://github.com/matrix-org/matrix-rust-sdk.git" features = [ diff --git a/build-aux/org.gnome.Fractal.Devel.json b/build-aux/org.gnome.Fractal.Devel.json index f216f210..79a8168c 100644 --- a/build-aux/org.gnome.Fractal.Devel.json +++ b/build-aux/org.gnome.Fractal.Devel.json @@ -31,6 +31,22 @@ ] }, "modules" : [ + { + "name": "libshumate", + "buildsystem": "meson", + "config-opts": [ + "-Dgir=false", + "-Dvapi=false", + "-Dgtk_doc=false" + ], + "sources": [ + { + "type": "git", + "url": "https://gitlab.gnome.org/GNOME/libshumate/", + "tag": "1.0.0.alpha.1" + } + ] + }, { "name" : "fractal", "buildsystem" : "meson", diff --git a/data/resources/icons/scalable/actions/map-marker-symbolic.svg b/data/resources/icons/scalable/actions/map-marker-symbolic.svg new file mode 100644 index 00000000..6511c874 --- /dev/null +++ b/data/resources/icons/scalable/actions/map-marker-symbolic.svg @@ -0,0 +1,28 @@ + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/resources/resources.gresource.xml b/data/resources/resources.gresource.xml index 79008ec3..8f23ec3f 100644 --- a/data/resources/resources.gresource.xml +++ b/data/resources/resources.gresource.xml @@ -14,6 +14,7 @@ icons/scalable/actions/idp-google-dark.svg icons/scalable/actions/idp-google.svg icons/scalable/actions/idp-twitter.svg + icons/scalable/actions/map-marker-symbolic.svg icons/scalable/actions/send-symbolic.svg icons/scalable/status/devices-symbolic.svg icons/scalable/status/empty-page.svg @@ -54,6 +55,7 @@ ui/content-member-row.ui ui/content-message-audio.ui ui/content-message-file.ui + ui/content-message-location.ui ui/content-message-media.ui ui/content-message-reaction-list.ui ui/content-message-reaction.ui diff --git a/data/resources/style.css b/data/resources/style.css index e7910519..64e3e1dd 100644 --- a/data/resources/style.css +++ b/data/resources/style.css @@ -375,6 +375,15 @@ login { font-size: 3em; } +.room-history .event-content .location .map { + border-radius: 6px; + background-color: @borders; +} + +.room-history .event-content .location .map-marker { + color: @accent_color; +} + .room-history .event-content .thumbnail { border-radius: 6px; background-color: @borders; diff --git a/data/resources/ui/content-message-location.ui b/data/resources/ui/content-message-location.ui new file mode 100644 index 00000000..c4eb804e --- /dev/null +++ b/data/resources/ui/content-message-location.ui @@ -0,0 +1,23 @@ + + + + map-marker-symbolic + 32 + + + + diff --git a/data/resources/ui/content-room-history.ui b/data/resources/ui/content-room-history.ui index 3d3baa56..aeb7d0b8 100644 --- a/data/resources/ui/content-room-history.ui +++ b/data/resources/ui/content-room-history.ui @@ -21,6 +21,20 @@ + +
+ + _Location + room-history.send-location + map-marker-symbolic + + + _Attachment + room-history.select-file + mail-attachment-symbolic + +
+