Catch beos gui up with libtransmission api changes.

This commit is contained in:
Josh Elsasser 2007-08-04 03:56:59 +00:00
parent e068d8b30d
commit d65c401b11
2 changed files with 14 additions and 9 deletions

View File

@ -160,7 +160,9 @@ void TRWindow::AddEntry(BEntry *torrent) {
// Try adding the torrent to the engine.
int error;
tr_torrent_t *nTorrent = tr_torrentInit(engine, path.Path(), NULL, 0, &error);
tr_torrent_t *nTorrent;
nTorrent = tr_torrentInit(engine, path.Path(), GetFolder().String(),
TR_FLAG_PAUSED, &error);
if (nTorrent != NULL && Lock()) { // Success. Add the TRTorrent item.
transfers->AddItem(new TRTransfer(path.Path(), node, nTorrent));
@ -397,10 +399,7 @@ void TRWindow::StopTorrent(tr_torrent_t *torrent) {
UpdateList(transfers->CurrentSelection(), true);
}
/**
* Called from StartTorrent thread.
*/
void TRWindow::StartTorrent(tr_torrent_t *torrent) {
BString TRWindow::GetFolder(void) {
// Read the settings.
BString folder("");
Prefs *prefs = new Prefs(TRANSMISSION_SETTINGS);
@ -408,14 +407,20 @@ void TRWindow::StartTorrent(tr_torrent_t *torrent) {
prefs->SetString("download.folder", "/boot/home/Downloads");
folder << "/boot/home/Downloads";
}
tr_torrentSetFolder(torrent, folder.String());
delete prefs;
return folder;
}
/**
* Called from StartTorrent thread.
*/
void TRWindow::StartTorrent(tr_torrent_t *torrent) {
tr_torrentSetFolder(torrent, GetFolder().String());
tr_torrentStart(torrent);
if (transfers->CurrentSelection() >= 0) {
UpdateList(transfers->CurrentSelection(), true);
}
delete prefs;
}
/**

View File

@ -41,7 +41,7 @@ public: // TRWindow
void UpdateList(int32 selection, bool menus);
void LoadSettings();
BString GetFolder(void);
void StopTorrent(tr_torrent_t *torrent);
void StartTorrent(tr_torrent_t *torrent);