mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-04 16:56:59 +01:00
implemented real offline structure, with online drain
This commit is contained in:
1 parent
dcc62ba420
commit
50c96cbbf4
7 files changed
+1333
-195
No files matched your search
+12
-10
@@ -36,7 +36,7 @@ use pdfs_core::control::{
|
||||
ActivityEntry, ActivityKind, BookmarkInfo, DeviceInfo, DirEntry, InvitationInfo, JobItem,
|
||||
PhotoItem, PublicLinkInfo, RefreshScope, Request, Response, SearchHit, ShareEntry,
|
||||
ShareEntryKind, SharedItem, SyncFolderInfo, SyncPhase, SyncProgress, TransferDirection,
|
||||
TransferItem, send,
|
||||
TransferItem, pending_summary, send,
|
||||
};
|
||||
use pdfs_core::service;
|
||||
|
||||
@@ -1965,19 +1965,21 @@ fn refresh_status(ui: &Rc<Ui>) {
|
||||
pins,
|
||||
online,
|
||||
pending_uploads,
|
||||
pending_changes,
|
||||
..
|
||||
})) => {
|
||||
set_mounted(&ui, true);
|
||||
// Queued uploads are the more useful thing to say when there are
|
||||
// any: they are why a file that looks saved is not on the remote
|
||||
// yet, and offline is usually the reason they are still queued.
|
||||
ui.mount_row.set_subtitle(&match (online, pending_uploads) {
|
||||
(true, 0) => format!("Mounted at {mountpoint}"),
|
||||
(true, n) => format!("Mounted at {mountpoint} — uploading {n} file(s)"),
|
||||
(false, 0) => format!("Mounted at {mountpoint} — offline, cached files only"),
|
||||
(false, n) => {
|
||||
format!("Mounted at {mountpoint} — offline, {n} file(s) waiting to upload")
|
||||
// The queue is the more useful thing to say when it has anything
|
||||
// in it: it is why a file that looks saved is not on the remote
|
||||
// yet, and offline is usually the reason it is still queued.
|
||||
let queued = pending_summary(pending_uploads, pending_changes);
|
||||
ui.mount_row.set_subtitle(&match (online, queued) {
|
||||
(true, None) => format!("Mounted at {mountpoint}"),
|
||||
(true, Some(q)) => format!("Mounted at {mountpoint} — {q}"),
|
||||
(false, None) => {
|
||||
format!("Mounted at {mountpoint} — offline, cached files only")
|
||||
}
|
||||
(false, Some(q)) => format!("Mounted at {mountpoint} — offline, {q}"),
|
||||
});
|
||||
let fraction = if budget == 0 {
|
||||
0.0
|
||||
|
||||
@@ -18,7 +18,9 @@ use ksni::menu::StandardItem;
|
||||
use ksni::{MenuItem, Tray, TrayService};
|
||||
use pdfs_core::auth;
|
||||
use pdfs_core::config::AppDirs;
|
||||
use pdfs_core::control::{JobItem, Request, Response, TransferDirection, TransferItem, send};
|
||||
use pdfs_core::control::{
|
||||
JobItem, Request, Response, TransferDirection, TransferItem, pending_summary, send,
|
||||
};
|
||||
use pdfs_core::service;
|
||||
|
||||
/// How often the tray re-polls the daemon to refresh its menu.
|
||||
@@ -90,13 +92,14 @@ fn poll_state(socket: &Path, default_mountpoint: &Path) -> DriveState {
|
||||
pinned,
|
||||
online,
|
||||
pending_uploads,
|
||||
pending_changes,
|
||||
..
|
||||
}) => DriveState {
|
||||
line: match (online, pending_uploads) {
|
||||
(true, 0) => format!("Mounted at {mountpoint} ({pinned} pinned)"),
|
||||
(true, n) => format!("Uploading {n} file(s) ({pinned} pinned)"),
|
||||
(false, 0) => format!("Offline — cached files only ({pinned} pinned)"),
|
||||
(false, n) => format!("Offline — {n} file(s) waiting to upload"),
|
||||
line: match (online, pending_summary(pending_uploads, pending_changes)) {
|
||||
(true, None) => format!("Mounted at {mountpoint} ({pinned} pinned)"),
|
||||
(true, Some(q)) => format!("Syncing — {q} ({pinned} pinned)"),
|
||||
(false, None) => format!("Offline — cached files only ({pinned} pinned)"),
|
||||
(false, Some(q)) => format!("Offline — {q}"),
|
||||
},
|
||||
mounted: true,
|
||||
mountpoint: PathBuf::from(mountpoint),
|
||||
|
||||
Reference in new issue
Block a user