Browse Source

chore: Update gtk-rs to 0.4.4

Update also:
  - libdwaita to 0.1.0
  - sourceview5 to 0.4.0
  - gstreamer, gstreamer-base and gstreamer video to 0.18
  - ashpd to 0.2.0-beta-1
merge-requests/1327/merge
Kévin Commaille 4 years ago
parent
commit
7f4f7cc8f8
No known key found for this signature in database
GPG Key ID: DD507DAE96E8245C
  1. 469
      Cargo.lock
  2. 15
      Cargo.toml
  3. 4
      meson.build
  4. 2
      src/application.rs
  5. 13
      src/components/auth_dialog.rs
  6. 4
      src/components/avatar.rs
  7. 2
      src/components/badge.rs
  8. 15
      src/components/context_menu_bin.rs
  9. 2
      src/components/in_app_notification.rs
  10. 20
      src/components/label_with_widgets.rs
  11. 7
      src/components/loading_listbox_row.rs
  12. 10
      src/components/pill.rs
  13. 5
      src/components/reaction_chooser.rs
  14. 4
      src/components/room_title.rs
  15. 11
      src/components/spinner_button.rs
  16. 2
      src/components/video_player.rs
  17. 9
      src/contrib/qr_code.rs
  18. 18
      src/contrib/qr_code_scanner/camera_paintable.rs
  19. 12
      src/contrib/qr_code_scanner/mod.rs
  20. 1
      src/contrib/qr_code_scanner/qr_code_detector.rs
  21. 2
      src/contrib/qr_code_scanner/screenshot.rs
  22. 3
      src/login.rs
  23. 1
      src/main.rs
  24. 12
      src/session/account_settings/devices_page/device.rs
  25. 6
      src/session/account_settings/devices_page/device_item.rs
  26. 4
      src/session/account_settings/devices_page/device_list.rs
  27. 12
      src/session/account_settings/devices_page/device_row.rs
  28. 2
      src/session/account_settings/devices_page/mod.rs
  29. 2
      src/session/account_settings/mod.rs
  30. 27
      src/session/avatar.rs
  31. 6
      src/session/content/explore/mod.rs
  32. 8
      src/session/content/explore/public_room.rs
  33. 8
      src/session/content/explore/public_room_list.rs
  34. 4
      src/session/content/explore/public_room_row.rs
  35. 4
      src/session/content/invite.rs
  36. 2
      src/session/content/markdown_popover.rs
  37. 8
      src/session/content/mod.rs
  38. 4
      src/session/content/room_details/invite_subpage/invitee.rs
  39. 18
      src/session/content/room_details/invite_subpage/invitee_list.rs
  40. 5
      src/session/content/room_details/invite_subpage/invitee_row.rs
  41. 18
      src/session/content/room_details/invite_subpage/mod.rs
  42. 4
      src/session/content/room_details/member_page/member_menu.rs
  43. 2
      src/session/content/room_details/member_page/member_row.rs
  44. 19
      src/session/content/room_details/member_page/mod.rs
  45. 32
      src/session/content/room_details/mod.rs
  46. 2
      src/session/content/room_history/divider_row.rs
  47. 16
      src/session/content/room_history/item_row.rs
  48. 4
      src/session/content/room_history/message_row/file.rs
  49. 71
      src/session/content/room_history/message_row/media.rs
  50. 11
      src/session/content/room_history/message_row/mod.rs
  51. 2
      src/session/content/room_history/message_row/reaction.rs
  52. 4
      src/session/content/room_history/message_row/text.rs
  53. 31
      src/session/content/room_history/mod.rs
  54. 2
      src/session/content/room_history/verification_info_bar.rs
  55. 4
      src/session/content/verification/identity_verification_widget.rs
  56. 10
      src/session/content/verification/session_verification.rs
  57. 6
      src/session/event_source_dialog.rs
  58. 37
      src/session/media_viewer.rs
  59. 27
      src/session/mod.rs
  60. 20
      src/session/room/event.rs
  61. 16
      src/session/room/event_actions.rs
  62. 10
      src/session/room/highlight_flags.rs
  63. 14
      src/session/room/item.rs
  64. 2
      src/session/room/member.rs
  65. 2
      src/session/room/member_list.rs
  66. 8
      src/session/room/member_role.rs
  67. 41
      src/session/room/mod.rs
  68. 32
      src/session/room/power_levels.rs
  69. 6
      src/session/room/reaction_group.rs
  70. 4
      src/session/room/room_type.rs
  71. 10
      src/session/room/timeline.rs
  72. 4
      src/session/room_creation/mod.rs
  73. 13
      src/session/room_list.rs
  74. 6
      src/session/sidebar/account_switcher/avatar_with_selection.rs
  75. 6
      src/session/sidebar/account_switcher/item.rs
  76. 4
      src/session/sidebar/account_switcher/mod.rs
  77. 11
      src/session/sidebar/account_switcher/user_entry.rs
  78. 8
      src/session/sidebar/category.rs
  79. 8
      src/session/sidebar/category_row.rs
  80. 4
      src/session/sidebar/category_type.rs
  81. 6
      src/session/sidebar/entry.rs
  82. 2
      src/session/sidebar/entry_row.rs
  83. 4
      src/session/sidebar/entry_type.rs
  84. 6
      src/session/sidebar/item_list.rs
  85. 33
      src/session/sidebar/mod.rs
  86. 11
      src/session/sidebar/room_row.rs
  87. 24
      src/session/sidebar/row.rs
  88. 6
      src/session/sidebar/selection.rs
  89. 2
      src/session/sidebar/verification_row.rs
  90. 17
      src/session/user.rs
  91. 46
      src/session/verification/identity_verification.rs
  92. 2
      src/session/verification/verification_list.rs
  93. 48
      src/utils.rs
  94. 6
      src/window.rs

469
Cargo.lock generated

