[gnome-system-monitor] Added options to turn on/off graphs (bgo #531097)
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Added options to turn on/off graphs (bgo #531097)
- Date: Thu, 25 Jul 2013 23:34:25 +0000 (UTC)
commit da4bb2cc0600054751fd0c3953dbb8efca29b016
Author: Robert Roth <robert roth off gmail com>
Date: Fri Jul 26 02:33:57 2013 +0300
Added options to turn on/off graphs (bgo #531097)
data/preferences.ui | 75 ++++++++++++++++++---
src/interface.cpp | 23 ++++--
src/org.gnome.gnome-system-monitor.gschema.xml.in | 21 ++++++
src/procdialogs.cpp | 9 +++
4 files changed, 109 insertions(+), 19 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index cb0377d..87f2a6b 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.15.2 on Fri Jul 26 02:08:44 2013 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="preferences_dialog">
@@ -21,11 +22,10 @@
<child>
<object class="GtkButton" id="help_button">
<property name="label" translatable="yes">_Help</property>
- <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_stock">False</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -36,11 +36,10 @@
<child>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
- <property name="use_underline">True</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_stock">False</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -402,7 +401,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
- <property name="invisible_char_set">True</property>
<property name="climb_rate">1</property>
<property name="digits">2</property>
</object>
@@ -422,8 +420,27 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="bits_button">
- <property name="label" translatable="yes">_Show network speed in
bits</property>
+ <object class="GtkCheckButton" id="draw_stacked_button">
+ <property name="label" translatable="yes">_Draw as stacked area
chart</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="margin_left">12</property>
+ <property name="hexpand">True</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="draw_cpu">
+ <property name="label" translatable="yes">Show _processor usage
graph</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -440,8 +457,8 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="draw_stacked_button">
- <property name="label" translatable="yes">_Draw CPU chart as stacked area
chart</property>
+ <object class="GtkCheckButton" id="draw_mem">
+ <property name="label" translatable="yes">Show _memory and swap usage
graph</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -452,7 +469,44 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="draw_net">
+ <property name="label" translatable="yes">Show _network traffic
graph</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="hexpand">True</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="bits_button">
+ <property name="label" translatable="yes">_Show network speed in
bits</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="margin_left">12</property>
+ <property name="hexpand">True</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -557,7 +611,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
- <property name="invisible_char_set">True</property>
<property name="climb_rate">1</property>
<property name="digits">2</property>
</object>
diff --git a/src/interface.cpp b/src/interface.cpp
index c482076..7c6c442 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -160,7 +160,7 @@ create_sys_view (ProcmanApp *app, GtkBuilder * builder)
title_template = g_strdup(_("Pick a Color for '%s'"));
/* The CPU BOX */
-
+
cpu_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "cpu_graph_box"));
cpu_graph = new LoadGraph(LOAD_GRAPH_CPU);
@@ -183,10 +183,6 @@ create_sys_view (ProcmanApp *app, GtkBuilder * builder)
gtk_grid_insert_row(GTK_GRID(cpu_table), (i+1)/cols);
}
gtk_grid_attach(GTK_GRID (cpu_table), temp_hbox, i%cols, i/cols, 1, 1);
- //gtk_size_group_add_widget (sizegroup, temp_hbox);
- /*g_signal_connect (G_OBJECT (temp_hbox), "size_request",
- G_CALLBACK(size_request), &cpu_size);
- */
color_picker = gsm_color_button_new (&cpu_graph->colors.at(i), GSMCP_TYPE_CPU);
g_signal_connect (G_OBJECT (color_picker), "color_set",
G_CALLBACK (cb_cpu_color_changed), GINT_TO_POINTER (i));
@@ -214,6 +210,7 @@ create_sys_view (ProcmanApp *app, GtkBuilder * builder)
app->cpu_graph = cpu_graph;
/** The memory box */
+
mem_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "mem_graph_box"));
mem_graph = new LoadGraph(LOAD_GRAPH_MEM);
@@ -252,6 +249,7 @@ create_sys_view (ProcmanApp *app, GtkBuilder * builder)
app->mem_graph = mem_graph;
/* The net box */
+
net_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "net_graph_box"));
net_graph = new LoadGraph(LOAD_GRAPH_NET);
@@ -273,7 +271,6 @@ create_sys_view (ProcmanApp *app, GtkBuilder * builder)
picker_alignment = GTK_WIDGET (gtk_builder_get_object (builder, "receiving_picker_alignment"));
gtk_container_add (GTK_CONTAINER (picker_alignment), color_picker);
- //gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_in), 100, -1);
label = GTK_WIDGET (gtk_builder_get_object(builder, "receiving_label"));
gtk_grid_attach_next_to (GTK_GRID (table), load_graph_get_labels(net_graph)->net_in, label,
GTK_POS_RIGHT, 1, 1);
label = GTK_WIDGET (gtk_builder_get_object(builder, "total_received_label"));
@@ -290,7 +287,6 @@ create_sys_view (ProcmanApp *app, GtkBuilder * builder)
picker_alignment = GTK_WIDGET (gtk_builder_get_object (builder, "sending_picker_alignment"));
gtk_container_add (GTK_CONTAINER (picker_alignment), color_picker);
- //gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_out), 100, -1);
label = GTK_WIDGET (gtk_builder_get_object(builder, "sending_label"));
gtk_grid_attach_next_to (GTK_GRID (table), load_graph_get_labels(net_graph)->net_out, label,
GTK_POS_RIGHT, 1, 1);
label = GTK_WIDGET (gtk_builder_get_object(builder, "total_sent_label"));
@@ -628,7 +624,18 @@ create_main_window (ProcmanApp *app)
g_settings_get_value (app->settings, "show-whose-processes"));
gtk_widget_show_all(main_window);
-
+
+ GtkWidget *cpu_box, *mem_box, *net_box;
+
+ cpu_box = GTK_WIDGET (gtk_builder_get_object (builder, "cpu_box"));
+ g_settings_bind(app->settings, "show-cpu", cpu_box, "visible", G_SETTINGS_BIND_GET);
+
+ mem_box = GTK_WIDGET (gtk_builder_get_object (builder, "mem_box"));
+ g_settings_bind(app->settings, "show-mem", mem_box, "visible", G_SETTINGS_BIND_GET);
+
+ net_box = GTK_WIDGET (gtk_builder_get_object (builder, "net_box"));
+ g_settings_bind(app->settings, "show-network", net_box, "visible", G_SETTINGS_BIND_GET);
+
update_page_activities (app);
g_object_unref (G_OBJECT (builder));
diff --git a/src/org.gnome.gnome-system-monitor.gschema.xml.in
b/src/org.gnome.gnome-system-monitor.gschema.xml.in
index 01b1250..718e544 100644
--- a/src/org.gnome.gnome-system-monitor.gschema.xml.in
+++ b/src/org.gnome.gnome-system-monitor.gschema.xml.in
@@ -168,6 +168,27 @@
</_summary>
</key>
+ <key type="b" name="show-cpu">
+ <default>true
+ </default>
+ <_summary>Show processor usage graph
+ </_summary>
+ </key>
+
+ <key type="b" name="show-mem">
+ <default>true
+ </default>
+ <_summary>Show memory and swap usage graph
+ </_summary>
+ </key>
+
+ <key type="b" name="show-network">
+ <default>true
+ </default>
+ <_summary>Show network traffic graph
+ </_summary>
+ </key>
+
<child name="proctree" schema="org.gnome.gnome-system-monitor.proctree" />
<child name="disktreenew" schema="org.gnome.gnome-system-monitor.disktreenew" />
<child name="memmapstree" schema="org.gnome.gnome-system-monitor.memmapstree" />
diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp
index 6a8b661..b568048 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -459,6 +459,15 @@ procdialog_create_preferences_dialog (ProcmanApp *app)
&disks_interval_updater);
+ check_button = GTK_WIDGET (gtk_builder_get_object (builder, "draw_cpu"));
+ g_settings_bind(app->settings, "show-cpu", check_button, "active", G_SETTINGS_BIND_DEFAULT);
+
+ check_button = GTK_WIDGET (gtk_builder_get_object (builder, "draw_mem"));
+ g_settings_bind(app->settings, "show-mem", check_button, "active", G_SETTINGS_BIND_DEFAULT);
+
+ check_button = GTK_WIDGET (gtk_builder_get_object (builder, "draw_net"));
+ g_settings_bind(app->settings, "show-network", check_button, "active", G_SETTINGS_BIND_DEFAULT);
+
check_button = GTK_WIDGET (gtk_builder_get_object (builder, "all_devices_check"));
g_settings_bind(app->settings, "show-all-fs", check_button, "active", G_SETTINGS_BIND_DEFAULT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]