parent
d2584ed381
commit
eb7c589ae6
2 changed files with 13 additions and 6 deletions
|
@ -46,7 +46,7 @@ impl<'a> MemberBox<'a> {
|
|||
let avatar = widgets::Avatar::avatar_new(Some(globals::USERLIST_ICON_SIZE));
|
||||
avatar.default(String::from("avatar-default-symbolic"),
|
||||
Some(globals::USERLIST_ICON_SIZE));
|
||||
get_member_avatar(backend.clone(), avatar.clone(), Some(self.member.clone()), globals::USERLIST_ICON_SIZE, 10);
|
||||
get_member_info(backend.clone(), avatar.clone(), username.clone(), self.member.uid.clone(), globals::USERLIST_ICON_SIZE, 10);
|
||||
avatar.set_margin_start(5);
|
||||
|
||||
w.add(&avatar);
|
||||
|
@ -58,7 +58,11 @@ impl<'a> MemberBox<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_member_avatar(backend: Sender<BKCommand>, img: widgets::Avatar, m: Option<Member>, size: i32, tries: i32) {
|
||||
#[allow(dead_code)]
|
||||
pub fn get_member_avatar(backend: Sender<BKCommand>,
|
||||
img: widgets::Avatar,
|
||||
m: Option<Member>,
|
||||
size: i32, tries: i32) {
|
||||
if tries <= 0 {
|
||||
return;
|
||||
}
|
||||
|
@ -83,7 +87,11 @@ pub fn get_member_avatar(backend: Sender<BKCommand>, img: widgets::Avatar, m: Op
|
|||
|
||||
|
||||
|
||||
pub fn get_member_info(backend: Sender<BKCommand>, img: widgets::Avatar, username: gtk::Label, sender: String, size: i32, tries: i32) {
|
||||
pub fn get_member_info(backend: Sender<BKCommand>,
|
||||
img: widgets::Avatar,
|
||||
username: gtk::Label,
|
||||
sender: String,
|
||||
size: i32, tries: i32) {
|
||||
let (tx, rx): (Sender<(String, String)>, Receiver<(String, String)>) = channel();
|
||||
backend.send(BKCommand::GetUserInfoAsync(sender.clone(), tx)).unwrap();
|
||||
gtk::timeout_add(100, move || match rx.try_recv() {
|
||||
|
|
|
@ -23,7 +23,6 @@ use app::AppOp;
|
|||
use globals;
|
||||
use widgets;
|
||||
use widgets::AvatarExt;
|
||||
use widgets::member::get_member_avatar;
|
||||
use widgets::member::get_member_info;
|
||||
|
||||
// Room Message item
|
||||
|
@ -137,11 +136,11 @@ impl<'a> MessageBox<'a> {
|
|||
match m {
|
||||
Some(member) => {
|
||||
self.username.set_markup(&format!("<b>{}</b>", member.get_alias().unwrap_or_default()));
|
||||
get_member_avatar(backend.clone(), avatar.clone(), m.cloned(), 40, 10);
|
||||
get_member_info(backend.clone(), avatar.clone(), self.username.clone(), sender.clone(), globals::MSG_ICON_SIZE, 10);
|
||||
}
|
||||
None => {
|
||||
self.username.set_markup(&format!("<b>{} @@</b>", sender));
|
||||
get_member_info(backend.clone(), avatar.clone(), self.username.clone(), sender.clone(), 40, 10);
|
||||
get_member_info(backend.clone(), avatar.clone(), self.username.clone(), sender.clone(), globals::MSG_ICON_SIZE, 10);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue