Commit 6dffb549 authored by Sophie Herold's avatar Sophie Herold

Fix deprecation warnings

parent f31634a6
......@@ -76,6 +76,6 @@ modules:
- "-Dprofile=release"
sources:
- type: archive
url:
sha256:
url: https://gitlab.gnome.org/World/pika-backup/uploads/3274b9544debdd5f571c743eab6752c3/pika-backup-0.1.0.tar.xz
sha256: 0be9693be49508b90c4b630e6b969709f4183ca440676b283e998c15b27b7895
......@@ -178,7 +178,7 @@ impl Borg {
Ok(String::from_utf8_lossy(&borg.stdout).to_string())
}
pub fn peak(&self) -> Result<(), BorgErr> {
pub fn peek(&self) -> Result<(), BorgErr> {
let borg = BorgCall::new("list")
.add_options(&["--json", "--last=1"])
.add_envs(vec![
......
......@@ -4,6 +4,7 @@ use std::io::prelude::*;
use gdk_pixbuf::prelude::*;
use gio::prelude::*;
use gtk::prelude::*;
use glib;
use crate::borg;
use crate::shared;
......@@ -49,7 +50,7 @@ pub fn main() {
// Ctrl-C handling
let (send, recv) = std::sync::mpsc::channel();
// Use channel to call GtkApplicaton from main thread
gtk::timeout_add(100, move || {
glib::timeout_add_local(100, move || {
if recv.try_recv().is_ok() {
on_ctrlc();
}
......@@ -134,7 +135,7 @@ fn init(_app: &gtk::Application) {
}
fn init_timeouts() {
gtk::timeout_add(1000, move || {
glib::timeout_add_local(1000, move || {
let inhibit_cookie = INHIBIT_COOKIE.get();
if is_backup_running() {
......
......@@ -97,7 +97,7 @@ pub fn init() {
.stop_backup_create()
.connect_clicked(|_| stop_backup_create());
gtk::timeout_add(500, || {
glib::timeout_add_local(500, || {
refresh_statusx();
Continue(true)
});
......
......@@ -366,7 +366,7 @@ fn insert_backup_config_encryption_unknown(
let mut borg = borg::Borg::new(config.clone());
borg.set_password(Zeroizing::new(vec![]));
// TODO: This is not async
if let Err(err) = borg.peak() {
if let Err(err) = borg.peek() {
if matches!(err, shared::BorgErr::PasswordMissing)
|| err.has_borg_msgid(&shared::MsgId::PassphraseWrong)
{
......@@ -388,9 +388,9 @@ fn insert_backup_config_password_unknown(config: shared::BackupConfig, ui: Rc<bu
ui.new_backup().hide();
let x = config.clone();
ui::utils::Async::borg(
"borg::peak",
"borg::peek",
borg::Borg::new(x),
|borg| borg.peak(),
|borg| borg.peek(),
move |result| match result {
Ok(()) => {
insert_backup_config(config.clone());
......
......@@ -98,7 +98,7 @@ impl<T> BackupMap<T> for std::collections::BTreeMap<String, T> {
}
}
pub enum Async {}
pub struct Async(());
impl Async {
pub fn borg<F, G, V>(name: &'static str, borg: borg::Borg, task: F, result_handler: G)
......@@ -178,7 +178,7 @@ where
});
let task_name = name.to_string();
gtk::timeout_add(50, move || match recv.try_recv() {
glib::timeout_add_local(50, move || match recv.try_recv() {
Ok(result) => {
result_handler(result);
Continue(false)
......
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