From d65c401b11f352881bc944204b8495131672d625 Mon Sep 17 00:00:00 2001 From: Josh Elsasser Date: Sat, 4 Aug 2007 03:56:59 +0000 Subject: [PATCH] Catch beos gui up with libtransmission api changes. --- beos/TRWindow.cpp | 21 +++++++++++++-------- beos/TRWindow.h | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/beos/TRWindow.cpp b/beos/TRWindow.cpp index b5cba3e27..c5066dabe 100644 --- a/beos/TRWindow.cpp +++ b/beos/TRWindow.cpp @@ -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; } /** diff --git a/beos/TRWindow.h b/beos/TRWindow.h index f232ff5da..869178bdc 100644 --- a/beos/TRWindow.h +++ b/beos/TRWindow.h @@ -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);