From 97421cf1bd6fbd81037ffb05db982fed041e7472 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 4 May 2025 10:19:56 +0000 Subject: [PATCH] Add option to hide refresh button --- .../main/java/io/xpipe/app/util/FixedHierarchyStore.java | 4 ++++ .../xpipe/ext/base/action/RefreshChildrenStoreAction.java | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/xpipe/app/util/FixedHierarchyStore.java b/app/src/main/java/io/xpipe/app/util/FixedHierarchyStore.java index 7259e1089..537586aab 100644 --- a/app/src/main/java/io/xpipe/app/util/FixedHierarchyStore.java +++ b/app/src/main/java/io/xpipe/app/util/FixedHierarchyStore.java @@ -8,6 +8,10 @@ import java.util.List; public interface FixedHierarchyStore extends DataStore { + default boolean canManuallyRefresh() { + return true; + } + default boolean removeLeftovers() { return true; } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/action/RefreshChildrenStoreAction.java b/ext/base/src/main/java/io/xpipe/ext/base/action/RefreshChildrenStoreAction.java index 8d78880a9..b7b079265 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/action/RefreshChildrenStoreAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/action/RefreshChildrenStoreAction.java @@ -42,6 +42,11 @@ public class RefreshChildrenStoreAction implements ActionProvider { public LabelGraphic getIcon(DataStoreEntryRef store) { return new LabelGraphic.IconGraphic("mdi2r-refresh"); } + + @Override + public boolean isApplicable(DataStoreEntryRef o) { + return o.getStore().canManuallyRefresh(); + } }; } @@ -61,7 +66,7 @@ public class RefreshChildrenStoreAction implements ActionProvider { @Override public boolean isApplicable(DataStoreEntryRef o) { - return DataStorage.get().getStoreChildren(o.get()).size() == 0; + return o.getStore().canManuallyRefresh() && DataStorage.get().getStoreChildren(o.get()).size() == 0; } }; }