[Xfce4-commits] [panel-plugins/xfce4-hardware-monitor-plugin] 05/13: Implement tags for monitors to allow for a user-defined tag to appear with the data in a CurveView text overlay
noreply at xfce.org
noreply at xfce.org
Wed Aug 12 18:39:09 CEST 2015
This is an automated email from the git hooks/post-receive script.
omegaphil pushed a commit to branch master
in repository panel-plugins/xfce4-hardware-monitor-plugin.
commit 3a1d9c993a08168a50c286a87636ce539c062607
Author: OmegaPhil <OmegaPhil at startmail.com>
Date: Wed Aug 5 16:48:14 2015 +0100
Implement tags for monitors to allow for a user-defined tag to appear with the data in a CurveView text overlay
---
src/choose-monitor-window.cpp | 41 ++-
src/choose-monitor-window.hpp | 19 +-
src/curve-view.cpp | 20 +-
src/monitor-impls.cpp | 75 +++---
src/monitor-impls.hpp | 25 +-
src/monitor.hpp | 11 +-
src/ui.glade | 553 ++++++++++++++++++++++++++++++++++++++---
7 files changed, 632 insertions(+), 112 deletions(-)
diff --git a/src/choose-monitor-window.cpp b/src/choose-monitor-window.cpp
index 63d8cb0..3600828 100644
--- a/src/choose-monitor-window.cpp
+++ b/src/choose-monitor-window.cpp
@@ -65,13 +65,19 @@ ChooseMonitorWindow::ChooseMonitorWindow(XfcePanelPlugin* panel_applet_local,
ui->get_widget("all_cpus_radiobutton", all_cpus_radiobutton);
ui->get_widget("one_cpu_radiobutton", one_cpu_radiobutton);
ui->get_widget("cpu_no_spinbutton", cpu_no_spinbutton);
+ ui->get_widget("cpu_usage_tag_entry", cpu_tag);
+ ui->get_widget("load_average_tag_entry", load_average_tag);
ui->get_widget("mount_dir_entry", mount_dir_entry);
ui->get_widget("show_free_checkbutton", show_free_checkbutton);
+ ui->get_widget("disk_usage_tag_entry", disk_usage_tag);
+ ui->get_widget("memory_tag_entry", memory_usage_tag);
+ ui->get_widget("swap_tag_entry", swap_usage_tag);
ui->get_widget("network_type_optionmenu", network_type_optionmenu);
ui->get_widget("network_direction_optionmenu", network_direction_optionmenu);
ui->get_widget("network_interfaces_treeview", network_interfaces_treeview);
+ ui->get_widget("network_load_tag_entry", network_load_tag);
/* Need special code here to set the desired stock icon as glade doesn't support
* setting a stock icon but custom text, and as soon as you change the label
@@ -86,10 +92,12 @@ ChooseMonitorWindow::ChooseMonitorWindow(XfcePanelPlugin* panel_applet_local,
ui->get_widget("temperature_box", temperature_box);
ui->get_widget("temperature_options", temperature_options);
ui->get_widget("temperature_optionmenu", temperature_optionmenu);
+ ui->get_widget("temperature_tag_entry", temperature_tag);
ui->get_widget("fan_speed_box", fan_speed_box);
ui->get_widget("fan_speed_options", fan_speed_options);
ui->get_widget("fan_speed_optionmenu", fan_speed_optionmenu);
+ ui->get_widget("fan_speed_tag_entry", fan_speed_tag);
cpu_usage_radiobutton->signal_toggled()
.connect(sigc::mem_fun(*this, &ChooseMonitorWindow::
@@ -203,43 +211,51 @@ Monitor *ChooseMonitorWindow::run(const Glib::ustring &mon_dir)
if (!mon_dir.empty())
{
xfce_rc_set_group(settings_ro, mon_dir.c_str());
- Glib::ustring type = xfce_rc_read_entry(settings_ro, "type", "");
+ Glib::ustring type = xfce_rc_read_entry(settings_ro, "type", ""),
+ tag = xfce_rc_read_entry(settings_ro, "tag", "");
if (type == "memory_usage")
{
device_notebook->set_current_page(1);
memory_usage_radiobutton->set_active();
+ memory_usage_tag->set_text(tag);
}
else if (type == "load_average")
{
device_notebook->set_current_page(0);
load_average_radiobutton->set_active();
+ load_average_tag->set_text(tag);
}
else if (type == "disk_usage")
{
device_notebook->set_current_page(1);
disk_usage_radiobutton->set_active();
+ disk_usage_tag->set_text(tag);
}
else if (type == "swap_usage")
{
device_notebook->set_current_page(1);
swap_usage_radiobutton->set_active();
+ swap_usage_tag->set_text(tag);
}
else if (type == "network_load")
{
device_notebook->set_current_page(2);
network_load_radiobutton->set_active();
+ network_load_tag->set_text(tag);
}
else if (type == "temperature")
{
device_notebook->set_current_page(3);
temperature_radiobutton->set_active();
+ temperature_tag->set_text(tag);
}
else
{
device_notebook->set_current_page(0);
// FIXME: use schema?
cpu_usage_radiobutton->set_active();
+ cpu_tag->set_text(tag);
}
// Fill in cpu info
@@ -390,20 +406,22 @@ Monitor *ChooseMonitorWindow::run(const Glib::ustring &mon_dir)
if (cpu_usage_radiobutton->get_active())
if (one_cpu_radiobutton->get_active())
- mon = new CpuUsageMonitor(int(cpu_no_spinbutton->get_value()) - 1);
+ mon = new CpuUsageMonitor(int(cpu_no_spinbutton->get_value()) - 1,
+ cpu_tag->get_text());
else
- mon = new CpuUsageMonitor;
+ mon = new CpuUsageMonitor(cpu_tag->get_text());
else if (memory_usage_radiobutton->get_active())
- mon = new MemoryUsageMonitor;
+ mon = new MemoryUsageMonitor(memory_usage_tag->get_text());
else if (swap_usage_radiobutton->get_active())
- mon = new SwapUsageMonitor;
+ mon = new SwapUsageMonitor(swap_usage_tag->get_text());
else if (load_average_radiobutton->get_active())
- mon = new LoadAverageMonitor;
+ mon = new LoadAverageMonitor(load_average_tag->get_text());
else if (disk_usage_radiobutton->get_active()) {
Glib::ustring mount_dir = mount_dir_entry->get_text();
bool show_free = show_free_checkbutton->get_active();
// FIXME: check that mount_dir is valid
- mon = new DiskUsageMonitor(mount_dir, show_free);
+ mon = new DiskUsageMonitor(mount_dir, show_free,
+ disk_usage_tag->get_text());
}
else if (network_load_radiobutton->get_active())
{
@@ -425,12 +443,15 @@ Monitor *ChooseMonitorWindow::run(const Glib::ustring &mon_dir)
break;
}
- mon = new NetworkLoadMonitor(interface_type, dir, panel_applet);
+ mon = new NetworkLoadMonitor(interface_type, dir,
+ network_load_tag->get_text(), panel_applet);
}
else if (temperature_radiobutton->get_active())
- mon = new TemperatureMonitor(temperature_optionmenu->get_history());
+ mon = new TemperatureMonitor(temperature_optionmenu->get_history(),
+ temperature_tag->get_text());
else if (fan_speed_radiobutton->get_active())
- mon = new FanSpeedMonitor(fan_speed_optionmenu->get_history());
+ mon = new FanSpeedMonitor(fan_speed_optionmenu->get_history(),
+ fan_speed_tag->get_text());
return mon;
}
diff --git a/src/choose-monitor-window.hpp b/src/choose-monitor-window.hpp
index 416ee31..5c402b1 100644
--- a/src/choose-monitor-window.hpp
+++ b/src/choose-monitor-window.hpp
@@ -76,24 +76,25 @@ private:
*fan_speed_radiobutton;
Gtk::Box *cpu_usage_options;
- Gtk::RadioButton *all_cpus_radiobutton;
- Gtk::RadioButton *one_cpu_radiobutton;
+ Gtk::RadioButton *all_cpus_radiobutton, *one_cpu_radiobutton;
Gtk::SpinButton *cpu_no_spinbutton;
+ Gtk::Entry *cpu_tag, *load_average_tag;
Gtk::Box *disk_usage_options;
- Gtk::Entry *mount_dir_entry;
+ Gtk::Entry *mount_dir_entry, *disk_usage_tag, *memory_usage_tag,
+ *swap_usage_tag;
Gtk::CheckButton *show_free_checkbutton;
Gtk::Box *network_load_options;
- Gtk::OptionMenu *network_type_optionmenu;
- Gtk::OptionMenu *network_direction_optionmenu;
+ Gtk::OptionMenu *network_type_optionmenu, *network_direction_optionmenu;
Gtk::TreeView *network_interfaces_treeview;
Gtk::Button *network_interfaces_restore_defaults_button;
+ Gtk::Entry *network_load_tag;
- Gtk::Box *temperature_box, *temperature_options;
- Gtk::OptionMenu *temperature_optionmenu;
- Gtk::Box *fan_speed_box, *fan_speed_options;
- Gtk::OptionMenu *fan_speed_optionmenu;
+ Gtk::Box *temperature_box, *temperature_options, *fan_speed_box,
+ *fan_speed_options;
+ Gtk::OptionMenu *temperature_optionmenu, *fan_speed_optionmenu;
+ Gtk::Entry *temperature_tag, *fan_speed_tag;
XfcePanelPlugin* panel_applet;
diff --git a/src/curve-view.cpp b/src/curve-view.cpp
index 6c14b46..01dff53 100644
--- a/src/curve-view.cpp
+++ b/src/curve-view.cpp
@@ -299,28 +299,28 @@ void CurveView::do_draw_loop()
{
if (monitor_data.empty())
{
- monitor_data = (*i)->monitor->format_value((*i)->monitor->value(),
- false);
+ monitor_data = (*i)->monitor->tag + ":" + separator_string +
+ (*i)->monitor->format_value((*i)->monitor->value(), false);
}
else
{
- monitor_data.append(separator_string +
- (*i)->monitor->format_value((*i)->monitor->value(),
- false));
+ monitor_data.append(separator_string + (*i)->monitor->tag + ":" +
+ separator_string +
+ (*i)->monitor->format_value((*i)->monitor->value(), false));
}
}
if (monitor_data_compact_needed)
{
if (monitor_data_compact.empty())
{
- monitor_data_compact = (*i)->monitor
- ->format_value((*i)->monitor->value(), true);
+ monitor_data_compact = (*i)->monitor->tag + ":" +
+ (*i)->monitor->format_value((*i)->monitor->value(), true);
}
else
{
- monitor_data_compact.append(separator_string +
- (*i)->monitor->format_value((*i)->monitor->value(),
- true));
+ monitor_data_compact.append(separator_string + (*i)->monitor->tag +
+ ":" +
+ (*i)->monitor->format_value((*i)->monitor->value(), true));
}
}
}
diff --git a/src/monitor-impls.cpp b/src/monitor-impls.cpp
index 92b5275..cc35a77 100644
--- a/src/monitor-impls.cpp
+++ b/src/monitor-impls.cpp
@@ -75,8 +75,9 @@ load_monitors(XfceRc *settings_ro, XfcePanelPlugin *panel_plugin)
// Setting the correct group prior to loading settings
xfce_rc_set_group(settings_ro, settings_monitors[i]);
- // Obtaining monitor type
- Glib::ustring type = xfce_rc_read_entry(settings_ro, "type", "");
+ // Obtaining general monitor details
+ Glib::ustring type = xfce_rc_read_entry(settings_ro, "type", ""),
+ tag = xfce_rc_read_entry(settings_ro, "tag", "");
if (type == "cpu_usage")
{
@@ -85,16 +86,16 @@ load_monitors(XfceRc *settings_ro, XfcePanelPlugin *panel_plugin)
// Creating CPU usage monitor with provided number if valid
if (cpu_no == -1)
- monitors.push_back(new CpuUsageMonitor);
+ monitors.push_back(new CpuUsageMonitor(tag));
else
- monitors.push_back(new CpuUsageMonitor(cpu_no));
+ monitors.push_back(new CpuUsageMonitor(cpu_no, tag));
}
else if (type == "memory_usage")
- monitors.push_back(new MemoryUsageMonitor);
+ monitors.push_back(new MemoryUsageMonitor(tag));
else if (type == "swap_usage")
- monitors.push_back(new SwapUsageMonitor);
+ monitors.push_back(new SwapUsageMonitor(tag));
else if (type == "load_average")
- monitors.push_back(new LoadAverageMonitor);
+ monitors.push_back(new LoadAverageMonitor(tag));
else if (type == "disk_usage")
{
// Obtaining volume mount directory
@@ -106,7 +107,7 @@ load_monitors(XfceRc *settings_ro, XfcePanelPlugin *panel_plugin)
false);
// Creating disk usage monitor
- monitors.push_back(new DiskUsageMonitor(mount_dir, show_free));
+ monitors.push_back(new DiskUsageMonitor(mount_dir, show_free, tag));
}
else if (type == "network_load")
{
@@ -183,7 +184,8 @@ load_monitors(XfceRc *settings_ro, XfcePanelPlugin *panel_plugin)
dir = NetworkLoadMonitor::all_data;
// Creating network load monitor
- monitors.push_back(new NetworkLoadMonitor(inter_type, dir, panel_plugin));
+ monitors.push_back(new NetworkLoadMonitor(inter_type, dir,
+ tag, panel_plugin));
}
else if (type == "temperature")
{
@@ -192,7 +194,7 @@ load_monitors(XfceRc *settings_ro, XfcePanelPlugin *panel_plugin)
"temperature_no", 0);
// Creating temperature monitor
- monitors.push_back(new TemperatureMonitor(temperature_no));
+ monitors.push_back(new TemperatureMonitor(temperature_no, tag));
}
else if (type == "fan_speed")
{
@@ -200,7 +202,7 @@ load_monitors(XfceRc *settings_ro, XfcePanelPlugin *panel_plugin)
int fan_no = xfce_rc_read_int_entry(settings_ro, "fan_no", 0);
// Creating fan monitor
- monitors.push_back(new FanSpeedMonitor(fan_no));
+ monitors.push_back(new FanSpeedMonitor(fan_no, tag));
}
// Saving the monitor's settings root
@@ -213,7 +215,7 @@ load_monitors(XfceRc *settings_ro, XfcePanelPlugin *panel_plugin)
// Always start with a CpuUsageMonitor - FIXME: use schema?
if (monitors.empty())
- monitors.push_back(new CpuUsageMonitor);
+ monitors.push_back(new CpuUsageMonitor(""));
return monitors;
}
@@ -273,12 +275,14 @@ Precision decimal_digits(double val, int n)
int const CpuUsageMonitor::max_no_cpus = GLIBTOP_NCPU;
-CpuUsageMonitor::CpuUsageMonitor()
- : cpu_no(all_cpus), total_time(0), nice_time(0), idle_time(0), iowait_time(0)
+CpuUsageMonitor::CpuUsageMonitor(const Glib::ustring &tag_string)
+ : Monitor(tag_string), cpu_no(all_cpus), total_time(0), nice_time(0),
+ idle_time(0), iowait_time(0)
{}
-CpuUsageMonitor::CpuUsageMonitor(int cpu)
- : cpu_no(cpu), total_time(0), nice_time(0), idle_time(0), iowait_time(0)
+CpuUsageMonitor::CpuUsageMonitor(int cpu, const Glib::ustring &tag_string)
+ : Monitor(tag_string), cpu_no(cpu), total_time(0), nice_time(0), idle_time(0),
+ iowait_time(0)
{
if (cpu_no < 0 || cpu_no >= max_no_cpus)
cpu_no = all_cpus;
@@ -375,6 +379,7 @@ void CpuUsageMonitor::save(XfceRc *settings_w)
xfce_rc_set_group(settings_w, dir.c_str());
xfce_rc_write_entry(settings_w, "type", "cpu_usage");
xfce_rc_write_int_entry(settings_w, "cpu_no", cpu_no);
+ xfce_rc_write_entry(settings_w, "tag", tag.c_str());
}
@@ -382,8 +387,8 @@ void CpuUsageMonitor::save(XfceRc *settings_w)
// class SwapUsageMonitor
//
-SwapUsageMonitor::SwapUsageMonitor()
- : max_value(0)
+SwapUsageMonitor::SwapUsageMonitor(const Glib::ustring &tag_string)
+ : Monitor(tag_string), max_value(0)
{
}
@@ -444,6 +449,7 @@ void SwapUsageMonitor::save(XfceRc *settings_w)
// Saving settings
xfce_rc_set_group(settings_w, dir.c_str());
xfce_rc_write_entry(settings_w, "type", "swap_usage");
+ xfce_rc_write_entry(settings_w, "tag", tag.c_str());
}
@@ -451,8 +457,8 @@ void SwapUsageMonitor::save(XfceRc *settings_w)
// class LoadAverageMonitor
//
-LoadAverageMonitor::LoadAverageMonitor()
- : max_value(1.0)
+LoadAverageMonitor::LoadAverageMonitor(const Glib::ustring &tag_string)
+ : Monitor(tag_string), max_value(1.0)
{
}
@@ -518,6 +524,7 @@ void LoadAverageMonitor::save(XfceRc *settings_w)
// Saving settings
xfce_rc_set_group(settings_w, dir.c_str());
xfce_rc_write_entry(settings_w, "type", "load_average");
+ xfce_rc_write_entry(settings_w, "tag", tag.c_str());
// No support for floats - stringifying
Glib::ustring setting = String::ucompose("%1", max_value);
@@ -541,8 +548,8 @@ void LoadAverageMonitor::load(XfceRc *settings_ro)
// class MemoryUsageMonitor
//
-MemoryUsageMonitor::MemoryUsageMonitor()
- : max_value(0)
+MemoryUsageMonitor::MemoryUsageMonitor(const Glib::ustring &tag_string)
+ : Monitor(tag_string), max_value(0)
{
}
@@ -603,6 +610,7 @@ void MemoryUsageMonitor::save(XfceRc *settings_w)
// Saving settings
xfce_rc_set_group(settings_w, dir.c_str());
xfce_rc_write_entry(settings_w, "type", "memory_usage");
+ xfce_rc_write_entry(settings_w, "tag", tag.c_str());
}
@@ -610,8 +618,9 @@ void MemoryUsageMonitor::save(XfceRc *settings_w)
// class DiskUsageMonitor
//
-DiskUsageMonitor::DiskUsageMonitor(const std::string &dir, bool free)
- : max_value(0), mount_dir(dir), show_free(free)
+DiskUsageMonitor::DiskUsageMonitor(const std::string &dir, bool free,
+ const Glib::ustring &tag_string)
+ : Monitor(tag_string), max_value(0), mount_dir(dir), show_free(free)
{
}
@@ -697,6 +706,7 @@ void DiskUsageMonitor::save(XfceRc *settings_w)
xfce_rc_write_entry(settings_w, "type", "disk_usage");
xfce_rc_write_entry(settings_w, "mount_dir", mount_dir.c_str());
xfce_rc_write_bool_entry(settings_w, "show_free", show_free);
+ xfce_rc_write_entry(settings_w, "tag", tag.c_str());
}
@@ -714,9 +724,11 @@ std::vector<Glib::ustring> NetworkLoadMonitor::interface_type_names_default = in
bool NetworkLoadMonitor::interface_names_configured = false;
NetworkLoadMonitor::NetworkLoadMonitor(InterfaceType &inter_type, Direction dir,
+ const Glib::ustring &tag_string,
XfcePanelPlugin* panel_applet)
- : max_value(1), byte_count(0), time_stamp_secs(0), time_stamp_usecs(0),
- interface_type(inter_type), direction(dir), pnl_applet(panel_applet)
+ : Monitor(tag_string), max_value(1), byte_count(0), time_stamp_secs(0),
+ time_stamp_usecs(0),interface_type(inter_type), direction(dir),
+ pnl_applet(panel_applet)
{
}
@@ -869,6 +881,7 @@ void NetworkLoadMonitor::save(XfceRc *settings_w)
xfce_rc_write_int_entry(settings_w, "interface_direction",
int(direction));
xfce_rc_write_int_entry(settings_w, "max", int(max_value));
+ xfce_rc_write_entry(settings_w, "tag", tag.c_str());
}
void NetworkLoadMonitor::load(XfceRc *settings_ro)
@@ -1428,8 +1441,8 @@ double Sensors::get_value(int chip_no, int feature_no)
double const Sensors::invalid_max = -1000000;
-TemperatureMonitor::TemperatureMonitor(int no)
- : sensors_no(no)
+TemperatureMonitor::TemperatureMonitor(int no, const Glib::ustring &tag_string)
+ : Monitor(tag_string), sensors_no(no)
{
Sensors::FeatureInfo info
= Sensors::instance().get_temperature_features()[sensors_no];
@@ -1500,6 +1513,7 @@ void TemperatureMonitor::save(XfceRc *settings_w)
xfce_rc_set_group(settings_w, dir.c_str());
xfce_rc_write_entry(settings_w, "type", "temperature");
xfce_rc_write_int_entry(settings_w, "temperature_no", sensors_no);
+ xfce_rc_write_entry(settings_w, "tag", tag.c_str());
// No support for floats - stringifying
Glib::ustring setting = String::ucompose("%1", max_value);
@@ -1526,8 +1540,8 @@ void TemperatureMonitor::load(XfceRc *settings_ro)
// class FanSpeedMonitor
//
-FanSpeedMonitor::FanSpeedMonitor(int no)
- : sensors_no(no)
+FanSpeedMonitor::FanSpeedMonitor(int no, const Glib::ustring &tag_string)
+ : Monitor(tag_string), sensors_no(no)
{
Sensors::FeatureInfo info
= Sensors::instance().get_fan_features()[sensors_no];
@@ -1596,6 +1610,7 @@ void FanSpeedMonitor::save(XfceRc *settings_w)
xfce_rc_set_group(settings_w, dir.c_str());
xfce_rc_write_entry(settings_w, "type", "fan_speed");
xfce_rc_write_int_entry(settings_w, "fan_no", sensors_no);
+ xfce_rc_write_entry(settings_w, "tag", tag.c_str());
// No support for floats - stringifying
Glib::ustring setting = String::ucompose("%1", max_value);
diff --git a/src/monitor-impls.hpp b/src/monitor-impls.hpp
index 48a9523..66bde2d 100644
--- a/src/monitor-impls.hpp
+++ b/src/monitor-impls.hpp
@@ -48,8 +48,9 @@ extern "C"
class CpuUsageMonitor: public Monitor
{
public:
- CpuUsageMonitor(); // monitor all cpus
- CpuUsageMonitor(int cpu_no); // monitor only cpu no.
+ CpuUsageMonitor(const Glib::ustring &tag_string); // Monitor all CPUs
+ CpuUsageMonitor(int cpu_no, const Glib::ustring &tag_string); // Monitor only
+ // CPU no.
virtual double max();
virtual bool fixed_max();
@@ -76,7 +77,7 @@ private:
class SwapUsageMonitor: public Monitor
{
public:
- SwapUsageMonitor();
+ SwapUsageMonitor(const Glib::ustring &tag_string);
virtual double max();
virtual bool fixed_max();
@@ -96,7 +97,7 @@ private:
class LoadAverageMonitor: public Monitor
{
public:
- LoadAverageMonitor();
+ LoadAverageMonitor(const Glib::ustring &tag_string);
virtual double max();
virtual bool fixed_max();
@@ -117,7 +118,7 @@ private:
class MemoryUsageMonitor: public Monitor
{
public:
- MemoryUsageMonitor();
+ MemoryUsageMonitor(const Glib::ustring &tag_string);
virtual double max();
virtual bool fixed_max();
@@ -137,7 +138,8 @@ private:
class DiskUsageMonitor: public Monitor
{
public:
- DiskUsageMonitor(const std::string &mount_dir, bool show_free);
+ DiskUsageMonitor(const std::string &mount_dir, bool show_free,
+ const Glib::ustring &tag_string);
virtual double max();
virtual bool fixed_max();
@@ -181,7 +183,8 @@ public:
};
NetworkLoadMonitor(InterfaceType &interface_type,
- Direction direction, XfcePanelPlugin *panel_applet);
+ Direction direction, const Glib::ustring &tag_string,
+ XfcePanelPlugin *panel_applet);
virtual double max();
virtual bool fixed_max();
@@ -247,7 +250,9 @@ private:
class TemperatureMonitor: public Monitor
{
public:
- TemperatureMonitor(int no); // no. in the temperature features
+
+ // no. in the temperature features
+ TemperatureMonitor(int no, const Glib::ustring &tag_string);
virtual double max();
virtual bool fixed_max();
@@ -270,7 +275,9 @@ private:
class FanSpeedMonitor: public Monitor
{
public:
- FanSpeedMonitor(int no); // no. in the fan features
+
+ // no. in the fan features
+ FanSpeedMonitor(int no, const Glib::ustring &tag_string);
virtual double max();
virtual bool fixed_max();
diff --git a/src/monitor.hpp b/src/monitor.hpp
index 893879e..e35b6cd 100644
--- a/src/monitor.hpp
+++ b/src/monitor.hpp
@@ -37,8 +37,8 @@ extern "C"
class Monitor: noncopyable
{
public:
- Monitor()
- : measured_value(0)
+ Monitor(const Glib::ustring &tag_string)
+ : measured_value(0), tag(tag_string)
{
}
@@ -68,7 +68,12 @@ public:
{
return settings_dir;
}
-
+
+ /* Storing the user-defined tag for the monitor - this is a short piece of text
+ * to identify the data source when its value is output in the optional text
+ * overlay in the CurveView */
+ Glib::ustring tag;
+
// The max value that the monitor may attain
virtual double max() = 0;
diff --git a/src/ui.glade b/src/ui.glade
index 4b2c2b0..4f33adb 100644
--- a/src/ui.glade
+++ b/src/ui.glade
@@ -183,6 +183,49 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="cpu_tag_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="cpu_usage_tag_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tag: </property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="cpu_usage_tag_entry">
+ <property name="width_request">80</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -206,15 +249,88 @@
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="load_average_radiobutton">
- <property name="label" translatable="yes">_Load average</property>
+ <widget class="GtkVBox" id="load_vbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip" translatable="yes">A running average of the number of simultanous processes</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">cpu_usage_radiobutton</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="load_average_radiobutton">
+ <property name="label" translatable="yes">_Load average</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">A running average of the number of simultanous processes</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">cpu_usage_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="load_average_options">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">18</property>
+ <child>
+ <widget class="GtkHBox" id="load_average_tag_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="load_average_tag_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tag:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="load_average_tag_entry">
+ <property name="width_request">80</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">18</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -329,6 +445,52 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="disk_usage_tag_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="disk_usage_tag_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="label" translatable="yes">Tag: </property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="disk_usage_tag_entry">
+ <property name="width_request">80</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -352,15 +514,97 @@
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="memory_usage_radiobutton">
- <property name="label" translatable="yes">_Memory usage</property>
+ <widget class="GtkVBox" id="memory_vbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip" translatable="yes">The amount of memory used</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">cpu_usage_radiobutton</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="memory_usage_radiobutton">
+ <property name="label" translatable="yes">_Memory usage</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">The amount of memory used</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">cpu_usage_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="memory_options">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="memory_options_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkHBox" id="memory_tag_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="memory_tag_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tag: </property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="memory_tag_entry">
+ <property name="width_request">80</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">18</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -369,15 +613,100 @@
</packing>
</child>
<child>
- <widget class="GtkRadioButton" id="swap_usage_radiobutton">
- <property name="label" translatable="yes">_Swap usage</property>
+ <widget class="GtkVBox" id="swap_vbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip" translatable="yes">The amount of disk-based memory used</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">cpu_usage_radiobutton</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="swap_usage_radiobutton">
+ <property name="label" translatable="yes">_Swap usage</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">The amount of disk-based memory used</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">cpu_usage_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="swap_options">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="swap_options_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkHBox" id="swap_tag_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="swap_tag_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tag: </property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="swap_tag_entry">
+ <property name="width_request">80</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">18</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -439,7 +768,7 @@
<widget class="GtkTable" id="network_load_options_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -598,6 +927,38 @@
<property name="y_options"/>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel" id="network_load_tag_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Tag:</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="network_load_tag_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -741,23 +1102,78 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
- <widget class="GtkOptionMenu" id="temperature_optionmenu">
+ <widget class="GtkVBox" id="temperature_options_vbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip" translatable="yes">Select the sensor to monitor</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkOptionMenu" id="temperature_optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">Select the sensor to monitor</property>
+ <child>
+ <widget class="GtkMenu" id="menu3">
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkMenuItem" id="no_sensors">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">No sensors detected</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
- <widget class="GtkMenu" id="menu3">
+ <widget class="GtkHBox" id="temperature_tag_hbox">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <widget class="GtkMenuItem" id="no_sensors">
+ <widget class="GtkLabel" id="temperature_tag_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">No sensors detected</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">Tag: </property>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="temperature_tag_entry">
+ <property name="width_request">80</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
@@ -811,23 +1227,78 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
- <widget class="GtkOptionMenu" id="fan_speed_optionmenu">
+ <widget class="GtkVBox" id="fan_speed_options_vbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip" translatable="yes">Select the sensor to monitor</property>
+ <property name="can_focus">False</property>
<child>
- <widget class="GtkMenu" id="menu4">
+ <widget class="GtkOptionMenu" id="fan_speed_optionmenu">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">Select the sensor to monitor</property>
+ <child>
+ <widget class="GtkMenu" id="menu4">
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkMenuItem" id="no_sensors1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">No sensors detected</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="fan_speed_tag_hbox">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <widget class="GtkMenuItem" id="no_sensors1">
+ <widget class="GtkLabel" id="fan_speed_tag_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">No sensors detected</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">Tag: </property>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="fan_speed_tag_entry">
+ <property name="width_request">80</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">Tag to display along with monitor data
+in the optional text overlay in a curve
+view</property>
+ <property name="invisible_char">●</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">6</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list