1
- package org .cryptomator .linux .sidebar ;
1
+ package org .cryptomator .linux .quickaccess ;
2
2
3
3
import org .cryptomator .integrations .common .CheckAvailability ;
4
4
import org .cryptomator .integrations .common .Priority ;
5
- import org .cryptomator .integrations .sidebar . SidebarService ;
6
- import org .cryptomator .integrations .sidebar . SidebarServiceException ;
5
+ import org .cryptomator .integrations .quickaccess . QuickAccessService ;
6
+ import org .cryptomator .integrations .quickaccess . QuickAccessServiceException ;
7
7
8
8
import java .io .IOException ;
9
9
import java .nio .charset .StandardCharsets ;
17
17
18
18
@ Priority (100 )
19
19
@ CheckAvailability
20
- public class NautilusSidebarService implements SidebarService {
20
+ public class NautilusBookmarks implements QuickAccessService {
21
21
22
22
private static final int MAX_FILE_SIZE = 4096 ;
23
23
private static final Path BOOKMARKS_FILE = Path .of (System .getProperty ("user.home" ), ".config/gtk-3.0/bookmarks" );
24
24
private static final Path TMP_FILE = BOOKMARKS_FILE .resolveSibling ("bookmarks.cryptomator.tmp" );
25
25
private static final Lock BOOKMARKS_LOCK = new ReentrantReadWriteLock ().writeLock ();
26
26
27
27
@ Override
28
- public SidebarEntry add (Path target , String displayName ) throws SidebarServiceException {
28
+ public QuickAccessService . QuickAccessEntry add (Path target , String displayName ) throws QuickAccessServiceException {
29
29
String entryLine = "file://" + target .toAbsolutePath () + " " + displayName ;
30
30
try {
31
31
BOOKMARKS_LOCK .lock ();
@@ -37,25 +37,25 @@ public SidebarEntry add(Path target, String displayName) throws SidebarServiceEx
37
37
entries .add (entryLine );
38
38
Files .write (TMP_FILE , entries , StandardCharsets .UTF_8 , StandardOpenOption .WRITE , StandardOpenOption .CREATE , StandardOpenOption .TRUNCATE_EXISTING );
39
39
Files .move (TMP_FILE , BOOKMARKS_FILE , StandardCopyOption .REPLACE_EXISTING , StandardCopyOption .ATOMIC_MOVE );
40
- return new NautilusSidebarEntry (entryLine );
40
+ return new NautilusQuickAccessEntry (entryLine );
41
41
} catch (IOException e ) {
42
- throw new SidebarServiceException ("Adding entry to Nautilus bookmarks file failed." , e );
42
+ throw new QuickAccessServiceException ("Adding entry to Nautilus bookmarks file failed." , e );
43
43
} finally {
44
44
BOOKMARKS_LOCK .unlock ();
45
45
}
46
46
}
47
47
48
- static class NautilusSidebarEntry implements SidebarEntry {
48
+ static class NautilusQuickAccessEntry implements QuickAccessEntry {
49
49
50
50
private final String line ;
51
51
private volatile boolean isRemoved = false ;
52
52
53
- NautilusSidebarEntry (String line ) {
53
+ NautilusQuickAccessEntry (String line ) {
54
54
this .line = line ;
55
55
}
56
56
57
57
@ Override
58
- public void remove () throws SidebarServiceException {
58
+ public void remove () throws QuickAccessServiceException {
59
59
try {
60
60
BOOKMARKS_LOCK .lock ();
61
61
if (isRemoved ) {
@@ -71,7 +71,7 @@ public void remove() throws SidebarServiceException {
71
71
}
72
72
isRemoved = true ;
73
73
} catch (IOException e ) {
74
- throw new SidebarServiceException ("Removing entry from Nautilus bookmarks file failed" , e );
74
+ throw new QuickAccessServiceException ("Removing entry from Nautilus bookmarks file failed" , e );
75
75
} finally {
76
76
BOOKMARKS_LOCK .unlock ();
77
77
}
0 commit comments