mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-26 13:55:34 +00:00
Removed AODC feature, it's been deprecated for a while.
This commit is contained in:
+3
-3
@@ -1,9 +1,9 @@
|
||||
# expected
|
||||
Single header implementation of `std::expected` with functional-style extensions.
|
||||
|
||||
[](https://tl.tartanllama.xyz/en/latest/?badge=latest)
|
||||
Clang + GCC: [](https://github.com/TartanLlama/expected/actions/workflows/cmake.yml)
|
||||
MSVC: [](https://ci.appveyor.com/project/TartanLlama/expected)
|
||||
[](https://tl.tartanllama.xyz/en/latest/?badge=latest)
|
||||
Clang + GCC: [](https://github.com/TartanLlama/expected/actions/workflows/cmake.yml)
|
||||
MSVC: [](https://ci.appveyor.com/project/TartanLlama/expected)
|
||||
|
||||
Available on [Vcpkg](https://github.com/microsoft/vcpkg/tree/master/ports/tl-expected) and [Conan](https://github.com/yipdw/conan-tl-expected).
|
||||
|
||||
|
||||
@@ -33,10 +33,6 @@ msgstr "Řada modelu:"
|
||||
msgid "enable smart (action-replaced text)"
|
||||
msgstr "Zapnout SMART"
|
||||
|
||||
#: src/ui/gsc_main_window.glade:209
|
||||
msgid "enable aodc (action-replaced text)"
|
||||
msgstr "Zapnout AODC"
|
||||
|
||||
#: src/ui/gsc_add_device_window.glade:29
|
||||
msgid "Add Device - GSmartControl"
|
||||
msgstr "Přidat zařízení - GSmartControl"
|
||||
|
||||
@@ -67,10 +67,6 @@ Information not printed in JSON yet:
|
||||
_text_only/write_cache_reorder
|
||||
_text_only/power_mode
|
||||
|
||||
- Automatic Offline Data Collection toggle support
|
||||
FIXME Already filed a bug report with smartmontools.
|
||||
_text_only/aodc_support
|
||||
|
||||
- Directory log supported
|
||||
We don't use this.
|
||||
_text_only/directory_log_supported
|
||||
|
||||
@@ -40,13 +40,12 @@ Copyright:
|
||||
|
||||
|
||||
|
||||
std::string StorageDevice::get_status_displayable_name(Status status)
|
||||
std::string StorageDevice::get_status_displayable_name(SmartStatus status)
|
||||
{
|
||||
static const std::unordered_map<Status, std::string> m {
|
||||
{Status::Enabled, C_("status", "Enabled")},
|
||||
{Status::Disabled, C_("status", "Disabled")},
|
||||
{Status::Unsupported, C_("status", "Unsupported")},
|
||||
{Status::Unknown, C_("status", "Unknown")},
|
||||
static const std::unordered_map<SmartStatus, std::string> m {
|
||||
{SmartStatus::Enabled, C_("status", "Enabled")},
|
||||
{SmartStatus::Disabled, C_("status", "Disabled")},
|
||||
{SmartStatus::Unsupported, C_("status", "Unsupported")},
|
||||
};
|
||||
if (auto iter = m.find(status); iter != m.end()) {
|
||||
return iter->second;
|
||||
@@ -92,7 +91,6 @@ void StorageDevice::clear_parse_results()
|
||||
smart_supported_.reset();
|
||||
smart_enabled_.reset();
|
||||
model_name_.reset();
|
||||
aodc_status_.reset();
|
||||
family_name_.reset();
|
||||
size_.reset();
|
||||
health_property_.reset();
|
||||
@@ -146,7 +144,7 @@ hz::ExpectedVoid<StorageDeviceError> StorageDevice::fetch_basic_data_and_parse(
|
||||
// return execute_status;
|
||||
// }
|
||||
|
||||
// Set some properties too - they are needed for e.g. AODC status, etc.
|
||||
// Set some properties too - they are needed for e.g. SMART on/off support, etc.
|
||||
return this->parse_basic_data();
|
||||
}
|
||||
|
||||
@@ -524,42 +522,6 @@ A mandatory SMART command failed: exiting. To continue, add one or more '-T perm
|
||||
|
||||
|
||||
|
||||
hz::ExpectedVoid<StorageDeviceError> StorageDevice::set_aodc_enabled(bool b, const std::shared_ptr<CommandExecutor>& smartctl_ex)
|
||||
{
|
||||
if (this->test_is_active_) {
|
||||
return hz::Unexpected(StorageDeviceError::TestRunning, _("A test is currently being performed on this drive."));
|
||||
}
|
||||
|
||||
// execute smartctl --offlineauto=on|off /dev/...
|
||||
// Output:
|
||||
/*
|
||||
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
|
||||
SMART Automatic Offline Testing Enabled every four hours.
|
||||
--------------------------- OR ---------------------------
|
||||
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
|
||||
SMART Automatic Offline Testing Disabled.
|
||||
--------------------------- OR ---------------------------
|
||||
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
|
||||
*/
|
||||
std::string output;
|
||||
auto status = execute_device_smartctl((b ? "--offlineauto=on" : "--offlineauto=off"), smartctl_ex, output);
|
||||
if (!status) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (app_pcre_match("/Testing Enabled/mi", output) || app_pcre_match("/Testing Disabled/mi", output)) {
|
||||
return {}; // success
|
||||
}
|
||||
|
||||
if (app_pcre_match("/^A mandatory SMART command failed/mi", output)) {
|
||||
return hz::Unexpected(StorageDeviceError::CommandFailed, _("Mandatory SMART command failed."));
|
||||
}
|
||||
|
||||
return hz::Unexpected(StorageDeviceError::CommandUnknownError, _("Unknown error occurred."));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void StorageDevice::read_common_properties()
|
||||
{
|
||||
if (auto prop = property_repository_.lookup_property("smart_support/available"); !prop.empty()) {
|
||||
@@ -648,32 +610,32 @@ void StorageDevice::detect_drive_type_from_properties(const StoragePropertyRepos
|
||||
|
||||
|
||||
|
||||
StorageDevice::Status StorageDevice::get_smart_status() const
|
||||
StorageDevice::SmartStatus StorageDevice::get_smart_status() const
|
||||
{
|
||||
Status status = Status::Unsupported;
|
||||
SmartStatus status = SmartStatus::Unsupported;
|
||||
if (smart_enabled_.has_value()) {
|
||||
if (smart_enabled_.value()) { // enabled, supported
|
||||
status = Status::Enabled;
|
||||
status = SmartStatus::Enabled;
|
||||
} else { // if it's disabled, maybe it's unsupported, check that:
|
||||
if (smart_supported_.has_value()) {
|
||||
if (smart_supported_.value()) { // disabled, supported
|
||||
status = Status::Disabled;
|
||||
status = SmartStatus::Disabled;
|
||||
} else { // disabled, unsupported
|
||||
status = Status::Unsupported;
|
||||
status = SmartStatus::Unsupported;
|
||||
}
|
||||
} else { // disabled, support unknown
|
||||
status = Status::Disabled;
|
||||
status = SmartStatus::Disabled;
|
||||
}
|
||||
}
|
||||
} else { // status unknown
|
||||
if (smart_supported_.has_value()) {
|
||||
if (smart_supported_.value()) { // status unknown, supported
|
||||
status = Status::Disabled; // at least give the user a chance to try enabling it
|
||||
status = SmartStatus::Disabled; // at least give the user a chance to try enabling it
|
||||
} else { // status unknown, unsupported
|
||||
status = Status::Unsupported; // most likely
|
||||
status = SmartStatus::Unsupported; // most likely
|
||||
}
|
||||
} else { // status unknown, support unknown
|
||||
status = Status::Unsupported;
|
||||
status = SmartStatus::Unsupported;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
@@ -683,7 +645,7 @@ StorageDevice::Status StorageDevice::get_smart_status() const
|
||||
|
||||
bool StorageDevice::get_smart_switch_supported() const
|
||||
{
|
||||
const bool supported = get_smart_status() != Status::Unsupported;
|
||||
const bool supported = get_smart_status() != SmartStatus::Unsupported;
|
||||
// NVMe does not support on/off
|
||||
const bool is_nvme = get_detected_type() == StorageDeviceDetectedType::Nvme;
|
||||
|
||||
@@ -692,51 +654,6 @@ bool StorageDevice::get_smart_switch_supported() const
|
||||
|
||||
|
||||
|
||||
StorageDevice::Status StorageDevice::get_aodc_status() const
|
||||
{
|
||||
// smart-disabled drives are known to print some garbage, so
|
||||
// let's protect us from it.
|
||||
if (get_smart_status() != Status::Enabled)
|
||||
return Status::Unsupported;
|
||||
|
||||
if (aodc_status_.has_value()) // cached return value
|
||||
return aodc_status_.value();
|
||||
|
||||
Status status = Status::Unknown; // for now
|
||||
|
||||
bool aodc_supported = false;
|
||||
int found = 0;
|
||||
|
||||
for (const auto& p : property_repository_.get_properties()) {
|
||||
// if (p.section == AtaStoragePropertySection::Internal) {
|
||||
if (p.generic_name == "ata_smart_data/offline_data_collection/status/value/_parsed") { // if this is not present at all, we set the unknown status.
|
||||
status = (p.get_value<bool>() ? Status::Enabled : Status::Disabled);
|
||||
//++found;
|
||||
continue;
|
||||
}
|
||||
if (p.generic_name == "_text_only/aodc_support") {
|
||||
aodc_supported = p.get_value<bool>();
|
||||
++found;
|
||||
continue;
|
||||
}
|
||||
if (found >= 2)
|
||||
break;
|
||||
// }
|
||||
}
|
||||
|
||||
if (!aodc_supported)
|
||||
status = Status::Unsupported;
|
||||
// if it's supported, then status may be enabled, disabled or unknown.
|
||||
|
||||
aodc_status_ = status; // store to cache
|
||||
|
||||
debug_out_info("app", DBG_FUNC_MSG << "AODC status: " << get_status_displayable_name(status) << "\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string StorageDevice::get_device_size_str() const
|
||||
{
|
||||
return (size_.has_value() ? size_.value() : "");
|
||||
|
||||
@@ -52,15 +52,14 @@ class StorageDevice {
|
||||
public:
|
||||
|
||||
/// Statuses of various states
|
||||
enum class Status {
|
||||
Enabled, ///< SMART, AODC
|
||||
Disabled, ///< SMART, AODC
|
||||
Unsupported, ///< SMART, AODC
|
||||
Unknown ///< AODC - supported but unknown if it's enabled or not.
|
||||
enum class SmartStatus {
|
||||
Enabled,
|
||||
Disabled,
|
||||
Unsupported,
|
||||
};
|
||||
|
||||
/// Get displayable name for Status.
|
||||
[[nodiscard]] static std::string get_status_displayable_name(Status status);
|
||||
[[nodiscard]] static std::string get_status_displayable_name(SmartStatus status);
|
||||
|
||||
|
||||
/// Statuses of various parse states
|
||||
@@ -115,9 +114,6 @@ class StorageDevice {
|
||||
/// Try to enable SMART.
|
||||
[[nodiscard]] hz::ExpectedVoid<StorageDeviceError> set_smart_enabled(bool b, const std::shared_ptr<CommandExecutor>& smartctl_ex);
|
||||
|
||||
/// Try to enable Automatic Offline Data Collection.
|
||||
[[nodiscard]] hz::ExpectedVoid<StorageDeviceError> set_aodc_enabled(bool b, const std::shared_ptr<CommandExecutor>& smartctl_ex);
|
||||
|
||||
|
||||
/// Read common properties (smart supported, smart enabled, etc.) from the repository.
|
||||
void read_common_properties();
|
||||
@@ -127,14 +123,11 @@ class StorageDevice {
|
||||
|
||||
|
||||
/// Get SMART status
|
||||
[[nodiscard]] Status get_smart_status() const;
|
||||
[[nodiscard]] SmartStatus get_smart_status() const;
|
||||
|
||||
/// Get if SMART on/off is supported
|
||||
[[nodiscard]] bool get_smart_switch_supported() const;
|
||||
|
||||
/// Get AODC status
|
||||
[[nodiscard]] Status get_aodc_status() const;
|
||||
|
||||
|
||||
/// Get format size string, or an empty string on error.
|
||||
[[nodiscard]] std::string get_device_size_str() const;
|
||||
@@ -294,7 +287,6 @@ class StorageDevice {
|
||||
// Common properties
|
||||
std::optional<bool> smart_supported_; ///< SMART support status
|
||||
std::optional<bool> smart_enabled_; ///< SMART enabled status
|
||||
mutable std::optional<Status> aodc_status_; ///< Cached aodc status.
|
||||
std::optional<std::string> model_name_; ///< Model name
|
||||
std::optional<std::string> family_name_; ///< Family name
|
||||
std::optional<std::string> serial_number_; ///< Serial number
|
||||
|
||||
+10
-159
@@ -238,7 +238,6 @@ bool GscMainWindow::create_widgets()
|
||||
" <menuitem action='" APP_ACTION_NAME(action_view_details) "' />"
|
||||
" <separator />"
|
||||
" <menuitem action='" APP_ACTION_NAME(action_enable_smart) "' />"
|
||||
" <menuitem action='" APP_ACTION_NAME(action_enable_aodc) "' />"
|
||||
" <separator />"
|
||||
" <menuitem action='" APP_ACTION_NAME(action_reread_device_data) "' />"
|
||||
" <menuitem action='" APP_ACTION_NAME(action_perform_tests) "' />"
|
||||
@@ -269,7 +268,6 @@ bool GscMainWindow::create_widgets()
|
||||
" <menuitem action='" APP_ACTION_NAME(action_view_details) "' />"
|
||||
" <separator />"
|
||||
" <menuitem action='" APP_ACTION_NAME(action_enable_smart) "' />"
|
||||
" <menuitem action='" APP_ACTION_NAME(action_enable_aodc) "' />"
|
||||
" <separator />"
|
||||
" <menuitem action='" APP_ACTION_NAME(action_reread_device_data) "' />"
|
||||
" <menuitem action='" APP_ACTION_NAME(action_perform_tests) "' />"
|
||||
@@ -311,12 +309,6 @@ bool GscMainWindow::create_widgets()
|
||||
actiongroup_device_->add((action_map_[action_enable_smart] = action), Gtk::AccelKey("<control>M"),
|
||||
sigc::bind(sigc::mem_fun(*this, &GscMainWindow::on_action_activated), action_enable_smart));
|
||||
|
||||
action = Gtk::ToggleAction::create(APP_ACTION_NAME(action_enable_aodc), _("Enable Auto Offline Data Collection"),
|
||||
_("Toggle Automatic Offline Data Collection which will update \"offline\" SMART attributes every four hours"));
|
||||
lookup_widget<Gtk::CheckButton*>("status_aodc_enabled_check")->set_related_action(action);
|
||||
actiongroup_device_->add((action_map_[action_enable_aodc] = action), Gtk::AccelKey("<control>F"),
|
||||
sigc::bind(sigc::mem_fun(*this, &GscMainWindow::on_action_activated), action_enable_aodc));
|
||||
|
||||
action = Gtk::Action::create(APP_ACTION_NAME(action_reread_device_data), Gtk::Stock::REFRESH, _("Re-read Data"),
|
||||
_("Re-read basic SMART data"));
|
||||
actiongroup_device_->add((action_map_[action_reread_device_data] = action), Gtk::AccelKey("<control>E"),
|
||||
@@ -526,11 +518,6 @@ void GscMainWindow::on_action_activated(GscMainWindow::action_t action_type)
|
||||
actiongroup_device_->get_action(APP_ACTION_NAME(action_enable_smart)).operator->()));
|
||||
break;
|
||||
|
||||
case action_enable_aodc: // this may be invoked on menu manipulation
|
||||
on_action_enable_aodc_toggled(dynamic_cast<Gtk::ToggleAction*>(
|
||||
actiongroup_device_->get_action(APP_ACTION_NAME(action_enable_aodc)).operator->()));
|
||||
break;
|
||||
|
||||
case action_reread_device_data:
|
||||
on_action_reread_device_data();
|
||||
break;
|
||||
@@ -641,14 +628,14 @@ void GscMainWindow::on_action_enable_smart_toggled(Gtk::ToggleAction* action)
|
||||
if (!drive->get_smart_switch_supported())
|
||||
return;
|
||||
|
||||
StorageDevice::Status status = drive->get_smart_status();
|
||||
if (status == StorageDevice::Status::Unsupported) // this shouldn't happen
|
||||
StorageDevice::SmartStatus status = drive->get_smart_status();
|
||||
if (status == StorageDevice::SmartStatus::Unsupported) // this shouldn't happen
|
||||
return;
|
||||
|
||||
bool toggle_active = action->get_active();
|
||||
|
||||
if ( (toggle_active && status == StorageDevice::Status::Disabled)
|
||||
|| (!toggle_active && status == StorageDevice::Status::Enabled) ) {
|
||||
if ( (toggle_active && status == StorageDevice::SmartStatus::Disabled)
|
||||
|| (!toggle_active && status == StorageDevice::SmartStatus::Enabled) ) {
|
||||
|
||||
std::shared_ptr<SmartctlExecutorGui> ex(new SmartctlExecutorGui());
|
||||
ex->create_running_dialog(this);
|
||||
@@ -666,112 +653,6 @@ void GscMainWindow::on_action_enable_smart_toggled(Gtk::ToggleAction* action)
|
||||
|
||||
|
||||
|
||||
void GscMainWindow::on_action_enable_aodc_toggled(Gtk::ToggleAction* action)
|
||||
{
|
||||
if (!action || !iconview_)
|
||||
return;
|
||||
if (!action->get_sensitive()) // it's insensitive, nothing to do (this shouldn't happen).
|
||||
return;
|
||||
|
||||
StorageDevicePtr drive = iconview_->get_selected_drive();
|
||||
|
||||
// we should be protected from these by disabled actions, but still...
|
||||
if (!drive || drive->get_is_virtual() || drive->get_test_is_active())
|
||||
return;
|
||||
|
||||
StorageDevice::Status status = drive->get_aodc_status();
|
||||
if (status == StorageDevice::Status::Unsupported) // this shouldn't happen
|
||||
return;
|
||||
|
||||
if (status == StorageDevice::Status::Unknown) {
|
||||
// it's supported, but we don't know if it's enabled or not. ask the user.
|
||||
|
||||
int response = 0;
|
||||
{ // the dialog hides at the end of scope
|
||||
Gtk::MessageDialog dialog(*this, "\n"s + _("Automatic Offline Data Collection status could not be determined.\n"
|
||||
"\n<big>Do you want to enable or disable it?</big>") + "\n",
|
||||
true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true); // markup, modal
|
||||
|
||||
Gtk::Button dismiss_button(_("Dis_miss"), true);
|
||||
dismiss_button.set_image(*Gtk::manage(new Gtk::Image(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_BUTTON)));
|
||||
dismiss_button.show_all();
|
||||
dialog.add_action_widget(dismiss_button, Gtk::RESPONSE_CANCEL);
|
||||
|
||||
Gtk::Button disable_button(_("_Disable"), true);
|
||||
disable_button.set_image(*Gtk::manage(new Gtk::Image(Gtk::Stock::NO, Gtk::ICON_SIZE_BUTTON)));
|
||||
disable_button.show_all();
|
||||
dialog.add_action_widget(disable_button, Gtk::RESPONSE_NO);
|
||||
|
||||
Gtk::Button enable_button(_("_Enable"), true);
|
||||
enable_button.set_image(*Gtk::manage(new Gtk::Image(Gtk::Stock::YES, Gtk::ICON_SIZE_BUTTON)));
|
||||
enable_button.set_can_default(true);
|
||||
enable_button.show_all();
|
||||
dialog.add_action_widget(enable_button, Gtk::RESPONSE_YES);
|
||||
enable_button.grab_default(); // make it the default widget
|
||||
|
||||
dialog.set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
|
||||
|
||||
response = dialog.run(); // blocks until the dialog is closed
|
||||
}
|
||||
|
||||
bool enable_aodc = false;
|
||||
|
||||
switch (response) {
|
||||
case Gtk::RESPONSE_YES:
|
||||
enable_aodc = true;
|
||||
break;
|
||||
case Gtk::RESPONSE_NO:
|
||||
enable_aodc = false;
|
||||
break;
|
||||
case Gtk::RESPONSE_CANCEL: case Gtk::RESPONSE_DELETE_EVENT:
|
||||
// nothing, the dialog is closed already
|
||||
return;
|
||||
default:
|
||||
debug_out_error("app", DBG_FUNC_MSG << "Unknown dialog response code: " << response << ".\n");
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<SmartctlExecutorGui> ex(new SmartctlExecutorGui());
|
||||
ex->create_running_dialog(this);
|
||||
|
||||
auto command_status = drive->set_aodc_enabled(enable_aodc, ex); // run it with GUI support
|
||||
|
||||
if (!command_status) {
|
||||
std::string error_header = (enable_aodc ? _("Cannot enable Automatic Offline Data Collection")
|
||||
: _("Cannot disable Automatic Offline Data Collection"));
|
||||
gsc_executor_error_dialog_show(error_header, command_status.error().message(), this);
|
||||
|
||||
} else { // tell the user, because there's no other feedback
|
||||
gui_show_info_dialog((enable_aodc ? _("Automatic Offline Data Collection enabled.")
|
||||
: _("Automatic Offline Data Collection disabled.")), this);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool toggle_active = action->get_active();
|
||||
|
||||
if ( (toggle_active && status == StorageDevice::Status::Disabled)
|
||||
|| (!toggle_active && status == StorageDevice::Status::Enabled) ) {
|
||||
|
||||
std::shared_ptr<SmartctlExecutorGui> ex(new SmartctlExecutorGui());
|
||||
ex->create_running_dialog(this);
|
||||
|
||||
auto command_status = drive->set_aodc_enabled(toggle_active, ex); // run it with GUI support
|
||||
|
||||
if (!command_status) {
|
||||
std::string error_header = (toggle_active ? _("Cannot enable Automatic Offline Data Collection")
|
||||
: _("Cannot disable Automatic Offline Data Collection"));
|
||||
gsc_executor_error_dialog_show(error_header, command_status.error().message(), this);
|
||||
}
|
||||
|
||||
on_action_reread_device_data(); // reread if changed
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GscMainWindow::on_action_reread_device_data()
|
||||
{
|
||||
if (!iconview_)
|
||||
@@ -826,12 +707,10 @@ void GscMainWindow::set_drive_menu_status(const StorageDevicePtr& drive)
|
||||
|
||||
bool is_virtual = (drive && drive->get_is_virtual());
|
||||
|
||||
StorageDevice::Status smart_status = StorageDevice::Status::Unsupported;
|
||||
StorageDevice::Status aodc_status = StorageDevice::Status::Unsupported;
|
||||
StorageDevice::SmartStatus smart_status = StorageDevice::SmartStatus::Unsupported;
|
||||
|
||||
if (drive && !is_virtual) {
|
||||
smart_status = drive->get_smart_status();
|
||||
aodc_status = drive->get_aodc_status();
|
||||
}
|
||||
|
||||
|
||||
@@ -841,7 +720,7 @@ void GscMainWindow::set_drive_menu_status(const StorageDevicePtr& drive)
|
||||
Glib::RefPtr<Gtk::Action> action;
|
||||
|
||||
if ((action = actiongroup_device_->get_action(APP_ACTION_NAME(action_perform_tests))))
|
||||
action->set_sensitive(smart_status == StorageDevice::Status::Enabled);
|
||||
action->set_sensitive(smart_status == StorageDevice::SmartStatus::Enabled);
|
||||
if ((action = actiongroup_device_->get_action(APP_ACTION_NAME(action_reread_device_data))))
|
||||
action->set_visible(drive && !is_virtual);
|
||||
if ((action = actiongroup_device_->get_action(APP_ACTION_NAME(action_remove_device)))) {
|
||||
@@ -853,8 +732,6 @@ void GscMainWindow::set_drive_menu_status(const StorageDevicePtr& drive)
|
||||
if ((action = actiongroup_device_->get_action(APP_ACTION_NAME(action_enable_smart)))) {
|
||||
action->set_sensitive(drive && drive->get_smart_switch_supported());
|
||||
}
|
||||
if ((action = actiongroup_device_->get_action(APP_ACTION_NAME(action_enable_aodc))))
|
||||
action->set_sensitive(aodc_status != StorageDevice::Status::Unsupported);
|
||||
}
|
||||
|
||||
|
||||
@@ -863,33 +740,7 @@ void GscMainWindow::set_drive_menu_status(const StorageDevicePtr& drive)
|
||||
Gtk::ToggleAction* action = dynamic_cast<Gtk::ToggleAction*>(
|
||||
actiongroup_device_->get_action(APP_ACTION_NAME(action_enable_smart)).operator->());
|
||||
if (action) {
|
||||
action->set_active(smart_status == StorageDevice::Status::Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// aodc toggle status
|
||||
{
|
||||
Gtk::ToggleAction* action = dynamic_cast<Gtk::ToggleAction*>(
|
||||
actiongroup_device_->get_action(APP_ACTION_NAME(action_enable_aodc)).operator->());
|
||||
|
||||
if (action) {
|
||||
Gtk::CheckMenuItem* dev_odc_item = dynamic_cast<Gtk::CheckMenuItem*>(ui_manager_->get_widget(
|
||||
"/main_menubar/device_menu/" APP_ACTION_NAME(action_enable_aodc)));
|
||||
Gtk::CheckMenuItem* popup_odc_item = dynamic_cast<Gtk::CheckMenuItem*>(ui_manager_->get_widget(
|
||||
"/device_popup/" APP_ACTION_NAME(action_enable_aodc)));
|
||||
auto* status_aodc_check = lookup_widget<Gtk::CheckButton*>("status_aodc_enabled_check");
|
||||
|
||||
// true if supported, but unknown whether it's enabled or not.
|
||||
if (dev_odc_item)
|
||||
dev_odc_item->set_inconsistent(aodc_status == StorageDevice::Status::Unknown);
|
||||
if (popup_odc_item)
|
||||
popup_odc_item->set_inconsistent(aodc_status == StorageDevice::Status::Unknown);
|
||||
if (status_aodc_check)
|
||||
status_aodc_check->set_inconsistent(aodc_status == StorageDevice::Status::Unknown);
|
||||
|
||||
// for unknown it doesn't really matter what state it's in.
|
||||
action->set_active(aodc_status == StorageDevice::Status::Enabled);
|
||||
action->set_active(smart_status == StorageDevice::SmartStatus::Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1062,7 +913,7 @@ void GscMainWindow::rescan_devices()
|
||||
// add them to iconview
|
||||
for (auto& drive : drives_) {
|
||||
if (rconfig::get_data<bool>("gui/show_smart_capable_only")) {
|
||||
if (drive->get_smart_status() != StorageDevice::Status::Unsupported)
|
||||
if (drive->get_smart_status() != StorageDevice::SmartStatus::Unsupported)
|
||||
iconview_->add_entry(drive);
|
||||
} else {
|
||||
iconview_->add_entry(drive);
|
||||
@@ -1207,7 +1058,7 @@ std::shared_ptr<GscInfoWindow> GscMainWindow::show_device_info_window(const Stor
|
||||
}
|
||||
|
||||
// ask to enable SMART if it's supported but disabled
|
||||
if (!drive->get_is_virtual() && (drive->get_smart_status() == StorageDevice::Status::Disabled)) {
|
||||
if (!drive->get_is_virtual() && (drive->get_smart_status() == StorageDevice::SmartStatus::Disabled)) {
|
||||
|
||||
int status = 0;
|
||||
|
||||
@@ -1237,7 +1088,7 @@ std::shared_ptr<GscInfoWindow> GscMainWindow::show_device_info_window(const Stor
|
||||
|
||||
// Virtual drives are parsed at load time.
|
||||
// Parse non-virtual, smart-supporting drives here.
|
||||
if (!drive->get_is_virtual() && drive->get_smart_status() != StorageDevice::Status::Unsupported) {
|
||||
if (!drive->get_is_virtual() && drive->get_smart_status() != StorageDevice::SmartStatus::Unsupported) {
|
||||
std::shared_ptr<SmartctlExecutorGui> ex(new SmartctlExecutorGui());
|
||||
ex->create_running_dialog(this, Glib::ustring::compose(_("Running {command} on %1..."), drive->get_device_with_type()));
|
||||
auto command_status = drive->fetch_full_data_and_parse(ex); // run it with GUI support
|
||||
|
||||
@@ -79,7 +79,6 @@ class GscMainWindow : public AppBuilderWidget<GscMainWindow, false> {
|
||||
|
||||
action_view_details,
|
||||
action_enable_smart,
|
||||
action_enable_aodc,
|
||||
action_reread_device_data,
|
||||
action_perform_tests,
|
||||
action_remove_device,
|
||||
@@ -146,9 +145,6 @@ class GscMainWindow : public AppBuilderWidget<GscMainWindow, false> {
|
||||
/// Action callback
|
||||
void on_action_enable_smart_toggled(Gtk::ToggleAction* action);
|
||||
|
||||
/// Action callback
|
||||
void on_action_enable_aodc_toggled(Gtk::ToggleAction* action);
|
||||
|
||||
/// Action callback
|
||||
void on_action_reread_device_data();
|
||||
|
||||
|
||||
@@ -339,8 +339,6 @@ class GscMainWindowIconView : public Gtk::IconView {
|
||||
}
|
||||
tooltip_strs.push_back(Glib::ustring::compose(_("SMART status: %1"),
|
||||
"<b>" + Glib::Markup::escape_text(StorageDevice::get_status_displayable_name(drive->get_smart_status())) + "</b>"));
|
||||
tooltip_strs.push_back(Glib::ustring::compose(_("Automatic Offline Data Collection status: %1"),
|
||||
"<b>" + Glib::Markup::escape_text(StorageDevice::get_status_displayable_name(drive->get_aodc_status())) + "</b>"));
|
||||
|
||||
std::string tooltip_str = hz::string_join(tooltip_strs, '\n');
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1
|
||||
<!-- Generated with glade 3.38.2
|
||||
|
||||
Copyright (C) 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com>
|
||||
|
||||
@@ -25,22 +25,19 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
<!-- interface-name GSmartControl -->
|
||||
<!-- interface-copyright 2008 - 2021 Alexander Shaduri <ashaduri@gmail.com> -->
|
||||
<object class="GtkWindow" id="gsc_main_window">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="title" translatable="yes">GSmartControl</property>
|
||||
<property name="default_width">560</property>
|
||||
<property name="default_height">450</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<property name="default-width">560</property>
|
||||
<property name="default-height">450</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="menubar_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
@@ -52,45 +49,46 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=3 n-rows=3 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">6</property>
|
||||
<property name="margin_right">6</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-left">6</property>
|
||||
<property name="margin-right">6</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="status_name_label_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="status_health_label_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="status_name_left_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Drive information:</property>
|
||||
<attributes>
|
||||
@@ -98,14 +96,14 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Basic health check:</property>
|
||||
<attributes>
|
||||
@@ -113,14 +111,14 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Model family:</property>
|
||||
<property name="selectable">True</property>
|
||||
@@ -129,23 +127,32 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="status_family_label_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@@ -156,21 +163,21 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkIconView" id="drive_iconview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="is_focus">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="has-focus">True</property>
|
||||
<property name="is-focus">True</property>
|
||||
<property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="item_width">250</property>
|
||||
<property name="item-width">250</property>
|
||||
<property name="spacing">3</property>
|
||||
<property name="row_spacing">20</property>
|
||||
<property name="column_spacing">5</property>
|
||||
<property name="row-spacing">20</property>
|
||||
<property name="column-spacing">5</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -183,20 +190,20 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">6</property>
|
||||
<property name="margin_right">6</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-left">6</property>
|
||||
<property name="margin-right">6</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="status_smart_enabled_check">
|
||||
<property name="label">enable smart (action-replaced text)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
@@ -204,20 +211,6 @@ along with GSmartControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="status_aodc_enabled_check">
|
||||
<property name="label">enable aodc (action-replaced text)</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
Reference in New Issue
Block a user