manual update and unsubscribe actions

This commit is contained in:
Zlatin Balevsky
2020-03-10 13:51:07 +00:00
parent 166b71f128
commit 15430d6c03
3 changed files with 20 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ public class Feed {
public Feed(Persona publisher) {
this.publisher = publisher;
this.status = FeedFetchStatus.IDLE;
}
public int getUpdateInterval() {

View File

@@ -30,6 +30,9 @@ import com.muwire.core.download.UIDownloadCancelledEvent
import com.muwire.core.download.UIDownloadPausedEvent
import com.muwire.core.download.UIDownloadResumedEvent
import com.muwire.core.filecert.UICreateCertificateEvent
import com.muwire.core.filefeeds.Feed
import com.muwire.core.filefeeds.UIFeedDeletedEvent
import com.muwire.core.filefeeds.UIFeedUpdateEvent
import com.muwire.core.filefeeds.UIFilePublishedEvent
import com.muwire.core.filefeeds.UIFileUnpublishedEvent
import com.muwire.core.files.FileUnsharedEvent
@@ -530,12 +533,23 @@ class MainFrameController {
@ControllerAction
void updateFileFeed() {
Feed feed = view.selectedFeed()
if (feed == null)
return
model.core.eventBus.publish(new UIFeedUpdateEvent(host: feed.getPublisher()))
}
@ControllerAction
void unsubscribeFileFeed() {
Feed feed = view.selectedFeed()
if (feed == null)
return
model.core.eventBus.publish(new UIFeedDeletedEvent(host : feed.getPublisher()))
runInsideUIAsync {
model.feeds.remove(feed)
model.feedItems.clear()
view.refreshFeeds()
}
}
@ControllerAction

View File

@@ -1332,6 +1332,9 @@ class MainFrameView {
feedsTable.model.fireTableDataChanged()
if (selectedFeed >= 0)
feedsTable.selectionModel.setSelectionInterval(selectedFeed, selectedFeed)
JTable feedItemsTable = builder.getVariable("feed-items-table")
feedItemsTable.model.fireTableDataChanged()
}
Feed selectedFeed() {