mirror of
https://github.com/transmission/transmission.git
synced 2025-12-19 18:08:31 +00:00
Rename GTK client files to match the classes they contain (#2073)
This also brings naming closer to Qt client which simplifies things a bit.
This commit is contained in:
@@ -15,16 +15,16 @@
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include "actions.h"
|
||||
#include "conf.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "Actions.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
TrCore* myCore = nullptr;
|
||||
Session* myCore = nullptr;
|
||||
|
||||
void action_cb(Glib::RefPtr<Gtk::Action> const& a, void* user_data)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ Gtk::UIManager* myUIManager = nullptr;
|
||||
|
||||
} // namespace
|
||||
|
||||
void gtr_actions_set_core(Glib::RefPtr<TrCore> const& core)
|
||||
void gtr_actions_set_core(Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
myCore = gtr_get_ptr(core);
|
||||
}
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "tr-core.h"
|
||||
class Session;
|
||||
|
||||
#define WINDOW_ICON "transmission-main-window-icon"
|
||||
#define TRAY_ICON "transmission-tray-icon"
|
||||
#define NOTIFICATION_ICON "transmission-notification-icon"
|
||||
|
||||
void gtr_actions_init(Glib::RefPtr<Gtk::UIManager> const& ui_manager, void* callback_user_data);
|
||||
void gtr_actions_set_core(Glib::RefPtr<TrCore> const& core);
|
||||
void gtr_actions_set_core(Glib::RefPtr<Session> const& core);
|
||||
void gtr_actions_handler(Glib::ustring const& action_name, void* user_data);
|
||||
|
||||
void gtr_action_activate(Glib::ustring const& action_name);
|
||||
@@ -40,22 +40,22 @@
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/version.h>
|
||||
|
||||
#include "actions.h"
|
||||
#include "application.h"
|
||||
#include "conf.h"
|
||||
#include "details.h"
|
||||
#include "dialogs.h"
|
||||
#include "hig.h"
|
||||
#include "makemeta-ui.h"
|
||||
#include "msgwin.h"
|
||||
#include "open-dialog.h"
|
||||
#include "relocate.h"
|
||||
#include "stats.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-icon.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "tr-window.h"
|
||||
#include "util.h"
|
||||
#include "Actions.h"
|
||||
#include "Application.h"
|
||||
#include "DetailsDialog.h"
|
||||
#include "Dialogs.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MakeDialog.h"
|
||||
#include "MessageLogWindow.h"
|
||||
#include "OptionsDialog.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "RelocateDialog.h"
|
||||
#include "Session.h"
|
||||
#include "StatsDialog.h"
|
||||
#include "SystemTrayIcon.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define MY_CONFIG_NAME "transmission"
|
||||
|
||||
@@ -145,7 +145,7 @@ private:
|
||||
bool update_model_loop();
|
||||
|
||||
void on_core_busy(bool busy);
|
||||
void on_core_error(TrCore::ErrorCode code, Glib::ustring const& msg);
|
||||
void on_core_error(Session::ErrorCode code, Glib::ustring const& msg);
|
||||
void on_add_torrent(tr_ctor* ctor);
|
||||
void on_prefs_changed(tr_quark key);
|
||||
|
||||
@@ -179,7 +179,7 @@ private:
|
||||
sigc::connection refresh_actions_tag_;
|
||||
std::unique_ptr<SystemTrayIcon> icon_;
|
||||
std::unique_ptr<MainWindow> wind_;
|
||||
Glib::RefPtr<TrCore> core_;
|
||||
Glib::RefPtr<Session> core_;
|
||||
std::unique_ptr<MessageLogWindow> msgwin_;
|
||||
std::unique_ptr<PrefsDialog> prefs_;
|
||||
std::vector<std::string> error_list_;
|
||||
@@ -557,7 +557,7 @@ void Application::Impl::on_startup()
|
||||
|
||||
gtr_pref_flag_set(TR_KEY_alt_speed_enabled, tr_sessionUsesAltSpeed(session));
|
||||
gtr_pref_int_set(TR_KEY_peer_port, tr_sessionGetPeerPort(session));
|
||||
core_ = TrCore::create(session);
|
||||
core_ = Session::create(session);
|
||||
|
||||
/* init the ui manager */
|
||||
ui_manager_ = Gtk::UIManager::create();
|
||||
@@ -958,19 +958,19 @@ void Application::Impl::flush_torrent_errors()
|
||||
}
|
||||
}
|
||||
|
||||
void Application::Impl::on_core_error(TrCore::ErrorCode code, Glib::ustring const& msg)
|
||||
void Application::Impl::on_core_error(Session::ErrorCode code, Glib::ustring const& msg)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case TrCore::ERR_ADD_TORRENT_ERR:
|
||||
case Session::ERR_ADD_TORRENT_ERR:
|
||||
error_list_.push_back(Glib::path_get_basename(msg));
|
||||
break;
|
||||
|
||||
case TrCore::ERR_ADD_TORRENT_DUP:
|
||||
case Session::ERR_ADD_TORRENT_DUP:
|
||||
duplicates_list_.push_back(msg);
|
||||
break;
|
||||
|
||||
case TrCore::ERR_NO_MORE_TORRENTS:
|
||||
case Session::ERR_NO_MORE_TORRENTS:
|
||||
flush_torrent_errors();
|
||||
break;
|
||||
|
||||
@@ -68,55 +68,57 @@ if(ENABLE_NLS)
|
||||
endif()
|
||||
|
||||
set(${PROJECT_NAME}_SOURCES
|
||||
actions.cc
|
||||
application.cc
|
||||
conf.cc
|
||||
details.cc
|
||||
dialogs.cc
|
||||
favicon.cc
|
||||
file-list.cc
|
||||
filter.cc
|
||||
hig.cc
|
||||
icons.cc
|
||||
Actions.cc
|
||||
Application.cc
|
||||
DetailsDialog.cc
|
||||
Dialogs.cc
|
||||
FaviconCache.cc
|
||||
FileList.cc
|
||||
FilterBar.cc
|
||||
FreeSpaceLabel.cc
|
||||
HigWorkarea.cc
|
||||
IconCache.cc
|
||||
main.cc
|
||||
makemeta-ui.cc
|
||||
msgwin.cc
|
||||
notify.cc
|
||||
open-dialog.cc
|
||||
relocate.cc
|
||||
stats.cc
|
||||
torrent-cell-renderer.cc
|
||||
tr-core.cc
|
||||
tr-icon.cc
|
||||
tr-prefs.cc
|
||||
tr-window.cc
|
||||
util.cc
|
||||
MainWindow.cc
|
||||
MakeDialog.cc
|
||||
MessageLogWindow.cc
|
||||
Notify.cc
|
||||
OptionsDialog.cc
|
||||
Prefs.cc
|
||||
PrefsDialog.cc
|
||||
RelocateDialog.cc
|
||||
Session.cc
|
||||
StatsDialog.cc
|
||||
SystemTrayIcon.cc
|
||||
TorrentCellRenderer.cc
|
||||
Utils.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/transmission-resources.c
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_HEADERS
|
||||
actions.h
|
||||
application.h
|
||||
conf.h
|
||||
details.h
|
||||
dialogs.h
|
||||
favicon.h
|
||||
file-list.h
|
||||
filter.h
|
||||
hig.h
|
||||
icons.h
|
||||
makemeta-ui.h
|
||||
msgwin.h
|
||||
notify.h
|
||||
open-dialog.h
|
||||
relocate.h
|
||||
stats.h
|
||||
torrent-cell-renderer.h
|
||||
tr-core.h
|
||||
tr-icon.h
|
||||
tr-prefs.h
|
||||
tr-window.h
|
||||
util.h
|
||||
Actions.h
|
||||
Application.h
|
||||
DetailsDialog.h
|
||||
Dialogs.h
|
||||
FaviconCache.h
|
||||
FileList.h
|
||||
FilterBar.h
|
||||
FreeSpaceLabel.h
|
||||
HigWorkarea.h
|
||||
IconCache.h
|
||||
MainWindow.h
|
||||
MakeDialog.h
|
||||
MessageLogWindow.h
|
||||
Notify.h
|
||||
OptionsDialog.h
|
||||
Prefs.h
|
||||
PrefsDialog.h
|
||||
RelocateDialog.h
|
||||
Session.h
|
||||
StatsDialog.h
|
||||
SystemTrayIcon.h
|
||||
TorrentCellRenderer.h
|
||||
Utils.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/transmission-resources.h
|
||||
)
|
||||
|
||||
|
||||
@@ -20,22 +20,22 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h> /* tr_free */
|
||||
|
||||
#include "actions.h"
|
||||
#include "conf.h"
|
||||
#include "details.h"
|
||||
#include "favicon.h" /* gtr_get_favicon() */
|
||||
#include "file-list.h"
|
||||
#include "hig.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "Actions.h"
|
||||
#include "DetailsDialog.h"
|
||||
#include "FaviconCache.h" /* gtr_get_favicon() */
|
||||
#include "FileList.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
class DetailsDialog::Impl
|
||||
{
|
||||
public:
|
||||
Impl(DetailsDialog& dialog, Glib::RefPtr<TrCore> const& core);
|
||||
Impl(DetailsDialog& dialog, Glib::RefPtr<Session> const& core);
|
||||
~Impl();
|
||||
|
||||
void set_torrents(std::vector<int> const& torrent_ids);
|
||||
@@ -148,7 +148,7 @@ private:
|
||||
Gtk::Label* file_label_ = nullptr;
|
||||
|
||||
std::vector<int> ids_;
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
sigc::connection periodic_refresh_tag_;
|
||||
|
||||
Glib::Quark const TORRENT_ID_KEY = Glib::Quark("tr-torrent-id-key");
|
||||
@@ -2570,12 +2570,12 @@ DetailsDialog::Impl::~Impl()
|
||||
periodic_refresh_tag_.disconnect();
|
||||
}
|
||||
|
||||
std::unique_ptr<DetailsDialog> DetailsDialog::create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
std::unique_ptr<DetailsDialog> DetailsDialog::create(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
return std::unique_ptr<DetailsDialog>(new DetailsDialog(parent, core));
|
||||
}
|
||||
|
||||
DetailsDialog::DetailsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
DetailsDialog::DetailsDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
: Gtk::Dialog({}, parent)
|
||||
, impl_(std::make_unique<Impl>(*this, core))
|
||||
{
|
||||
@@ -2583,7 +2583,7 @@ DetailsDialog::DetailsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& co
|
||||
|
||||
DetailsDialog::~DetailsDialog() = default;
|
||||
|
||||
DetailsDialog::Impl::Impl(DetailsDialog& dialog, Glib::RefPtr<TrCore> const& core)
|
||||
DetailsDialog::Impl::Impl(DetailsDialog& dialog, Glib::RefPtr<Session> const& core)
|
||||
: dialog_(dialog)
|
||||
, core_(core)
|
||||
{
|
||||
@@ -14,19 +14,19 @@
|
||||
#include <glibmm.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
class DetailsDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
~DetailsDialog() override;
|
||||
|
||||
static std::unique_ptr<DetailsDialog> create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
static std::unique_ptr<DetailsDialog> create(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
void set_torrents(std::vector<int> const& torrent_ids);
|
||||
|
||||
protected:
|
||||
DetailsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
DetailsDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include "dialogs.h"
|
||||
#include "tr-core.h"
|
||||
#include "util.h"
|
||||
#include "Dialogs.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
/***
|
||||
****
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
void gtr_confirm_remove(
|
||||
Gtk::Window& parent,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
std::vector<int> const& torrent_ids,
|
||||
bool delete_files)
|
||||
{
|
||||
@@ -26,13 +26,13 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
/**
|
||||
* Prompt the user to confirm removing a torrent.
|
||||
*/
|
||||
void gtr_confirm_remove(
|
||||
Gtk::Window& parent,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
std::vector<int> const& torrent_ids,
|
||||
bool delete_files);
|
||||
@@ -13,8 +13,8 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/web.h> /* tr_webRun() */
|
||||
|
||||
#include "favicon.h"
|
||||
#include "util.h" /* gtr_get_host_from_url() */
|
||||
#include "FaviconCache.h"
|
||||
#include "Utils.h" /* gtr_get_host_from_url() */
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -17,12 +17,12 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "file-list.h"
|
||||
#include "hig.h"
|
||||
#include "icons.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "FileList.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "IconCache.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define TR_COLUMN_ID_KEY "tr-model-column-id-key"
|
||||
|
||||
@@ -73,7 +73,7 @@ FileModelColumns const file_cols;
|
||||
class FileList::Impl
|
||||
{
|
||||
public:
|
||||
Impl(FileList& widget, Glib::RefPtr<TrCore> const& core, int torrent_id);
|
||||
Impl(FileList& widget, Glib::RefPtr<Session> const& core, int torrent_id);
|
||||
~Impl();
|
||||
|
||||
void set_torrent(int torrent_id);
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
private:
|
||||
FileList& widget_;
|
||||
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
// GtkWidget* top_ = nullptr; // == widget_
|
||||
Gtk::TreeView* view_ = nullptr;
|
||||
Glib::RefPtr<Gtk::TreeStore> store_;
|
||||
@@ -815,13 +815,13 @@ void FileList::Impl::cell_edited_callback(Glib::ustring const& path_string, Glib
|
||||
rename_data);
|
||||
}
|
||||
|
||||
FileList::FileList(Glib::RefPtr<TrCore> const& core, int torrent_id)
|
||||
FileList::FileList(Glib::RefPtr<Session> const& core, int torrent_id)
|
||||
: Gtk::ScrolledWindow()
|
||||
, impl_(std::make_unique<Impl>(*this, core, torrent_id))
|
||||
{
|
||||
}
|
||||
|
||||
FileList::Impl::Impl(FileList& widget, Glib::RefPtr<TrCore> const& core, int torrent_id)
|
||||
FileList::Impl::Impl(FileList& widget, Glib::RefPtr<Session> const& core, int torrent_id)
|
||||
: widget_(widget)
|
||||
, core_(core)
|
||||
{
|
||||
@@ -12,12 +12,12 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
class FileList : public Gtk::ScrolledWindow
|
||||
{
|
||||
public:
|
||||
FileList(Glib::RefPtr<TrCore> const& core, int torrent_id);
|
||||
FileList(Glib::RefPtr<Session> const& core, int torrent_id);
|
||||
~FileList() override;
|
||||
|
||||
void clear();
|
||||
@@ -16,11 +16,11 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "favicon.h" /* gtr_get_favicon() */
|
||||
#include "filter.h"
|
||||
#include "hig.h" /* GUI_PAD */
|
||||
#include "tr-core.h" /* MC_TORRENT */
|
||||
#include "util.h" /* gtr_get_host_from_url() */
|
||||
#include "FaviconCache.h" /* gtr_get_favicon() */
|
||||
#include "FilterBar.h"
|
||||
#include "HigWorkarea.h" /* GUI_PAD */
|
||||
#include "Session.h" /* MC_TORRENT */
|
||||
#include "Utils.h" /* gtr_get_host_from_url() */
|
||||
|
||||
namespace
|
||||
{
|
||||
80
gtk/FreeSpaceLabel.cc
Normal file
80
gtk/FreeSpaceLabel.cc
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* This file Copyright (C) 2008-2021 Mnemosyne LLC
|
||||
*
|
||||
* It may be used under the GNU GPL versions 2 or 3
|
||||
* or any future license endorsed by Mnemosyne LLC.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <glibmm/i18n.h>
|
||||
|
||||
#include "FreeSpaceLabel.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
class FreeSpaceLabel::Impl
|
||||
{
|
||||
public:
|
||||
Impl(FreeSpaceLabel& label, Glib::RefPtr<Session> const& core, std::string const& dir);
|
||||
~Impl();
|
||||
|
||||
void set_dir(std::string const& dir);
|
||||
|
||||
private:
|
||||
bool on_freespace_timer();
|
||||
|
||||
private:
|
||||
FreeSpaceLabel& label_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
std::string dir_;
|
||||
sigc::connection timer_id_;
|
||||
};
|
||||
|
||||
FreeSpaceLabel::Impl::~Impl()
|
||||
{
|
||||
timer_id_.disconnect();
|
||||
}
|
||||
|
||||
bool FreeSpaceLabel::Impl::on_freespace_timer()
|
||||
{
|
||||
auto* const session = core_->get_session();
|
||||
if (session == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto const bytes = tr_sessionGetDirFreeSpace(session, dir_.c_str());
|
||||
auto const text = bytes < 0 ? _("Error") : gtr_sprintf(_("%s free"), tr_strlsize(bytes));
|
||||
auto const markup = gtr_sprintf("<i>%s</i>", text);
|
||||
label_.set_markup(markup);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FreeSpaceLabel::FreeSpaceLabel(Glib::RefPtr<Session> const& core, std::string const& dir)
|
||||
: Gtk::Label()
|
||||
, impl_(std::make_unique<Impl>(*this, core, dir))
|
||||
{
|
||||
}
|
||||
|
||||
FreeSpaceLabel::~FreeSpaceLabel() = default;
|
||||
|
||||
FreeSpaceLabel::Impl::Impl(FreeSpaceLabel& label, Glib::RefPtr<Session> const& core, std::string const& dir)
|
||||
: label_(label)
|
||||
, core_(core)
|
||||
, dir_(dir)
|
||||
{
|
||||
timer_id_ = Glib::signal_timeout().connect_seconds(sigc::mem_fun(this, &Impl::on_freespace_timer), 3);
|
||||
on_freespace_timer();
|
||||
}
|
||||
|
||||
void FreeSpaceLabel::set_dir(std::string const& dir)
|
||||
{
|
||||
impl_->set_dir(dir);
|
||||
}
|
||||
|
||||
void FreeSpaceLabel::Impl::set_dir(std::string const& dir)
|
||||
{
|
||||
dir_ = dir;
|
||||
on_freespace_timer();
|
||||
}
|
||||
28
gtk/FreeSpaceLabel.h
Normal file
28
gtk/FreeSpaceLabel.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file Copyright (C) 2008-2021 Mnemosyne LLC
|
||||
*
|
||||
* It may be used under the GNU GPL versions 2 or 3
|
||||
* or any future license endorsed by Mnemosyne LLC.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <glibmm.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
class Session;
|
||||
|
||||
class FreeSpaceLabel : public Gtk::Label
|
||||
{
|
||||
public:
|
||||
FreeSpaceLabel(Glib::RefPtr<Session> const& core, std::string const& dir = {});
|
||||
~FreeSpaceLabel() override;
|
||||
|
||||
void set_dir(std::string const& dir);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> const impl_;
|
||||
};
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
#include <libtransmission/tr-macros.h>
|
||||
|
||||
#include "hig.h"
|
||||
#include "util.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "Utils.h"
|
||||
|
||||
HigWorkarea::HigWorkarea()
|
||||
{
|
||||
@@ -11,8 +11,8 @@
|
||||
#include <glibmm.h>
|
||||
#include <giomm.h>
|
||||
|
||||
#include "icons.h"
|
||||
#include "util.h"
|
||||
#include "IconCache.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define VOID_PIXBUF_KEY "void-pixbuf"
|
||||
|
||||
@@ -27,20 +27,20 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h> /* tr_formatter_speed_KBps() */
|
||||
|
||||
#include "actions.h"
|
||||
#include "conf.h"
|
||||
#include "filter.h"
|
||||
#include "hig.h"
|
||||
#include "torrent-cell-renderer.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "tr-window.h"
|
||||
#include "util.h"
|
||||
#include "Actions.h"
|
||||
#include "FilterBar.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "TorrentCellRenderer.h"
|
||||
#include "Utils.h"
|
||||
|
||||
class MainWindow::Impl
|
||||
{
|
||||
public:
|
||||
Impl(MainWindow& window, Glib::RefPtr<Gtk::UIManager> const& ui_mgr, Glib::RefPtr<TrCore> const& core);
|
||||
Impl(MainWindow& window, Glib::RefPtr<Gtk::UIManager> const& ui_mgr, Glib::RefPtr<Session> const& core);
|
||||
~Impl();
|
||||
|
||||
Glib::RefPtr<Gtk::TreeSelection> get_selection() const;
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
Glib::RefPtr<Gtk::TreeSelection> selection_;
|
||||
TorrentCellRenderer* renderer_ = nullptr;
|
||||
Gtk::TreeViewColumn* column_ = nullptr;
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
sigc::connection pref_handler_id_;
|
||||
};
|
||||
|
||||
@@ -449,12 +449,12 @@ void MainWindow::Impl::onOptionsClicked(Gtk::Button* button)
|
||||
std::unique_ptr<MainWindow> MainWindow::create(
|
||||
Gtk::Application& app,
|
||||
Glib::RefPtr<Gtk::UIManager> const& uim,
|
||||
Glib::RefPtr<TrCore> const& core)
|
||||
Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
return std::unique_ptr<MainWindow>(new MainWindow(app, uim, core));
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(Gtk::Application& app, Glib::RefPtr<Gtk::UIManager> const& ui_mgr, Glib::RefPtr<TrCore> const& core)
|
||||
MainWindow::MainWindow(Gtk::Application& app, Glib::RefPtr<Gtk::UIManager> const& ui_mgr, Glib::RefPtr<Session> const& core)
|
||||
: Gtk::ApplicationWindow()
|
||||
, impl_(std::make_unique<Impl>(*this, ui_mgr, core))
|
||||
{
|
||||
@@ -463,7 +463,7 @@ MainWindow::MainWindow(Gtk::Application& app, Glib::RefPtr<Gtk::UIManager> const
|
||||
|
||||
MainWindow::~MainWindow() = default;
|
||||
|
||||
MainWindow::Impl::Impl(MainWindow& window, Glib::RefPtr<Gtk::UIManager> const& ui_mgr, Glib::RefPtr<TrCore> const& core)
|
||||
MainWindow::Impl::Impl(MainWindow& window, Glib::RefPtr<Gtk::UIManager> const& ui_mgr, Glib::RefPtr<Session> const& core)
|
||||
: core_(core)
|
||||
{
|
||||
static struct
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <glibmm.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
class MainWindow : public Gtk::ApplicationWindow
|
||||
{
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
static std::unique_ptr<MainWindow> create(
|
||||
Gtk::Application& app,
|
||||
Glib::RefPtr<Gtk::UIManager> const& uim,
|
||||
Glib::RefPtr<TrCore> const& core);
|
||||
Glib::RefPtr<Session> const& core);
|
||||
|
||||
Glib::RefPtr<Gtk::TreeSelection> get_selection() const;
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
void refresh();
|
||||
|
||||
protected:
|
||||
MainWindow(Gtk::Application& app, Glib::RefPtr<Gtk::UIManager> const& uim, Glib::RefPtr<TrCore> const& core);
|
||||
MainWindow(Gtk::Application& app, Glib::RefPtr<Gtk::UIManager> const& uim, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -13,11 +13,11 @@
|
||||
#include <libtransmission/makemeta.h>
|
||||
#include <libtransmission/utils.h> /* tr_formatter_mem_B() */
|
||||
|
||||
#include "hig.h"
|
||||
#include "makemeta-ui.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "MakeDialog.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define FILE_CHOSEN_KEY "file-is-chosen"
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
Gtk::Window& parent,
|
||||
tr_metainfo_builder& builder,
|
||||
std::string const& target,
|
||||
Glib::RefPtr<TrCore> const& core);
|
||||
Glib::RefPtr<Session> const& core);
|
||||
~MakeProgressDialog() override;
|
||||
|
||||
private:
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
private:
|
||||
tr_metainfo_builder& builder_;
|
||||
std::string const target_;
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
|
||||
sigc::connection progress_tag_;
|
||||
Gtk::Label* progress_label_ = nullptr;
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
class MakeDialog::Impl
|
||||
{
|
||||
public:
|
||||
Impl(MakeDialog& dialog, Glib::RefPtr<TrCore> const& core);
|
||||
Impl(MakeDialog& dialog, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
void onSourceToggled2(Gtk::ToggleButton* tb, Gtk::FileChooserButton* chooser);
|
||||
@@ -78,7 +78,7 @@ private:
|
||||
|
||||
private:
|
||||
MakeDialog& dialog_;
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
|
||||
Gtk::RadioButton* file_radio_ = nullptr;
|
||||
Gtk::FileChooserButton* file_chooser_ = nullptr;
|
||||
@@ -195,7 +195,7 @@ MakeProgressDialog::MakeProgressDialog(
|
||||
Gtk::Window& parent,
|
||||
tr_metainfo_builder& builder,
|
||||
std::string const& target,
|
||||
Glib::RefPtr<TrCore> const& core)
|
||||
Glib::RefPtr<Session> const& core)
|
||||
: Gtk::Dialog(_("New Torrent"), parent, true)
|
||||
, builder_(builder)
|
||||
, target_(target)
|
||||
@@ -415,12 +415,12 @@ void MakeDialog::Impl::on_drag_data_received(
|
||||
drag_context->drag_finish(success, false, time_);
|
||||
}
|
||||
|
||||
std::unique_ptr<MakeDialog> MakeDialog::create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
std::unique_ptr<MakeDialog> MakeDialog::create(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
return std::unique_ptr<MakeDialog>(new MakeDialog(parent, core));
|
||||
}
|
||||
|
||||
MakeDialog::MakeDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
MakeDialog::MakeDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
: Gtk::Dialog(_("New Torrent"), parent)
|
||||
, impl_(std::make_unique<Impl>(*this, core))
|
||||
{
|
||||
@@ -428,7 +428,7 @@ MakeDialog::MakeDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
|
||||
MakeDialog::~MakeDialog() = default;
|
||||
|
||||
MakeDialog::Impl::Impl(MakeDialog& dialog, Glib::RefPtr<TrCore> const& core)
|
||||
MakeDialog::Impl::Impl(MakeDialog& dialog, Glib::RefPtr<Session> const& core)
|
||||
: dialog_(dialog)
|
||||
, core_(core)
|
||||
{
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
class MakeDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
~MakeDialog() override;
|
||||
|
||||
static std::unique_ptr<MakeDialog> create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
static std::unique_ptr<MakeDialog> create(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
protected:
|
||||
MakeDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
MakeDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -16,12 +16,12 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/log.h>
|
||||
|
||||
#include "conf.h"
|
||||
#include "hig.h"
|
||||
#include "msgwin.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "MessageLogWindow.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
class MessageLogColumnsModel : public Gtk::TreeModelColumnRecord
|
||||
{
|
||||
@@ -45,7 +45,7 @@ MessageLogColumnsModel const message_log_cols;
|
||||
class MessageLogWindow::Impl
|
||||
{
|
||||
public:
|
||||
Impl(MessageLogWindow& window, Glib::RefPtr<TrCore> const& core);
|
||||
Impl(MessageLogWindow& window, Glib::RefPtr<Session> const& core);
|
||||
~Impl();
|
||||
|
||||
private:
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
private:
|
||||
MessageLogWindow& window_;
|
||||
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
Gtk::TreeView* view_ = nullptr;
|
||||
Glib::RefPtr<Gtk::ListStore> store_;
|
||||
Glib::RefPtr<Gtk::TreeModelFilter> filter_;
|
||||
@@ -429,12 +429,12 @@ Gtk::ComboBox* debug_level_combo_new()
|
||||
*** Public Functions
|
||||
**/
|
||||
|
||||
std::unique_ptr<MessageLogWindow> MessageLogWindow::create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
std::unique_ptr<MessageLogWindow> MessageLogWindow::create(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
return std::unique_ptr<MessageLogWindow>(new MessageLogWindow(parent, core));
|
||||
}
|
||||
|
||||
MessageLogWindow::MessageLogWindow(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
MessageLogWindow::MessageLogWindow(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
: Gtk::Window(Gtk::WINDOW_TOPLEVEL)
|
||||
, impl_(std::make_unique<Impl>(*this, core))
|
||||
{
|
||||
@@ -443,7 +443,7 @@ MessageLogWindow::MessageLogWindow(Gtk::Window& parent, Glib::RefPtr<TrCore> con
|
||||
|
||||
MessageLogWindow::~MessageLogWindow() = default;
|
||||
|
||||
MessageLogWindow::Impl::Impl(MessageLogWindow& window, Glib::RefPtr<TrCore> const& core)
|
||||
MessageLogWindow::Impl::Impl(MessageLogWindow& window, Glib::RefPtr<Session> const& core)
|
||||
: window_(window)
|
||||
, core_(core)
|
||||
{
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
class MessageLogWindow : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
~MessageLogWindow() override;
|
||||
|
||||
static std::unique_ptr<MessageLogWindow> create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
static std::unique_ptr<MessageLogWindow> create(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
protected:
|
||||
MessageLogWindow(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
MessageLogWindow(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -11,11 +11,11 @@
|
||||
#include <giomm.h>
|
||||
#include <glibmm/i18n.h>
|
||||
|
||||
#include "conf.h"
|
||||
#include "notify.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "Notify.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define NOTIFICATIONS_DBUS_NAME "org.freedesktop.Notifications"
|
||||
#define NOTIFICATIONS_DBUS_CORE_OBJECT "/org/freedesktop/Notifications"
|
||||
@@ -30,7 +30,7 @@ namespace
|
||||
|
||||
struct TrNotification
|
||||
{
|
||||
Glib::RefPtr<TrCore> core;
|
||||
Glib::RefPtr<Session> core;
|
||||
int torrent_id = 0;
|
||||
};
|
||||
|
||||
@@ -160,7 +160,7 @@ void notify_callback(Glib::RefPtr<Gio::AsyncResult>& res, TrNotification const&
|
||||
|
||||
} // namespace
|
||||
|
||||
void gtr_notify_torrent_completed(Glib::RefPtr<TrCore> const& core, int torrent_id)
|
||||
void gtr_notify_torrent_completed(Glib::RefPtr<Session> const& core, int torrent_id)
|
||||
{
|
||||
if (gtr_pref_flag_get(TR_KEY_torrent_complete_sound_enabled))
|
||||
{
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
void gtr_notify_init();
|
||||
|
||||
void gtr_notify_torrent_added(Glib::ustring const& name);
|
||||
|
||||
void gtr_notify_torrent_completed(Glib::RefPtr<TrCore> const& core, int torrent_id);
|
||||
void gtr_notify_torrent_completed(Glib::RefPtr<Session> const& core, int torrent_id);
|
||||
@@ -15,13 +15,14 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/file.h> /* tr_sys_path_is_same() */
|
||||
|
||||
#include "conf.h"
|
||||
#include "file-list.h"
|
||||
#include "hig.h"
|
||||
#include "open-dialog.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h" /* gtr_priority_combo_get_value() */
|
||||
#include "FileList.h"
|
||||
#include "FreeSpaceLabel.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "OptionsDialog.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h" /* gtr_priority_combo_get_value() */
|
||||
|
||||
/****
|
||||
*****
|
||||
@@ -49,7 +50,7 @@ std::list<std::string> get_recent_destinations()
|
||||
return list;
|
||||
}
|
||||
|
||||
void save_recent_destination(Glib::RefPtr<TrCore> const& core, std::string const& dir)
|
||||
void save_recent_destination(Glib::RefPtr<Session> const& core, std::string const& dir)
|
||||
{
|
||||
if (dir.empty())
|
||||
{
|
||||
@@ -85,7 +86,7 @@ void save_recent_destination(Glib::RefPtr<TrCore> const& core, std::string const
|
||||
class OptionsDialog::Impl
|
||||
{
|
||||
public:
|
||||
Impl(OptionsDialog& dialog, Glib::RefPtr<TrCore> const& core, std::unique_ptr<tr_ctor, void (*)(tr_ctor*)> ctor);
|
||||
Impl(OptionsDialog& dialog, Glib::RefPtr<Session> const& core, std::unique_ptr<tr_ctor, void (*)(tr_ctor*)> ctor);
|
||||
|
||||
private:
|
||||
void sourceChanged(Gtk::FileChooserButton* b);
|
||||
@@ -99,7 +100,7 @@ private:
|
||||
private:
|
||||
OptionsDialog& dialog_;
|
||||
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
FileList* file_list_ = nullptr;
|
||||
Gtk::CheckButton* run_check_ = nullptr;
|
||||
Gtk::CheckButton* trash_check_ = nullptr;
|
||||
@@ -253,7 +254,7 @@ void addTorrentFilters(Gtk::FileChooser* chooser)
|
||||
|
||||
std::unique_ptr<OptionsDialog> OptionsDialog::create(
|
||||
Gtk::Window& parent,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
std::unique_ptr<tr_ctor, void (*)(tr_ctor*)> ctor)
|
||||
{
|
||||
return std::unique_ptr<OptionsDialog>(new OptionsDialog(parent, core, std::move(ctor)));
|
||||
@@ -261,7 +262,7 @@ std::unique_ptr<OptionsDialog> OptionsDialog::create(
|
||||
|
||||
OptionsDialog::OptionsDialog(
|
||||
Gtk::Window& parent,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
std::unique_ptr<tr_ctor, void (*)(tr_ctor*)> ctor)
|
||||
: Gtk::Dialog(_("Torrent Options"), parent)
|
||||
, impl_(std::make_unique<Impl>(*this, core, std::move(ctor)))
|
||||
@@ -272,7 +273,7 @@ OptionsDialog::~OptionsDialog() = default;
|
||||
|
||||
OptionsDialog::Impl::Impl(
|
||||
OptionsDialog& dialog,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
std::unique_ptr<tr_ctor, void (*)(tr_ctor*)> ctor)
|
||||
: dialog_(dialog)
|
||||
, core_(core)
|
||||
@@ -410,7 +411,7 @@ OptionsDialog::Impl::Impl(
|
||||
*****
|
||||
****/
|
||||
|
||||
void TorrentFileChooserDialog::onOpenDialogResponse(int response, Glib::RefPtr<TrCore> const& core)
|
||||
void TorrentFileChooserDialog::onOpenDialogResponse(int response, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
/* remember this folder the next time we use this dialog */
|
||||
gtr_pref_string_set(TR_KEY_open_dialog_dir, get_current_folder());
|
||||
@@ -431,12 +432,12 @@ void TorrentFileChooserDialog::onOpenDialogResponse(int response, Glib::RefPtr<T
|
||||
|
||||
std::unique_ptr<TorrentFileChooserDialog> TorrentFileChooserDialog::create(
|
||||
Gtk::Window& parent,
|
||||
Glib::RefPtr<TrCore> const& core)
|
||||
Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
return std::unique_ptr<TorrentFileChooserDialog>(new TorrentFileChooserDialog(parent, core));
|
||||
}
|
||||
|
||||
TorrentFileChooserDialog::TorrentFileChooserDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
TorrentFileChooserDialog::TorrentFileChooserDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
: Gtk::FileChooserDialog(parent, _("Open a Torrent"), Gtk::FILE_CHOOSER_ACTION_OPEN)
|
||||
{
|
||||
add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
|
||||
@@ -461,7 +462,7 @@ TorrentFileChooserDialog::TorrentFileChooserDialog(Gtk::Window& parent, Glib::Re
|
||||
****
|
||||
***/
|
||||
|
||||
void TorrentUrlChooserDialog::onOpenURLResponse(int response, Glib::RefPtr<TrCore> const& core)
|
||||
void TorrentUrlChooserDialog::onOpenURLResponse(int response, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
bool handled = false;
|
||||
|
||||
@@ -491,12 +492,12 @@ void TorrentUrlChooserDialog::onOpenURLResponse(int response, Glib::RefPtr<TrCor
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<TorrentUrlChooserDialog> TorrentUrlChooserDialog::create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
std::unique_ptr<TorrentUrlChooserDialog> TorrentUrlChooserDialog::create(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
return std::unique_ptr<TorrentUrlChooserDialog>(new TorrentUrlChooserDialog(parent, core));
|
||||
}
|
||||
|
||||
TorrentUrlChooserDialog::TorrentUrlChooserDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
TorrentUrlChooserDialog::TorrentUrlChooserDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
: Gtk::Dialog(_("Open URL"), parent)
|
||||
{
|
||||
guint row;
|
||||
@@ -12,31 +12,31 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
typedef struct tr_ctor tr_ctor;
|
||||
|
||||
class TorrentUrlChooserDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
static std::unique_ptr<TorrentUrlChooserDialog> create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
static std::unique_ptr<TorrentUrlChooserDialog> create(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
protected:
|
||||
TorrentUrlChooserDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
TorrentUrlChooserDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
void onOpenURLResponse(int response, Glib::RefPtr<TrCore> const& core);
|
||||
void onOpenURLResponse(int response, Glib::RefPtr<Session> const& core);
|
||||
};
|
||||
|
||||
class TorrentFileChooserDialog : public Gtk::FileChooserDialog
|
||||
{
|
||||
public:
|
||||
static std::unique_ptr<TorrentFileChooserDialog> create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
static std::unique_ptr<TorrentFileChooserDialog> create(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
protected:
|
||||
TorrentFileChooserDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
TorrentFileChooserDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
void onOpenDialogResponse(int response, Glib::RefPtr<TrCore> const& core);
|
||||
void onOpenDialogResponse(int response, Glib::RefPtr<Session> const& core);
|
||||
};
|
||||
|
||||
class OptionsDialog : public Gtk::Dialog
|
||||
@@ -46,11 +46,11 @@ public:
|
||||
|
||||
static std::unique_ptr<OptionsDialog> create(
|
||||
Gtk::Window& parent,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
std::unique_ptr<tr_ctor, void (*)(tr_ctor*)> ctor);
|
||||
|
||||
protected:
|
||||
OptionsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core, std::unique_ptr<tr_ctor, void (*)(tr_ctor*)> ctor);
|
||||
OptionsDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core, std::unique_ptr<tr_ctor, void (*)(tr_ctor*)> ctor);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -34,9 +34,9 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "conf.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define MY_CONFIG_NAME "transmission"
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/version.h>
|
||||
|
||||
#include "conf.h"
|
||||
#include "hig.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "FreeSpaceLabel.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
/**
|
||||
***
|
||||
@@ -31,7 +32,7 @@
|
||||
class PrefsDialog::Impl
|
||||
{
|
||||
public:
|
||||
Impl(PrefsDialog& dialog, Glib::RefPtr<TrCore> const& core);
|
||||
Impl(PrefsDialog& dialog, Glib::RefPtr<Session> const& core);
|
||||
~Impl();
|
||||
|
||||
private:
|
||||
@@ -50,7 +51,7 @@ private:
|
||||
private:
|
||||
PrefsDialog& dialog_;
|
||||
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
sigc::connection core_prefs_tag_;
|
||||
|
||||
FreeSpaceLabel* freespace_label_ = nullptr;
|
||||
@@ -82,7 +83,7 @@ void PrefsDialog::Impl::response_cb(int response)
|
||||
namespace
|
||||
{
|
||||
|
||||
Gtk::CheckButton* new_check_button(Glib::ustring const& mnemonic, tr_quark const key, Glib::RefPtr<TrCore> const& core)
|
||||
Gtk::CheckButton* new_check_button(Glib::ustring const& mnemonic, tr_quark const key, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
auto* w = Gtk::make_managed<Gtk::CheckButton>(mnemonic, true);
|
||||
w->set_active(gtr_pref_flag_get(key));
|
||||
@@ -92,7 +93,7 @@ Gtk::CheckButton* new_check_button(Glib::ustring const& mnemonic, tr_quark const
|
||||
|
||||
#define IDLE_DATA "idle-data"
|
||||
|
||||
bool spun_cb_idle(Gtk::SpinButton* spin, tr_quark const key, Glib::RefPtr<TrCore> const& core, bool isDouble)
|
||||
bool spun_cb_idle(Gtk::SpinButton* spin, tr_quark const key, Glib::RefPtr<Session> const& core, bool isDouble)
|
||||
{
|
||||
bool keep_waiting = true;
|
||||
auto* last_change = static_cast<Glib::Timer*>(spin->get_data(IDLE_DATA));
|
||||
@@ -121,7 +122,7 @@ bool spun_cb_idle(Gtk::SpinButton* spin, tr_quark const key, Glib::RefPtr<TrCore
|
||||
return keep_waiting;
|
||||
}
|
||||
|
||||
void spun_cb(Gtk::SpinButton* w, tr_quark const key, Glib::RefPtr<TrCore> const& core, bool isDouble)
|
||||
void spun_cb(Gtk::SpinButton* w, tr_quark const key, Glib::RefPtr<Session> const& core, bool isDouble)
|
||||
{
|
||||
/* user may be spinning through many values, so let's hold off
|
||||
for a moment to keep from flooding the core with changes */
|
||||
@@ -138,7 +139,7 @@ void spun_cb(Gtk::SpinButton* w, tr_quark const key, Glib::RefPtr<TrCore> const&
|
||||
last_change->start();
|
||||
}
|
||||
|
||||
Gtk::SpinButton* new_spin_button(tr_quark const key, Glib::RefPtr<TrCore> const& core, int low, int high, int step)
|
||||
Gtk::SpinButton* new_spin_button(tr_quark const key, Glib::RefPtr<Session> const& core, int low, int high, int step)
|
||||
{
|
||||
auto* w = Gtk::make_managed<Gtk::SpinButton>(Gtk::Adjustment::create(gtr_pref_int_get(key), low, high, step));
|
||||
w->set_digits(0);
|
||||
@@ -148,7 +149,7 @@ Gtk::SpinButton* new_spin_button(tr_quark const key, Glib::RefPtr<TrCore> const&
|
||||
|
||||
Gtk::SpinButton* new_spin_button_double(
|
||||
tr_quark const key,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
double low,
|
||||
double high,
|
||||
double step)
|
||||
@@ -159,12 +160,12 @@ Gtk::SpinButton* new_spin_button_double(
|
||||
return w;
|
||||
}
|
||||
|
||||
void entry_changed_cb(Gtk::Entry* w, tr_quark const key, Glib::RefPtr<TrCore> const& core)
|
||||
void entry_changed_cb(Gtk::Entry* w, tr_quark const key, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
core->set_pref(key, w->get_text());
|
||||
}
|
||||
|
||||
Gtk::Entry* new_entry(tr_quark const key, Glib::RefPtr<TrCore> const& core)
|
||||
Gtk::Entry* new_entry(tr_quark const key, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
auto* w = Gtk::make_managed<Gtk::Entry>();
|
||||
|
||||
@@ -177,12 +178,12 @@ Gtk::Entry* new_entry(tr_quark const key, Glib::RefPtr<TrCore> const& core)
|
||||
return w;
|
||||
}
|
||||
|
||||
void chosen_cb(Gtk::FileChooser* w, tr_quark const key, Glib::RefPtr<TrCore> const& core)
|
||||
void chosen_cb(Gtk::FileChooser* w, tr_quark const key, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
core->set_pref(key, w->get_filename());
|
||||
}
|
||||
|
||||
Gtk::FileChooserButton* new_path_chooser_button(tr_quark const key, Glib::RefPtr<TrCore> const& core)
|
||||
Gtk::FileChooserButton* new_path_chooser_button(tr_quark const key, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
auto* w = Gtk::make_managed<Gtk::FileChooserButton>(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
|
||||
@@ -195,7 +196,7 @@ Gtk::FileChooserButton* new_path_chooser_button(tr_quark const key, Glib::RefPtr
|
||||
return w;
|
||||
}
|
||||
|
||||
Gtk::FileChooserButton* new_file_chooser_button(tr_quark const key, Glib::RefPtr<TrCore> const& core)
|
||||
Gtk::FileChooserButton* new_file_chooser_button(tr_quark const key, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
auto* w = Gtk::make_managed<Gtk::FileChooserButton>(Gtk::FILE_CHOOSER_ACTION_OPEN);
|
||||
|
||||
@@ -368,10 +369,10 @@ struct blocklist_data
|
||||
std::unique_ptr<Gtk::MessageDialog> updateBlocklistDialog;
|
||||
Gtk::Label* label = nullptr;
|
||||
Gtk::CheckButton* check = nullptr;
|
||||
Glib::RefPtr<TrCore> core;
|
||||
Glib::RefPtr<Session> core;
|
||||
};
|
||||
|
||||
void updateBlocklistText(Gtk::Label* w, Glib::RefPtr<TrCore> const& core)
|
||||
void updateBlocklistText(Gtk::Label* w, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
int const n = tr_blocklistGetRuleCount(core->get_session());
|
||||
w->set_markup(
|
||||
@@ -396,7 +397,7 @@ void onBlocklistUpdateResponse(std::shared_ptr<blocklist_data> const& data)
|
||||
}
|
||||
|
||||
/* core says the blocklist was updated */
|
||||
void onBlocklistUpdated(Glib::RefPtr<TrCore> const& core, int n, blocklist_data* data)
|
||||
void onBlocklistUpdated(Glib::RefPtr<Session> const& core, int n, blocklist_data* data)
|
||||
{
|
||||
bool const success = n >= 0;
|
||||
int const count = n >= 0 ? n : tr_blocklistGetRuleCount(core->get_session());
|
||||
@@ -432,12 +433,12 @@ void on_blocklist_url_changed(Gtk::Editable* e, Gtk::Button* button)
|
||||
button->set_sensitive(is_url_valid);
|
||||
}
|
||||
|
||||
void onIntComboChanged(Gtk::ComboBox* combo_box, tr_quark const key, Glib::RefPtr<TrCore> const& core)
|
||||
void onIntComboChanged(Gtk::ComboBox* combo_box, tr_quark const key, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
core->set_pref(key, gtr_combo_box_get_active_enum(*combo_box));
|
||||
}
|
||||
|
||||
Gtk::ComboBox* new_encryption_combo(Glib::RefPtr<TrCore> const& core, tr_quark const key)
|
||||
Gtk::ComboBox* new_encryption_combo(Glib::RefPtr<Session> const& core, tr_quark const key)
|
||||
{
|
||||
auto* w = gtr_combo_box_new_enum({
|
||||
{ _("Allow encryption"), TR_CLEAR_PREFERRED },
|
||||
@@ -543,7 +544,7 @@ Glib::RefPtr<Gtk::ListStore> whitelist_tree_model_new(std::string const& whiteli
|
||||
|
||||
struct remote_page
|
||||
{
|
||||
Glib::RefPtr<TrCore> core;
|
||||
Glib::RefPtr<Session> core;
|
||||
Gtk::TreeView* view;
|
||||
Glib::RefPtr<Gtk::ListStore> store;
|
||||
Gtk::Button* remove_button;
|
||||
@@ -760,7 +761,7 @@ void refreshSchedSensitivity(std::shared_ptr<BandwidthPage> const& p)
|
||||
}
|
||||
}
|
||||
|
||||
Gtk::ComboBox* new_time_combo(Glib::RefPtr<TrCore> const& core, tr_quark const key)
|
||||
Gtk::ComboBox* new_time_combo(Glib::RefPtr<Session> const& core, tr_quark const key)
|
||||
{
|
||||
class TimeModelColumns : public Gtk::TreeModelColumnRecord
|
||||
{
|
||||
@@ -806,7 +807,7 @@ Gtk::ComboBox* new_time_combo(Glib::RefPtr<TrCore> const& core, tr_quark const k
|
||||
return w;
|
||||
}
|
||||
|
||||
Gtk::ComboBox* new_week_combo(Glib::RefPtr<TrCore> const& core, tr_quark const key)
|
||||
Gtk::ComboBox* new_week_combo(Glib::RefPtr<Session> const& core, tr_quark const key)
|
||||
{
|
||||
auto* w = gtr_combo_box_new_enum({
|
||||
{ _("Every Day"), TR_SCHED_ALL },
|
||||
@@ -919,7 +920,7 @@ struct network_page_data
|
||||
{
|
||||
~network_page_data();
|
||||
|
||||
Glib::RefPtr<TrCore> core;
|
||||
Glib::RefPtr<Session> core;
|
||||
Gtk::Label* portLabel = nullptr;
|
||||
Gtk::Button* portButton = nullptr;
|
||||
Gtk::SpinButton* portSpin = nullptr;
|
||||
@@ -1074,12 +1075,12 @@ void PrefsDialog::Impl::on_core_prefs_changed(tr_quark const key)
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<PrefsDialog> PrefsDialog::create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
std::unique_ptr<PrefsDialog> PrefsDialog::create(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
return std::unique_ptr<PrefsDialog>(new PrefsDialog(parent, core));
|
||||
}
|
||||
|
||||
PrefsDialog::PrefsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
PrefsDialog::PrefsDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
: Gtk::Dialog(_("Transmission Preferences"), parent)
|
||||
, impl_(std::make_unique<Impl>(*this, core))
|
||||
{
|
||||
@@ -1087,7 +1088,7 @@ PrefsDialog::PrefsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
|
||||
PrefsDialog::~PrefsDialog() = default;
|
||||
|
||||
PrefsDialog::Impl::Impl(PrefsDialog& dialog, Glib::RefPtr<TrCore> const& core)
|
||||
PrefsDialog::Impl::Impl(PrefsDialog& dialog, Glib::RefPtr<Session> const& core)
|
||||
: dialog_(dialog)
|
||||
, core_(core)
|
||||
{
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
class PrefsDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
~PrefsDialog() override;
|
||||
|
||||
static std::unique_ptr<PrefsDialog> create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
static std::unique_ptr<PrefsDialog> create(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
protected:
|
||||
PrefsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
PrefsDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include "conf.h" /* gtr_pref_string_get */
|
||||
#include "hig.h"
|
||||
#include "relocate.h"
|
||||
#include "tr-core.h"
|
||||
#include "util.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "Prefs.h" /* gtr_pref_string_get */
|
||||
#include "RelocateDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -29,7 +29,7 @@ std::string previousLocation;
|
||||
class RelocateDialog::Impl
|
||||
{
|
||||
public:
|
||||
Impl(RelocateDialog& dialog, Glib::RefPtr<TrCore> const& core, std::vector<int> const& torrent_ids);
|
||||
Impl(RelocateDialog& dialog, Glib::RefPtr<Session> const& core, std::vector<int> const& torrent_ids);
|
||||
~Impl();
|
||||
|
||||
private:
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
|
||||
private:
|
||||
RelocateDialog& dialog_;
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
std::vector<int> torrent_ids_;
|
||||
|
||||
int done_ = 0;
|
||||
@@ -135,13 +135,13 @@ void RelocateDialog::Impl::onResponse(int response)
|
||||
|
||||
std::unique_ptr<RelocateDialog> RelocateDialog::create(
|
||||
Gtk::Window& parent,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
std::vector<int> const& torrent_ids)
|
||||
{
|
||||
return std::unique_ptr<RelocateDialog>(new RelocateDialog(parent, core, torrent_ids));
|
||||
}
|
||||
|
||||
RelocateDialog::RelocateDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core, std::vector<int> const& torrent_ids)
|
||||
RelocateDialog::RelocateDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core, std::vector<int> const& torrent_ids)
|
||||
: Gtk::Dialog(_("Set Torrent Location"), parent, true)
|
||||
, impl_(std::make_unique<Impl>(*this, core, torrent_ids))
|
||||
{
|
||||
@@ -149,7 +149,7 @@ RelocateDialog::RelocateDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const&
|
||||
|
||||
RelocateDialog::~RelocateDialog() = default;
|
||||
|
||||
RelocateDialog::Impl::Impl(RelocateDialog& dialog, Glib::RefPtr<TrCore> const& core, std::vector<int> const& torrent_ids)
|
||||
RelocateDialog::Impl::Impl(RelocateDialog& dialog, Glib::RefPtr<Session> const& core, std::vector<int> const& torrent_ids)
|
||||
: dialog_(dialog)
|
||||
, core_(core)
|
||||
, torrent_ids_(torrent_ids)
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
class RelocateDialog : public Gtk::Dialog
|
||||
{
|
||||
@@ -22,11 +22,11 @@ public:
|
||||
|
||||
static std::unique_ptr<RelocateDialog> create(
|
||||
Gtk::Window& parent,
|
||||
Glib::RefPtr<TrCore> const& core,
|
||||
Glib::RefPtr<Session> const& core,
|
||||
std::vector<int> const& torrent_ids);
|
||||
|
||||
protected:
|
||||
RelocateDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core, std::vector<int> const& torrent_ids);
|
||||
RelocateDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core, std::vector<int> const& torrent_ids);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -37,12 +37,12 @@
|
||||
#include <libtransmission/utils.h> /* tr_free */
|
||||
#include <libtransmission/variant.h>
|
||||
|
||||
#include "actions.h"
|
||||
#include "conf.h"
|
||||
#include "notify.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "Actions.h"
|
||||
#include "Notify.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -70,10 +70,10 @@ private:
|
||||
|
||||
} // namespace
|
||||
|
||||
class TrCore::Impl
|
||||
class Session::Impl
|
||||
{
|
||||
public:
|
||||
Impl(TrCore& core, tr_session* session);
|
||||
Impl(Session& core, tr_session* session);
|
||||
|
||||
tr_session* close();
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
sigc::signal<void(bool)> signal_port_tested;
|
||||
|
||||
private:
|
||||
Glib::RefPtr<TrCore> get_core_ptr() const;
|
||||
Glib::RefPtr<Session> get_core_ptr() const;
|
||||
|
||||
bool is_busy();
|
||||
void add_to_busy(int addMe);
|
||||
@@ -141,7 +141,7 @@ private:
|
||||
void on_torrent_metadata_changed(tr_torrent* tor);
|
||||
|
||||
private:
|
||||
TrCore& core_;
|
||||
Session& core_;
|
||||
|
||||
Glib::RefPtr<Gio::FileMonitor> monitor_;
|
||||
sigc::connection monitor_tag_;
|
||||
@@ -182,37 +182,37 @@ TorrentModelColumns::TorrentModelColumns()
|
||||
|
||||
TorrentModelColumns const torrent_cols;
|
||||
|
||||
Glib::RefPtr<TrCore> TrCore::Impl::get_core_ptr() const
|
||||
Glib::RefPtr<Session> Session::Impl::get_core_ptr() const
|
||||
{
|
||||
core_.reference();
|
||||
return Glib::RefPtr<TrCore>(&core_);
|
||||
return Glib::RefPtr<Session>(&core_);
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
Glib::RefPtr<Gtk::ListStore> TrCore::Impl::get_raw_model() const
|
||||
Glib::RefPtr<Gtk::ListStore> Session::Impl::get_raw_model() const
|
||||
{
|
||||
return raw_model_;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gtk::TreeModel> TrCore::get_model() const
|
||||
Glib::RefPtr<Gtk::TreeModel> Session::get_model() const
|
||||
{
|
||||
return impl_->get_model();
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gtk::TreeModelSort> TrCore::Impl::get_model() const
|
||||
Glib::RefPtr<Gtk::TreeModelSort> Session::Impl::get_model() const
|
||||
{
|
||||
return sorted_model_;
|
||||
}
|
||||
|
||||
tr_session* TrCore::get_session() const
|
||||
tr_session* Session::get_session() const
|
||||
{
|
||||
return impl_->get_session();
|
||||
}
|
||||
|
||||
tr_session* TrCore::Impl::get_session() const
|
||||
tr_session* Session::Impl::get_session() const
|
||||
{
|
||||
return session_;
|
||||
}
|
||||
@@ -221,12 +221,12 @@ tr_session* TrCore::Impl::get_session() const
|
||||
**** BUSY
|
||||
***/
|
||||
|
||||
bool TrCore::Impl::is_busy()
|
||||
bool Session::Impl::is_busy()
|
||||
{
|
||||
return busy_count_ > 0;
|
||||
}
|
||||
|
||||
void TrCore::Impl::add_to_busy(int addMe)
|
||||
void Session::Impl::add_to_busy(int addMe)
|
||||
{
|
||||
bool const wasBusy = is_busy();
|
||||
|
||||
@@ -238,12 +238,12 @@ void TrCore::Impl::add_to_busy(int addMe)
|
||||
}
|
||||
}
|
||||
|
||||
void TrCore::Impl::inc_busy()
|
||||
void Session::Impl::inc_busy()
|
||||
{
|
||||
add_to_busy(1);
|
||||
}
|
||||
|
||||
void TrCore::Impl::dec_busy()
|
||||
void Session::Impl::dec_busy()
|
||||
{
|
||||
add_to_busy(-1);
|
||||
}
|
||||
@@ -561,7 +561,7 @@ int compare_by_state(Gtk::TreeModel::iterator const& a, Gtk::TreeModel::iterator
|
||||
|
||||
} // namespace
|
||||
|
||||
void TrCore::Impl::set_sort_mode(std::string const& mode, bool is_reversed)
|
||||
void Session::Impl::set_sort_mode(std::string const& mode, bool is_reversed)
|
||||
{
|
||||
auto const& col = torrent_cols.torrent;
|
||||
Gtk::TreeSortable::SlotCompare sort_func;
|
||||
@@ -647,7 +647,7 @@ void rename_torrent(Glib::RefPtr<Gio::File> const& file)
|
||||
|
||||
} // namespace
|
||||
|
||||
bool TrCore::Impl::watchdir_idle()
|
||||
bool Session::Impl::watchdir_idle()
|
||||
{
|
||||
std::vector<Glib::RefPtr<Gio::File>> changing;
|
||||
std::vector<Glib::RefPtr<Gio::File>> unchanging;
|
||||
@@ -694,7 +694,7 @@ bool TrCore::Impl::watchdir_idle()
|
||||
}
|
||||
|
||||
/* If this file is a torrent, add it to our list */
|
||||
void TrCore::Impl::watchdir_monitor_file(Glib::RefPtr<Gio::File> const& file)
|
||||
void Session::Impl::watchdir_monitor_file(Glib::RefPtr<Gio::File> const& file)
|
||||
{
|
||||
auto const filename = file->get_path();
|
||||
bool const is_torrent = Glib::str_has_suffix(filename, ".torrent");
|
||||
@@ -720,7 +720,7 @@ void TrCore::Impl::watchdir_monitor_file(Glib::RefPtr<Gio::File> const& file)
|
||||
}
|
||||
|
||||
/* GFileMonitor noticed a file was created */
|
||||
void TrCore::Impl::on_file_changed_in_watchdir(
|
||||
void Session::Impl::on_file_changed_in_watchdir(
|
||||
Glib::RefPtr<Gio::File> const& file,
|
||||
Glib::RefPtr<Gio::File> const& /*other_type*/,
|
||||
Gio::FileMonitorEvent event_type)
|
||||
@@ -732,7 +732,7 @@ void TrCore::Impl::on_file_changed_in_watchdir(
|
||||
}
|
||||
|
||||
/* walk through the pre-existing files in the watchdir */
|
||||
void TrCore::Impl::watchdir_scan()
|
||||
void Session::Impl::watchdir_scan()
|
||||
{
|
||||
auto const dirname = gtr_pref_string_get(TR_KEY_watch_dir);
|
||||
|
||||
@@ -748,7 +748,7 @@ void TrCore::Impl::watchdir_scan()
|
||||
}
|
||||
}
|
||||
|
||||
void TrCore::Impl::watchdir_update()
|
||||
void Session::Impl::watchdir_update()
|
||||
{
|
||||
bool const is_enabled = gtr_pref_flag_get(TR_KEY_watch_dir_enabled);
|
||||
auto const dir = Gio::File::create_for_path(gtr_pref_string_get(TR_KEY_watch_dir));
|
||||
@@ -777,7 +777,7 @@ void TrCore::Impl::watchdir_update()
|
||||
****
|
||||
***/
|
||||
|
||||
void TrCore::Impl::on_pref_changed(tr_quark const key)
|
||||
void Session::Impl::on_pref_changed(tr_quark const key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
@@ -816,20 +816,20 @@ void TrCore::Impl::on_pref_changed(tr_quark const key)
|
||||
***
|
||||
**/
|
||||
|
||||
Glib::RefPtr<TrCore> TrCore::create(tr_session* session)
|
||||
Glib::RefPtr<Session> Session::create(tr_session* session)
|
||||
{
|
||||
return Glib::make_refptr_for_instance(new TrCore(session));
|
||||
return Glib::make_refptr_for_instance(new Session(session));
|
||||
}
|
||||
|
||||
TrCore::TrCore(tr_session* session)
|
||||
: Glib::ObjectBase(typeid(TrCore))
|
||||
Session::Session(tr_session* session)
|
||||
: Glib::ObjectBase(typeid(Session))
|
||||
, impl_(std::make_unique<Impl>(*this, session))
|
||||
{
|
||||
}
|
||||
|
||||
TrCore::~TrCore() = default;
|
||||
Session::~Session() = default;
|
||||
|
||||
TrCore::Impl::Impl(TrCore& core, tr_session* session)
|
||||
Session::Impl::Impl(Session& core, tr_session* session)
|
||||
: core_(core)
|
||||
, session_(session)
|
||||
{
|
||||
@@ -847,12 +847,12 @@ TrCore::Impl::Impl(TrCore& core, tr_session* session)
|
||||
signal_prefs_changed.connect([this](auto key) { on_pref_changed(key); });
|
||||
}
|
||||
|
||||
tr_session* TrCore::close()
|
||||
tr_session* Session::close()
|
||||
{
|
||||
return impl_->close();
|
||||
}
|
||||
|
||||
tr_session* TrCore::Impl::close()
|
||||
tr_session* Session::Impl::close()
|
||||
{
|
||||
auto* session = session_;
|
||||
|
||||
@@ -871,7 +871,7 @@ tr_session* TrCore::Impl::close()
|
||||
|
||||
/* this is called in the libtransmission thread, *NOT* the GTK+ thread,
|
||||
so delegate to the GTK+ thread before calling notify's dbus code... */
|
||||
void TrCore::Impl::on_torrent_completeness_changed(tr_torrent* tor, tr_completeness completeness, bool was_running)
|
||||
void Session::Impl::on_torrent_completeness_changed(tr_torrent* tor, tr_completeness completeness, bool was_running)
|
||||
{
|
||||
if (was_running && completeness != TR_LEECH && tr_torrentStat(tor)->sizeWhenDone != 0)
|
||||
{
|
||||
@@ -899,7 +899,7 @@ Glib::ustring get_collated_name(tr_torrent const* tor)
|
||||
|
||||
struct metadata_callback_data
|
||||
{
|
||||
TrCore* core;
|
||||
Session* core;
|
||||
int torrent_id;
|
||||
};
|
||||
|
||||
@@ -920,7 +920,7 @@ Gtk::TreeModel::iterator find_row_from_torrent_id(Glib::RefPtr<Gtk::TreeModel> c
|
||||
|
||||
/* this is called in the libtransmission thread, *NOT* the GTK+ thread,
|
||||
so delegate to the GTK+ thread before changing our list store... */
|
||||
void TrCore::Impl::on_torrent_metadata_changed(tr_torrent* tor)
|
||||
void Session::Impl::on_torrent_metadata_changed(tr_torrent* tor)
|
||||
{
|
||||
Glib::signal_idle().connect(
|
||||
[this, core = get_core_ptr(), torrent_id = tr_torrentId(tor)]()
|
||||
@@ -972,13 +972,13 @@ bool is_torrent_active(tr_stat const* st)
|
||||
|
||||
} // namespace
|
||||
|
||||
void TrCore::add_torrent(tr_torrent* tor, bool do_notify)
|
||||
void Session::add_torrent(tr_torrent* tor, bool do_notify)
|
||||
{
|
||||
ScopedModelSortBlocker disable_sort(*gtr_get_ptr(impl_->get_model()));
|
||||
impl_->add_torrent(tor, do_notify);
|
||||
}
|
||||
|
||||
void TrCore::Impl::add_torrent(tr_torrent* tor, bool do_notify)
|
||||
void Session::Impl::add_torrent(tr_torrent* tor, bool do_notify)
|
||||
{
|
||||
if (tor != nullptr)
|
||||
{
|
||||
@@ -1020,7 +1020,7 @@ void TrCore::Impl::add_torrent(tr_torrent* tor, bool do_notify)
|
||||
}
|
||||
}
|
||||
|
||||
tr_torrent* TrCore::Impl::create_new_torrent(tr_ctor* ctor)
|
||||
tr_torrent* Session::Impl::create_new_torrent(tr_ctor* ctor)
|
||||
{
|
||||
bool do_trash = false;
|
||||
|
||||
@@ -1050,7 +1050,7 @@ tr_torrent* TrCore::Impl::create_new_torrent(tr_ctor* ctor)
|
||||
return tor;
|
||||
}
|
||||
|
||||
int TrCore::Impl::add_ctor(tr_ctor* ctor, bool do_prompt, bool do_notify)
|
||||
int Session::Impl::add_ctor(tr_ctor* ctor, bool do_prompt, bool do_notify)
|
||||
{
|
||||
tr_info inf;
|
||||
auto err = tr_torrentParse(ctor, &inf);
|
||||
@@ -1120,7 +1120,7 @@ void core_apply_defaults(tr_ctor* ctor)
|
||||
|
||||
} // namespace
|
||||
|
||||
void TrCore::add_ctor(tr_ctor* ctor)
|
||||
void Session::add_ctor(tr_ctor* ctor)
|
||||
{
|
||||
bool const do_notify = false;
|
||||
bool const do_prompt = gtr_pref_flag_get(TR_KEY_show_options_window);
|
||||
@@ -1132,7 +1132,7 @@ void TrCore::add_ctor(tr_ctor* ctor)
|
||||
****
|
||||
***/
|
||||
|
||||
void TrCore::Impl::add_file_async_callback(
|
||||
void Session::Impl::add_file_async_callback(
|
||||
Glib::RefPtr<Gio::File> const& file,
|
||||
Glib::RefPtr<Gio::AsyncResult>& result,
|
||||
tr_ctor* ctor,
|
||||
@@ -1165,7 +1165,7 @@ void TrCore::Impl::add_file_async_callback(
|
||||
dec_busy();
|
||||
}
|
||||
|
||||
bool TrCore::Impl::add_file(Glib::RefPtr<Gio::File> const& file, bool do_start, bool do_prompt, bool do_notify)
|
||||
bool Session::Impl::add_file(Glib::RefPtr<Gio::File> const& file, bool do_start, bool do_prompt, bool do_notify)
|
||||
{
|
||||
bool handled = false;
|
||||
auto const* const session = get_session();
|
||||
@@ -1236,12 +1236,12 @@ bool TrCore::Impl::add_file(Glib::RefPtr<Gio::File> const& file, bool do_start,
|
||||
return handled;
|
||||
}
|
||||
|
||||
bool TrCore::add_from_url(Glib::ustring const& uri)
|
||||
bool Session::add_from_url(Glib::ustring const& uri)
|
||||
{
|
||||
return impl_->add_from_url(uri);
|
||||
}
|
||||
|
||||
bool TrCore::Impl::add_from_url(Glib::ustring const& uri)
|
||||
bool Session::Impl::add_from_url(Glib::ustring const& uri)
|
||||
{
|
||||
bool handled;
|
||||
bool const do_start = gtr_pref_flag_get(TR_KEY_start_added_torrents);
|
||||
@@ -1255,12 +1255,12 @@ bool TrCore::Impl::add_from_url(Glib::ustring const& uri)
|
||||
return handled;
|
||||
}
|
||||
|
||||
void TrCore::add_files(std::vector<Glib::RefPtr<Gio::File>> const& files, bool do_start, bool do_prompt, bool do_notify)
|
||||
void Session::add_files(std::vector<Glib::RefPtr<Gio::File>> const& files, bool do_start, bool do_prompt, bool do_notify)
|
||||
{
|
||||
impl_->add_files(files, do_start, do_prompt, do_notify);
|
||||
}
|
||||
|
||||
void TrCore::Impl::add_files(std::vector<Glib::RefPtr<Gio::File>> const& files, bool do_start, bool do_prompt, bool do_notify)
|
||||
void Session::Impl::add_files(std::vector<Glib::RefPtr<Gio::File>> const& files, bool do_start, bool do_prompt, bool do_notify)
|
||||
{
|
||||
for (auto const& file : files)
|
||||
{
|
||||
@@ -1270,18 +1270,18 @@ void TrCore::Impl::add_files(std::vector<Glib::RefPtr<Gio::File>> const& files,
|
||||
torrents_added();
|
||||
}
|
||||
|
||||
void TrCore::torrents_added()
|
||||
void Session::torrents_added()
|
||||
{
|
||||
impl_->torrents_added();
|
||||
}
|
||||
|
||||
void TrCore::Impl::torrents_added()
|
||||
void Session::Impl::torrents_added()
|
||||
{
|
||||
update();
|
||||
signal_add_error.emit(ERR_NO_MORE_TORRENTS, {});
|
||||
}
|
||||
|
||||
void TrCore::torrent_changed(int id)
|
||||
void Session::torrent_changed(int id)
|
||||
{
|
||||
auto const model = impl_->get_raw_model();
|
||||
|
||||
@@ -1291,7 +1291,7 @@ void TrCore::torrent_changed(int id)
|
||||
}
|
||||
}
|
||||
|
||||
void TrCore::remove_torrent(int id, bool delete_local_data)
|
||||
void Session::remove_torrent(int id, bool delete_local_data)
|
||||
{
|
||||
auto* tor = find_torrent(id);
|
||||
|
||||
@@ -1313,7 +1313,7 @@ void TrCore::remove_torrent(int id, bool delete_local_data)
|
||||
}
|
||||
}
|
||||
|
||||
void TrCore::load(bool forcePaused)
|
||||
void Session::load(bool forcePaused)
|
||||
{
|
||||
tr_ctor* ctor;
|
||||
tr_torrent** torrents;
|
||||
@@ -1341,7 +1341,7 @@ void TrCore::load(bool forcePaused)
|
||||
tr_ctorFree(ctor);
|
||||
}
|
||||
|
||||
void TrCore::clear()
|
||||
void Session::clear()
|
||||
{
|
||||
impl_->get_raw_model()->clear();
|
||||
}
|
||||
@@ -1436,12 +1436,12 @@ void update_foreach(Gtk::TreeModel::Row const& row)
|
||||
|
||||
} // namespace
|
||||
|
||||
void TrCore::update()
|
||||
void Session::update()
|
||||
{
|
||||
impl_->update();
|
||||
}
|
||||
|
||||
void TrCore::Impl::update()
|
||||
void Session::Impl::update()
|
||||
{
|
||||
/* update the model */
|
||||
for (auto const& row : raw_model_->children())
|
||||
@@ -1529,7 +1529,7 @@ void gtr_uninhibit_hibernation(guint inhibit_cookie)
|
||||
|
||||
} // namespace
|
||||
|
||||
void TrCore::Impl::set_hibernation_allowed(bool allowed)
|
||||
void Session::Impl::set_hibernation_allowed(bool allowed)
|
||||
{
|
||||
inhibit_allowed_ = allowed;
|
||||
|
||||
@@ -1552,7 +1552,7 @@ void TrCore::Impl::set_hibernation_allowed(bool allowed)
|
||||
}
|
||||
}
|
||||
|
||||
void TrCore::Impl::maybe_inhibit_hibernation()
|
||||
void Session::Impl::maybe_inhibit_hibernation()
|
||||
{
|
||||
/* hibernation is allowed if EITHER
|
||||
* (a) the "inhibit" pref is turned off OR
|
||||
@@ -1565,13 +1565,13 @@ void TrCore::Impl::maybe_inhibit_hibernation()
|
||||
*** Prefs
|
||||
**/
|
||||
|
||||
void TrCore::Impl::commit_prefs_change(tr_quark const key)
|
||||
void Session::Impl::commit_prefs_change(tr_quark const key)
|
||||
{
|
||||
signal_prefs_changed.emit(key);
|
||||
gtr_pref_save(session_);
|
||||
}
|
||||
|
||||
void TrCore::set_pref(tr_quark const key, std::string const& newval)
|
||||
void Session::set_pref(tr_quark const key, std::string const& newval)
|
||||
{
|
||||
if (newval != gtr_pref_string_get(key))
|
||||
{
|
||||
@@ -1580,7 +1580,7 @@ void TrCore::set_pref(tr_quark const key, std::string const& newval)
|
||||
}
|
||||
}
|
||||
|
||||
void TrCore::set_pref(tr_quark const key, bool newval)
|
||||
void Session::set_pref(tr_quark const key, bool newval)
|
||||
{
|
||||
if (newval != gtr_pref_flag_get(key))
|
||||
{
|
||||
@@ -1589,7 +1589,7 @@ void TrCore::set_pref(tr_quark const key, bool newval)
|
||||
}
|
||||
}
|
||||
|
||||
void TrCore::set_pref(tr_quark const key, int newval)
|
||||
void Session::set_pref(tr_quark const key, int newval)
|
||||
{
|
||||
if (newval != gtr_pref_int_get(key))
|
||||
{
|
||||
@@ -1598,7 +1598,7 @@ void TrCore::set_pref(tr_quark const key, int newval)
|
||||
}
|
||||
}
|
||||
|
||||
void TrCore::set_pref(tr_quark const key, double newval)
|
||||
void Session::set_pref(tr_quark const key, double newval)
|
||||
{
|
||||
if (gtr_compare_double(newval, gtr_pref_double_get(key), 4))
|
||||
{
|
||||
@@ -1620,7 +1620,7 @@ namespace
|
||||
|
||||
int nextTag = 1;
|
||||
|
||||
typedef void (*server_response_func)(TrCore* core, tr_variant* response, gpointer user_data);
|
||||
typedef void (*server_response_func)(Session* core, tr_variant* response, gpointer user_data);
|
||||
|
||||
struct pending_request_data
|
||||
{
|
||||
@@ -1666,7 +1666,7 @@ void core_read_rpc_response(tr_session* /*session*/, tr_variant* response, void*
|
||||
|
||||
} // namespace
|
||||
|
||||
void TrCore::Impl::send_rpc_request(tr_variant const* request, int tag, std::function<void(tr_variant*)> const& response_func)
|
||||
void Session::Impl::send_rpc_request(tr_variant const* request, int tag, std::function<void(tr_variant*)> const& response_func)
|
||||
{
|
||||
if (session_ == nullptr)
|
||||
{
|
||||
@@ -1698,7 +1698,7 @@ void TrCore::Impl::send_rpc_request(tr_variant const* request, int tag, std::fun
|
||||
**** Sending a test-port request via RPC
|
||||
***/
|
||||
|
||||
void TrCore::port_test()
|
||||
void Session::port_test()
|
||||
{
|
||||
int const tag = nextTag;
|
||||
++nextTag;
|
||||
@@ -1730,7 +1730,7 @@ void TrCore::port_test()
|
||||
**** Updating a blocklist via RPC
|
||||
***/
|
||||
|
||||
void TrCore::blocklist_update()
|
||||
void Session::blocklist_update()
|
||||
{
|
||||
int const tag = nextTag;
|
||||
++nextTag;
|
||||
@@ -1767,7 +1767,7 @@ void TrCore::blocklist_update()
|
||||
****
|
||||
***/
|
||||
|
||||
void TrCore::exec(tr_variant const* top)
|
||||
void Session::exec(tr_variant const* top)
|
||||
{
|
||||
int const tag = nextTag;
|
||||
++nextTag;
|
||||
@@ -1779,17 +1779,17 @@ void TrCore::exec(tr_variant const* top)
|
||||
****
|
||||
***/
|
||||
|
||||
size_t TrCore::get_torrent_count() const
|
||||
size_t Session::get_torrent_count() const
|
||||
{
|
||||
return impl_->get_raw_model()->children().size();
|
||||
}
|
||||
|
||||
size_t TrCore::get_active_torrent_count() const
|
||||
size_t Session::get_active_torrent_count() const
|
||||
{
|
||||
return impl_->get_active_torrent_count();
|
||||
}
|
||||
|
||||
size_t TrCore::Impl::get_active_torrent_count() const
|
||||
size_t Session::Impl::get_active_torrent_count() const
|
||||
{
|
||||
size_t activeCount = 0;
|
||||
|
||||
@@ -1804,7 +1804,7 @@ size_t TrCore::Impl::get_active_torrent_count() const
|
||||
return activeCount;
|
||||
}
|
||||
|
||||
tr_torrent* TrCore::find_torrent(int id) const
|
||||
tr_torrent* Session::find_torrent(int id) const
|
||||
{
|
||||
tr_torrent* tor = nullptr;
|
||||
|
||||
@@ -1816,7 +1816,7 @@ tr_torrent* TrCore::find_torrent(int id) const
|
||||
return tor;
|
||||
}
|
||||
|
||||
void TrCore::open_folder(int torrent_id)
|
||||
void Session::open_folder(int torrent_id)
|
||||
{
|
||||
auto const* tor = find_torrent(torrent_id);
|
||||
|
||||
@@ -1836,32 +1836,32 @@ void TrCore::open_folder(int torrent_id)
|
||||
}
|
||||
}
|
||||
|
||||
sigc::signal<void(TrCore::ErrorCode, Glib::ustring const&)>& TrCore::signal_add_error()
|
||||
sigc::signal<void(Session::ErrorCode, Glib::ustring const&)>& Session::signal_add_error()
|
||||
{
|
||||
return impl_->signal_add_error;
|
||||
}
|
||||
|
||||
sigc::signal<void(tr_ctor*)>& TrCore::signal_add_prompt()
|
||||
sigc::signal<void(tr_ctor*)>& Session::signal_add_prompt()
|
||||
{
|
||||
return impl_->signal_add_prompt;
|
||||
}
|
||||
|
||||
sigc::signal<void(int)>& TrCore::signal_blocklist_updated()
|
||||
sigc::signal<void(int)>& Session::signal_blocklist_updated()
|
||||
{
|
||||
return impl_->signal_blocklist_updated;
|
||||
}
|
||||
|
||||
sigc::signal<void(bool)>& TrCore::signal_busy()
|
||||
sigc::signal<void(bool)>& Session::signal_busy()
|
||||
{
|
||||
return impl_->signal_busy;
|
||||
}
|
||||
|
||||
sigc::signal<void(tr_quark)>& TrCore::signal_prefs_changed()
|
||||
sigc::signal<void(tr_quark)>& Session::signal_prefs_changed()
|
||||
{
|
||||
return impl_->signal_prefs_changed;
|
||||
}
|
||||
|
||||
sigc::signal<void(bool)>& TrCore::signal_port_tested()
|
||||
sigc::signal<void(bool)>& Session::signal_port_tested()
|
||||
{
|
||||
return impl_->signal_port_tested;
|
||||
}
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#define TR_RESOURCE_PATH "/com/transmissionbt/transmission/"
|
||||
|
||||
class TrCore : public Glib::Object
|
||||
class Session : public Glib::Object
|
||||
{
|
||||
public:
|
||||
enum ErrorCode
|
||||
@@ -45,9 +45,9 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
~TrCore() override;
|
||||
~Session() override;
|
||||
|
||||
static Glib::RefPtr<TrCore> create(tr_session* session);
|
||||
static Glib::RefPtr<Session> create(tr_session* session);
|
||||
|
||||
tr_session* close();
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
sigc::signal<void(bool)>& signal_port_tested();
|
||||
|
||||
protected:
|
||||
TrCore(tr_session* session);
|
||||
Session(tr_session* session);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -9,11 +9,11 @@
|
||||
#include <glibmm.h>
|
||||
#include <glibmm/i18n.h>
|
||||
|
||||
#include "hig.h"
|
||||
#include "stats.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "StatsDialog.h"
|
||||
#include "Utils.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -23,7 +23,7 @@ enum
|
||||
class StatsDialog::Impl
|
||||
{
|
||||
public:
|
||||
Impl(StatsDialog& dialog, Glib::RefPtr<TrCore> const& core);
|
||||
Impl(StatsDialog& dialog, Glib::RefPtr<Session> const& core);
|
||||
~Impl();
|
||||
|
||||
private:
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
|
||||
private:
|
||||
StatsDialog& dialog_;
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
|
||||
Gtk::Label* one_up_lb_;
|
||||
Gtk::Label* one_down_lb_;
|
||||
@@ -118,12 +118,12 @@ void StatsDialog::Impl::dialogResponse(int response)
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<StatsDialog> StatsDialog::create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
std::unique_ptr<StatsDialog> StatsDialog::create(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
{
|
||||
return std::unique_ptr<StatsDialog>(new StatsDialog(parent, core));
|
||||
}
|
||||
|
||||
StatsDialog::StatsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
StatsDialog::StatsDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
||||
: Gtk::Dialog(_("Statistics"), parent)
|
||||
, impl_(std::make_unique<Impl>(*this, core))
|
||||
{
|
||||
@@ -131,7 +131,7 @@ StatsDialog::StatsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core)
|
||||
|
||||
StatsDialog::~StatsDialog() = default;
|
||||
|
||||
StatsDialog::Impl::Impl(StatsDialog& dialog, Glib::RefPtr<TrCore> const& core)
|
||||
StatsDialog::Impl::Impl(StatsDialog& dialog, Glib::RefPtr<Session> const& core)
|
||||
: dialog_(dialog)
|
||||
, core_(core)
|
||||
{
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class TrCore;
|
||||
class Session;
|
||||
|
||||
class StatsDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
~StatsDialog() override;
|
||||
|
||||
static std::unique_ptr<StatsDialog> create(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
static std::unique_ptr<StatsDialog> create(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
protected:
|
||||
StatsDialog(Gtk::Window& parent, Glib::RefPtr<TrCore> const& core);
|
||||
StatsDialog(Gtk::Window& parent, Glib::RefPtr<Session> const& core);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
@@ -17,17 +17,17 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "actions.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-icon.h"
|
||||
#include "util.h"
|
||||
#include "Actions.h"
|
||||
#include "Session.h"
|
||||
#include "SystemTrayIcon.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define ICON_NAME "transmission"
|
||||
|
||||
class SystemTrayIcon::Impl
|
||||
{
|
||||
public:
|
||||
Impl(Glib::RefPtr<TrCore> const& core);
|
||||
Impl(Glib::RefPtr<Session> const& core);
|
||||
~Impl();
|
||||
|
||||
void refresh();
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
void popup(guint button, guint when);
|
||||
|
||||
private:
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
Glib::RefPtr<Session> const core_;
|
||||
|
||||
Gtk::Menu* menu_;
|
||||
|
||||
@@ -167,7 +167,7 @@ std::string getIconName()
|
||||
|
||||
} // namespace
|
||||
|
||||
SystemTrayIcon::SystemTrayIcon(Glib::RefPtr<TrCore> const& core)
|
||||
SystemTrayIcon::SystemTrayIcon(Glib::RefPtr<Session> const& core)
|
||||
: impl_(std::make_unique<Impl>(core))
|
||||
{
|
||||
}
|
||||
@@ -179,7 +179,7 @@ void SystemTrayIcon::refresh()
|
||||
impl_->refresh();
|
||||
}
|
||||
|
||||
SystemTrayIcon::Impl::Impl(Glib::RefPtr<TrCore> const& core)
|
||||
SystemTrayIcon::Impl::Impl(Glib::RefPtr<Session> const& core)
|
||||
: core_(core)
|
||||
{
|
||||
auto const icon_name = getIconName();
|
||||
@@ -10,10 +10,12 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
class Session;
|
||||
|
||||
class SystemTrayIcon
|
||||
{
|
||||
public:
|
||||
SystemTrayIcon(Glib::RefPtr<TrCore> const& core);
|
||||
SystemTrayIcon(Glib::RefPtr<Session> const& core);
|
||||
~SystemTrayIcon();
|
||||
|
||||
void refresh();
|
||||
@@ -14,10 +14,10 @@
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h> /* tr_truncd() */
|
||||
|
||||
#include "hig.h"
|
||||
#include "icons.h"
|
||||
#include "torrent-cell-renderer.h"
|
||||
#include "util.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "IconCache.h"
|
||||
#include "TorrentCellRenderer.h"
|
||||
#include "Utils.h"
|
||||
|
||||
/* #define TEST_RTL */
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
#include <libtransmission/web.h> /* tr_webResponseStr() */
|
||||
#include <libtransmission/version.h> /* SHORT_VERSION_STRING */
|
||||
|
||||
#include "conf.h"
|
||||
#include "hig.h"
|
||||
#include "tr-core.h"
|
||||
#include "tr-prefs.h"
|
||||
#include "util.h"
|
||||
#include "HigWorkarea.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
/***
|
||||
**** UNITS
|
||||
@@ -574,74 +574,3 @@ void gtr_label_set_text(Gtk::Label& lb, Glib::ustring const& newstr)
|
||||
lb.set_text(newstr);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
class FreeSpaceLabel::Impl
|
||||
{
|
||||
public:
|
||||
Impl(FreeSpaceLabel& label, Glib::RefPtr<TrCore> const& core, std::string const& dir);
|
||||
~Impl();
|
||||
|
||||
void set_dir(std::string const& dir);
|
||||
|
||||
private:
|
||||
bool on_freespace_timer();
|
||||
|
||||
private:
|
||||
FreeSpaceLabel& label_;
|
||||
Glib::RefPtr<TrCore> const core_;
|
||||
std::string dir_;
|
||||
sigc::connection timer_id_;
|
||||
};
|
||||
|
||||
FreeSpaceLabel::Impl::~Impl()
|
||||
{
|
||||
timer_id_.disconnect();
|
||||
}
|
||||
|
||||
bool FreeSpaceLabel::Impl::on_freespace_timer()
|
||||
{
|
||||
auto* const session = core_->get_session();
|
||||
if (session == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto const bytes = tr_sessionGetDirFreeSpace(session, dir_.c_str());
|
||||
auto const text = bytes < 0 ? _("Error") : gtr_sprintf(_("%s free"), tr_strlsize(bytes));
|
||||
auto const markup = gtr_sprintf("<i>%s</i>", text);
|
||||
label_.set_markup(markup);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FreeSpaceLabel::FreeSpaceLabel(Glib::RefPtr<TrCore> const& core, std::string const& dir)
|
||||
: Gtk::Label()
|
||||
, impl_(std::make_unique<Impl>(*this, core, dir))
|
||||
{
|
||||
}
|
||||
|
||||
FreeSpaceLabel::~FreeSpaceLabel() = default;
|
||||
|
||||
FreeSpaceLabel::Impl::Impl(FreeSpaceLabel& label, Glib::RefPtr<TrCore> const& core, std::string const& dir)
|
||||
: label_(label)
|
||||
, core_(core)
|
||||
, dir_(dir)
|
||||
{
|
||||
timer_id_ = Glib::signal_timeout().connect_seconds(sigc::mem_fun(this, &Impl::on_freespace_timer), 3);
|
||||
on_freespace_timer();
|
||||
}
|
||||
|
||||
void FreeSpaceLabel::set_dir(std::string const& dir)
|
||||
{
|
||||
impl_->set_dir(dir);
|
||||
}
|
||||
|
||||
void FreeSpaceLabel::Impl::set_dir(std::string const& dir)
|
||||
{
|
||||
dir_ = dir;
|
||||
on_freespace_timer();
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <glibmm.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
@@ -102,25 +103,6 @@ void gtr_combo_box_set_active_enum(Gtk::ComboBox&, int value);
|
||||
****
|
||||
***/
|
||||
|
||||
class TrCore;
|
||||
|
||||
class FreeSpaceLabel : public Gtk::Label
|
||||
{
|
||||
public:
|
||||
FreeSpaceLabel(Glib::RefPtr<TrCore> const& core, std::string const& dir = {});
|
||||
~FreeSpaceLabel() override;
|
||||
|
||||
void set_dir(std::string const& dir);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> const impl_;
|
||||
};
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
void gtr_unrecognized_url_dialog(Gtk::Widget& parent, Glib::ustring const& url);
|
||||
|
||||
void gtr_add_torrent_error_dialog(
|
||||
@@ -30,10 +30,10 @@
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/version.h>
|
||||
|
||||
#include "application.h"
|
||||
#include "conf.h"
|
||||
#include "notify.h"
|
||||
#include "util.h"
|
||||
#include "Application.h"
|
||||
#include "Notify.h"
|
||||
#include "Prefs.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define MY_CONFIG_NAME "transmission"
|
||||
#define MY_READABLE_NAME "transmission-gtk"
|
||||
|
||||
Reference in New Issue
Block a user