Commit 0a4a4656 authored by Eisha Chen-yen-su's avatar Eisha Chen-yen-su

Member: Add a widget for member pills

See #78
parent a1fa6acf
......@@ -2,6 +2,7 @@ pub static INITIAL_MESSAGES: usize = 40;
pub static CACHE_SIZE: usize = 40;
pub static MSG_ICON_SIZE: i32 = 40;
pub static USERLIST_ICON_SIZE: i32 = 30;
pub static PILL_ICON_SIZE: i32 = 18;
pub static MINUTES_TO_SPLIT_MSGS: i64 = 30;
pub static DEFAULT_HOMESERVER: &'static str = "https://matrix.org";
pub static DEFAULT_IDENTITYSERVER: &'static str = "https://vector.im";
......
......@@ -92,4 +92,32 @@ impl<'a> MemberBox<'a> {
event_box.show_all();
event_box
}
pub fn pill(&self) -> gtk::Box {
let backend = self.op.backend.clone();
let pill = gtk::Box::new(gtk::Orientation::Horizontal, 3);
let username = gtk::Label::new("");
username.set_text(&self.member.get_alias());
username.set_margin_end(3);
if let Some(style) = username.get_style_context() {
style.add_class("msg-highlighted");
}
let avatar =
widgets::Avatar::avatar_new(Some(globals::PILL_ICON_SIZE));
let data = avatar.circle(self.member.uid.clone(),
Some(self.member.get_alias()),
globals::PILL_ICON_SIZE);
let member_id = self.member.uid.clone();
download_to_cache(backend.clone(), member_id.clone(), data.clone());
avatar.set_margin_start(3);
pill.pack_start(&avatar, true, true, 0);
pill.pack_start(&username, true, true, 0);
pill.show_all();
pill
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment