diff --git a/gtk/Session.cc b/gtk/Session.cc index f4894b0f4..f4b614514 100644 --- a/gtk/Session.cc +++ b/gtk/Session.cc @@ -79,7 +79,7 @@ public: void torrents_added(); void add_files(std::vector> const& files, bool do_start, bool do_prompt, bool do_notify); - int add_ctor(tr_ctor* ctor, bool do_prompt, bool do_notify); + void add_ctor(tr_ctor* ctor, bool do_prompt, bool do_notify); void add_torrent(Glib::RefPtr const& torrent, bool do_notify); bool add_from_url(Glib::ustring const& url); @@ -690,12 +690,12 @@ Glib::RefPtr Session::Impl::create_new_torrent(tr_ctor* ctor) return Torrent::create(tor); } -int Session::Impl::add_ctor(tr_ctor* ctor, bool do_prompt, bool do_notify) +void Session::Impl::add_ctor(tr_ctor* ctor, bool do_prompt, bool do_notify) { auto const* metainfo = tr_ctorGetMetainfo(ctor); if (metainfo == nullptr) { - return TR_PARSE_ERR; + return; } if (tr_torrentFindFromMetainfo(get_session(), metainfo) != nullptr) @@ -709,18 +709,17 @@ int Session::Impl::add_ctor(tr_ctor* ctor, bool do_prompt, bool do_notify) } tr_ctorFree(ctor); - return TR_PARSE_DUPLICATE; + return; } if (!do_prompt) { add_torrent(create_new_torrent(ctor), do_notify); tr_ctorFree(ctor); - return 0; + return; } signal_add_prompt_.emit(ctor); - return 0; } namespace diff --git a/gtk/Session.h b/gtk/Session.h index 51cdbd51b..b323e9db7 100644 --- a/gtk/Session.h +++ b/gtk/Session.h @@ -31,8 +31,8 @@ class Session : public Glib::Object public: enum ErrorCode { - ERR_ADD_TORRENT_ERR = TR_PARSE_ERR, - ERR_ADD_TORRENT_DUP = TR_PARSE_DUPLICATE, + ERR_ADD_TORRENT_ERR = 1, + ERR_ADD_TORRENT_DUP = 2, ERR_NO_MORE_TORRENTS = 1000 /* finished adding a batch */ }; diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 1314fdc94..7ceb95ce5 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -808,14 +808,6 @@ void tr_ctorSetFilesWanted(tr_ctor* ctor, tr_file_index_t const* files, tr_file_ or nullptr if `tr_ctorSetMetainfoFromFile()` wasn't used */ char const* tr_ctorGetSourceFile(tr_ctor const* ctor); -// TODO(ckerr) remove -enum tr_parse_result -{ - TR_PARSE_OK, - TR_PARSE_ERR, - TR_PARSE_DUPLICATE -}; - /** * Instantiate a single torrent. *