Browse Source

chore: Use binding builder fns instead of glib::BindingFlags

merge-requests/1327/merge
Kévin Commaille 3 years ago
parent
commit
5252af0722
No known key found for this signature in database
GPG Key ID: 29A48C1F03620416
  1. 4
      src/components/pill.rs
  2. 2
      src/components/reaction_chooser.rs
  3. 3
      src/login/mod.rs
  4. 2
      src/session/model/room/mod.rs
  5. 2
      src/session/model/user.rs
  6. 3
      src/session/view/account_settings/notifications_page.rs
  7. 3
      src/session/view/content/room_details/invite_subpage/invitee_row.rs
  8. 4
      src/session/view/content/room_details/invite_subpage/mod.rs
  9. 2
      src/session/view/content/room_details/member_page/mod.rs
  10. 6
      src/session/view/content/room_history/message_row/mod.rs
  11. 4
      src/session/view/content/room_history/message_row/reaction.rs
  12. 2
      src/session/view/content/room_history/mod.rs
  13. 2
      src/session/view/create_dm_dialog/mod.rs
  14. 2
      src/session/view/media_viewer.rs
  15. 2
      src/session/view/sidebar/room_row.rs
  16. 2
      src/session/view/sidebar/row.rs

4
src/components/pill.rs

@ -119,7 +119,7 @@ impl Pill {
if let Some(ref user) = user {
let display_name_binding = user
.bind_property("display-name", &*imp.display_name, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
imp.bindings.borrow_mut().push(display_name_binding);
@ -155,7 +155,7 @@ impl Pill {
if let Some(ref room) = room {
let display_name_binding = room
.bind_property("display-name", &*imp.display_name, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
imp.bindings.borrow_mut().push(display_name_binding);

2
src/components/reaction_chooser.rs

@ -178,7 +178,7 @@ impl ReactionChooser {
.unwrap();
let binding = reaction
.bind_property("has-user", &button, "active")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
reaction_bindings.insert(reaction_item.key.to_string(), binding);
}

3
src/login/mod.rs

@ -419,7 +419,8 @@ impl Login {
async fn open_advanced_dialog(&self) {
let dialog = LoginAdvancedDialog::new(self.parent_window().upcast_ref());
self.bind_property("autodiscovery", &dialog, "autodiscovery")
.flags(glib::BindingFlags::SYNC_CREATE | glib::BindingFlags::BIDIRECTIONAL)
.sync_create()
.bidirectional()
.build();
dialog.run_future().await;
}

2
src/session/model/room/mod.rs

@ -249,7 +249,7 @@ mod imp {
}));
obj.bind_property("display-name", obj.avatar_data(), "display-name")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
if !matches!(obj.category(), RoomType::Left | RoomType::Outdated) {

2
src/session/model/user.rs

@ -116,7 +116,7 @@ mod imp {
self.avatar_data.set(avatar_data).unwrap();
obj.bind_property("display-name", obj.avatar_data(), "display-name")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
obj.init_is_verified();

3
src/session/view/account_settings/notifications_page.rs

@ -136,7 +136,8 @@ impl NotificationsPage {
let binding = session
.settings()
.bind_property("notifications-enabled", self, "session-enabled")
.flags(glib::BindingFlags::SYNC_CREATE | glib::BindingFlags::BIDIRECTIONAL)
.sync_create()
.bidirectional()
.build();
imp.settings_binding.replace(Some(binding));
}

3
src/session/view/content/room_details/invite_subpage/invitee_row.rs

@ -101,7 +101,8 @@ impl InviteeRow {
// We can't use `gtk::Expression` because we need a bidirectional binding
let binding = user
.bind_property("invited", &*imp.check_button, "active")
.flags(glib::BindingFlags::BIDIRECTIONAL | glib::BindingFlags::SYNC_CREATE)
.sync_create()
.bidirectional()
.build();
imp.binding.replace(Some(binding));

4
src/session/view/content/room_details/invite_subpage/mod.rs

@ -225,12 +225,12 @@ impl InviteSubpage {
imp.text_buffer
.bind_property("text", &user_list, "search-term")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
user_list
.bind_property("has-selected", &*imp.invite_button, "sensitive")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
imp.list_view

2
src/session/view/content/room_details/member_page/mod.rs

@ -342,7 +342,7 @@ impl MemberPage {
self.imp()
.members_search_entry
.bind_property("text", &search_filter, "search")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
let filter = gtk::EveryFilter::new();

6
src/session/view/content/room_history/message_row/mod.rs

@ -187,17 +187,17 @@ impl MessageRow {
let display_name_binding = event
.sender()
.bind_property("display-name", &imp.display_name.get(), "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
let show_header_binding = event
.bind_property("show-header", self, "show-header")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
let timestamp_binding = event
.bind_property("time", &*imp.timestamp, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
imp.bindings.borrow_mut().append(&mut vec![

4
src/session/view/content/room_history/message_row/reaction.rs

@ -105,11 +105,11 @@ impl MessageReaction {
imp.button.set_action_target_value(Some(&key.to_variant()));
group
.bind_property("has-user", &*imp.button, "active")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
group
.bind_property("count", &*imp.reaction_count, "label")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
imp.group.set(group).unwrap();

2
src/session/view/content/room_history/mod.rs

@ -458,7 +458,7 @@ mod imp {
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)
.sync_create()
.build();
let settings = Application::default().settings();

2
src/session/view/create_dm_dialog/mod.rs

@ -132,7 +132,7 @@ impl CreateDmDialog {
imp.search_entry
.bind_property("text", &user_list, "search-term")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
imp.list_box.bind_model(Some(&user_list), |user| {

2
src/session/view/media_viewer.rs

@ -207,7 +207,7 @@ mod imp {
if let Some(window) = obj.root().and_downcast::<Window>() {
window
.bind_property("fullscreened", obj, "fullscreened")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build();
}
});

2
src/session/view/sidebar/room_row.rs

@ -210,7 +210,7 @@ impl RoomRow {
&imp.notification_count.get(),
"visible",
)
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.transform_from(|_, count: u64| Some(count > 0))
.build(),
));

2
src/session/view/sidebar/row.rs

@ -195,7 +195,7 @@ impl Row {
bindings.push(
row.bind_property("expanded", &child, "expanded")
.flags(glib::BindingFlags::SYNC_CREATE)
.sync_create()
.build(),
);
} else if let Some(room) = item.downcast_ref::<Room>() {

Loading…
Cancel
Save