HaikuDepot: Add "Refresh repositories" menu item.
- Allows the user to request manually updating the package list from the server.
This commit is contained in:
parent
cea02697b4
commit
4bee7f070b
@ -43,7 +43,8 @@
|
||||
|
||||
|
||||
enum {
|
||||
MSG_MODEL_WORKER_DONE = 'mmwd'
|
||||
MSG_MODEL_WORKER_DONE = 'mmwd',
|
||||
MSG_REFRESH_DEPOTS = 'mrdp'
|
||||
};
|
||||
|
||||
|
||||
@ -92,11 +93,7 @@ MainWindow::MainWindow(BRect frame)
|
||||
fSplitView->SetCollapsible(0, false);
|
||||
fSplitView->SetCollapsible(1, false);
|
||||
|
||||
fModelWorker = spawn_thread(&_RefreshModelThreadWorker, "model loader",
|
||||
B_LOW_PRIORITY, this);
|
||||
|
||||
if (fModelWorker > 0)
|
||||
resume_thread(fModelWorker);
|
||||
_StartRefreshWorker();
|
||||
}
|
||||
|
||||
|
||||
@ -136,6 +133,11 @@ MainWindow::MessageReceived(BMessage* message)
|
||||
// TODO: ?
|
||||
break;
|
||||
|
||||
case MSG_REFRESH_DEPOTS:
|
||||
{
|
||||
_StartRefreshWorker();
|
||||
break;
|
||||
}
|
||||
case MSG_PACKAGE_SELECTED:
|
||||
{
|
||||
BString title;
|
||||
@ -196,6 +198,8 @@ void
|
||||
MainWindow::_BuildMenu(BMenuBar* menuBar)
|
||||
{
|
||||
BMenu* menu = new BMenu(B_TRANSLATE("Package"));
|
||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Refresh depots"),
|
||||
new BMessage(MSG_REFRESH_DEPOTS)));
|
||||
menuBar->AddItem(menu);
|
||||
|
||||
}
|
||||
@ -390,6 +394,20 @@ MainWindow::_RefreshPackageList()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MainWindow::_StartRefreshWorker()
|
||||
{
|
||||
if (fModelWorker != B_BAD_THREAD_ID)
|
||||
return;
|
||||
|
||||
fModelWorker = spawn_thread(&_RefreshModelThreadWorker, "model loader",
|
||||
B_LOW_PRIORITY, this);
|
||||
|
||||
if (fModelWorker > 0)
|
||||
resume_thread(fModelWorker);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
MainWindow::_RefreshModelThreadWorker(void* arg)
|
||||
{
|
||||
|
@ -41,6 +41,8 @@ private:
|
||||
void _RefreshRepositories(bool force = false);
|
||||
void _RefreshPackageList();
|
||||
|
||||
void _StartRefreshWorker();
|
||||
|
||||
static status_t _RefreshModelThreadWorker(void* arg);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user