summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/config.cc4
-rw-r--r--src/config.hh4
-rw-r--r--src/gui_gtk.cc3
-rw-r--r--src/gui_qt.cc3
-rw-r--r--src/monitor-gui.cc4
5 files changed, 18 insertions, 0 deletions
diff --git a/src/config.cc b/src/config.cc
index db42a7b..90ef95d 100644
--- a/src/config.cc
+++ b/src/config.cc
@@ -90,6 +90,10 @@ public:
}
}
+ void remove(std::string const& key) override {
+ override_.erase(key);
+ }
+
private:
bool update(bool good, std::string const& last_error,
std::unordered_map<std::string, std::string>& data) {
diff --git a/src/config.hh b/src/config.hh
index 5262e91..011e890 100644
--- a/src/config.hh
+++ b/src/config.hh
@@ -24,6 +24,10 @@ public:
virtual bool is_set(std::string const& key) = 0;
virtual void set(std::string const& key, std::string const& value) = 0;
+ virtual void set(std::string const& key, bool value) {
+ set(key, std::string(value ? "true" : "false"));
+ }
+ virtual void remove(std::string const& key) = 0;
protected:
Config() { }
diff --git a/src/gui_gtk.cc b/src/gui_gtk.cc
index 55ce88a..a326cea 100644
--- a/src/gui_gtk.cc
+++ b/src/gui_gtk.cc
@@ -555,6 +555,9 @@ public:
void set(std::string const& key, std::string const& value) override {
g_settings_set_string(settings_.get(), key.c_str(), value.c_str());
}
+ void remove(std::string const& key) override {
+ g_settings_reset(settings_.get(), key.c_str());
+ }
private:
shared_gobject<GSettings> settings_;
diff --git a/src/gui_qt.cc b/src/gui_qt.cc
index 59dc5e1..ec67527 100644
--- a/src/gui_qt.cc
+++ b/src/gui_qt.cc
@@ -352,6 +352,9 @@ public:
settings_->setValue(QString::fromStdString(key),
QString::fromStdString(value));
}
+ void remove(std::string const& key) override {
+ settings_->remove(QString::fromStdString(key));
+ }
private:
std::unique_ptr<QSettings> settings_;
diff --git a/src/monitor-gui.cc b/src/monitor-gui.cc
index 8044a02..4f4f2fb 100644
--- a/src/monitor-gui.cc
+++ b/src/monitor-gui.cc
@@ -260,6 +260,10 @@ public:
memory_[key] = value;
}
+ void remove(std::string const& key) override {
+ memory_.erase(key);
+ }
+
private:
std::unordered_map<std::string, std::string> memory_;
};