Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aknarts committed Sep 16, 2023
1 parent a8cc879 commit da64071
Show file tree
Hide file tree
Showing 29 changed files with 173 additions and 119 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ keywords = ["unreal", "engine", "gamedev", "assets", "epic"]
categories = ["gui"]

[dependencies]
adw = { package = "libadwaita", version = "0.3" }
adw = { package = "libadwaita", version = "0.5.2" }
anyhow = "1.0"
byte-unit = "4.0"
chrono = "0.4"
diesel = { version = "2.0.0", features = ["sqlite", "r2d2"] }
diesel_migrations = { version = "2.0.0", features = ["sqlite"] }
diesel = { version = "2", features = ["sqlite", "r2d2"] }
diesel_migrations = { version = "2", features = ["sqlite"] }
egs-api = "0.6"
env_logger = "0.10.0"
fs2 = "0.4.3"
gtk4 = { version = "0.6", features = ["v4_8"] }
gtk4 = { version = "0.7.2", features = ["v4_8"] }
gtk-macros = "0.3"
html2pango = "0.5"
lazy_static = "1.4"
Expand All @@ -42,10 +42,10 @@ zip = "0.6"
winres = "0.1"

[target.'cfg(target_os = "windows")'.dependencies]
open = "4"
open = "5.0.0"

[target.'cfg(target_os = "linux")'.dependencies]
ashpd = "0.4"
ashpd = "0.6.2"
gettext-rs = { version = "0.7", features = ["gettext-system"] }
ghregistry = "^0.2"
secret-service = { version = "3.0", features = ["crypto-rust"]}
25 changes: 25 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

if [ "$1" = "clean" ]; then
rm -rf .~/.cargo/bin/fenv/ .flatpak-builder/ _build/
~/.cargo/bin/fenv gen build-aux/io.github.achetagames.epic_asset_manager.Devel.json
~/.cargo/bin/fenv exec -- meson --prefix=/app -Dprofile=development _build
exit 0
fi

if [ "$1" = "build" ]; then
~/.cargo/bin/fenv build
exit 0
fi

if [ "$1" = "install" ]; then
~/.cargo/bin/fenv exec -- ninja -C _build install
exit 0
fi

if [ "$1" = "dist" ]; then
meson dist -C _build
exit 0
fi

