diff --git a/fractal-gtk/res/app.css b/fractal-gtk/res/app.css index 0d75e139..2adfbc29 100644 --- a/fractal-gtk/res/app.css +++ b/fractal-gtk/res/app.css @@ -36,3 +36,7 @@ border-radius: 20px; } **/ + +.room-avatar-container .avatar { + margin: 3px; +} diff --git a/fractal-gtk/res/main_window.glade b/fractal-gtk/res/main_window.glade index 2d3e7cae..7c0b828d 100644 --- a/fractal-gtk/res/main_window.glade +++ b/fractal-gtk/res/main_window.glade @@ -1073,12 +1073,15 @@ Join a room to start to chat False 6 - + + True False - 6 - 40 - camera-photo-symbolic - 5 + + + + False diff --git a/fractal-gtk/src/app.rs b/fractal-gtk/src/app.rs index 339f4007..fe111221 100644 --- a/fractal-gtk/src/app.rs +++ b/fractal-gtk/src/app.rs @@ -674,22 +674,26 @@ impl AppOp { pub fn set_current_room_avatar(&self, avatar: Option) { let image = self.gtk_builder - .get_object::("room_image") + .get_object::("room_image") .expect("Can't find room_image in ui file."); + for ch in image.get_children() { + image.remove(&ch); + } + let config = self.gtk_builder .get_object::("room_avatar_image") .expect("Can't find room_avatar_image in ui file."); if avatar.is_some() && !avatar.clone().unwrap().is_empty() { - if let Ok(pixbuf) = Pixbuf::new_from_file_at_size(&avatar.clone().unwrap(), 40, 40) { - image.set_from_pixbuf(&pixbuf); - } + image.add(&widgets::Avatar::circle_avatar(avatar.clone().unwrap(), Some(40))); if let Ok(pixbuf) = Pixbuf::new_from_file_at_size(&avatar.clone().unwrap(), 100, 100) { config.set_from_pixbuf(&pixbuf); } } else { - image.set_from_icon_name("image-missing", 5); - config.set_from_icon_name("image-missing", 5); + let w = widgets::Avatar::avatar_new(Some(40)); + w.default(String::from("camera-photo-symbolic"), Some(40)); + image.add(&w); + config.set_from_icon_name("camera-photo-symbolic", 5); } }