@ -154,10 +154,11 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "ashpd"
version = "0.2.0-alpha-5"
source = "git+https://github.com/bilelmoussaoui/ashpd?rev=66d4dc0020181a7174451150ecc711344082b5ce#66d4dc0020181a7174451150ecc711344082b5ce"
version = "0.2.0-beta-1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0e317c257d4733c44475b3cefd53adb2540771ba8bd4adf37eabef3bbf8298e"
dependencies = [
"enumflags2",
"enumflags2 0.7.3",
"futures",
"gdk4-wayland",
"gdk4-x11",
@ -168,11 +169,10 @@ dependencies = [
"serde",
"serde_repr",
"tracing",
"zbus 2.0.0-beta.7",
"zbus_macros 2.0.0-beta.7",
"zbus_names",
"zvariant",
"zvariant_derive",
"zbus 2.0.1",
"zbus_macros 2.0.1",
"zvariant 3.1.0",
"zvariant_derive 3.1.0",
]
[[package]]
@ -365,9 +365,9 @@ dependencies = [
[[package]]
name = "bitflags"
version = "1.2.1"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitvec"
@ -450,9 +450,9 @@ checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
[[package]]
name = "cairo-rs"
version = "0.14.9"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33b5725979db0c586d98abad2193cdb612dd40ef95cd26bd99851bf93b3cb482"
checksum = "b869e97a87170f96762f9f178eae8c461147e722ba21dd8814105bf5716bf14a"
dependencies = [
"bitflags",
"cairo-sys-rs",
@ -463,13 +463,13 @@ dependencies = [
[[package]]
name = "cairo-sys-rs"
version = "0.14.9"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b448b876970834fda82ba3aeaccadbd760206b75388fc5c1b02f1e343b697570"
checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
dependencies = [
"glib-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@ -809,21 +809,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "dlib"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794"
dependencies = [
"libloading",
]
[[package]]
name = "downcast-rs"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "easy-parallel"
version = "3.1.0"
@ -874,7 +859,17 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0"
dependencies = [
"enumflags2_derive",
"enumflags2_derive 0.6.4",
"serde",
]
[[package]]
name = "enumflags2"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a25c90b056b3f84111cf183cbeddef0d3a0bbe9a674f057e1a1533c315f24def"
dependencies = [
"enumflags2_derive 0.7.3",
"serde",
]
@ -889,6 +884,17 @@ dependencies = [
"syn 1.0.80",
]
[[package]]
name = "enumflags2_derive"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "144ec79496cbab6f84fa125dc67be9264aef22eb8a28da8454d9c33f15108da4"
dependencies = [
"proc-macro2 1.0.30",
"quote 1.0.10",
"syn 1.0.80",
]
[[package]]
name = "env_logger"
version = "0.8.4"
@ -1013,6 +1019,12 @@ dependencies = [
"url",
]
[[package]]
name = "fragile"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da1b8f89c5b5a5b7e59405cfcf0bb9588e5ed19f0b57a4cd542bbba3f164a6d"
[[package]]
name = "fs2"
version = "0.4.3"
@ -1197,10 +1209,11 @@ checksum = "e837767888fca507f07e89c90e0b350da7bbb89170f67a4655dc9bdc4cca457b"
[[package]]
name = "gdk-pixbuf"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534192cb8f01daeb8fab2c8d4baa8f9aae5b7a39130525779f5c2608e235b10f"
checksum = "172dfe1d9dfb62936bf7ad3ede2913a1b21b1e3db56990e46e00789201de9070"
dependencies = [
"bitflags",
"gdk-pixbuf-sys",
"gio",
"glib",
@ -1209,22 +1222,22 @@ dependencies = [
[[package]]
name = "gdk-pixbuf-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590"
checksum = "413424d9818621fa3cfc8a3a915cdb89a7c3c507d56761b4ec83a9a98e587171"
dependencies = [
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "gdk4"
version = "0.3.1"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f97a162c17214d1bf981af3f683156a0b1667dd1927057c4f0a68513251ecf0f"
checksum = "d0896d44001092e0b85b62b186c9428c6f61646ff6f957a811c81e3f1bbafb3e"
dependencies = [
"bitflags",
"cairo-rs",
@ -1238,71 +1251,68 @@ dependencies = [
[[package]]
name = "gdk4-sys"
version = "0.3.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9498f4e06969fb96a4e4234dfe1d308a3ac6b120b3c6d93e3ec5c77fe88bc6d5"
checksum = "48a39e34abe35ee2cf54a1e29dd983accecd113ad30bdead5050418fa92f2a1b"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"graphene-sys",
"libc",
"pango-sys",
"system-deps 5.0.0",
"pkg-config",
"system-deps 6.0.0",
]
[[package]]
name = "gdk4-wayland"
version = "0.3.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c930875d2f466207eae96d0110a3233c22744c16087cd0035f73da507f1a1bf5"
checksum = "12e6dcdd75e7fa114869d89c03a00081a3f54d7b5300f7d02a82bd3a97026c40"
dependencies = [
"gdk4",
"gdk4-wayland-sys",
"gio",
"glib",
"libc",
"wayland-client",
]
[[package]]
name = "gdk4-wayland-sys"
version = "0.3.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89c321379df46fc983d2a6aa0b639832e22ea0f85d64222a10e985b4378565ac"
checksum = "22cbf7fa3fc7714c72902d82229677f9291f7cceb33855c5cef868f177356c30"
dependencies = [
"glib-sys",
"libc",
"system-deps 5.0.0",
"system-deps 6.0.0",
]
[[package]]
name = "gdk4-x11"
version = "0.3.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb34d456170b6293d8d195090e3fd2fa0cb6f44d46b27bb7b729ada679cfa742"
checksum = "f2a54a4f3405461afa18ddc2b5fbeaecc2558fcd8b132ed0c9c7c4ffa2f9ae22"
dependencies = [
"gdk4",
"gdk4-x11-sys",
"gio",
"glib",
"libc",
"x11",
]
[[package]]
name = "gdk4-x11-sys"
version = "0.3.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b3e38c047b930780e687774a050f65e10cc1186494b36ef0e8ec09271a19fa4"
checksum = "1eb40aebb4f15b270df2ac2c463bf7f6d82211d9c5df1d13b84541a63a3139d7"
dependencies = [
"gdk4-sys",
"glib-sys",
"libc",
"system-deps 5.0.0",
"x11",
"system-deps 6.0.0",
]
[[package]]
@ -1381,9 +1391,9 @@ dependencies = [
[[package]]
name = "gio"
version = "0.14.8"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711c3632b3ebd095578a9c091418d10fed492da9443f58ebc8f45efbeb215cb0"
checksum = "5e14e0166f772d6295cfda361d227a63194497641a42da81b9e531c9f5a4d77f"
dependencies = [
"bitflags",
"futures-channel",
@ -1398,22 +1408,22 @@ dependencies = [
[[package]]
name = "gio-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa"
checksum = "04b57719ccaacf2a0d9c79f151be629f3a3ef3991658ee2af0bb66287e4ea86c"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
"winapi",
]
[[package]]
name = "glib"
version = "0.14.8"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c515f1e62bf151ef6635f528d05b02c11506de986e43b34a5c920ef0b3796a4"
checksum = "30a3e6b2e5ef2ecfb10c1e083074a81160b8f6408fcc08195c872e9de37a361b"
dependencies = [
"bitflags",
"futures-channel",
@ -1426,16 +1436,17 @@ dependencies = [
"libc",
"once_cell",
"smallvec",
"thiserror",
]
[[package]]
name = "glib-macros"
version = "0.14.1"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518"
checksum = "54c0c7194ee4c597b334e3ce84d22d929405e94497828e1c54da762cbe8e3d93"
dependencies = [
"anyhow",
"heck",
"heck 0.4.0",
"proc-macro-crate 1.1.0",
"proc-macro-error",
"proc-macro2 1.0.30",
@ -1445,12 +1456,12 @@ dependencies = [
[[package]]
name = "glib-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae"
checksum = "c668102c6e15e0a7f6b99b59f602c2e806967bb86414f617b77e19b1de5b3fac"
dependencies = [
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@ -1474,20 +1485,20 @@ dependencies = [
[[package]]
name = "gobject-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5"
checksum = "6edb1f0b3e4c08e2a0a490d1082ba9e902cdff8ff07091e85c6caec60d17e2ab"
dependencies = [
"glib-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "graphene-rs"
version = "0.14.8"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3380f132530ef9eb9e0a2bac180e30390aa5e49892d20294f822a974117a563"
checksum = "7c54f9fbbeefdb62c99f892dfca35f83991e2cb5b46a8dc2a715e58612f85570"
dependencies = [
"glib",
"graphene-sys",
@ -1496,21 +1507,21 @@ dependencies = [
[[package]]
name = "graphene-sys"
version = "0.14.8"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a9ac7450b3aa80792513a3c029920a2ede419de13fb5169a4e51b07a5685332"
checksum = "03f311acb023cf7af5537f35de028e03706136eead7f25a31e8fd26f5011e0b3"
dependencies = [
"glib-sys",
"libc",
"pkg-config",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "gsk4"
version = "0.3.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff59ca46c4fc5087fd7a0c3770a71ea4b6e94f8c24c12e2c2e8538f9f6fd764"
checksum = "cc7de6ca62027aea1d3ab5d4a6bb2db24a296f56473d8a9a4d7ee33042745ff3"
dependencies = [
"bitflags",
"cairo-rs",
@ -1524,9 +1535,9 @@ dependencies = [
[[package]]
name = "gsk4-sys"
version = "0.3.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13aa53ce70234da02f9954339d988d5ab853d746a8f47a4ae17735ff873545b5"
checksum = "e31d21d7ce02ba261bb24c50c4ab238a10b41a2c97c32afffae29471b7cca69b"
dependencies = [
"cairo-sys-rs",
"gdk4-sys",
@ -1535,17 +1546,18 @@ dependencies = [
"graphene-sys",
"libc",
"pango-sys",
"system-deps 5.0.0",
"system-deps 6.0.0",
]
[[package]]
name = "gstreamer"
version = "0.17.4"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6a255f142048ba2c4a4dce39106db1965abe355d23f4b5335edea43a553faa4"
checksum = "8050dd478c50f1796595275eb8f21b2e1c2604f7797fcd2cc513c7af710bb4ac"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"fragile",
"futures-channel",
"futures-core",
"futures-util",
@ -1556,6 +1568,7 @@ dependencies = [
"num-integer",
"num-rational 0.4.0",
"once_cell",
"option-operations",
"paste",
"pretty-hex",
"thiserror",
@ -1563,9 +1576,9 @@ dependencies = [
[[package]]
name = "gstreamer-base"
version = "0.17.2"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c0c1d8c62eb5d08fb80173609f2eea71d385393363146e4e78107facbd67715"
checksum = "224f35f36582407caf58ded74854526beeecc23d0cf64b8d1c3e00584ed6863f"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
@ -1577,37 +1590,38 @@ dependencies = [
[[package]]
name = "gstreamer-base-sys"
version = "0.17.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28169a7b58edb93ad8ac766f0fa12dcd36a2af4257a97ee10194c7103baf3e27"
checksum = "a083493c3c340e71fa7c66eebda016e9fafc03eb1b4804cf9b2bad61994b078e"
dependencies = [
"glib-sys",
"gobject-sys",
"gstreamer-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "gstreamer-sys"
version = "0.17.3"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a81704feeb3e8599913bdd1e738455c2991a01ff4a1780cb62200993e454cc3e"
checksum = "e3517a65d3c2e6f8905b456eba5d53bda158d664863aef960b44f651cb7d33e2"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "gstreamer-video"
version = "0.17.2"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3447ee95c8e79daec0b163260cf6a3de9bc19ff47a01b533787f900074a3476"
checksum = "410c72d885a67aeb7dbfa49c347e6c85d60f54e1cdaf6aadf8b5364892451261"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"fragile",
"futures-channel",
"glib",
"gstreamer",
@ -1619,16 +1633,16 @@ dependencies = [
[[package]]
name = "gstreamer-video-sys"
version = "0.17.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b81608f4182bdddd5bd33aaaa341d5544eda12b067a3dab75b1b7d2de01a3ba7"
checksum = "255c487bf6dd145e23558eaf1c92ef0946ee1999d22bdadc1e492b463609c4b6"
dependencies = [
"glib-sys",
"gobject-sys",
"gstreamer-base-sys",
"gstreamer-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@ -1639,9 +1653,9 @@ checksum = "da5bf7748fd4cd0b2490df8debcc911809dbcbee4ece9531b96c29a9c729de5a"
[[package]]
name = "gtk4"
version = "0.3.1"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58a04f421d1485ba4739e723199f5828bca05ab4e622ed39a96a342b6b1a6a3d"
checksum = "b5020aeb559e0431930d66d85b8f16fc453fc0863466b13b7e1e1b800cf1a47b"
dependencies = [
"bitflags",
"cairo-rs",
@ -1662,13 +1676,11 @@ dependencies = [
[[package]]
name = "gtk4-macros"
version = "0.3.1"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5068d4354af02454f44687adc613100aa98ae11e273cdcac84f89dc08be2b4a1"
checksum = "573db42bb64973a4d5f718b73caa7204285a1a665308a23b11723d0ee56ec305"
dependencies = [
"anyhow",
"heck",
"itertools",
"proc-macro-crate 1.1.0",
"proc-macro-error",
"proc-macro2 1.0.30",
@ -1678,9 +1690,9 @@ dependencies = [
[[package]]
name = "gtk4-sys"
version = "0.3.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e20a64c8f0ddcff8902ff04c130747f2fb7834a43530f75d03d6c71335733b49"
checksum = "1544614a8d44f38719a2fdfd608d644d5f385beab33e5852688f48a983a2b583"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
@ -1692,7 +1704,7 @@ dependencies = [
"gsk4-sys",
"libc",
"pango-sys",
"system-deps 5.0.0",
"system-deps 6.0.0",
]
[[package]]
@ -1732,6 +1744,12 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
@ -2021,9 +2039,9 @@ dependencies = [
[[package]]
name = "libadwaita"
version = "0.1.0-alpha-6"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8d01ba5036df1c3e09be88b4b8e0906af977bb7ec28d5faec81a1de94bc775c"
checksum = "0d4b1d54d907dfa5d6663fdf4bdbe46c34747258b85c787adbf66187ccbaac81"
dependencies = [
"gdk-pixbuf",
"gdk4",
@ -2038,19 +2056,17 @@ dependencies = [
[[package]]
name = "libadwaita-sys"
version = "0.1.0-alpha-6"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3127d83c55f64c466925b9d1e27a964187f193e94c7c8820ad6b29d6e5f487d8"
checksum = "f18b6ac4cadd252a89f5cba0a5a4e99836131795d6fad37b859ac79e8cb7d2c8"
dependencies = [
"gdk-pixbuf-sys",
"gdk4-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"gtk4-sys",
"libc",
"pango-sys",
"system-deps 4.0.0",
"system-deps 6.0.0",
]
[[package]]
@ -2461,22 +2477,9 @@ dependencies = [
[[package]]
name = "nix"
version = "0.20.2"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77d9f3521ea8e0641a153b3cddaf008dcbf26acd4ed739a2517295e0760d12c7"
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
dependencies = [
"bitflags",
"cc",
@ -2721,11 +2724,30 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "option-operations"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95d6113415f41b268f1195907427519769e40ee6f28cbb053795098a2c16f447"
dependencies = [
"paste",
]
[[package]]
name = "ordered-stream"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44630c059eacfd6e08bdaa51b1db2ce33119caa4ddc1235e923109aa5f25ccb1"
dependencies = [
"futures-core",
"pin-project-lite",
]
[[package]]
name = "pango"
version = "0.14.8"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "546fd59801e5ca735af82839007edd226fe7d3bb06433ec48072be4439c28581"
checksum = "79211eff430c29cc38c69e0ab54bc78fa1568121ca9737707eee7f92a8417a94"
dependencies = [
"bitflags",
"glib",
@ -2736,14 +2758,14 @@ dependencies = [
[[package]]
name = "pango-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe"
checksum = "7022c2fb88cd2d9d55e1a708a8c53a3ae8678234c4a54bf623400aeb7f31fac2"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@ -2925,9 +2947,9 @@ dependencies = [
[[package]]
name = "pkg-config"
version = "0.3.20"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
[[package]]
name = "png"
@ -3598,8 +3620,8 @@ dependencies = [
"sha2",
"zbus 1.9.1",
"zbus_macros 1.9.1",
"zvariant",
"zvariant_derive",
"zvariant 2.9.0",
"zvariant_derive 2.9.0",
]
[[package]]
@ -3781,15 +3803,6 @@ dependencies = [
"parking_lot",
]
[[package]]
name = "slotmap"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342"
dependencies = [
"version_check",
]
[[package]]
name = "smallvec"
version = "1.7.0"
@ -3808,9 +3821,9 @@ dependencies = [
[[package]]
name = "sourceview5"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f2f8375300de56f43ef03876a8c6ede4be89ea994b76e0f07e080aeb43c6dc3"
checksum = "a5c1e4191e6387d0542caf6761c9c101e4648cb588b965f8efec8a3943a1ad22"
dependencies = [
"bitflags",
"gdk-pixbuf",
@ -3825,9 +3838,9 @@ dependencies = [
[[package]]
name = "sourceview5-sys"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1be3031333cb0f2300aa9e57a25b82f9c9c915dce25b81ac703fbe9a4e6e8986"
checksum = "900965718bc3384c7d3f08976b35b47810ee73810b2882d30453b33ba7622337"
dependencies = [
"gdk-pixbuf-sys",
"gdk4-sys",
@ -3837,7 +3850,7 @@ dependencies = [
"gtk4-sys",
"libc",
"pango-sys",
"system-deps 4.0.0",
"system-deps 6.0.0",
]
[[package]]
@ -3899,7 +3912,7 @@ version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec"
dependencies = [
"heck",
"heck 0.3.3",
"proc-macro2 1.0.30",
"quote 1.0.10",
"syn 1.0.80",
@ -3953,40 +3966,27 @@ checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"
dependencies = [
"anyhow",
"cfg-expr 0.8.1",
"heck",
"heck 0.3.3",
"itertools",
"pkg-config",
"strum",
"strum_macros",
"thiserror",
"toml",
"version-compare",
]
[[package]]
name = "system-deps"
version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c1889ab44c2a423ba9ba4d64cd04989b25c0280ca7ade813f05368418722a04"
dependencies = [
"cfg-expr 0.9.0",
"heck",
"pkg-config",
"toml",
"version-compare",
"version-compare 0.0.11",
]
[[package]]
name = "system-deps"
version = "5.0.0"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18db855554db7bd0e73e06cf7ba3df39f97812cb11d3f75e71c39bf45171797e"
checksum = "7b1487aaddaacbc5d60a2a507ba1617c5ca66c57dd0dd07d0c5efd5b693841d4"
dependencies = [
"cfg-expr 0.9.0",
"heck",
"heck 0.3.3",
"pkg-config",
"toml",
"version-compare",
"version-compare 0.1.0",
]
[[package]]
@ -4378,6 +4378,12 @@ version = "0.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b"
[[package]]
name = "version-compare"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73"
[[package]]
name = "version_check"
version = "0.9.3"
@ -4484,55 +4490,6 @@ version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc"
[[package]]
name = "wayland-client"
version = "0.28.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355"
dependencies = [
"bitflags",
"downcast-rs",
"libc",
"nix 0.20.2",
"scoped-tls",
"wayland-commons",
"wayland-scanner",
"wayland-sys",
]
[[package]]
name = "wayland-commons"
version = "0.28.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda"
dependencies = [
"nix 0.20.2",
"once_cell",
"smallvec",
"wayland-sys",
]
[[package]]
name = "wayland-scanner"
version = "0.28.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1"
dependencies = [
"proc-macro2 1.0.30",
"quote 1.0.10",
"xml-rs",
]
[[package]]
name = "wayland-sys"
version = "0.28.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8"
dependencies = [
"dlib",
"pkg-config",
]
[[package]]
name = "web-sys"
version = "0.3.55"
@ -4619,22 +4576,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
[[package]]
name = "x11"
version = "2.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dd0565fa8bfba8c5efe02725b14dff114c866724eff2cfd44d76cea74bcd87a"
dependencies = [
"libc",
"pkg-config",
]
[[package]]
name = "xml-rs"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
[[package]]
name = "xml5ever"
version = "0.16.2"
@ -4656,7 +4597,7 @@ dependencies = [
"async-io",
"byteorder",
"derivative",
"enumflags2",
"enumflags2 0.6.4",
"fastrand",
"futures",
"nb-connect",
@ -4667,14 +4608,14 @@ dependencies = [
"serde",
"serde_repr",
"zbus_macros 1.9.1",
"zvariant",
"zvariant 2.9.0",
]
[[package]]
name = "zbus"
version = "2.0.0-beta.7"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b2e14e7c15f04af391e91950081f5ac19c6a595a8906bc156f5d914ab57b681"
checksum = "2ac8424f5aa1f239d2d7ecb32f9d5ffc6fcf5fb9298d2d524a7e7c8b258c3f80"
dependencies = [
"async-broadcast",
"async-channel",
@ -4686,23 +4627,23 @@ dependencies = [
"async-trait",
"byteorder",
"derivative",
"enumflags2",
"enumflags2 0.7.3",
"event-listener",
"futures-core",
"futures-sink",
"futures-util",
"hex",
"nix 0.21.2",
"nix 0.23.1",
"once_cell",
"ordered-stream",
"rand 0.8.4",
"serde",
"serde_repr",
"sha1",
"slotmap",
"static_assertions",
"zbus_macros 2.0.0-beta.7",
"zbus_macros 2.0.1",
"zbus_names",
"zvariant",
"zvariant 3.1.0",
]
[[package]]
@ -4719,9 +4660,9 @@ dependencies = [
[[package]]
name = "zbus_macros"
version = "2.0.0-beta.7"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d54aa0d29b3e36e112361c54bc3b750e12a45d704f86ca543e3101b338834ad"
checksum = "3e03af45fc15e2c977161c5ffea56c43c41f425a963affd7074bf91b5bf5a8cf"
dependencies = [
"proc-macro-crate 1.1.0",
"proc-macro2 1.0.30",
@ -4732,13 +4673,13 @@ dependencies = [
[[package]]
name = "zbus_names"
version = "1.1.0"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a45b644a32f28e5fc17974d63d3d8ee9f9f7985f9f4fb6f4e12d8be2fa3eaa31"
checksum = "45dfcdcf87b71dad505d30cc27b1b7b88a64b6d1c435648f48f9dbc1fdc4b7e1"
dependencies = [
"serde",
"static_assertions",
"zvariant",
"zvariant 3.1.0",
]
[[package]]
@ -4769,11 +4710,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1a9373dead84d640ccf5798f2928917e6aa1ab3f130751406bb13e0a9dd9913"
dependencies = [
"byteorder",
"enumflags2",
"enumflags2 0.6.4",
"libc",
"serde",
"static_assertions",
"zvariant_derive",
"zvariant_derive 2.9.0",
]
[[package]]
name = "zvariant"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb31b009e0b0c4f2c1283c9c23129e4f76020da4b3c4dfa032abfbfe30a2c02"
dependencies = [
"byteorder",
"enumflags2 0.7.3",
"libc",
"serde",
"static_assertions",
"zvariant_derive 3.1.0",
]
[[package]]
@ -4787,3 +4742,15 @@ dependencies = [
"quote 1.0.10",
"syn 1.0.80",
]
[[package]]
name = "zvariant_derive"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5295bdc2688c7239423889191d730ad071f814dc36c48edf7cda23f38dd28b2a"
dependencies = [
"proc-macro-crate 1.1.0",
"proc-macro2 1.0.30",
"quote 1.0.10",
"syn 1.0.80",
]

15
Cargo.toml

@ -29,14 +29,14 @@ futures = "0.3"
rand = "0.8"
indexmap = "1.6.2"
qrcode = "0.12.0"
ashpd = { git = "https://github.com/bilelmoussaoui/ashpd", rev = "66d4dc0020181a7174451150ecc711344082b5ce", features = [
ashpd = { version = "0.2.0-beta-1", features = [
"feature_gtk4",
"feature_pipewire",
"log",
] }
gst = { version = "0.17", package = "gstreamer" }
gst_base = { version = "0.17", package = "gstreamer-base" }
gst_video = { version = "0.17", package = "gstreamer-video" }
gst = { version = "0.18", package = "gstreamer" }
gst_base = { version = "0.18", package = "gstreamer-base" }
gst_video = { version = "0.18", package = "gstreamer-video" }
image = { version = "0.23", default-features = false, features = ["png"] }
regex = "1.5.4"
mime_guess = "2.0.3"
@ -44,15 +44,16 @@ num_enum = "0.5.6"
[dependencies.sourceview]
package = "sourceview5"
version = "0.3.0"
version = "0.4.0"
[dependencies.gtk]
package = "gtk4"
version = "0.3"
version = "0.4.4"
features = ["v4_6"]
[dependencies.adw]
package = "libadwaita"
version = "0.1.0-alpha-6"
version = "0.1.0"
[dependencies.matrix-sdk]
git = "https://github.com/jsparber/matrix-rust-sdk.git"

4
meson.build

@ -11,9 +11,9 @@ base_id = 'org.gnome.FractalNext'
dependency('glib-2.0', version: '>= 2.66')
dependency('gio-2.0', version: '>= 2.66')
dependency('gtk4', version: '>= 4.0.0')
dependency('gtk4', version: '>= 4.6.0')
dependency(
'libadwaita-1', version: '>= 1.0.0-alpha.1',
'libadwaita-1', version: '>= 1.0.0',
fallback: ['libadwaita', 'libadwaita_dep'],
default_options: ['tests=false', 'examples=false', 'vapi=false']
)

2
src/application.rs

@ -145,7 +145,7 @@ impl Application {
}
fn show_about_dialog(&self) {
let dialog = gtk::AboutDialogBuilder::new()
let dialog = gtk::AboutDialog::builder()
.logo_icon_name(config::APP_ID)
.license_type(gtk::License::Gpl30)
.website("https://gitlab.gnome.org/GNOME/fractal/")

13
src/components/auth_dialog.rs

@ -104,9 +104,9 @@ mod imp {
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);
let response = glib::Variant::from_tuple(&[false.to_variant()]);
let response = (&[false]).to_variant();
klass.add_binding_signal(
gdk::keys::constants::Escape,
gdk::Key::Escape,
gdk::ModifierType::empty(),
"response",
Some(&response),
@ -121,7 +121,7 @@ mod imp {
impl ObjectImpl for AuthDialog {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"session",
"Session",
"The session",
@ -161,17 +161,17 @@ mod imp {
self.button_cancel
.connect_clicked(clone!(@weak obj => move |_| {
obj.emit_by_name("response", &[&false]).unwrap();
obj.emit_by_name::<()>("response", &[&false]);
}));
self.button_ok
.connect_clicked(clone!(@weak obj => move |_| {
obj.emit_by_name("response", &[&true]).unwrap();
obj.emit_by_name::<()>("response", &[&true]);
}));
obj.connect_close_request(
clone!(@weak obj => @default-return gtk::Inhibit(false), move |_| {
obj.emit_by_name("response", &[&false]).unwrap();
obj.emit_by_name::<()>("response", &[&false]);
gtk::Inhibit(false)
}),
);
@ -355,6 +355,5 @@ impl AuthDialog {
None
})
.unwrap()
}
}

4
src/components/avatar.rs

@ -37,14 +37,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"item",
"Item",
"The Avatar item displayed by this widget",
AvatarItem::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_int(
glib::ParamSpecInt::new(
"size",
"Size",
"The size of the Avatar",

2
src/components/badge.rs

@ -25,7 +25,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_int64(
vec![glib::ParamSpecInt64::new(
"power-level",
"Power level",
"The power level this badge displays",

15
src/components/context_menu_bin.rs

@ -24,7 +24,7 @@ mod imp {
click_gesture: Default::default(),
long_press_gesture: Default::default(),
// WORKAROUND: there is some issue with creating the popover from the template
popover: gtk::PopoverMenuBuilder::new()
popover: gtk::PopoverMenu::builder()
.position(gtk::PositionType::Bottom)
.has_arrow(false)
.halign(gtk::Align::Start)
@ -46,13 +46,13 @@ mod imp {
widget.open_menu_at(0, 0)
});
klass.add_binding_action(
gdk::keys::constants::F10,
gdk::Key::F10,
gdk::ModifierType::SHIFT_MASK,
"context-menu.activate",
None,
);
klass.add_binding_action(
gdk::keys::constants::Menu,
gdk::Key::Menu,
gdk::ModifierType::empty(),
"context-menu.activate",
None,
@ -73,7 +73,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"context-menu",
"Context Menu",
"The context menu",
@ -160,12 +160,7 @@ impl ContextMenuBin {
return;
}
popover.set_pointing_to(&gdk::Rectangle {
x,
y,
width: 0,
height: 0,
});
popover.set_pointing_to(Some(&gdk::Rectangle::new(x, y, 0, 0)));
popover.popup();
}
}

2
src/components/in_app_notification.rs

@ -45,7 +45,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"error-list",
"Error List",
"The list of errors to display",

20
src/components/label_with_widgets.rs

@ -27,7 +27,7 @@ mod imp {
impl Default for LabelWithWidgets {
fn default() -> Self {
Self {
label: gtk::LabelBuilder::new().wrap(true).build(),
label: gtk::Label::builder().wrap(true).build(),
widgets: Default::default(),
widgets_sizes: Default::default(),
placeholder: Default::default(),
@ -49,14 +49,14 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"label",
"Label",
"The label",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"placeholder",
"Placeholder",
"The placeholder that is replaced with widgets",
@ -277,8 +277,8 @@ impl LabelWithWidgets {
let mut child_size_changed = false;
for (i, child) in priv_.widgets.borrow().iter().enumerate() {
let (_, natural_size) = child.preferred_size();
let width = natural_size.width;
let height = natural_size.height;
let width = natural_size.width();
let height = natural_size.height();
if let Some((old_width, old_height)) = widgets_sizes.get(i) {
if old_width != &width || old_height != &height {
let _ = std::mem::replace(&mut widgets_sizes[i], (width, height));
@ -310,7 +310,7 @@ impl LabelWithWidgets {
height * PANGO_SCALE,
);
let mut shape = pango::Attribute::new_shape(&logical_rect, &logical_rect);
let mut shape = pango::AttrShape::new(&logical_rect, &logical_rect);
shape.set_start_index(start_index as u32);
shape.set_end_index((start_index + OBJECT_REPLACEMENT_CHARACTER.len()) as u32);
attrs.insert(shape);
@ -342,12 +342,12 @@ impl LabelWithWidgets {
let (_, extents) = run_iter.run_extents();
let (offset_x, offset_y) = priv_.label.layout_offsets();
let allocation = gtk::Allocation {
x: pango_pixels(extents.x) + offset_x,
y: pango_pixels(extents.y) + offset_y,
let allocation = gtk::Allocation::new(
pango_pixels(extents.x()) + offset_x,
pango_pixels(extents.y()) + offset_y,
width,
height,
};
);
widget.size_allocate(&allocation, -1);
i += 1;
} else {

7
src/components/loading_listbox_row.rs

@ -42,14 +42,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"loading",
"Loading",
"Whether to show the loading spinner",
true,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"error",
"Error",
"The error message to show",
@ -100,7 +100,7 @@ mod imp {
self.retry_button
.connect_clicked(clone!(@weak obj => move |_| {
obj.emit_by_name("retry", &[]).unwrap();
obj.emit_by_name::<()>("retry", &[]);
}));
}
}
@ -175,6 +175,5 @@ impl LoadingListBoxRow {
f(&obj);
None
})
.unwrap()
}
}

10
src/components/pill.rs

@ -46,14 +46,14 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"user",
"User",
"The user displayed by this widget",
User::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room",
"Room",
"The room displayed by this widget",
@ -120,8 +120,7 @@ impl Pill {
let display_name_binding = user
.bind_property("display-name", &*priv_.display_name, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
priv_.bindings.borrow_mut().push(display_name_binding);
}
@ -154,8 +153,7 @@ impl Pill {
let display_name_binding = room
.bind_property("display-name", &*priv_.display_name, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
priv_.bindings.borrow_mut().push(display_name_binding);
}

5
src/components/reaction_chooser.rs

@ -92,7 +92,7 @@ mod imp {
.css_classes(vec!["flat".to_string(), "circular".to_string()])
.build();
button.connect_clicked(|button| {
button.activate_action("context-menu.close", None);
button.activate_action("context-menu.close", None).unwrap();
});
grid.attach(&button, reaction_item.column, reaction_item.row, 1, 1);
}
@ -166,8 +166,7 @@ impl ReactionChooser {
let binding = reaction
.bind_property("has-user", &button, "active")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
reaction_bindings.insert(reaction_item.key.to_string(), binding);
}
} else if let Some(binding) = reaction_bindings.remove(reaction_item.key) {

4
src/components/room_title.rs

@ -42,14 +42,14 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"title",
"Title",
"The title of the room",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"subtitle",
"Subtitle",
"The subtitle of the room",

11
src/components/spinner_button.rs

@ -5,7 +5,6 @@ use gtk::{glib, CompositeTemplate};
mod imp {
use super::*;
use glib::object::ObjectClass;
use glib::subclass::InitializingObject;
#[derive(Debug, Default, CompositeTemplate)]
@ -39,14 +38,8 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_override(
"label",
&ObjectClass::from_type(gtk::Button::static_type())
.unwrap()
.find_property("label")
.unwrap(),
),
glib::ParamSpec::new_boolean(
glib::ParamSpecOverride::for_class::<gtk::Button>("label"),
glib::ParamSpecBoolean::new(
"loading",
"Loading",
"Whether to display the loading spinner or the content",

2
src/components/video_player.rs

@ -37,7 +37,7 @@ mod imp {
impl ObjectImpl for VideoPlayer {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_boolean(
vec![glib::ParamSpecBoolean::new(
"compact",
"Compact",
"Whether this player should be displayed in a compact format",

9
src/contrib/qr_code.rs

@ -43,7 +43,7 @@ pub(crate) mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_uint(
vec![glib::ParamSpecUInt::new(
"block-size",
"block-size",
"block-size",
@ -94,12 +94,7 @@ pub(crate) mod imp {
widget
.style_context()
.lookup_color("background")
.unwrap_or(gdk::RGBA {
red: 0.0,
blue: 0.0,
green: 0.0,
alpha: 0.0,
})
.unwrap_or_else(|| gdk::RGBA::new(0.0, 0.0, 0.0, 0.0))
};
let position = graphene::Rect::new(
(x as f32) * square_width,

18
src/contrib/qr_code_scanner/camera_paintable.rs

@ -13,8 +13,8 @@ use glib::{clone, Receiver, Sender};
use gst::prelude::*;
use gtk::gdk::prelude::TextureExt;
use gtk::glib;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use gtk::glib::subclass::prelude::*;
use gtk::{prelude::*, subclass::prelude::*};
use once_cell::sync::Lazy;
use std::os::unix::io::AsRawFd;
@ -111,6 +111,7 @@ mod camera_sink {
}
impl ObjectImpl for CameraSink {}
impl GstObjectImpl for CameraSink {}
impl ElementImpl for CameraSink {
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {
@ -316,7 +317,7 @@ mod imp {
image.snapshot(snapshot.upcast_ref(), new_width, new_height);
} else {
snapshot.append_color(
&gdk::RGBA::black(),
&gdk::RGBA::BLACK,
&graphene::Rect::new(0f32, 0f32, width as f32, height as f32),
);
}
@ -338,12 +339,8 @@ impl CameraPaintable {
pub fn set_pipewire_fd<F: AsRawFd>(&self, fd: F, node_id: u32) {
self.close_pipeline();
let pipewire_element = gst::ElementFactory::make("pipewiresrc", None).unwrap();
pipewire_element
.set_property("fd", &fd.as_raw_fd())
.unwrap();
pipewire_element
.set_property("path", &node_id.to_string())
.unwrap();
pipewire_element.set_property("fd", &fd.as_raw_fd());
pipewire_element.set_property("path", &node_id.to_string());
self.init_pipeline(pipewire_element);
}
@ -452,8 +449,7 @@ impl CameraPaintable {
}
}
Action::QrCodeDetected(code) => {
self.emit_by_name("code-detected", &[&QrVerificationDataBoxed(code)])
.unwrap();
self.emit_by_name::<()>("code-detected", &[&QrVerificationDataBoxed(code)]);
}
}
glib::Continue(true)

12
src/contrib/qr_code_scanner/mod.rs

@ -51,7 +51,7 @@ mod imp {
impl ObjectImpl for QrCodeScanner {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_boolean(
vec![glib::ParamSpecBoolean::new(
"has-camera",
"Has Camera",
"Whether we have a working camera",
@ -75,13 +75,12 @@ mod imp {
let callback = glib::clone!(@weak obj => @default-return None, move |args: &[glib::Value]| {
let code = args.get(1).unwrap().get::<QrVerificationDataBoxed>().unwrap();
obj.emit_by_name("code-detected", &[&code]).unwrap();
obj.emit_by_name::<()>("code-detected", &[&code]);
None
});
self.paintable
.connect_local("code-detected", false, callback)
.unwrap();
.connect_local("code-detected", false, callback);
obj.init_has_camera();
}
@ -194,10 +193,9 @@ impl QrCodeScanner {
None
})
.unwrap()
}
}
#[derive(Clone, Debug, PartialEq, glib::GBoxed)]
#[gboxed(type_name = "QrVerificationDataBoxed")]
#[derive(Clone, Debug, PartialEq, glib::Boxed)]
#[boxed_type(name = "QrVerificationDataBoxed")]
struct QrVerificationDataBoxed(QrVerificationData);

1
src/contrib/qr_code_scanner/qr_code_detector.rs

@ -33,6 +33,7 @@ mod imp {
}
impl ObjectImpl for QrCodeDetector {}
impl GstObjectImpl for QrCodeDetector {}
impl ElementImpl for QrCodeDetector {
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {

2
src/contrib/qr_code_scanner/screenshot.rs

@ -7,7 +7,7 @@ pub async fn capture(root: &gtk::Root) -> Option<QrVerificationData> {
let identifier = ashpd::WindowIdentifier::from_native(root).await;
let uri = screenshot::take(&identifier, true, true).await.ok()?;
let screenshot = gio::File::for_uri(&uri);
let (data, _) = screenshot.load_contents(gio::NONE_CANCELLABLE).ok()?;
let (data, _) = screenshot.load_contents(gio::Cancellable::NONE).ok()?;
let image = image::load_from_memory(&data).ok()?;
QrVerificationData::from_image(image).ok()

3
src/login.rs

@ -177,7 +177,6 @@ impl Login {
None
})
.unwrap()
}
fn drop_session_reference(&self) {
@ -219,7 +218,7 @@ impl Login {
},
None => {
debug!("A new session was prepared");
login.emit_by_name("new-session", &[&session]).unwrap();
login.emit_by_name::<()>("new-session", &[&session]);
}
}
}),

1
src/main.rs

@ -53,7 +53,6 @@ fn main() {
gio::resources_register(&res);
IconTheme::for_display(&Display::default().unwrap())
.unwrap()
.add_resource_path("/org/gnome/FractalNext/icons");
let app = Application::new();

12
src/session/account_settings/devices_page/device.rs

@ -36,41 +36,41 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The session",
Session::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"device-id",
"Device Id",
"The Id of this device",
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"display-name",
"Display Name",
"The display name of the device",
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"last-seen-ip",
"Last Seen Ip",
"The last ip the device used",
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_pointer(
glib::ParamSpecPointer::new(
"last-seen-ts",
"Last Seen Ts",
"The last time the device was used",
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_pointer(
glib::ParamSpecPointer::new(
"verified",
"Verified",
"Whether this devices is verified",

6
src/session/account_settings/devices_page/device_item.rs

@ -10,8 +10,8 @@ pub enum ItemType {
LoadingSpinner,
}
#[derive(Clone, Debug, glib::GBoxed)]
#[gboxed(type_name = "BoxedDeviceItemType")]
#[derive(Clone, Debug, glib::Boxed)]
#[boxed_type(name = "BoxedDeviceItemType")]
pub struct BoxedItemType(ItemType);
impl From<ItemType> for BoxedItemType {
@ -39,7 +39,7 @@ mod imp {
impl ObjectImpl for Item {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_boxed(
vec![glib::ParamSpecBoxed::new(
"type",
"Type",
"The type of this item",

4
src/session/account_settings/devices_page/device_list.rs

@ -36,14 +36,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The session",
Session::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"current-device",
"Current Device",
"The device of this session",

12
src/session/account_settings/devices_page/device_row.rs

@ -5,8 +5,6 @@ use super::Device;
use crate::components::SpinnerButton;
use crate::spawn;
const G_TIME_SPAN_DAY: i64 = 86400000000;
mod imp {
use super::*;
use glib::subclass::InitializingObject;
@ -49,7 +47,7 @@ mod imp {
impl ObjectImpl for DeviceRow {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"device",
"Device",
"The device this row is showing",
@ -174,14 +172,14 @@ impl DeviceRow {
// This was ported from Nautilus and simplified for our use case.
// See: https://gitlab.gnome.org/GNOME/nautilus/-/blob/master/src/nautilus-file.c#L5488
pub fn format_date_time_as_string(datetime: glib::DateTime) -> glib::GString {
let now = glib::DateTime::new_now_local().unwrap();
let now = glib::DateTime::now_local().unwrap();
let format;
let days_ago = {
let today_midnight =
glib::DateTime::new_local(now.year(), now.month(), now.day_of_month(), 0, 0, 0f64)
glib::DateTime::from_local(now.year(), now.month(), now.day_of_month(), 0, 0, 0f64)
.unwrap();
let date = glib::DateTime::new_local(
let date = glib::DateTime::from_local(
datetime.year(),
datetime.month(),
datetime.day_of_month(),
@ -191,7 +189,7 @@ pub fn format_date_time_as_string(datetime: glib::DateTime) -> glib::GString {
)
.unwrap();
today_midnight.difference(&date) / G_TIME_SPAN_DAY
today_midnight.difference(&date).as_days()
};
let use_24 = {

2
src/session/account_settings/devices_page/mod.rs

@ -51,7 +51,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"user",
"User",
"The user of this account",

2
src/session/account_settings/mod.rs

@ -37,7 +37,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"user",
"User",
"The user of this account",

27
src/session/avatar.rs

@ -1,6 +1,6 @@
use std::path::Path;
use gtk::{gdk, gdk_pixbuf::Pixbuf, gio, glib, glib::clone, prelude::*, subclass::prelude::*};
use gtk::{gdk, gio, glib, glib::clone, prelude::*, subclass::prelude::*};
use log::{debug, error, info};
use matrix_sdk::room::Room as MatrixRoom;
@ -42,14 +42,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"image",
"Image",
"The user defined image if any",
gdk::Paintable::static_type(),
glib::ParamFlags::READABLE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_int(
glib::ParamSpecInt::new(
"needed-size",
"Needed Size",
"The size needed of the user defined image. If -1 no image will be loaded",
@ -58,21 +58,21 @@ mod imp {
-1,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"url",
"Url",
"The url of the Avatar",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"display-name",
"Display Name",
"The display name used for this avatar",
None,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The session",
@ -151,14 +151,9 @@ impl Avatar {
fn set_image_data(&self, data: Option<Vec<u8>>) {
let priv_ = imp::Avatar::from_instance(self);
let image = if let Some(data) = data {
let stream = gio::MemoryInputStream::from_bytes(&glib::Bytes::from(&data));
Pixbuf::from_stream(&stream, gio::NONE_CANCELLABLE)
.ok()
.map(|pixbuf| gdk::Texture::for_pixbuf(&pixbuf).upcast())
} else {
None
};
let image = data
.and_then(|data| gdk::Texture::from_bytes(&glib::Bytes::from(&data)).ok())
.map(|texture| texture.upcast());
priv_.image.replace(image);
self.notify("image");
}
@ -298,7 +293,9 @@ where
{
debug!("Getting mime type of file {:?}", filename);
let image = tokio::fs::read(filename).await?;
let content_type = gio::content_type_guess(None, &image).0.to_string();
let content_type = gio::content_type_guess(Option::<String>::None, &image)
.0
.to_string();
info!("Uploading avatar from file {:?}", filename);
// TODO: Use blurhash

6
src/session/content/explore/mod.rs

@ -66,14 +66,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"compact",
"Compact",
"Whether a compact view is used",
false,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The session",
@ -110,7 +110,7 @@ mod imp {
fn constructed(&self, obj: &Self::Type) {
self.parent_constructed(obj);
let adj = self.scrolled_window.vadjustment().unwrap();
let adj = self.scrolled_window.vadjustment();
adj.connect_value_changed(clone!(@weak obj => move |adj| {
if adj.upper() - adj.value() < adj.page_size() * 2.0 {

8
src/session/content/explore/public_room.rs

@ -33,28 +33,28 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room-list",
"Room List",
"The list of rooms in this session",
RoomList::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room",
"Room",
"The room, this is only set if the user is already a member",
Room::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"pending",
"Pending",
"A room is pending when the user already clicked to join a room",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"avatar",
"Avatar",
"The Avatar of this room",

8
src/session/content/explore/public_room_list.rs

@ -48,28 +48,28 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The session",
Session::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"loading",
"Loading",
"Whether a response is loaded",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"empty",
"Empty",
"Whether any matching rooms are found",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"complete",
"Complete",
"Whether all search results are loaded",

4
src/session/content/explore/public_room_row.rs

@ -51,7 +51,7 @@ mod imp {
impl ObjectImpl for PublicRoomRow {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"public-room",
"Public Room",
"The public room displayed by this row",
@ -201,7 +201,7 @@ impl PublicRoomRow {
self.update_button(public_room);
} else if priv_.original_child.borrow().is_none() {
let spinner = gtk::SpinnerBuilder::new()
let spinner = gtk::Spinner::builder()
.spinning(true)
.margin_top(12)
.margin_bottom(12)

4
src/session/content/invite.rs

@ -62,14 +62,14 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"compact",
"Compact",
"Whether a compact view is used",
false,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room",
"Room",
"The room currently shown",

2
src/session/content/markdown_popover.rs

@ -31,7 +31,7 @@ pub mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_boolean(
vec![glib::ParamSpecBoolean::new(
"markdown-enabled",
"Markdown enabled",
"Whether outgoing messages should be interpreted as markdown",

8
src/session/content/mod.rs

@ -80,28 +80,28 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The session",
Session::static_type(),
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"compact",
"Compact",
"Whether a compact view is used",
false,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"item",
"Item",
"The item currently shown",
glib::Object::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"error-list",
"Error List",
"A list of errors shown as in-app-notification",

4
src/session/content/room_details/invite_subpage/invitee.rs

@ -28,14 +28,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"invited",
"Invited",
"Whether this Invitee is actually invited",
false,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"anchor",
"Anchor",
"The anchor location in the text buffer",

18
src/session/content/room_details/invite_subpage/invitee_list.rs

@ -9,9 +9,9 @@ use crate::{session::Room, spawn, spawn_tokio};
use super::Invitee;
#[derive(Debug, Eq, PartialEq, Clone, Copy, glib::GEnum)]
#[derive(Debug, Eq, PartialEq, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[genum(type_name = "ContentInviteeListState")]
#[enum_type(name = "ContentInviteeListState")]
pub enum InviteeListState {
Initial = 0,
Loading = 1,
@ -57,28 +57,28 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room",
"Room",
"The room this invitee list refers to",
Room::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"search-term",
"Search Term",
"The search term",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"has-selected",
"Has Selected",
"Whether the user has selected some users",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"state",
"InviteeListState",
"The state of the list",
@ -334,7 +334,7 @@ impl InviteeList {
.invitee_list
.borrow_mut()
.insert(user.user_id(), user.clone());
self.emit_by_name("invitee-added", &[&user]).unwrap();
self.emit_by_name::<()>("invitee-added", &[&user]);
self.notify("has-selected");
}
@ -353,7 +353,7 @@ impl InviteeList {
let removed = priv_.invitee_list.borrow_mut().remove(&user_id);
if let Some(user) = removed {
user.set_invited(false);
self.emit_by_name("invitee-removed", &[&user]).unwrap();
self.emit_by_name::<()>("invitee-removed", &[&user]);
self.notify("has-selected");
}
}
@ -373,7 +373,6 @@ impl InviteeList {
f(&obj, &invitee);
None
})
.unwrap()
}
pub fn connect_invitee_removed<F: Fn(&Self, &Invitee) + 'static>(
@ -386,6 +385,5 @@ impl InviteeList {
f(&obj, &invitee);
None
})
.unwrap()
}
}

5
src/session/content/room_details/invite_subpage/invitee_row.rs

@ -36,7 +36,7 @@ mod imp {
impl ObjectImpl for InviteeRow {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"user",
"User",
"The user this row is showing",
@ -105,8 +105,7 @@ impl InviteeRow {
let binding = user
.bind_property("invited", &*priv_.check_button, "active")
.flags(glib::BindingFlags::BIDIRECTIONAL | glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
priv_.binding.replace(Some(binding));
}

18
src/session/content/room_details/invite_subpage/mod.rs

@ -60,7 +60,7 @@ mod imp {
Self::bind_template(klass);
klass.add_binding(
gdk::keys::constants::Escape,
gdk::Key::Escape,
gdk::ModifierType::empty(),
|obj, _| {
obj.close();
@ -79,7 +79,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"room",
"Room",
"The room users will be invited to",
@ -120,7 +120,7 @@ mod imp {
}));
self.text_buffer.connect_delete_range(clone!(@weak obj => move |_, start, end| {
let mut current = start.clone();
let mut current = start.to_owned();
loop {
if let Some(anchor) = current.child_anchor() {
let user = anchor.widgets()[0].downcast_ref::<Pill>().unwrap().user().unwrap().downcast::<Invitee>().unwrap();
@ -154,7 +154,7 @@ mod imp {
if changed {
text_buffer.place_cursor(location);
text_buffer.stop_signal_emission("insert-text");
text_buffer.stop_signal_emission_by_name("insert-text");
text_buffer.insert(location, text);
}
}),
@ -227,20 +227,18 @@ impl InviteSubpage {
.text_buffer
.bind_property("text", &user_list, "search-term")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
user_list
.bind_property("has-selected", &*priv_.invite_button, "sensitive")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
priv_
.list_view
.set_model(Some(&gtk::NoSelection::new(Some(&user_list))));
} else {
priv_.list_view.set_model(gtk::NONE_SELECTION_MODEL);
priv_.list_view.set_model(gtk::SelectionModel::NONE);
}
priv_.room.replace(room);
@ -285,7 +283,7 @@ impl InviteSubpage {
if let Some(anchor) = user.take_anchor() {
if !anchor.is_deleted() {
let mut start_iter = priv_.text_buffer.iter_at_child_anchor(&anchor);
let mut end_iter = start_iter.clone();
let mut end_iter = start_iter;
end_iter.forward_char();
priv_.text_buffer.delete(&mut start_iter, &mut end_iter);
}

4
src/session/content/room_details/member_page/member_menu.rs

@ -26,14 +26,14 @@ mod imp {
impl ObjectImpl for MemberMenu {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"member",
"Member",
"The member this row is showing",
Member::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_flags(
glib::ParamSpecFlags::new(
"allowed-actions",
"Allowed Actions",
"The actions the currently logged-in user is allowed to perform on the selected member.",

2
src/session/content/room_details/member_page/member_row.rs

@ -36,7 +36,7 @@ mod imp {
impl ObjectImpl for MemberRow {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"member",
"Member",
"The member this row is showing",

19
src/session/content/room_details/member_page/mod.rs

@ -1,7 +1,7 @@
use adw::prelude::*;
use adw::subclass::prelude::*;
use gettextrs::ngettext;
use gtk::glib::{self, clone};
use gtk::glib::{self, clone, closure};
use gtk::subclass::prelude::*;
use gtk::CompositeTemplate;
@ -69,14 +69,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room",
"Room",
"The room backing all details of the member page",
Room::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"member-menu",
"Member Menu",
"The object holding information needed for the menu of each MemberRow",
@ -152,7 +152,7 @@ impl MemberPage {
&gtk::NumericSorter::builder()
.expression(&gtk::PropertyExpression::new(
Member::static_type(),
gtk::NONE_EXPRESSION,
gtk::Expression::NONE,
"power-level",
))
.sort_order(gtk::SortType::Descending)
@ -161,7 +161,7 @@ impl MemberPage {
sorter.append(&gtk::StringSorter::new(Some(
&gtk::PropertyExpression::new(
Member::static_type(),
gtk::NONE_EXPRESSION,
gtk::Expression::NONE,
"display-name",
),
)));
@ -177,14 +177,9 @@ impl MemberPage {
)
}
let member_expr = gtk::ClosureExpression::new(
|value| {
value[0]
.get::<Member>()
.map(search_string)
.unwrap_or_default()
},
let member_expr = gtk::ClosureExpression::new::<String, &[gtk::Expression], _>(
&[],
closure!(|member: Option<Member>| { member.map(search_string).unwrap_or_default() }),
);
let filter = gtk::StringFilter::builder()
.match_mode(gtk::StringFilterMatchMode::Substring)

32
src/session/content/room_details/mod.rs

@ -6,7 +6,7 @@ use adw::subclass::prelude::*;
use gettextrs::gettext;
use gtk::gdk;
use gtk::{
glib::{self, clone},
glib::{self, clone, closure},
subclass::prelude::*,
CompositeTemplate,
};
@ -17,7 +17,7 @@ pub use self::member_page::MemberPage;
use crate::components::CustomEntry;
use crate::session::room::RoomAction;
use crate::session::{self, Room};
use crate::utils::{and_expr, or_expr, prop_expr};
use crate::utils::{and_expr, or_expr};
mod imp {
use super::*;
@ -68,7 +68,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"room",
"Room",
"The room backing all details of the preference window",
@ -150,25 +150,19 @@ impl RoomDetails {
// Hide avatar controls when the user is not eligible to perform the actions.
let room = self.room();
let avatar = prop_expr(room, "avatar");
let avatar_image =
gtk::PropertyExpression::new(session::Avatar::static_type(), Some(&avatar), "image")
.upcast();
let room_avatar_exists = gtk::ClosureExpression::new(
move |args| {
let image: Option<gdk::Paintable> = args[1].get().unwrap();
image.is_some()
},
&[avatar_image],
)
.upcast();
let room_avatar_exists = room
.property_expression("avatar")
.chain_property::<session::Avatar>("image")
.chain_closure::<bool>(closure!(
|_: Option<glib::Object>, image: Option<gdk::Paintable>| { image.is_some() }
));
let room_avatar_changeable =
room.new_allowed_expr(RoomAction::StateEvent(EventType::RoomAvatar));
let room_avatar_removable = and_expr(room_avatar_changeable.clone(), room_avatar_exists);
let room_avatar_removable = and_expr(&room_avatar_changeable, &room_avatar_exists);
room_avatar_removable.bind(&avatar_remove_button.get(), "visible", gtk::NONE_WIDGET);
room_avatar_changeable.bind(&avatar_edit_button.get(), "visible", gtk::NONE_WIDGET);
room_avatar_removable.bind(&avatar_remove_button.get(), "visible", gtk::Widget::NONE);
room_avatar_changeable.bind(&avatar_edit_button.get(), "visible", gtk::Widget::NONE);
}
fn init_edit_toggle(&self) {
@ -214,7 +208,7 @@ impl RoomDetails {
room.new_allowed_expr(RoomAction::StateEvent(EventType::RoomTopic));
let edit_toggle_visible = or_expr(room_name_changeable, room_topic_changeable);
edit_toggle_visible.bind(&edit_toggle.get(), "visible", gtk::NONE_WIDGET);
edit_toggle_visible.bind(&edit_toggle.get(), "visible", gtk::Widget::NONE);
}
fn init_avatar_chooser(&self) {

2
src/session/content/room_history/divider_row.rs

@ -31,7 +31,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_string(
vec![glib::ParamSpecString::new(
"label",
"Label",
"The label for this divider",

16
src/session/content/room_history/item_row.rs

@ -32,7 +32,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"item",
"item",
"The item represented by this row",
@ -158,7 +158,7 @@ impl ItemRow {
self.remove_reaction_chooser();
}
let fmt = if date.year() == glib::DateTime::new_now_local().unwrap().year() {
let fmt = if date.year() == glib::DateTime::now_local().unwrap().year() {
// Translators: This is a date format in the day divider without the year
gettext("%A, %B %e")
} else {
@ -195,7 +195,7 @@ impl ItemRow {
.child()
.map_or(false, |widget| widget.is::<gtk::Spinner>())
{
let spinner = gtk::SpinnerBuilder::new()
let spinner = gtk::Spinner::builder()
.spinning(true)
.margin_top(12)
.margin_bottom(12)
@ -275,16 +275,18 @@ impl ItemRow {
if priv_.emoji_chooser.borrow().is_none() {
let emoji_chooser = gtk::EmojiChooser::builder().has_arrow(false).build();
emoji_chooser.connect_emoji_picked(|emoji_chooser, emoji| {
emoji_chooser.activate_action("event.toggle-reaction", Some(&emoji.to_variant()));
emoji_chooser
.activate_action("event.toggle-reaction", Some(&emoji.to_variant()))
.unwrap();
});
emoji_chooser.set_parent(self);
priv_.emoji_chooser.replace(Some(emoji_chooser));
}
let emoji_chooser = priv_.emoji_chooser.borrow().clone().unwrap();
if let Some(rectangle) = self.popover().pointing_to() {
emoji_chooser.set_pointing_to(&rectangle);
}
let (_, rectangle) = self.popover().pointing_to();
emoji_chooser.set_pointing_to(Some(&rectangle));
self.popover().popdown();
emoji_chooser.popup();
}

4
src/session/content/room_history/message_row/file.rs

@ -35,14 +35,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"filename",
"Filename",
"The filename of the file",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"compact",
"Compact",
"Whether this file should be displayed in a compact format",

71
src/session/content/room_history/message_row/media.rs

@ -1,9 +1,7 @@
use adw::{prelude::*, subclass::prelude::*};
use gettextrs::gettext;
use gtk::{
gdk,
gdk_pixbuf::Pixbuf,
gio,
gdk, gio,
glib::{self, clone},
subclass::prelude::*,
CompositeTemplate,
@ -35,18 +33,18 @@ const FALLBACK_HEIGHT: i32 = 360;
const MAX_COMPACT_THUMBNAIL_WIDTH: i32 = 75;
const MAX_COMPACT_THUMBNAIL_HEIGHT: i32 = 50;
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::GEnum)]
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[genum(type_name = "MediaType")]
#[enum_type(name = "MediaType")]
pub enum MediaType {
Image = 0,
Sticker = 1,
Video = 2,
}
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::GEnum)]
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[genum(type_name = "MediaState")]
#[enum_type(name = "MediaState")]
pub enum MediaState {
Initial = 0,
Loading = 1,
@ -106,7 +104,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_int(
glib::ParamSpecInt::new(
"width",
"Width",
"The intended display width of the media",
@ -115,7 +113,7 @@ mod imp {
-1,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_int(
glib::ParamSpecInt::new(
"height",
"Height",
"The intended display height of the media",
@ -124,7 +122,7 @@ mod imp {
-1,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"state",
"State",
"The state of the media",
@ -132,7 +130,7 @@ mod imp {
MediaState::default() as i32,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"compact",
"Compact",
"Whether to display this media in a compact format",
@ -429,28 +427,33 @@ impl MessageMedia {
Ok((Some(data), id)) => {
match media_type {
MediaType::Image | MediaType::Sticker => {
let stream = gio::MemoryInputStream::from_bytes(&glib::Bytes::from(&data));
let texture = Pixbuf::from_stream(&stream, gio::NONE_CANCELLABLE)
.ok()
.map(|pixbuf| gdk::Texture::for_pixbuf(&pixbuf));
let child = if let Some(Ok(child)) =
priv_.media.child().map(|w| w.downcast::<gtk::Picture>())
{
child
} else {
let child = gtk::Picture::new();
priv_.media.set_child(Some(&child));
child
};
child.set_paintable(texture.as_ref());
child.set_tooltip_text(body.as_deref());
if media_type == MediaType::Sticker && priv_.media.has_css_class("thumbnail") {
priv_.media.remove_css_class("thumbnail");
} else if !priv_.media.has_css_class("thumbnail") {
priv_.media.add_css_class("thumbnail");
}
match gdk::Texture::from_bytes(&glib::Bytes::from(&data))
{
Ok(texture) => {
let child = if let Some(Ok(child)) =
priv_.media.child().map(|w| w.downcast::<gtk::Picture>())
{
child
} else {
let child = gtk::Picture::new();
priv_.media.set_child(Some(&child));
child
};
child.set_paintable(Some(&texture));
child.set_tooltip_text(body.as_deref());
if media_type == MediaType::Sticker && priv_.media.has_css_class("thumbnail") {
priv_.media.remove_css_class("thumbnail");
} else if !priv_.media.has_css_class("thumbnail") {
priv_.media.add_css_class("thumbnail");
}
}
Err(error) => {
warn!("Image file not supported: {}", error);
priv_.overlay_error.set_tooltip_text(Some(&gettext("Image file not supported")));
obj.set_state(MediaState::Error);
}
}
}
MediaType::Video => {
// The GStreamer backend of GtkVideo doesn't work with input streams so
@ -464,7 +467,7 @@ impl MessageMedia {
None,
false,
gio::FileCreateFlags::REPLACE_DESTINATION,
gio::NONE_CANCELLABLE,
gio::Cancellable::NONE,
)
.unwrap();
let media_file = gtk::MediaFile::for_file(&file);

11
src/session/content/room_history/message_row/mod.rs

@ -70,7 +70,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"show-header",
"Show Header",
"Whether this item should show a header. This does nothing if this event doesn’t have a header. ",
@ -162,20 +162,17 @@ impl MessageRow {
.sender()
.bind_property("display-name", &priv_.display_name.get(), "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
let show_header_binding = event
.bind_property("show-header", self, "show-header")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
let timestamp_binding = event
.bind_property("time", &*priv_.timestamp, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
priv_.bindings.borrow_mut().append(&mut vec![
display_name_binding,

2
src/session/content/room_history/message_row/reaction.rs

@ -39,7 +39,7 @@ mod imp {
impl ObjectImpl for MessageReaction {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"group",
"Group",
"The reaction group to display",

4
src/session/content/room_history/message_row/text.rs

@ -51,14 +51,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"body",
"Body",
"The displayed content of the message",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"sender",
"Sender",
"The sender of the message",

31
src/session/content/room_history/mod.rs

@ -115,35 +115,35 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"compact",
"Compact",
"Whether a compact view is used",
false,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room",
"Room",
"The room currently shown",
Room::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"empty",
"Empty",
"Wheter there is currently a room shown",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"markdown-enabled",
"Markdown enabled",
"Whether outgoing messages should be interpreted as markdown",
false,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"sticky",
"Sticky",
"Whether the room history should stick to the newest message in the timeline",
@ -245,8 +245,8 @@ mod imp {
key_events
.connect_key_pressed(clone!(@weak obj => @default-return Inhibit(false), move |_, key, _, modifier| {
if !modifier.contains(gdk::ModifierType::SHIFT_MASK) && (key == gdk::keys::constants::Return || key == gdk::keys::constants::KP_Enter) {
obj.activate_action("room-history.send-text-message", None);
if !modifier.contains(gdk::ModifierType::SHIFT_MASK) && (key == gdk::Key::Return || key == gdk::Key::KP_Enter) {
obj.activate_action("room-history.send-text-message", None).unwrap();
Inhibit(true)
} else {
Inhibit(false)
@ -268,8 +268,7 @@ mod imp {
let (start_iter, end_iter) = buffer.bounds();
obj.action_set_enabled("room-history.send-text-message", start_iter != end_iter);
let md_lang =
sourceview::LanguageManager::default().and_then(|lm| lm.language("markdown"));
let md_lang = sourceview::LanguageManager::default().language("markdown");
buffer.set_language(md_lang.as_ref());
obj.bind_property("markdown-enabled", &buffer, "highlight-syntax")
.flags(glib::BindingFlags::SYNC_CREATE)
@ -390,8 +389,9 @@ impl RoomHistory {
let mut plain_body = String::with_capacity(body_len);
// formatted_body is Markdown if is_markdown is true, and HTML if false.
let mut formatted_body = String::with_capacity(body_len);
// uncopied_text_location is the start of the text we haven't copied to plain_body and formatted_body.
let mut uncopied_text_location = start_iter.clone();
// uncopied_text_location is the start of the text we haven't copied to
// plain_body and formatted_body.
let mut uncopied_text_location = start_iter;
let mut iter = start_iter;
loop {
@ -421,7 +421,7 @@ impl RoomHistory {
let some_text = buffer.text(&uncopied_text_location, &iter, false);
plain_body.push_str(&some_text);
formatted_body.push_str(&some_text);
uncopied_text_location = iter.clone();
uncopied_text_location = iter;
// Add mention
has_mentions = true;
@ -486,7 +486,7 @@ impl RoomHistory {
pub fn open_room_details(&self, page_name: &str) {
if let Some(room) = self.room() {
let window = RoomDetails::new(&self.parent_window(), &room);
window.set_property("visible-page-name", page_name).unwrap();
window.set_property("visible-page-name", page_name);
window.show();
}
}
@ -494,7 +494,7 @@ impl RoomHistory {
pub fn open_invite_members(&self) {
if let Some(room) = self.room() {
let window = RoomDetails::new(&self.parent_window(), &room);
window.set_property("visible-page-name", "members").unwrap();
window.set_property("visible-page-name", "members");
window.present_invite_subpage();
window.show();
}
@ -571,8 +571,7 @@ impl RoomHistory {
priv_
.scrolled_window
.emit_by_name("scroll-child", &[&gtk::ScrollType::End, &false])
.unwrap();
.emit_by_name::<bool>("scroll-child", &[&gtk::ScrollType::End, &false]);
}
}

2
src/session/content/room_history/verification_info_bar.rs

@ -58,7 +58,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"request",
"Request",
"The verification request this InfoBar is showing",

4
src/session/content/verification/identity_verification_widget.rs

@ -120,7 +120,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"request",
"Request",
"The Object holding the data for the verification",
@ -241,7 +241,7 @@ mod imp {
self.done_btn.connect_clicked(clone!(@weak obj => move |_| {
if let Some(request) = obj.request() {
if request.mode() == VerificationMode::CurrentSession {
obj.activate_action("session.show-content", None);
obj.activate_action("session.show-content", None).unwrap();
}
}
}));

10
src/session/content/verification/session_verification.rs

@ -75,7 +75,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"session",
"Session",
"The session",
@ -282,12 +282,12 @@ impl SessionVerification {
if let Some(request) = self.request() {
if request.state() == VerificationState::RequestSend {
self.set_request(None);
self.activate_action("session.logout", None);
self.activate_action("session.logout", None).unwrap();
} else {
self.start_request();
}
} else {
self.activate_action("session.logout", None);
self.activate_action("session.logout", None).unwrap();
}
}
@ -321,7 +321,7 @@ impl SessionVerification {
if let Some(error_message) = error_message {
let error = Error::new(move |_| {
let error_label = gtk::LabelBuilder::new()
let error_label = gtk::Label::builder()
.label(&error_message)
.wrap(true)
.build();
@ -333,7 +333,7 @@ impl SessionVerification {
}
} else {
// TODO tell user that the a crypto identity was created
obj.activate_action("session.show-content", None);
obj.activate_action("session.show-content", None).unwrap();
}
}));
}

6
src/session/event_source_dialog.rs

@ -38,7 +38,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"event",
"Event",
"The event that is displayed in the Dialog",
@ -80,8 +80,8 @@ mod imp {
.downcast::<sourceview::Buffer>()
.unwrap();
let md_lang = sourceview::LanguageManager::default().and_then(|lm| lm.language("json"));
buffer.set_language(md_lang.as_ref());
let json_lang = sourceview::LanguageManager::default().language("json");
buffer.set_language(json_lang.as_ref());
crate::utils::setup_style_scheme(&buffer);
self.parent_constructed(obj);

37
src/session/media_viewer.rs

@ -1,8 +1,6 @@
use adw::{prelude::*, subclass::prelude::*};
use gettextrs::gettext;
use gtk::{
gdk, gdk_pixbuf::Pixbuf, gio, glib, glib::clone, subclass::prelude::*, CompositeTemplate,
};
use gtk::{gdk, gio, glib, glib::clone, subclass::prelude::*, CompositeTemplate};
use log::warn;
use matrix_sdk::ruma::events::{room::message::MessageType, AnyMessageEventContent};
@ -55,10 +53,10 @@ mod imp {
stream.seek(0);
}
}
obj.activate_action("session.show-content", None);
obj.activate_action("session.show-content", None).unwrap();
});
klass.add_binding_action(
gdk::keys::constants::Escape,
gdk::Key::Escape,
gdk::ModifierType::empty(),
"media-viewer.close",
None,
@ -74,21 +72,21 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"fullscreened",
"Fullscreened",
"Whether the viewer is fullscreen",
false,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"event",
"Event",
"The media event to display",
Event::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"body",
"Body",
"The body of the media event",
@ -145,7 +143,7 @@ mod imp {
let click_gesture = gtk::GestureClick::builder().button(1).build();
click_gesture.connect_pressed(clone!(@weak obj => move |_, n_pressed, _, _| {
if n_pressed == 2 {
obj.activate_action("win.toggle-fullscreen", None);
obj.activate_action("win.toggle-fullscreen", None).unwrap();
}
}));
obj.add_controller(&click_gesture);
@ -265,13 +263,18 @@ impl MediaViewer {
match event.get_media_content().await {
Ok((_, _, data)) => {
let stream = gio::MemoryInputStream::from_bytes(&glib::Bytes::from(&data));
let texture = Pixbuf::from_stream(&stream, gio::NONE_CANCELLABLE)
.ok()
.map(|pixbuf| gdk::Texture::for_pixbuf(&pixbuf));
let child = gtk::Picture::for_paintable(texture.as_ref());
priv_.media.set_child(Some(&child));
match gdk::Texture::from_bytes(&glib::Bytes::from(&data))
{
Ok(texture) => {
let child = gtk::Picture::for_paintable(&texture);
priv_.media.set_child(Some(&child));
}
Err(error) => {
warn!("Image file not supported: {}", error);
let child = gtk::Label::new(Some(&gettext("Image file not supported")));
priv_.media.set_child(Some(&child));
}
}
}
Err(error) => {
warn!("Could not retrieve image file: {}", error);
@ -303,7 +306,7 @@ impl MediaViewer {
None,
false,
gio::FileCreateFlags::REPLACE_DESTINATION,
gio::NONE_CANCELLABLE,
gio::Cancellable::NONE,
)
.unwrap();
let child = gtk::Video::builder().file(&file).autoplay(true).build();

27
src/session/mod.rs

@ -137,7 +137,7 @@ mod imp {
});
klass.add_binding_action(
gdk::keys::constants::Escape,
gdk::Key::Escape,
gdk::ModifierType::empty(),
"session.close-room",
None,
@ -148,7 +148,7 @@ mod imp {
});
klass.add_binding_action(
gdk::keys::constants::k,
gdk::Key::k,
gdk::ModifierType::CONTROL_MASK,
"session.toggle-room-search",
None,
@ -174,14 +174,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"item-list",
"Item List",
"The list of items in the sidebar",
ItemList::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"user",
"User",
"The user of this session",
@ -237,7 +237,7 @@ mod imp {
fn dispose(&self, obj: &Self::Type) {
if let Some(source_id) = self.source_id.take() {
let _ = glib::Source::remove(source_id);
source_id.remove();
}
if let Some(handle) = self.sync_tokio_handle.take() {
@ -410,7 +410,7 @@ impl Session {
warn!("Couldn't store session: {:?}", error);
let error_string = error.to_user_facing();
Some(Error::new(move |_| {
let error_label = gtk::LabelBuilder::new()
let error_label = gtk::Label::builder()
.label(
&(gettext("Unable to store session")
+ ": "
@ -442,7 +442,7 @@ impl Session {
let error_string = error.to_user_facing();
Some(Error::new(move |_| {
let error_label = gtk::LabelBuilder::new()
let error_label = gtk::Label::builder()
.label(&error_string)
.wrap(true)
.build();
@ -451,7 +451,7 @@ impl Session {
}
};
self.emit_by_name("prepared", &[&error]).unwrap();
self.emit_by_name::<()>("prepared", &[&error]);
}
fn sync(&self) {
@ -616,7 +616,6 @@ impl Session {
None
})
.unwrap()
}
pub fn connect_logged_out<F: Fn(&Self) + 'static>(&self, f: F) -> glib::SignalHandlerId {
@ -627,7 +626,6 @@ impl Session {
None
})
.unwrap()
}
pub fn connect_ready<F: Fn(&Self) + 'static>(&self, f: F) -> glib::SignalHandlerId {
@ -638,7 +636,6 @@ impl Session {
None
})
.unwrap()
}
fn handle_sync_response(&self, response: Result<SyncResponse, matrix_sdk::Error>) {
@ -658,7 +655,7 @@ impl Session {
))) = error
{
if let ErrorKind::UnknownToken { soft_logout: _ } = error.kind {
self.emit_by_name("logged-out", &[]).unwrap();
self.emit_by_name::<()>("logged-out", &[]);
self.cleanup_session();
}
}
@ -693,7 +690,7 @@ impl Session {
pub async fn logout(&self) {
let priv_ = imp::Session::from_instance(self);
self.emit_by_name("logged-out", &[]).unwrap();
self.emit_by_name::<()>("logged-out", &[]);
debug!("The session is about to be logout");
@ -731,7 +728,7 @@ impl Session {
priv_.is_ready.set(false);
if let Some(source_id) = priv_.source_id.take() {
let _ = glib::Source::remove(source_id);
source_id.remove();
}
if let Some(handle) = priv_.sync_tokio_handle.take() {
@ -764,7 +761,7 @@ impl Session {
priv_.stack.remove(&session_verificiation);
}
self.emit_by_name("ready", &[]).unwrap();
self.emit_by_name::<()>("ready", &[]);
}
/// Show a media event

20
src/session/room/event.rs

@ -26,8 +26,8 @@ use crate::{
utils::{filename_for_mime, media_type_uid},
};
#[derive(Clone, Debug, glib::GBoxed)]
#[gboxed(type_name = "BoxedSyncRoomEvent")]
#[derive(Clone, Debug, glib::Boxed)]
#[boxed_type(name = "BoxedSyncRoomEvent")]
pub struct BoxedSyncRoomEvent(SyncRoomEvent);
mod imp {
@ -62,56 +62,56 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boxed(
glib::ParamSpecBoxed::new(
"event",
"event",
"The matrix event of this Event",
BoxedSyncRoomEvent::static_type(),
glib::ParamFlags::WRITABLE,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"source",
"Source",
"The source (JSON) of this Event",
None,
glib::ParamFlags::READABLE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"show-header",
"Show Header",
"Whether this event should show a header. This does nothing if this event doesn’t have a header. ",
false,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"can-hide-header",
"Can hide header",
"Whether this event is allowed to hide it's header or not.",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"sender",
"Sender",
"The sender of this matrix event",
Member::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room",
"Room",
"The room containing this event",
Room::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"time",
"Time",
"The locally formatted time of this matrix event",
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"can-view-media",
"Can View Media",
"Whether this is a media event that can be viewed",

16
src/session/room/event_actions.rs

@ -67,7 +67,7 @@ where
/// Should be paired with the `EventActions` menu models.
fn set_event_actions(&self, event: Option<&Event>) -> Option<gio::SimpleActionGroup> {
if event.is_none() {
self.insert_action_group("event", gio::NONE_ACTION_GROUP);
self.insert_action_group("event", gio::ActionGroup::NONE);
return None;
}
@ -143,7 +143,7 @@ where
let error_message = err.to_user_facing();
let error = Error::new(move |_| {
let error_label = gtk::LabelBuilder::new()
let error_label = gtk::Label::builder()
.label(&error_message)
.wrap(true)
.build();
@ -174,7 +174,7 @@ where
None,
false,
gio::FileCreateFlags::REPLACE_DESTINATION,
gio::NONE_CANCELLABLE,
gio::Cancellable::NONE,
)
.unwrap();
}
@ -200,7 +200,7 @@ where
let error_message = err.to_user_facing();
let error = Error::new(move |_| {
let error_label = gtk::LabelBuilder::new()
let error_label = gtk::Label::builder()
.label(&error_message)
.wrap(true)
.build();
@ -216,7 +216,7 @@ where
path.push(uid);
if !path.exists() {
let dir = gio::File::for_path(path.clone());
dir.make_directory_with_parents(gio::NONE_CANCELLABLE)
dir.make_directory_with_parents(gio::Cancellable::NONE)
.unwrap();
}
@ -228,13 +228,13 @@ where
None,
false,
gio::FileCreateFlags::REPLACE_DESTINATION,
gio::NONE_CANCELLABLE,
gio::Cancellable::NONE,
)
.unwrap();
if let Err(error) = gio::AppInfo::launch_default_for_uri_async_future(
if let Err(error) = gio::AppInfo::launch_default_for_uri_future(
&file.uri(),
gio::NONE_APP_LAUNCH_CONTEXT,
gio::AppLaunchContext::NONE,
)
.await
{

10
src/session/room/highlight_flags.rs

@ -1,14 +1,14 @@
use gtk::glib;
#[glib::gflags("HighlightFlags")]
#[glib::flags(name = "HighlightFlags")]
pub enum HighlightFlags {
#[glib::gflags(name = "NONE")]
#[flags_value(name = "NONE")]
NONE = 0b00000000,
#[glib::gflags(name = "HIGHLIGHT")]
#[flags_value(name = "HIGHLIGHT")]
HIGHLIGHT = 0b00000001,
#[glib::gflags(name = "BOLD")]
#[flags_value(name = "BOLD")]
BOLD = 0b00000010,
#[glib::gflags(skip)]
#[flags_value(skip)]
HIGHLIGHT_BOLD = Self::HIGHLIGHT.bits() | Self::BOLD.bits(),
}

14
src/session/room/item.rs

@ -17,8 +17,8 @@ pub enum ItemType {
LoadingSpinner,
}
#[derive(Clone, Debug, glib::GBoxed)]
#[gboxed(type_name = "BoxedItemType")]
#[derive(Clone, Debug, glib::Boxed)]
#[boxed_type(name = "BoxedItemType")]
pub struct BoxedItemType(ItemType);
impl From<ItemType> for BoxedItemType {
@ -50,35 +50,35 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_boxed(
glib::ParamSpecBoxed::new(
"type",
"Type",
"The type of this item",
BoxedItemType::static_type(),
glib::ParamFlags::WRITABLE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"selectable",
"Selectable",
"Whether this item is selectable.",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"show-header",
"Show Header",
"Whether this item should show a header. This does do nothing if this event doesn’t have a header. ",
false,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"can-hide-header",
"Can hide header",
"Whether this item is allowed to hide its header.",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"activatable",
"Activatable",
"Whether this item is activatable.",

2
src/session/room/member.rs

@ -31,7 +31,7 @@ mod imp {
impl ObjectImpl for Member {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_int64(
vec![glib::ParamSpecInt64::new(
"power-level",
"Power level",
"Power level of the member in its room.",

2
src/session/room/member_list.rs

@ -28,7 +28,7 @@ mod imp {
impl ObjectImpl for MemberList {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"room",
"Room",
"The associated room",

8
src/session/room/member_role.rs

@ -6,13 +6,13 @@ use gtk::glib;
use crate::session::room::power_levels::PowerLevel;
/// Role of a room member, like admin or moderator.
#[glib::gflags("MemberRole")]
#[glib::flags(name = "MemberRole")]
pub enum MemberRole {
#[glib::gflags(name = "ADMIN")]
#[flags_value(name = "ADMIN")]
ADMIN = 1,
#[glib::gflags(name = "MOD")]
#[flags_value(name = "MOD")]
MOD = 2,
#[glib::gflags(name = "PEASANT")]
#[flags_value(name = "PEASANT")]
PEASANT = 0,
}

41
src/session/room/mod.rs

@ -107,49 +107,49 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"room-id",
"Room id",
"The room id of this Room",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The session",
Session::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"display-name",
"Display Name",
"The display name of this room",
None,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"inviter",
"Inviter",
"The user who sent the invite to this room, this is only set when this room represents an invite",
Member::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"avatar",
"Avatar",
"The Avatar of this room",
Avatar::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"timeline",
"Timeline",
"The timeline of this room",
Timeline::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_flags(
glib::ParamSpecFlags::new(
"highlight",
"Highlight",
"How this room is highlighted",
@ -157,7 +157,7 @@ mod imp {
HighlightFlags::default().bits(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_uint64(
glib::ParamSpecUInt64::new(
"notification-count",
"Notification count",
"The notification count of this room",
@ -166,7 +166,7 @@ mod imp {
0,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"category",
"Category",
"The category of this room",
@ -174,35 +174,35 @@ mod imp {
RoomType::default() as i32,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"topic",
"Topic",
"The topic of this room",
None,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_boxed(
glib::ParamSpecBoxed::new(
"latest-change",
"Latest Change",
"Latest origin_server_ts of all loaded invents",
glib::DateTime::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"members",
"Members",
"Model of the room’s members",
MemberList::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"predecessor",
"Predecessor",
"The room id of predecessor of this Room",
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"successor",
"Successor",
"The room id of successor of this Room",
@ -318,8 +318,7 @@ mod imp {
obj.bind_property("display-name", obj.avatar(), "display-name")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
}
}
}
@ -399,7 +398,7 @@ impl Room {
clone!(@weak self as obj => async move {
match handle.await.unwrap() {
Ok(_) => {
obj.emit_by_name("room-forgotten", &[]).unwrap();
obj.emit_by_name::<()>("room-forgotten", &[]);
}
Err(error) => {
error!("Couldn’t forget the room: {}", error);
@ -442,7 +441,7 @@ impl Room {
priv_.category.set(category);
self.notify("category");
self.emit_by_name("order-changed", &[]).unwrap();
self.emit_by_name::<()>("order-changed", &[]);
}
/// Set the category of this room.
@ -852,7 +851,7 @@ impl Room {
priv_.timeline.get().unwrap().append(batch);
priv_.latest_change.replace(latest_change);
self.notify("latest-change");
self.emit_by_name("order-changed", &[]).unwrap();
self.emit_by_name::<()>("order-changed", &[]);
}
/// Returns the point in time this room received its latest event.
@ -1024,7 +1023,7 @@ impl Room {
}
/// Creates an expression that is true when the user is allowed the given action.
pub fn new_allowed_expr(&self, room_action: RoomAction) -> gtk::Expression {
pub fn new_allowed_expr(&self, room_action: RoomAction) -> gtk::ClosureExpression {
let session = self.session();
let user_id = session.user().unwrap().user_id();
let member = self.members().member_by_id(user_id);
@ -1174,7 +1173,6 @@ impl Room {
f(&obj);
None
})
.unwrap()
}
/// Connect to the signal sent when a room was forgotten.
@ -1184,7 +1182,6 @@ impl Room {
f(&obj);
None
})
.unwrap()
}
pub fn predecessor(&self) -> Option<&RoomId> {

32
src/session/room/power_levels.rs

@ -1,14 +1,13 @@
use gtk::glib;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use gtk::{glib, glib::closure};
use matrix_sdk::ruma::events::room::power_levels::RoomPowerLevelsEventContent;
use matrix_sdk::ruma::events::{EventType, SyncStateEvent};
use crate::session::room::Member;
use crate::utils::prop_expr;
#[derive(Clone, Debug, Default, glib::GBoxed)]
#[gboxed(type_name = "BoxedPowerLevelsEventContent")]
#[derive(Clone, Debug, Default, glib::Boxed)]
#[boxed_type(name = "BoxedPowerLevelsEventContent")]
pub struct BoxedPowerLevelsEventContent(RoomPowerLevelsEventContent);
/// Power level of a user.
@ -39,7 +38,7 @@ mod imp {
impl ObjectImpl for PowerLevels {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_boxed(
vec![glib::ParamSpecBoxed::new(
"power-levels",
"Power levels",
"Ruma struct containing all power level information of a room",
@ -82,19 +81,22 @@ impl PowerLevels {
}
/// Creates an expression that is true when the user is allowed the given action.
pub fn new_allowed_expr(&self, member: &Member, room_action: RoomAction) -> gtk::Expression {
gtk::ClosureExpression::new(
move |args| {
let power_level: PowerLevel = args[1].get().unwrap();
let content = args[2].get::<BoxedPowerLevelsEventContent>().unwrap().0;
power_level >= min_level_for_room_action(&content, &room_action)
},
pub fn new_allowed_expr(
&self,
member: &Member,
room_action: RoomAction,
) -> gtk::ClosureExpression {
gtk::ClosureExpression::new::<bool, _, _>(
&[
prop_expr(member, "power-level"),
prop_expr(self, "power-levels"),
member.property_expression("power-level"),
self.property_expression("power-levels"),
],
closure!(|_: Option<glib::Object>,
power_level: PowerLevel,
content: BoxedPowerLevelsEventContent| {
power_level >= min_level_for_room_action(&content.0, &room_action)
}),
)
.upcast()
}
/// Updates the power levels from the given event.

6
src/session/room/reaction_group.rs

@ -29,14 +29,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"key",
"Key",
"The key of the group",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_uint(
glib::ParamSpecUInt::new(
"count",
"Count",
"The number of reactions in this group",
@ -45,7 +45,7 @@ mod imp {
0,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"has-user",
"Has User",
"Whether this group has a reaction from this user",

4
src/session/room/room_type.rs

@ -6,9 +6,9 @@ use num_enum::{IntoPrimitive, TryFromPrimitive};
use crate::session::sidebar::CategoryType;
// TODO: do we also want the category `People` and a custom category support?
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::GEnum, IntoPrimitive, TryFromPrimitive)]
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::Enum, IntoPrimitive, TryFromPrimitive)]
#[repr(u32)]
#[genum(type_name = "RoomType")]
#[enum_type(name = "RoomType")]
pub enum RoomType {
Invited = 0,
Favorite = 1,

10
src/session/room/timeline.rs

@ -58,35 +58,35 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room",
"Room",
"The Room containing this timeline",
Room::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"loading",
"Loading",
"Whether a response is loaded or not",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"empty",
"Empty",
"Whether the timeline is empty",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"complete",
"Complete",
"Whether the full timeline is loaded",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"verification",
"Verification",
"The most recent active verification for a user in this timeline",

4
src/session/room_creation/mod.rs

@ -77,7 +77,7 @@ mod imp {
Self::bind_template(klass);
klass.add_binding(
gdk::keys::constants::Escape,
gdk::Key::Escape,
gdk::ModifierType::empty(),
|obj, _| {
obj.cancel();
@ -96,7 +96,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"session",
"Session",
"The session",

13
src/session/room_list.rs

@ -40,7 +40,7 @@ mod imp {
impl ObjectImpl for RoomList {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"session",
"Session",
"The session",
@ -108,7 +108,7 @@ glib::wrapper! {
///
/// This is the parent ListModel of the sidebar from which all other models
/// are derived. If a room is updated in an order-relevant manner, use
/// `room.emit_by_name("order-changed", &[])` to fix the sorting.
/// `room.emit_by_name::<()>("order-changed", &[])` to fix the sorting.
///
/// The `RoomList` also takes care of all so called *pending rooms*, i.e.
/// rooms the user requested to join, but received no response from the
@ -135,13 +135,13 @@ impl RoomList {
fn pending_rooms_remove(&self, identifier: &RoomOrAliasId) {
let priv_ = imp::RoomList::from_instance(self);
priv_.pending_rooms.borrow_mut().remove(identifier);
self.emit_by_name("pending-rooms-changed", &[]).unwrap();
self.emit_by_name::<()>("pending-rooms-changed", &[]);
}
fn pending_rooms_insert(&self, identifier: Box<RoomOrAliasId>) {
let priv_ = imp::RoomList::from_instance(self);
priv_.pending_rooms.borrow_mut().insert(identifier);
self.emit_by_name("pending-rooms-changed", &[]).unwrap();
self.emit_by_name::<()>("pending-rooms-changed", &[]);
}
fn pending_rooms_replace_or_remove(&self, identifier: &RoomOrAliasId, room_id: &RoomId) {
@ -153,7 +153,7 @@ impl RoomList {
pending_rooms.insert(room_id.to_owned().into());
}
}
self.emit_by_name("pending-rooms-changed", &[]).unwrap();
self.emit_by_name::<()>("pending-rooms-changed", &[]);
}
pub fn get(&self, room_id: &RoomId) -> Option<Room> {
@ -340,7 +340,7 @@ impl RoomList {
let error_message = gettext!(
"Failed to join room {}. Try again later.", identifier
);
let error_label = gtk::LabelBuilder::new().label(&error_message).wrap(true).build();
let error_label = gtk::Label::builder().label(&error_message).wrap(true).build();
Some(error_label.upcast())
}),
);
@ -365,6 +365,5 @@ impl RoomList {
None
})
.unwrap()
}
}

6
src/session/sidebar/account_switcher/avatar_with_selection.rs

@ -38,14 +38,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"item",
"Item",
"The Avatar item displayed by this widget",
AvatarItem::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_int(
glib::ParamSpecInt::new(
"size",
"Size",
"The size of the Avatar",
@ -54,7 +54,7 @@ mod imp {
-1,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"selected",
"Selected",
"Style helper for the inner Avatar",

6
src/session/sidebar/account_switcher/item.rs

@ -22,7 +22,7 @@ mod imp {
impl ObjectImpl for ExtraItemObj {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_enum(
vec![glib::ParamSpecEnum::new(
"inner",
"Inner",
"Inner value of ExtraItem",
@ -57,9 +57,9 @@ mod imp {
}
}
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::GEnum)]
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[genum(type_name = "ExtraItem")]
#[enum_type(name = "ExtraItem")]
pub enum ExtraItem {
Separator = 0,
AddAccount = 1,

4
src/session/sidebar/account_switcher/mod.rs

@ -67,7 +67,7 @@ mod imp {
.set_visible_child(&session_widget);
}
AccountSwitcherItem::AddAccount => {
list_view.activate_action("app.new-login", None);
list_view.activate_action("app.new-login", None).unwrap();
}
_ => {}
}
@ -122,7 +122,7 @@ impl AccountSwitcher {
}));
factory.connect_unbind(|_, list_item| {
list_item.set_child(gtk::NONE_WIDGET);
list_item.set_child(gtk::Widget::NONE);
});
entries.set_factory(Some(factory));

11
src/session/sidebar/account_switcher/user_entry.rs

@ -36,7 +36,8 @@ mod imp {
"user-entry-row.open-account-settings",
None,
move |item, _, _| {
item.activate_action("account-switcher.close", None);
item.activate_action("account-switcher.close", None)
.unwrap();
item.show_account_settings();
},
);
@ -51,14 +52,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session-page",
"Session StackPage",
"The stack page of the session that this entry represents",
gtk::StackPage::static_type(),
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"hint",
"Selection hint",
"The hint of the session that owns the account switcher which this entry belongs to",
@ -131,6 +132,8 @@ impl UserEntryRow {
.downcast::<Session>()
.unwrap();
session.activate_action("session.open-account-settings", None);
session
.activate_action("session.open-account-settings", None)
.unwrap();
}
}

8
src/session/sidebar/category.rs

@ -29,7 +29,7 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"type",
"Type",
"The type of this category",
@ -37,21 +37,21 @@ mod imp {
CategoryType::default() as i32,
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"display-name",
"Display Name",
"The display name of this category",
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"model",
"Model",
"The filter list model in that category",
gio::ListModel::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"empty",
"Empty",
"Whether this category is empty",

8
src/session/sidebar/category_row.rs

@ -43,28 +43,28 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"category",
"Category",
"The category of this row",
Category::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"expanded",
"Expanded",
"The expanded state of this row",
true,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"label",
"Label",
"The label to show for this row",
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"show-label-for-category",
"Show Label for Category",
"The CategoryType to show a label for",

4
src/session/sidebar/category_type.rs

@ -2,9 +2,9 @@ use crate::session::room::RoomType;
use gettextrs::gettext;
use gtk::glib;
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::GEnum)]
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::Enum)]
#[repr(i32)]
#[genum(type_name = "CategoryType")]
#[enum_type(name = "CategoryType")]
pub enum CategoryType {
None = -1,
VerificationRequest = 0,

6
src/session/sidebar/entry.rs

@ -25,7 +25,7 @@ mod imp {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"type",
"Type",
"The type of this category",
@ -33,14 +33,14 @@ mod imp {
EntryType::default() as i32,
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"display-name",
"Display Name",
"The display name of this Entry",
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"icon-name",
"Icon Name",
"The icon name used for this Entry",

2
src/session/sidebar/entry_row.rs

@ -35,7 +35,7 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
use once_cell::sync::Lazy;
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"entry",
"Entry",
"The entry of this row",

4
src/session/sidebar/entry_type.rs

@ -1,9 +1,9 @@
use gettextrs::gettext;
use gtk::glib;
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::GEnum)]
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[genum(type_name = "EntryType")]
#[enum_type(name = "EntryType")]
pub enum EntryType {
Explore = 0,
Forget = 1,

6
src/session/sidebar/item_list.rs

@ -41,21 +41,21 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"room-list",
"Room list",
"The list of rooms",
RoomList::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"verification-list",
"Verification list",
"The list of verification requests",
VerificationList::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"show-all-for-category",
"Show All For Category",
"The `CategoryType` to show all compatible categories for",

33
src/session/sidebar/mod.rs

@ -24,7 +24,7 @@ use self::selection::Selection;
use self::verification_row::VerificationRow;
use adw::{prelude::*, subclass::prelude::*};
use gtk::{gio, glib, subclass::prelude::*, CompositeTemplate, SelectionModel};
use gtk::{gio, glib, glib::closure, subclass::prelude::*, CompositeTemplate, SelectionModel};
use crate::components::Avatar;
use crate::session::room::{Room, RoomType};
@ -114,35 +114,35 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"user",
"User",
"The logged in user",
User::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"compact",
"Compact",
"Whether a compact view is used",
false,
glib::ParamFlags::READWRITE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"item-list",
"Item List",
"The list of items in the sidebar",
ItemList::static_type(),
glib::ParamFlags::WRITABLE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"selected-item",
"Selected Item",
"The selected item in this sidebar",
glib::Object::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"drop-source-type",
"Drop Source Type",
"The type of the source that activated drop mode",
@ -256,33 +256,30 @@ impl Sidebar {
let item_list = match item_list {
Some(item_list) => item_list,
None => {
priv_.listview.set_model(gtk::NONE_SELECTION_MODEL);
priv_.listview.set_model(gtk::SelectionModel::NONE);
return;
}
};
priv_.drop_binding.replace(
priv_.drop_binding.replace(Some(
self.bind_property("drop-source-type", &item_list, "show-all-for-category")
.flags(glib::BindingFlags::SYNC_CREATE)
.build(),
);
));
let tree_model = gtk::TreeListModel::new(&item_list, false, true, |item| {
item.clone().downcast::<gio::ListModel>().ok()
});
let room_expression = gtk::ClosureExpression::new(
|value| {
value[0]
.get::<gtk::TreeListRow>()
.unwrap()
.item()
let room_expression = gtk::ClosureExpression::new::<String, &[gtk::Expression], _>(
&[],
closure!(|row: gtk::TreeListRow| {
row.item()
.and_then(|o| o.downcast::<Room>().ok())
.map_or(String::new(), |o| o.display_name())
},
&[],
}),
);
let filter = gtk::StringFilterBuilder::new()
let filter = gtk::StringFilter::builder()
.match_mode(gtk::StringFilterMatchMode::Substring)
.expression(&room_expression)
.ignore_case(true)

11
src/session/sidebar/room_row.rs

@ -72,7 +72,7 @@ mod imp {
impl ObjectImpl for RoomRow {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"room",
"Room",
"The room of this row",
@ -180,8 +180,7 @@ impl RoomRow {
)
.flags(glib::BindingFlags::SYNC_CREATE)
.transform_from(|_, value| Some((value.get::<u64>().unwrap() > 0).to_value()))
.build()
.unwrap(),
.build(),
));
priv_.signal_handler.replace(Some(room.connect_notify_local(
@ -319,11 +318,13 @@ impl RoomRow {
fn drag_begin(&self) {
self.parent().unwrap().add_css_class("drag");
let category = Some(u32::from(self.room().unwrap().category()));
self.activate_action("sidebar.set-drop-source-type", Some(&category.to_variant()));
self.activate_action("sidebar.set-drop-source-type", Some(&category.to_variant()))
.unwrap();
}
fn drag_end(&self) {
self.activate_action("sidebar.set-drop-source-type", None);
self.activate_action("sidebar.set-drop-source-type", None)
.unwrap();
self.parent().unwrap().remove_css_class("drag");
}
}

24
src/session/sidebar/row.rs

@ -37,14 +37,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"item",
"Item",
"The sidebar item of this row",
glib::Object::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"list-row",
"List Row",
"The list row to track for expander state",
@ -160,8 +160,7 @@ impl Row {
let binding = row
.bind_property("expanded", &child, "expanded")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
priv_.binding.replace(Some(binding));
@ -220,7 +219,8 @@ impl Row {
} else {
panic!("Wrong row item: {:?}", item);
}
self.activate_action("sidebar.update-drop-targets", None);
self.activate_action("sidebar.update-drop-targets", None)
.unwrap();
}
self.notify("item");
@ -252,7 +252,7 @@ impl Row {
fn drop_accept(&self, drop: &gdk::Drop) -> bool {
let room = drop
.drag()
.and_then(|drag| drag.content())
.map(|drag| drag.content())
.and_then(|content| content.value(Room::static_type()).ok())
.and_then(|value| value.get::<Room>().ok());
if let Some(room) = room {
@ -261,13 +261,15 @@ impl Row {
self.activate_action(
"sidebar.set-active-drop-category",
Some(&Some(u32::from(target_type)).to_variant()),
);
)
.unwrap();
return true;
}
} else if let Some(entry_type) = self.entry_type() {
if room.category() == RoomType::Left && entry_type == EntryType::Forget {
self.parent().unwrap().add_css_class("drop-active");
self.activate_action("sidebar.set-active-drop-category", None);
self.activate_action("sidebar.set-active-drop-category", None)
.unwrap();
return true;
}
}
@ -277,7 +279,8 @@ impl Row {
fn drop_leave(&self) {
self.parent().unwrap().remove_css_class("drop-active");
self.activate_action("sidebar.set-active-drop-category", None);
self.activate_action("sidebar.set-active-drop-category", None)
.unwrap();
}
fn drop_end(&self, value: &glib::Value) -> bool {
@ -295,7 +298,8 @@ impl Row {
}
}
}
self.activate_action("sidebar.set-drop-source-type", None);
self.activate_action("sidebar.set-drop-source-type", None)
.unwrap();
ret
}
}

6
src/session/sidebar/selection.rs

@ -32,14 +32,14 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"model",
"Model",
"The model being managed",
gio::ListModel::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_uint(
glib::ParamSpecUInt::new(
"selected",
"Selected",
"The position of the selected item",
@ -48,7 +48,7 @@ mod imp {
gtk::INVALID_LIST_POSITION,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"selected-item",
"Selected Item",
"The selected item",

2
src/session/sidebar/verification_row.rs

@ -33,7 +33,7 @@ mod imp {
impl ObjectImpl for VerificationRow {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"identity-verification",
"Identity Verification",
"The identity verification of this row",

17
src/session/user.rs

@ -11,7 +11,7 @@ use std::sync::Arc;
use log::error;
#[glib::gflags("UserActions")]
#[glib::flags(name = "UserActions")]
pub enum UserActions {
NONE = 0b00000000,
VERIFY = 0b00000001,
@ -49,42 +49,42 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"user-id",
"User id",
"The user id of this user",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"display-name",
"Display Name",
"The display name of the user",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"avatar",
"Avatar",
"The avatar of this user",
Avatar::static_type(),
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The session",
Session::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_boolean(
glib::ParamSpecBoolean::new(
"verified",
"Verified",
"Whether this user has been verified",
false,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_flags(
glib::ParamSpecFlags::new(
"allowed-actions",
"Allowed Actions",
"The actions the currently logged-in user is allowed to perform on this user.",
@ -142,8 +142,7 @@ mod imp {
obj.bind_property("display-name", obj.avatar(), "display-name")
.flags(glib::BindingFlags::SYNC_CREATE)
.build()
.unwrap();
.build();
obj.init_is_verified();
}

46
src/session/verification/identity_verification.rs

@ -26,9 +26,9 @@ use qrcode::QrCode;
use std::time::Duration;
use tokio::sync::mpsc;
#[derive(Debug, Eq, PartialEq, Clone, Copy, glib::GEnum)]
#[derive(Debug, Eq, PartialEq, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[genum(type_name = "VerificationState")]
#[enum_type(name = "VerificationState")]
pub enum State {
Requested,
RequestSend,
@ -48,9 +48,9 @@ impl Default for State {
}
}
#[derive(Debug, Eq, PartialEq, Clone, Copy, glib::GEnum)]
#[derive(Debug, Eq, PartialEq, Clone, Copy, glib::Enum)]
#[repr(u32)]
#[genum(type_name = "VerificationMode")]
#[enum_type(name = "VerificationMode")]
pub enum Mode {
CurrentSession,
OtherSession,
@ -63,7 +63,7 @@ impl Default for Mode {
}
}
#[glib::gflags("VerificationSupportedMethods")]
#[glib::flags(name = "VerificationSupportedMethods")]
pub enum SupportedMethods {
NONE = 0b00000000,
SAS = 0b00000001,
@ -154,21 +154,21 @@ mod imp {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"user",
"User",
"The user to be verified",
User::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_object(
glib::ParamSpecObject::new(
"session",
"Session",
"The current session",
Session::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"state",
"State",
"The current state of this verification",
@ -176,7 +176,7 @@ mod imp {
State::default() as i32,
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_enum(
glib::ParamSpecEnum::new(
"mode",
"Mode",
"The mode of this verification",
@ -184,7 +184,7 @@ mod imp {
Mode::default() as i32,
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_flags(
glib::ParamSpecFlags::new(
"supported-methods",
"Supported Methods",
"The supported methods of this verification",
@ -192,28 +192,28 @@ mod imp {
SupportedMethods::default().bits(),
glib::ParamFlags::READABLE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"display-name",
"Display name",
"The display name of this verification request",
None,
glib::ParamFlags::READABLE | glib::ParamFlags::EXPLICIT_NOTIFY,
),
glib::ParamSpec::new_string(
glib::ParamSpecString::new(
"flow-id",
"Flow Id",
"The flow id of this verification request",
None,
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_boxed(
glib::ParamSpecBoxed::new(
"start-time",
"Start Time",
"The time when this verification request was started",
glib::DateTime::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
glib::ParamSpec::new_boxed(
glib::ParamSpecBoxed::new(
"receive-time",
"Receive Time",
"The time when this verification request was received",
@ -294,7 +294,7 @@ mod imp {
}
self.receive_time
.set(glib::DateTime::new_now_local().unwrap())
.set(glib::DateTime::now_local().unwrap())
.unwrap();
obj.setup_timeout();
obj.start_handler();
@ -368,7 +368,7 @@ impl IdentityVerification {
("flow-id", &request.flow_id()),
("session", session),
("user", user),
("start-time", &glib::DateTime::new_now_local().unwrap()),
("start-time", &glib::DateTime::now_local().unwrap()),
])
.expect("Failed to create IdentityVerification");
@ -382,12 +382,7 @@ impl IdentityVerification {
error!("Starting a verification failed: Crypto identity wasn't found");
}
Self::for_error(
mode,
session,
user,
&glib::DateTime::new_now_local().unwrap(),
)
Self::for_error(mode, session, user, &glib::DateTime::now_local().unwrap())
}
fn start_handler(&self) {
@ -459,9 +454,10 @@ impl IdentityVerification {
}
fn setup_timeout(&self) {
let difference = glib::DateTime::new_now_local()
let difference = glib::DateTime::now_local()
.unwrap()
.difference(self.start_time());
.difference(self.start_time())
.as_seconds();
if difference < 0 {
warn!("The verification request was sent in the future.");
@ -620,7 +616,7 @@ impl IdentityVerification {
});
let error = Error::new(move |_| {
let error_label = gtk::LabelBuilder::new()
let error_label = gtk::Label::builder()
.label(&error_message)
.wrap(true)
.build();

2
src/session/verification/verification_list.rs

@ -65,7 +65,7 @@ mod imp {
impl ObjectImpl for VerificationList {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![glib::ParamSpec::new_object(
vec![glib::ParamSpecObject::new(
"session",
"Session",
"The session",

48
src/utils.rs

@ -66,7 +66,7 @@ use std::str::FromStr;
use gettextrs::gettext;
use gtk::gio::{self, prelude::*};
use gtk::glib::{self, Object};
use gtk::glib::{self, closure, Object};
use matrix_sdk::{
media::MediaType,
ruma::{EventId, UInt},
@ -74,50 +74,30 @@ use matrix_sdk::{
};
use mime::Mime;
/// Returns an expression looking up the given property on `object`.
pub fn prop_expr<T: IsA<Object>>(object: &T, prop: &str) -> gtk::Expression {
let obj_expr = gtk::ConstantExpression::new(object).upcast();
gtk::PropertyExpression::new(T::static_type(), Some(&obj_expr), prop).upcast()
}
// Returns an expression that is the and’ed result of the given boolean expressions.
#[allow(dead_code)]
pub fn and_expr(a_expr: gtk::Expression, b_expr: gtk::Expression) -> gtk::Expression {
gtk::ClosureExpression::new(
move |args| {
let a: bool = args[1].get().unwrap();
let b: bool = args[2].get().unwrap();
a && b
},
pub fn and_expr<E: AsRef<gtk::Expression>>(a_expr: E, b_expr: E) -> gtk::ClosureExpression {
gtk::ClosureExpression::new::<bool, _, _>(
&[a_expr, b_expr],
closure!(|_: Option<Object>, a: bool, b: bool| { a && b }),
)
.upcast()
}
// Returns an expression that is the or’ed result of the given boolean expressions.
pub fn or_expr(a_expr: gtk::Expression, b_expr: gtk::Expression) -> gtk::Expression {
gtk::ClosureExpression::new(
move |args| {
let a: bool = args[1].get().unwrap();
let b: bool = args[2].get().unwrap();
a || b
},
pub fn or_expr<E: AsRef<gtk::Expression>>(a_expr: E, b_expr: E) -> gtk::ClosureExpression {
gtk::ClosureExpression::new::<bool, _, _>(
&[a_expr, b_expr],
closure!(|_: Option<Object>, a: bool, b: bool| { a || b }),
)
.upcast()
}
// Returns an expression that is the inverted result of the given boolean expressions.
#[allow(dead_code)]
pub fn not_expr(a_expr: gtk::Expression) -> gtk::Expression {
gtk::ClosureExpression::new(
move |args| {
let a: bool = args[1].get().unwrap();
!a
},
pub fn not_expr<E: AsRef<gtk::Expression>>(a_expr: E) -> gtk::ClosureExpression {
gtk::ClosureExpression::new::<bool, _, _>(
&[a_expr],
closure!(|_: Option<Object>, a: bool| { !a }),
)
.upcast()
}
pub fn cache_dir() -> PathBuf {
@ -126,7 +106,7 @@ pub fn cache_dir() -> PathBuf {
if !path.exists() {
let dir = gio::File::for_path(path.clone());
dir.make_directory_with_parents(gio::NONE_CANCELLABLE)
dir.make_directory_with_parents(gio::Cancellable::NONE)
.unwrap();
}
@ -149,7 +129,7 @@ pub fn uint_to_i32(u: Option<UInt>) -> i32 {
}
pub fn setup_style_scheme(buffer: &sourceview::Buffer) {
let manager = adw::StyleManager::default().unwrap();
let manager = adw::StyleManager::default();
buffer.set_style_scheme(style_scheme().as_ref());
@ -159,14 +139,14 @@ pub fn setup_style_scheme(buffer: &sourceview::Buffer) {
}
pub fn style_scheme() -> Option<sourceview::StyleScheme> {
let manager = adw::StyleManager::default().unwrap();
let manager = adw::StyleManager::default();
let scheme_name = if manager.is_dark() {
"Adwaita-dark"
} else {
"Adwaita"
};
sourceview::StyleSchemeManager::default().and_then(|scm| scm.scheme(scheme_name))
sourceview::StyleSchemeManager::default().scheme(scheme_name)
}
/// Get the unique id of the given `MediaType`.

6
src/window.rs

@ -153,7 +153,7 @@ impl Window {
warn!("Failed to restore previous sessions: {:?}", error);
let error_string = error.to_user_facing();
self.append_error(&Error::new(move |_| {
let error_label = gtk::LabelBuilder::new()
let error_label = gtk::Label::builder()
.label(
&(gettext("Unable to restore previous sessions")
+ ": "
@ -188,7 +188,7 @@ impl Window {
let is_maximized = settings.boolean("is-maximized");
self.set_default_size(width, height);
self.set_property("maximized", &is_maximized).unwrap();
self.set_property("maximized", &is_maximized);
}
/// Change the default widget of the window based on the visible child
@ -198,7 +198,7 @@ impl Window {
if priv_.main_stack.visible_child() == Some(priv_.login.get().upcast()) {
self.set_default_widget(Some(&priv_.login.default_widget()));
} else {
self.set_default_widget(gtk::NONE_WIDGET);
self.set_default_widget(gtk::Widget::NONE);
}
}

Loading…
Cancel
Save