Commit f580cb48 authored by Felix Häcker's avatar Felix Häcker

upgrade gtk-rs to 0.6.0 | upgrade gstreamer-rs to 0.13

parent 2806d848
Pipeline #63059 passed with stages
in 9 minutes and 56 seconds
......@@ -3,7 +3,6 @@
target/
target
**/*.rs.bk
Cargo.lock
_build
.buildconfig
de.haeckerfelix.gradio.json~
......
This diff is collapsed.
......@@ -6,30 +6,23 @@ build = "build.rs"
edition = "2018"
[dependencies]
gio = "0.5"
glib = "0.6.1"
gdk = "0.9.0"
gtk = { version="0.6.0", features=["v3_22"] }
libhandy = { version="0.3.0", features=["v0_0_7"] }
gio = "0.6.0"
glib = "0.7.0"
gdk = "0.10.0"
gstreamer = "0.13.0"
gstreamer-pbutils = "0.13.0"
rustio = { git="https://gitlab.gnome.org/haecker-felix/Rustio.git" }
mpris-player = { git="https://gitlab.gnome.org/World/Rust/mpris-player" }
log = "0.4"
pretty_env_logger = "0.3.0"
rustio = { git="https://gitlab.gnome.org/haecker-felix/Rustio.git" }
gstreamer = "0.12"
gstreamer-pbutils = "0.12"
mpris-player = "0.1"
rusqlite = "0.13"
indexmap = "1.0"
quick-error = "1.2.2"
restson = "0.4"
stopwatch = "0.0.7"
uuid = { version = "0.7", features = ["v4"] }
chrono = "0.4.6"
rust_cast = "0.14.0"
mdns = "0.3.1"
chrono = "0.4.6"
reqwest = "0.9.9"
[dependencies.gtk]
version = "0.5"
features = ["v3_22"]
[dependencies.libhandy]
git = "https://gitlab.gnome.org/World/Rust/libhandy-rs"
features = ["v0_0_8"]
use gio::prelude::*;
use glib::{Receiver, Sender};
use gtk::prelude::*;
use rustio::{Station, StationSearch};
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::mpsc::{channel, Receiver, Sender};
use crate::library::Library;
use crate::player::{PlaybackState, Player};
......@@ -42,7 +43,7 @@ pub struct App {
gtk_app: gtk::Application,
sender: Sender<Action>,
receiver: Receiver<Action>,
receiver: RefCell<Option<Receiver<Action>>>,
window: Window,
player: Player,
......@@ -65,7 +66,8 @@ impl App {
gtk::StyleContext::add_provider_for_screen(&gdk::Screen::get_default().unwrap(), &p, 500);
let gtk_app = gtk::Application::new(info.app_id.as_str(), gio::ApplicationFlags::FLAGS_NONE).unwrap();
let (sender, receiver) = channel();
let (sender, r) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
let receiver = RefCell::new(Some(r));
let window = Window::new(sender.clone(), &info);
let player = Player::new(sender.clone());
......@@ -106,7 +108,8 @@ impl App {
info!("Version: {} ({})", self.info.version, self.info.profile);
let a = app.clone();
gtk::timeout_add(25, move || a.process_action());
let receiver = self.receiver.borrow_mut().take().unwrap();
receiver.attach(None, move |action| a.process_action(action));
self.gtk_app.run(&[]);
self.player.shutdown();
......@@ -196,7 +199,6 @@ impl App {
_ => Sorting::Name,
};
debug!("Sorting: {} / {}", sorting_str, order_str);
sender.send(Action::ViewSetSorting(sorting, order)).unwrap();
}
......@@ -214,27 +216,25 @@ impl App {
self.gtk_app.connect_activate(move |app| app.add_window(&window));
}
fn process_action(&self) -> glib::Continue {
if let Ok(action) = self.receiver.try_recv() {
match action {
Action::ViewShowSearch => self.window.set_view(View::Search),
Action::ViewShowLibrary => self.window.set_view(View::Library),
Action::ViewRaise => self.window.widget.present_with_time((glib::get_monotonic_time() / 1000) as u32),
Action::ViewShowNotification(text) => self.window.show_notification(text),
Action::ViewSetSorting(sorting, order) => self.library.set_sorting(sorting, order),
Action::PlaybackSetStation(station) => {
self.player.set_station(station.clone());
self.window.show_sidebar_player(true);
}
Action::PlaybackStart => self.player.set_playback(PlaybackState::Playing),
Action::PlaybackStop => self.player.set_playback(PlaybackState::Stopped),
Action::LibraryWrite => self.library.write_data(),
Action::LibraryImport => self.import_library(),
Action::LibraryExport => self.export_library(),
Action::LibraryAddStations(stations) => self.library.add_stations(stations),
Action::LibraryRemoveStations(stations) => self.library.remove_stations(stations),
Action::SearchFor(data) => self.search.search_for(data),
fn process_action(&self, action: Action) -> glib::Continue {
match action {
Action::ViewShowSearch => self.window.set_view(View::Search),
Action::ViewShowLibrary => self.window.set_view(View::Library),
Action::ViewRaise => self.window.widget.present_with_time((glib::get_monotonic_time() / 1000) as u32),
Action::ViewShowNotification(text) => self.window.show_notification(text),
Action::ViewSetSorting(sorting, order) => self.library.set_sorting(sorting, order),
Action::PlaybackSetStation(station) => {
self.player.set_station(station.clone());
self.window.show_sidebar_player(true);
}
Action::PlaybackStart => self.player.set_playback(PlaybackState::Playing),
Action::PlaybackStop => self.player.set_playback(PlaybackState::Stopped),
Action::LibraryWrite => self.library.write_data(),
Action::LibraryImport => self.import_library(),
Action::LibraryExport => self.export_library(),
Action::LibraryAddStations(stations) => self.library.add_stations(stations),
Action::LibraryRemoveStations(stations) => self.library.remove_stations(stations),
Action::SearchFor(data) => self.search.search_for(data),
}
glib::Continue(true)
}
......
use glib::Sender;
use gtk::prelude::*;
use rusqlite::Connection;
use rustio::{Client, Station};
......@@ -8,7 +9,6 @@ use std::fs::File;
use std::io;
use std::path::PathBuf;
use std::result::Result;
use std::sync::mpsc::Sender;
use std::thread;
use crate::app::{Action, AppInfo};
......@@ -41,7 +41,7 @@ impl Library {
let db_path = Self::get_database_path("shortwave.db").expect("Could not open database path...");
let logo_image: gtk::Image = builder.get_object("logo_image").unwrap();
logo_image.set_from_icon_name(Some(format!("{}-symbolic", info.app_id).as_str()), 128);
logo_image.set_from_icon_name(Some(format!("{}-symbolic", info.app_id).as_str()), gtk::IconSize::__Unknown(128));
let welcome_text: gtk::Label = builder.get_object("welcome_text").unwrap();
welcome_text.set_text(format!("Welcome to {}", info.app_name).as_str());
......
......@@ -5,7 +5,6 @@ extern crate pretty_env_logger;
#[macro_use]
extern crate quick_error;
mod app;
mod library;
mod player;
......
use glib::Sender;
use gstreamer::prelude::*;
use gtk::prelude::*;
use rustio::{Client, Station};
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex};
use std::thread;
......
use glib::Sender;
use gtk::prelude::*;
use rustio::Station;
use std::sync::mpsc::Sender;
use crate::app::Action;
use crate::player::Controller;
use crate::player::PlaybackState;
......@@ -88,7 +87,7 @@ impl Controller for GtkController {
PlaybackState::Loading => self.playback_button_stack.set_visible_child_name("loading"),
PlaybackState::Failure(msg) => {
self.playback_button_stack.set_visible_child_name("error");
let mut text = self.error_label.get_text().unwrap();
let mut text = self.error_label.get_text().unwrap().to_string();
text = text + " " + msg;
self.error_label.set_text(&text);
}
......
use glib::Sender;
use mpris_player::{Metadata, MprisPlayer, OrgMprisMediaPlayer2Player, PlaybackStatus};
use rustio::Station;
use std::cell::Cell;
use std::sync::mpsc::Sender;
use std::sync::Arc;
use crate::app::Action;
......
......@@ -200,9 +200,7 @@ impl PlayerBackend {
bin.add_pad(&ghostpad).unwrap();
bin.sync_state_with_parent().unwrap();
if self.file_srcpad.link(&ghostpad) != gstreamer::PadLinkReturn::Ok {
warn!("Queue src pad cannot linked to vorbisenc sinkpad");
}
self.file_srcpad.link(&ghostpad).expect("Queue src pad cannot linked to vorbisenc sinkpad");
self.muxsinkbin = Some(bin);
}
......
use glib::Sender;
use gtk::prelude::*;
use rustio::{Client, StationSearch};
use std::cell::RefCell;
use std::sync::mpsc::Sender;
use crate::app::Action;
use crate::widgets::station_listbox::StationListBox;
......@@ -50,7 +50,7 @@ impl Search {
let search_entry: gtk::SearchEntry = self.builder.get_object("search_entry").unwrap();
let sender = self.sender.clone();
search_entry.connect_search_changed(move |entry| {
let data = StationSearch::search_for_name(entry.get_text().unwrap(), false, 100);
let data = StationSearch::search_for_name(entry.get_text().unwrap().to_string(), false, 100);
sender.send(Action::SearchFor(data)).unwrap();
});
}
......
use chrono::NaiveTime;
use gtk::prelude::*;
use libhandy::{ActionRow, ActionRowExt};
use chrono::{NaiveTime};
use crate::song::Song;
......@@ -20,7 +20,7 @@ impl SongRow {
let save_button = gtk::Button::new();
save_button.set_relief(gtk::ReliefStyle::None);
save_button.set_valign(gtk::Align::Center);
let save_image = gtk::Image::new_from_icon_name("document-save-symbolic", 4);
let save_image = gtk::Image::new_from_icon_name("document-save-symbolic", gtk::IconSize::__Unknown(4));
save_button.add(&save_image);
widget.add_action(&save_button);
widget.show_all();
......@@ -53,5 +53,4 @@ impl SongRow {
time.format("%M∶%S").to_string()
}
}
}
use glib::Sender;
use gtk::prelude::*;
use libhandy::{Column, ColumnExt};
use rustio::Station;
use std::sync::mpsc::Sender;
use crate::app::Action;
use crate::station_model::{Order, Sorting, StationModel};
use crate::widgets::station_row::{ContentType, StationRow};
......
use glib::Sender;
use gtk::prelude::*;
use rustio::Station;
use std::sync::mpsc::Sender;
use crate::app::Action;
use crate::widgets::station_infobox::StationInfobox;
......
use glib::Sender;
use gtk::prelude::*;
use libhandy::LeafletExt;
use std::sync::mpsc::Sender;
use crate::app::{Action, AppInfo};
use crate::widgets::notification::Notification;
......@@ -55,7 +54,8 @@ impl Window {
// Devel style class
if appinfo.app_id.ends_with("Devel") {
window.widget.get_style_context().map(|c| c.add_class("devel"));
let ctx = window.widget.get_style_context();
ctx.add_class("devel");
}
window.setup_signals();
......
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