mirror of
https://github.com/MeexReay/bRAC.git
synced 2025-09-13 23:47:39 +03:00
refactor: more avatar improvements
This commit is contained in:
parent
3fc9bd7bca
commit
0bb94a1ae5
@ -842,8 +842,6 @@ fn setup(_: &Application, ctx: Arc<Context>, ui: UiModel) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut avatars = Vec::new();
|
|
||||||
|
|
||||||
for message in messages.iter() {
|
for message in messages.iter() {
|
||||||
let Some(avatar_url) = grab_avatar(message) else { continue };
|
let Some(avatar_url) = grab_avatar(message) else { continue };
|
||||||
let avatar_id = get_avatar_id(&avatar_url);
|
let avatar_id = get_avatar_id(&avatar_url);
|
||||||
@ -863,36 +861,34 @@ fn setup(_: &Application, ctx: Arc<Context>, ui: UiModel) {
|
|||||||
pixbuf.rowstride()
|
pixbuf.rowstride()
|
||||||
))) else { continue };
|
))) else { continue };
|
||||||
|
|
||||||
avatars.push((avatar_id, avatar));
|
timeout_add_once(Duration::ZERO, {
|
||||||
}
|
let added = added.clone();
|
||||||
|
|
||||||
timeout_add_once(Duration::ZERO, {
|
move || {
|
||||||
move || {
|
while !added.load(Ordering::SeqCst) {}
|
||||||
while !added.load(Ordering::SeqCst) {}
|
|
||||||
|
|
||||||
GLOBAL.with(|global| {
|
GLOBAL.with(|global| {
|
||||||
if let Some(ui) = &*global.borrow() {
|
if let Some(ui) = &*global.borrow() {
|
||||||
for (id, avatar) in avatars {
|
let pixbuf = Pixbuf::from_bytes(
|
||||||
if let Some(pics) = ui.avatars.lock().unwrap().remove(&id) {
|
&avatar.0,
|
||||||
|
avatar.1,
|
||||||
|
avatar.2,
|
||||||
|
avatar.3,
|
||||||
|
avatar.4,
|
||||||
|
avatar.5,
|
||||||
|
avatar.6
|
||||||
|
);
|
||||||
|
|
||||||
|
if let Some(pics) = ui.avatars.lock().unwrap().remove(&avatar_id) {
|
||||||
for pic in pics {
|
for pic in pics {
|
||||||
pic.set_pixbuf(Some(&
|
pic.set_pixbuf(Some(&pixbuf));
|
||||||
Pixbuf::from_bytes(
|
|
||||||
&avatar.0,
|
|
||||||
avatar.1,
|
|
||||||
avatar.2,
|
|
||||||
avatar.3,
|
|
||||||
avatar.4,
|
|
||||||
avatar.5,
|
|
||||||
avatar.6
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user