Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Alireza Ghassemi committed Aug 3, 2023
1 parent 2ff7400 commit 450697a
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 111 deletions.
233 changes: 151 additions & 82 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ anyhow = "1.0.72"
log = "0.4.19"
std-logger = "0.5.2"
once_cell = "1.18.0"
gtk = { package = "gtk4", version = "0.6.6", features = ["v4_10"] }
adw = { package = "libadwaita", version = "0.4.4", features = ["v1_2"] }
gtk = { package = "gtk4", version = "0.7.1", features = ["v4_10"] }
adw = { package = "libadwaita", version = "0.5.2", features = ["v1_2"] }
diesel = { version = "2.1.0", features = ["r2d2", "sqlite", "returning_clauses_for_sqlite_3_35"] }
diesel_migrations = "2.1.0"
diesel-derive-enum = { version = "2.1.0", features = ["sqlite"] }
Expand Down
6 changes: 3 additions & 3 deletions src/body/collection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use std::thread;
use std::time::{Duration, UNIX_EPOCH};
use TryRecvError::{Disconnected, Empty};
use adw::ApplicationWindow;
use adw::glib::{ControlFlow, timeout_add_local};
use adw::prelude::*;
use diesel::{ExpressionMethods, insert_or_ignore_into, QueryDsl, RunQueryDsl, update};
use diesel::prelude::*;
use diesel::result::Error;
use gtk::{Button, FileDialog, ProgressBar};
use gtk::gio::{Cancellable, File};
use gtk::glib::timeout_add_local;
use gtk::Orientation::Vertical;
use crate::body::collection::model::Collection;
use crate::body::collection::r#box::CollectionBox;
Expand Down Expand Up @@ -43,7 +43,7 @@ pub(in crate::body) fn add_collection_box(window: &ApplicationWindow) -> gtk::Bo
timeout_add_local(Duration::from_millis(200), {
let collection_box = collection_box.clone();
move || {
Continue(match receiver.try_recv() {
if match receiver.try_recv() {
Err(Empty) => { true }
Err(Disconnected) => { false }
Ok(import_progress) => {
Expand All @@ -66,7 +66,7 @@ pub(in crate::body) fn add_collection_box(window: &ApplicationWindow) -> gtk::Bo
}
}
}
})
} { ControlFlow::Continue } else { ControlFlow::Break }
}
});
let paths = files.iter::<File>().map(|file| { Some(file.unwrap().path()?.to_str()?.to_owned()) })
Expand Down
4 changes: 2 additions & 2 deletions src/body/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use std::cell::{Cell, RefCell};
use std::ops::Deref;
use std::rc::Rc;
use adw::{ApplicationWindow, WindowTitle};
use adw::glib::BoxedAnyObject;
use adw::prelude::*;
use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl};
use diesel::dsl::{count_distinct, count_star, min};
use gtk::{Button, ColumnView, ColumnViewColumn, Image, Label, ListItem, NoSelection, ScrolledWindow, SignalListItemFactory, Widget};
use gtk::gio::ListStore;
use gtk::glib::BoxedAnyObject;
use gtk::Orientation::Vertical;
use crate::body::collection::add_collection_box;
use crate::body::collection::model::Collection;
Expand Down Expand Up @@ -65,7 +65,7 @@ pub struct Body {

fn column_view<T: 'static, S: Fn(Rc<T>, &ListItem) + ?Sized + 'static, F: Fn(Rc<T>) + 'static>(row_items: Vec<Rc<T>>,
columns: Vec<(Box<dyn Fn() -> Box<dyn AsRef<Widget>>>, Box<S>, bool)>, on_row_activated: F) -> ColumnView {
let store = ListStore::new(BoxedAnyObject::static_type());
let store = ListStore::new::<BoxedAnyObject>();
for row_item in row_items.iter() {
store.append(&BoxedAnyObject::new(row_item.clone()));
}
Expand Down
6 changes: 3 additions & 3 deletions src/common/wrapper/imp.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::cell::RefCell;
use adw::glib::{self, ParamSpec, Properties};
use adw::glib::subclass::Signal;
use adw::prelude::*;
use adw::subclass::prelude::*;
use gtk::*;
use gtk::glib::{self, ParamSpec, Properties};
use gtk::glib::subclass::Signal;
use gtk::subclass::prelude::*;
use gtk::Widget;
use once_cell::sync::Lazy;
use crate::common::wrapper::{SONG_SELECTED, STREAM_STARTED};
Expand Down
4 changes: 2 additions & 2 deletions src/common/wrapper/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use gtk::{glib, Widget};
use gtk::glib::{Cast, IsA, Object};
use adw::glib::{self, Cast, IsA, Object};
use gtk::Widget;

mod imp;

Expand Down
13 changes: 6 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,27 @@ use std::cell::RefCell;
use std::ops::Deref;
use std::rc::Rc;
use adw::{Application, ApplicationWindow, HeaderBar, WindowTitle};
use adw::glib::signal::Inhibit;
use adw::glib::{ExitCode, Propagation};
use adw::prelude::*;
use diesel::{delete, ExpressionMethods, insert_into, QueryDsl, RunQueryDsl, update};
use diesel::migration::Result;
use diesel_migrations::MigrationHarness;
use gtk::{Button, MenuButton, Popover, ScrolledWindow};
use gtk::Align::Fill;
use gtk::glib::ExitCode;
use gtk::Orientation::Vertical;
use db::MIGRATIONS;
use NavigationType::History;
use crate::body::{Body, BodyType, BodyTable, NavigationType};
use crate::body::{Body, BodyTable, BodyType, NavigationType};
use crate::body::NavigationType::SongSelected;
use crate::common::{AdjustableScrolledWindow, gtk_box};
use crate::common::constant::{APP_ID, BACK_ICON};
use crate::config::Config;
use crate::now_playing::playbin::{PLAYBIN, Playbin};
use crate::db::get_connection;
use crate::schema::config::{current_song_position, maximized, window_height, window_width};
use crate::schema::config::dsl::config as config_table;
use crate::now_playing::playbin::{PLAYBIN, Playbin};
use crate::schema::bodies::{body_type, navigation_type, query1, query2, scroll_adjustment};
use crate::schema::bodies::dsl::bodies;
use crate::schema::config::{current_song_position, maximized, window_height, window_width};
use crate::schema::config::dsl::config as config_table;

mod schema;
mod db;
Expand Down Expand Up @@ -135,7 +134,7 @@ fn main() -> Result<ExitCode> {
)
}).collect::<Vec<_>>()
).execute(&mut get_connection()).unwrap();
Inhibit(false)
Propagation::Proceed
}
});
window.present();
Expand Down
17 changes: 9 additions & 8 deletions src/now_playing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,38 @@ use std::ops::Deref;
use std::rc::Rc;
use std::sync::Once;
use std::time::Duration;
use adw::glib::Propagation;
use adw::prelude::*;
use adw::WindowTitle;
use diesel::{Connection, ExpressionMethods, QueryDsl, RunQueryDsl, TextExpressionMethods, update};
use gstreamer::glib::timeout_add_local;
use gstreamer::MessageView::{AsyncDone, DurationChanged, StateChanged, StreamStart};
use gstreamer::prelude::{Continue, ElementExt, ElementExtManual, ObjectExt, GstObjectExt};
use gstreamer::prelude::{Continue, ElementExt, ElementExtManual, GstObjectExt, ObjectExt as GstreamerObject};
use gstreamer::State::{Null, Paused, Playing};
use gtk::{Button, Image, Inhibit, Label, ProgressBar, Scale, ScrolledWindow, ScrollType};
use gtk::{Button, Image, Label, ProgressBar, Scale, ScrolledWindow, ScrollType};
use log::warn;
use mpris_player::{Metadata, PlaybackStatus};
use util::format;
use crate::body::Body;
use crate::body::collection::model::Collection;
use crate::song::{get_current_song, join_path, Song, WithCover};
use crate::song::WithPath;
use crate::common::{AdjustableScrolledWindow, EllipsizedLabelBuilder, util};
use crate::common::constant::BACK_ICON;
use crate::common::util::or_none;
use crate::common::wrapper::{SONG_SELECTED, STREAM_STARTED, Wrapper};
use crate::config::Config;
use crate::now_playing::mpris::mpris_player;
use crate::now_playing::bottom_widget::Playable;
use crate::now_playing::playbin::{PLAYBIN, Playbin, URI};
use crate::db::get_connection;
use crate::now_playing::bottom_widget::Playable;
use crate::now_playing::mpris::mpris_player;
use crate::now_playing::now_playing::NowPlaying;
use crate::now_playing::playbin::{PLAYBIN, Playbin, URI};
use crate::schema::collections::dsl::collections;
use crate::schema::collections::path;
use crate::schema::config::current_song_id;
use crate::schema::config::dsl::config;
use crate::schema::songs::dsl::songs;
use crate::schema::songs::path as song_path;
use crate::song::{get_current_song, join_path, Song, WithCover};
use crate::song::WithPath;

