Verified Commit 20e39c6e authored by Felix Häcker's avatar Felix Häcker

Get Shortwave back into a compilable state by replacing HdyFlap with GtkBox temporary

parent c3d836e3
Pipeline #218614 passed with stages
in 27 minutes and 22 seconds
......@@ -1109,11 +1109,14 @@ dependencies = [
[[package]]
name = "libhandy"
version = "1.0.0"
source = "git+https://gitlab.gnome.org/haecker-felix/libhandy-rs#c5ed9d1bf5aab9c29a3e7e7904347159c2518d59"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d776bf5b92993b8006688652cda2683261317dcc82bb4d91d3996bda2f7019e0"
dependencies = [
"bitflags",
"gdk",
"gdk-pixbuf",
"gdk-pixbuf-sys",
"gdk-sys",
"gio",
"gio-sys",
......@@ -1130,8 +1133,9 @@ dependencies = [
[[package]]
name = "libhandy-sys"
version = "1.0.0"
source = "git+https://gitlab.gnome.org/haecker-felix/libhandy-rs#c5ed9d1bf5aab9c29a3e7e7904347159c2518d59"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0017044b92ade6704a301212feea9e754be62f58d39d01aae8fcf2c1a982e3d9"
dependencies = [
"gdk",
"gdk-pixbuf-sys",
......
......@@ -41,7 +41,7 @@ gtk = { version = "0.9.0", features = ["v3_22"] }
gio = { version = "0.9.0", features = ["v2_46"] }
gdk-pixbuf = { version = "0.9.0", features = ["v2_36"] }
gettext-rs = { version = "0.4.4", features = ["gettext-system"] }
libhandy = { git="https://gitlab.gnome.org/haecker-felix/libhandy-rs", features = ["v1_0"] }
libhandy = "0.7.1"
gtk-macros = "0.2.0"
[target.'cfg(unix)'.dependencies]
......
......@@ -67,8 +67,7 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/libhandy",
"branch" : "wip/haecker-felix/flap-widget"
"url" : "https://gitlab.gnome.org/GNOME/libhandy"
}
]
},
......
......@@ -16,8 +16,6 @@
<property name="height_request">150</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="indicator_style">lines</property>
<property name="indicator_spacing">12</property>
<property name="spacing">12</property>
<property name="animation_duration">400</property>
<property name="allow_mouse_drag">True</property>
......
......@@ -373,7 +373,7 @@ impl GstreamerBackend {
// while and our closure here might've been called from the main UI thread
let recorderbin_sinkpad = recorderbin_sinkpad.clone();
recorderbin.call_async(move |_| {
recorderbin_sinkpad.send_event(Event::new_eos().build());
recorderbin_sinkpad.send_event(gstreamer::event::Eos::new());
debug!("Sent EOS event to recorderbin sinkpad");
});
}else{
......
......@@ -26,7 +26,7 @@ use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use crate::api::{FaviconDownloader, Station};
use crate::api::Station;
use crate::app::Action;
use crate::audio::backend::*;
#[cfg(unix)]
......@@ -386,12 +386,12 @@ impl SongTitle {
/// Returns path for current title
fn get_path(&self) -> Option<PathBuf> {
if let Some(title) = &self.current_title {
// Remove unsupported characters from the file name
// Remove unsupported characters from the file name
let title_raw = utils::simplify_string(title.to_string());
// Limit file name to 200 chars
let title_vec = title_raw.chars().collect::<Vec<_>>();
let cut_to_length = title_vec.len().min(200);
let title = text_vec[..cut_to_length].iter().cloned().collect::<String>();
let title = title_vec[..cut_to_length].iter().cloned().collect::<String>();
let mut path = path::CACHE.clone();
path.push("recording");
......
......@@ -40,7 +40,8 @@ pub enum View {
pub struct SwApplicationWindowPrivate {
window_builder: gtk::Builder,
sidebar_flap: libhandy::Flap,
//sidebar_flap: libhandy::Flap,
sidebar_flap: gtk::Box,
current_notification: RefCell<Option<Rc<Notification>>>,
}
......@@ -56,7 +57,9 @@ impl ObjectSubclass for SwApplicationWindowPrivate {
let window_builder = gtk::Builder::from_resource("/de/haeckerfelix/Shortwave/gtk/window.ui");
let current_notification = RefCell::new(None);
let sidebar_flap = libhandy::Flap::new();
// TODO: Re-add HdyFlap as soon it gets merged in libhandy
//let sidebar_flap = libhandy::Flap::new();
let sidebar_flap = gtk::Box::new(gtk::Orientation::Horizontal, 0);
Self {
window_builder,
......@@ -133,10 +136,11 @@ impl SwApplicationWindow {
get_widget!(self_.window_builder, gtk::Overlay, overlay);
self_.sidebar_flap.add(&window_deck);
self_.sidebar_flap.set_reveal_flap(false);
self_.sidebar_flap.set_locked(true);
self_.sidebar_flap.set_flap_position(gtk::PackType::End);
self_.sidebar_flap.set_flap(&app_private.player.widget);
//self_.sidebar_flap.set_reveal_flap(false);
//self_.sidebar_flap.set_locked(true);
//self_.sidebar_flap.set_flap_position(gtk::PackType::End);
//self_.sidebar_flap.set_flap(&app_private.player.widget);
self_.sidebar_flap.add(&app_private.player.widget);
overlay.add(&self_.sidebar_flap);
overlay.show_all();
......@@ -173,9 +177,9 @@ impl SwApplicationWindow {
s.bind("dark-mode", &gtk_s, "gtk-application-prefer-dark-theme", gio::SettingsBindFlags::GET);
// flap
self_.sidebar_flap.connect_property_folded_notify(clone!(@strong self as this => move |_| {
this.sync_ui_state();
}));
//self_.sidebar_flap.connect_property_folded_notify(clone!(@strong self as this => move |_| {
// this.sync_ui_state();
//}));
// window gets closed
self.connect_delete_event(move |window, _| {
......@@ -313,7 +317,7 @@ impl SwApplicationWindow {
toolbar_controller_revealer.set_visible(true);
// Unlock player sidebar flap
self_.sidebar_flap.set_locked(false);
//self_.sidebar_flap.set_locked(false);
self.sync_ui_state();
}
......@@ -350,12 +354,14 @@ impl SwApplicationWindow {
let self_ = SwApplicationWindowPrivate::from_instance(self);
// Check if current view = player sidebar
if self_.sidebar_flap.get_folded() && self_.sidebar_flap.get_reveal_flap() {
self_.sidebar_flap.set_reveal_flap(false);
} else {
get_widget!(self_.window_builder, libhandy::Deck, window_deck);
window_deck.navigate(libhandy::NavigationDirection::Back);
}
//if self_.sidebar_flap.get_folded() && self_.sidebar_flap.get_reveal_flap() {
// self_.sidebar_flap.set_reveal_flap(false);
//} else {
// get_widget!(self_.window_builder, libhandy::Deck, window_deck);
// window_deck.navigate(libhandy::NavigationDirection::Back);
//}
get_widget!(self_.window_builder, libhandy::Deck, window_deck);
window_deck.navigate(libhandy::NavigationDirection::Back);
// Make sure that the rest of the UI is correctly synced
self.sync_ui_state();
......@@ -370,24 +376,25 @@ impl SwApplicationWindow {
// Check in which state the sidebar flap is,
// and set the corresponding view (Library|Storefront|Player)
let current_view = if self_.sidebar_flap.get_folded() && self_.sidebar_flap.get_reveal_flap() {
View::Player
} else {
if deck_child_name == "storefront" {
View::Storefront
} else {
View::Library
}
};
//let current_view = if self_.sidebar_flap.get_folded() && self_.sidebar_flap.get_reveal_flap() {
// View::Player
//} else {
// if deck_child_name == "storefront" {
// View::Storefront
// } else {
// View::Library
// }
//};
let current_view = if deck_child_name == "storefront" { View::Storefront } else { View::Library };
// Show bottom player controller toolbar when sidebar flap is folded and player widget is not revealed
let show_toolbar_controller = self_.sidebar_flap.get_folded() && !self_.sidebar_flap.get_reveal_flap();
toolbar_controller_revealer.set_reveal_child(show_toolbar_controller);
//let show_toolbar_controller = self_.sidebar_flap.get_folded() && !self_.sidebar_flap.get_reveal_flap();
//toolbar_controller_revealer.set_reveal_child(show_toolbar_controller);
// Ensure that player sidebar gets revealed
if !show_toolbar_controller && !self_.sidebar_flap.get_locked() {
self_.sidebar_flap.set_reveal_flap(true);
}
//if !show_toolbar_controller && !self_.sidebar_flap.get_locked() {
// self_.sidebar_flap.set_reveal_flap(true);
//}
debug!("Setting current view as {:?}", &current_view);
self.update_view(current_view);
......@@ -403,9 +410,9 @@ impl SwApplicationWindow {
let app_priv = SwApplicationPrivate::from_instance(&app);
// Don't reveal sidebar flap by default
if !self_.sidebar_flap.get_locked() && self_.sidebar_flap.get_folded() {
self_.sidebar_flap.set_reveal_flap(false);
}
//if !self_.sidebar_flap.get_locked() && self_.sidebar_flap.get_folded() {
// self_.sidebar_flap.set_reveal_flap(false);
//}
// Show requested view / page
match view {
......@@ -419,7 +426,7 @@ impl SwApplicationWindow {
}
View::Player => {
app_priv.player.set_expand_widget(true);
self_.sidebar_flap.set_reveal_flap(true);
//self_.sidebar_flap.set_reveal_flap(true);
}
}
}
......
......@@ -96,7 +96,7 @@ where
}
pub fn simplify_string(s: String) -> String {
s.replace(&['/', '\\0', '\\', ':', '<', '>', '\"', '|', '?', '*', '.'] as &[_], "")
s.replace(&['/', '\0', '\\', ':', '<', '>', '\"', '|', '?', '*', '.'] as &[_], "")
}
pub fn station_subtitle(country: &str, state: &str, votes: i32) -> String {
......
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