[fractal/bilelmoussaoui/bump-gtk-rs: 12/15] Fix rebase conflict bugs
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/bilelmoussaoui/bump-gtk-rs: 12/15] Fix rebase conflict bugs
- Date: Sun, 23 Aug 2020 06:37:41 +0000 (UTC)
commit 3c3a4a4dbbd8c3ff3095c4ebf31a039099f015bf
Author: Daniel GarcĂa Moreno <dani danigm net>
Date: Mon Aug 3 09:39:57 2020 +0200
Fix rebase conflict bugs
fractal-gtk/src/widgets/avatar.rs | 2 +-
fractal-gtk/src/widgets/login.rs | 50 +++++++++++++++++++++-----------------
fractal-gtk/src/widgets/message.rs | 10 ++++++++
3 files changed, 39 insertions(+), 23 deletions(-)
---
diff --git a/fractal-gtk/src/widgets/avatar.rs b/fractal-gtk/src/widgets/avatar.rs
index 1f0e992a..f2a2a725 100644
--- a/fractal-gtk/src/widgets/avatar.rs
+++ b/fractal-gtk/src/widgets/avatar.rs
@@ -190,7 +190,7 @@ impl AvatarExt for gtk::Overlay {
}
}
-fn load_pixbuf(path: &str, size: i32) -> Option<Pixbuf> {
+fn load_pixbuf(path: &Path, size: i32) -> Option<Pixbuf> {
if let Ok(pixbuf) = Pixbuf::from_file(&path) {
// FIXME: We end up loading the file twice but we need to load the file first to find out its
dimensions to be
// able to decide wether to scale by width or height and gdk doesn't provide simple API to scale a
loaded
diff --git a/fractal-gtk/src/widgets/login.rs b/fractal-gtk/src/widgets/login.rs
index fba8573c..514ffe36 100644
--- a/fractal-gtk/src/widgets/login.rs
+++ b/fractal-gtk/src/widgets/login.rs
@@ -89,28 +89,34 @@ impl LoginWidget {
let txt = if !txt.ends_with('/') { txt + "/" } else { txt };
if !password.is_empty() && !username.is_empty() {
- // take the user's homeserver value if the
- // well-known request fails
- let mut homeserver_url = if let Ok(hs_url) = Url::parse(&txt) {
- hs_url
- } else {
- let msg = i18n("Malformed server URL");
- ErrorDialog::new(false, &msg);
- return;
- };
-
- let mut idserver = globals::DEFAULT_IDENTITYSERVER.clone();
- match get_well_known(homeserver_url.clone()) {
- Ok(response) => {
- info!("Got well-known response from {}: {:#?}", &txt, response);
- homeserver_url = response.homeserver.base_url;
- idserver = response
- .identity_server
- .map(|ids| ids.base_url)
- .unwrap_or(idserver);
- }
- Err(e) => info!("Failed to .well-known request: {:#?}", e),
- };
+ // take the user's homeserver value if the
+ // well-known request fails
+ let homeserver_url = if let Ok(hs_url) = Url::parse(&txt) {
+ hs_url
+ } else {
+ let msg = i18n("Malformed server URL");
+ ErrorDialog::new(false, &msg);
+ return;
+ };
+
+ let (homeserver_url, idserver) = get_well_known(homeserver_url.clone())
+ .and_then(|response| {
+ let hs_url = Url::parse(&response.homeserver.base_url)?;
+ let ids = response
+ .identity_server
+ .as_ref()
+ .map(|ids| Url::parse(&ids.base_url))
+ .transpose()?
+ .unwrap_or(globals::DEFAULT_IDENTITYSERVER.clone());
+ info!("Got well-known response from {}: {:#?}", &txt, response);
+
+ Ok((hs_url, ids))
+ })
+ .map_err(|e| {
+ info!("Failed to .well-known request: {:#?}", e);
+ e
+ })
+ .unwrap_or((homeserver_url, globals::DEFAULT_IDENTITYSERVER.clone()));
err_label.hide();
op.lock().unwrap().set_state(AppState::Loading);
diff --git a/fractal-gtk/src/widgets/message.rs b/fractal-gtk/src/widgets/message.rs
index c50bce51..47dd8fc1 100644
--- a/fractal-gtk/src/widgets/message.rs
+++ b/fractal-gtk/src/widgets/message.rs
@@ -512,6 +512,12 @@ impl MessageBox {
start_playing,
);
+ let overlay = Overlay::new();
+ let video_widget = player.get_video_widget();
+ video_widget.set_size_request(-1, 390);
+ VideoPlayerWidget::auto_adjust_video_dimensions(&player);
+ overlay.add(&video_widget);
+
let play_button = gtk::Button::new();
let play_icon = gtk::Image::from_icon_name(
Some("media-playback-start-symbolic"),
@@ -555,6 +561,10 @@ impl MessageBox {
let redactable = msg.redactable;
let menu = MessageMenu::new(evid, &RowType::Video, &redactable, None, None);
menu_button.set_popover(Some(&menu.get_popover()));
+
+ bx.pack_start(&overlay, true, true, 0);
+ self.connect_media_viewer(msg);
+ self.video_player = Some(player);
}
bx
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]