pub mod playbin;
mod mpris;
Expand Down Expand Up @@ -119,7 +120,7 @@ pub fn create(song_selected_body: Rc<RefCell<Option<Rc<Body>>>>, window_title: &
warn!("error trying to seek to {} {}", value, error);
}
}
Inhibit(true)
Propagation::Stop
}
});
let mpris_player = mpris_player();
Expand Down
4 changes: 2 additions & 2 deletions src/song/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::Sender;
use std::time::{Duration, SystemTime};
use adw::glib::{ControlFlow, timeout_add};
use diesel::{BoolExpressionMethods, ExpressionMethods, insert_or_ignore_into, QueryDsl, QueryResult, RunQueryDsl, SqliteConnection};
use diesel::r2d2::{ConnectionManager, PooledConnection};
use diesel::result::Error;
use gstreamer::ClockTime;
use gstreamer::tags::{Album, AlbumArtist, Artist, DateTime, Genre, Title, TrackNumber};
use gstreamer_pbutils::Discoverer;
use gtk::glib::{Continue, timeout_add};
use once_cell::sync::Lazy;
use walkdir::WalkDir;
use crate::body::collection::model::Collection;
Expand Down Expand Up @@ -87,7 +87,7 @@ pub fn import_songs(collection: &Collection, sender: Sender<ImportProgress>,
move || {
let count = count.lock().unwrap();
sender.send(ImportProgress::Fraction(*count / total)).unwrap();
Continue(*count < total)
if *count < total { ControlFlow::Continue } else { ControlFlow::Break }
}
});
let result = WalkDir::new(&collection.path).into_iter().filter_map(|entry_result| {
Expand Down

0 comments on commit 450697a

Please sign in to comment.