~/.cargo/bin/fenv run
4 changes: 2 additions & 2 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl EpicAssetManager {

let is_dark_mode = self_.settings.boolean("dark-mode");
let simple_action =
gio::SimpleAction::new_stateful("dark-mode", None, is_dark_mode.to_variant());
gio::SimpleAction::new_stateful("dark-mode", None, &is_dark_mode.to_variant());
simple_action.connect_activate(clone!(@weak self as app => move |action, _| {
app.toggle_dark_mode(action);
}));
Expand Down Expand Up @@ -225,7 +225,7 @@ impl EpicAssetManager {
let state = action.state().unwrap();
let action_state: bool = state.get().unwrap();
let is_dark_mode = !action_state;
action.set_state(is_dark_mode.to_variant());
action.set_state(&is_dark_mode.to_variant());
if let Err(err) = self_.settings.set_boolean("dark-mode", is_dark_mode) {
error!("Failed to switch dark mode: {} ", err);
}
Expand Down
6 changes: 3 additions & 3 deletions src/models/engine_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub enum Msg {
mod imp {
use super::*;
use glib::ToValue;
use gtk4::glib::{ParamSpec, ParamSpecBoolean, ParamSpecString};
use gtk4::glib::{ParamSpec, ParamSpecBoolean, ParamSpecString, Priority};
use once_cell::sync::OnceCell;
use std::cell::RefCell;

Expand Down Expand Up @@ -110,7 +110,7 @@ mod imp {
type Type = super::EngineData;

fn new() -> Self {
let (sender, receiver) = glib::MainContext::channel(glib::PRIORITY_DEFAULT);
let (sender, receiver) = glib::MainContext::channel(Priority::default());
Self {
guid: RefCell::new(None),
path: RefCell::new(None),
Expand Down Expand Up @@ -263,7 +263,7 @@ impl EngineData {
None,
clone!(@weak self as engine => @default-panic, move |msg| {
engine.update(msg);
glib::Continue(true)
glib::ControlFlow::Continue
}),
);
}
Expand Down
10 changes: 5 additions & 5 deletions src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod project_data;
use crate::config::APP_ID;
use egs_api::EpicGames;
use gtk4::gio;
use gtk4::glib::{MainContext, Receiver, Sender, UserDirectory, PRIORITY_DEFAULT};
use gtk4::glib::{MainContext, Priority, Receiver, Sender, UserDirectory};
use gtk4::prelude::*;
use log::{debug, error, info, warn};
use std::cell::RefCell;
Expand Down Expand Up @@ -38,7 +38,7 @@ impl Default for Model {

impl Model {
pub fn new() -> Self {
let (sender, receiver) = MainContext::channel(PRIORITY_DEFAULT);
let (sender, receiver) = MainContext::channel(Priority::default());
let mut obj = Self {
epic_games: RefCell::new(EpicGames::new()),
#[cfg(target_os = "linux")]
Expand Down Expand Up @@ -184,9 +184,9 @@ impl Model {
let mut ud = egs_api::api::types::account::UserData::new();
for item in items {
let Ok(label) = item.get_label() else {
debug!("No label skipping");
continue;
};
debug!("No label skipping");
continue;
};
debug!("Loading: {}", label);
if let Ok(attributes) = item.get_attributes() {
match label.as_str() {
Expand Down
6 changes: 3 additions & 3 deletions src/models/plugin_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub enum Msg {}
mod imp {
use super::*;
use glib::ToValue;
use gtk4::glib::{ParamSpec, ParamSpecString};
use gtk4::glib::{ParamSpec, ParamSpecString, Priority};
use std::cell::RefCell;

// The actual data structure that stores our values. This is not accessible
Expand All @@ -130,7 +130,7 @@ mod imp {
type ParentType = glib::Object;

fn new() -> Self {
let (sender, receiver) = gtk4::glib::MainContext::channel(gtk4::glib::PRIORITY_DEFAULT);
let (sender, receiver) = gtk4::glib::MainContext::channel(Priority::default());
Self {
guid: RefCell::new(None),
path: RefCell::new(None),
Expand Down Expand Up @@ -256,7 +256,7 @@ impl PluginData {
None,
clone!(@weak self as project => @default-panic, move |msg| {
project.update(&msg);
glib::Continue(true)
glib::ControlFlow::Continue
}),
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/models/project_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mod imp {
use super::*;
use glib::ToValue;
use gtk4::gdk::Texture;
use gtk4::glib::{ParamSpec, ParamSpecObject, ParamSpecString};
use gtk4::glib::{ParamSpec, ParamSpecObject, ParamSpecString, Priority};
use std::cell::RefCell;

// The actual data structure that stores our values. This is not accessible
Expand All @@ -66,7 +66,7 @@ mod imp {
type ParentType = glib::Object;

fn new() -> Self {
let (sender, receiver) = gtk4::glib::MainContext::channel(gtk4::glib::PRIORITY_DEFAULT);
let (sender, receiver) = gtk4::glib::MainContext::channel(Priority::default());
Self {
guid: RefCell::new(None),
path: RefCell::new(None),
Expand Down Expand Up @@ -225,7 +225,7 @@ impl ProjectData {
None,
clone!(@weak self as project => @default-panic, move |msg| {
project.update(msg);
glib::Continue(true)
glib::ControlFlow::Continue
}),
);
}
Expand Down
22 changes: 14 additions & 8 deletions src/ui/widgets/download_manager/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::ui::widgets::download_manager::{Msg, PostDownloadAction, ThreadMessag
use egs_api::api::types::chunk::Chunk;
use glib::clone;
use gtk4::glib;
use gtk4::glib::Sender;
use gtk4::glib::{Priority, Sender};
use gtk4::subclass::prelude::*;
use gtk4::{self, prelude::*};
use log::{debug, error, info, warn};
Expand Down Expand Up @@ -206,15 +206,15 @@ impl Asset for super::EpicDownloadManager {
}),
);

let (sender, receiver) = gtk4::glib::MainContext::channel(gtk4::glib::PRIORITY_DEFAULT);
let (sender, receiver) = gtk4::glib::MainContext::channel(Priority::default());

receiver.attach(
None,
clone!(@weak self as download_manager => @default-panic, move |(id, manifest)| {
let self_ = download_manager.imp();
let sender = self_.sender.clone();
sender.send(super::Msg::StartAssetDownload(id, manifest)).unwrap();
glib::Continue(true)
glib::ControlFlow::Continue
}),
);

Expand Down Expand Up @@ -275,7 +275,9 @@ impl Asset for super::EpicDownloadManager {
dm: &[egs_api::api::types::download_manifest::DownloadManifest],
) {
let self_ = self.imp();
let Some(item) = self.get_item(id) else { return };
let Some(item) = self.get_item(id) else {
return;
};
if dm.is_empty() {
item.set_property("status", "Failed to get download manifests".to_string());
return;
Expand Down Expand Up @@ -367,7 +369,9 @@ impl Asset for super::EpicDownloadManager {
manifest: egs_api::api::types::download_manifest::FileManifestList,
) {
let self_ = self.imp();
let Some(_item) = self.get_item(&id) else { return };
let Some(_item) = self.get_item(&id) else {
return;
};
let vaults = self_.settings.strv("unreal-vault-directories");
let mut target = std::path::PathBuf::from(vaults.first().map_or_else(
|| {
Expand Down Expand Up @@ -602,8 +606,8 @@ impl Asset for super::EpicDownloadManager {
for file in files {
if let Some(f) = self_.downloaded_files.borrow_mut().get_mut(file) {
let Some(item) = self.get_item(&f.asset) else {
break;
};
break;
};
item.add_downloaded_size(progress);
self.emit_by_name::<()>("tick", &[]);
break;
Expand All @@ -628,7 +632,9 @@ impl Asset for super::EpicDownloadManager {
filename: String,
) {
let self_ = self.imp();
let Some(item) = self.get_item(&asset_id) else { return; };
let Some(item) = self.get_item(&asset_id) else {
return;
};

let mut targets: Vec<(String, bool)> = Vec::new();
{
Expand Down
28 changes: 18 additions & 10 deletions src/ui/widgets/download_manager/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ impl Docker for crate::ui::widgets::download_manager::EpicDownloadManager {
fn perform_docker_blob_downloads(&self, version: &str, size: u64, digests: Vec<(String, u64)>) {
let self_ = self.imp();
let Some(item) = self.get_item(version) else {
return;
};
return;
};
item.set_property("status", "waiting for download slot".to_string());
item.set_total_size(u128::from(size));
item.set_total_files(digests.len() as u64);
Expand Down Expand Up @@ -114,7 +114,9 @@ impl Docker for crate::ui::widgets::download_manager::EpicDownloadManager {
let client = dclient.clone();
let sender = self_.sender.clone();
let pool = self_.download_pool.clone();
let Some(target) = self.docker_target_directory() else { return };
let Some(target) = self.docker_target_directory() else {
return;
};
debug!("Going to download to {:?}", target);
let (send, recv) = std::sync::mpsc::channel::<super::ThreadMessages>();
self.add_thread_sender(ver.clone(), send);
Expand Down Expand Up @@ -173,7 +175,9 @@ impl Docker for crate::ui::widgets::download_manager::EpicDownloadManager {
}
#[cfg(target_os = "linux")]
fn cancel_docker_digest(&self, _version: &str, digest: (String, u64)) {
let Some(mut target) = self.docker_target_directory() else { return };
let Some(mut target) = self.docker_target_directory() else {
return;
};
target.push(digest.0);
if let Err(e) = std::fs::remove_file(target) {
warn!("Unable to remove docker file {:?}", e);
Expand Down Expand Up @@ -292,8 +296,8 @@ impl Docker for crate::ui::widgets::download_manager::EpicDownloadManager {
#[cfg(target_os = "linux")]
fn docker_download_progress(&self, version: &str, progress: u64) {
let Some(item) = self.get_item(version) else {
return;
};
return;
};
item.add_downloaded_size(u128::from(progress));

self.emit_by_name::<()>("tick", &[]);
Expand All @@ -317,7 +321,9 @@ impl Docker for crate::ui::widgets::download_manager::EpicDownloadManager {
let self_ = self.imp();
if let Some(digests) = self_.docker_digests.borrow_mut().get_mut(version) {
let mut to_extract: Vec<String> = Vec::new();
let Some(target) = self.docker_target_directory() else { return };
let Some(target) = self.docker_target_directory() else {
return;
};
for d in digests {
match d.1 {
DownloadStatus::Init => {
Expand Down Expand Up @@ -386,9 +392,11 @@ impl Docker for crate::ui::widgets::download_manager::EpicDownloadManager {
let self_ = self.imp();
if let Some(digests) = self_.docker_digests.borrow_mut().get_mut(version) {
let Some(item) = self.get_item(version) else {
return;
};
let Some(target) = self.docker_target_directory() else { return };
return;
};
let Some(target) = self.docker_target_directory() else {
return;
};
let mut remaining = 0;
for d in digests {
match d.1 {
Expand Down
12 changes: 6 additions & 6 deletions src/ui/widgets/download_manager/download_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ impl EpicDownloadItem {
pub fn setup_timer(&self) {
glib::timeout_add_seconds_local(
1,
clone!(@weak self as obj => @default-return glib::Continue(false), move || {
clone!(@weak self as obj => @default-return glib::ControlFlow::Break, move || {
obj.speed_update();
glib::Continue(true)
glib::ControlFlow::Continue
}),
);
}
Expand Down Expand Up @@ -418,10 +418,10 @@ impl EpicDownloadItem {
get_action!(self_.actions, @pause).set_enabled(false);
glib::timeout_add_seconds_local(
2,
clone!(@weak self as obj => @default-return glib::Continue(false), move || {
clone!(@weak self as obj => @default-return glib::ControlFlow::Break, move || {
let self_ = obj.imp();
get_action!(self_.actions, @pause).set_enabled(true);
glib::Continue(false)
glib::ControlFlow::Break
}),
);
if let Some(dm) = self_.download_manager.get() {
Expand Down Expand Up @@ -571,9 +571,9 @@ impl EpicDownloadItem {
fn remove_from_parent_with_timer(&self, timer: u32) {
glib::timeout_add_seconds_local(
timer,
clone!(@weak self as obj => @default-return glib::Continue(false), move || {
clone!(@weak self as obj => @default-return glib::ControlFlow::Break, move || {
obj.emit_by_name::<()>("finished", &[]);
glib::Continue(false)
glib::ControlFlow::Break
}),
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/ui/widgets/download_manager/epic_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::ui::widgets::logged_in::engines::epic_download::Blob;
use crate::ui::widgets::logged_in::refresh::Refresh;
use glib::clone;
use gtk4::glib;
use gtk4::glib::Sender;
use gtk4::glib::{MainContext, ObjectExt, PRIORITY_DEFAULT};
use gtk4::glib::{MainContext, ObjectExt};
use gtk4::glib::{Priority, Sender};
use gtk4::prelude::WidgetExt;
use gtk4::subclass::prelude::ObjectSubclassIsExt;
use gtk4::{self, prelude::*};
Expand Down Expand Up @@ -174,7 +174,7 @@ impl EpicFile for crate::ui::widgets::download_manager::EpicDownloadManager {

fn start_version_file_download(&self, version: &str) {
let self_ = self.imp();
let (sender, receiver) = MainContext::channel(PRIORITY_DEFAULT);
let (sender, receiver) = MainContext::channel(Priority::default());

let vers = version.to_string();
receiver.attach(
Expand All @@ -185,7 +185,7 @@ impl EpicFile for crate::ui::widgets::download_manager::EpicDownloadManager {
if let Some(ver) = filter_versions(v, &vers) {
s.send(Msg::EpicDownloadStart(ver.name, ver.url, ver.size)).unwrap();
}
glib::Continue(false)
glib::ControlFlow::Break
}),
);
if let Some(window) = self_.window.get() {
Expand Down
Loading

0 comments on commit da64071

Please sign in to comment.