summaryrefslogtreecommitdiff
path: root/multiload/main.c
diff options
context:
space:
mode:
authorMarian Gasparovic <[email protected]>2018-02-04 18:36:36 +0100
committerraveit65 <[email protected]>2018-02-04 19:15:28 +0100
commite6d55cba85fc49b3dfac8150c397540bda369847 (patch)
treede6d8272b079641679b718258d4be7d9adc1594d /multiload/main.c
parent560c27fb0638d41fe39ad0e0719dd6153b17eea0 (diff)
downloadmate-applets-e6d55cba85fc49b3dfac8150c397540bda369847.tar.bz2
mate-applets-e6d55cba85fc49b3dfac8150c397540bda369847.tar.xz
Scaling network graph using thresholds defined by user
Diffstat (limited to 'multiload/main.c')
-rw-r--r--multiload/main.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/multiload/main.c b/multiload/main.c
index f117e8c2..8ce5b70d 100644
--- a/multiload/main.c
+++ b/multiload/main.c
@@ -73,17 +73,10 @@ help_cb (GtkAction *action,
GError *error = NULL;
-#if GTK_CHECK_VERSION (3, 22, 0)
gtk_show_uri_on_window (NULL,
"help:mate-multiload",
gtk_get_current_event_time (),
&error);
-#else
- gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (ma->applet)),
- "help:mate-multiload",
- gtk_get_current_event_time (),
- &error);
-#endif
if (error) { /* FIXME: the user needs to see this */
g_warning ("help error: %s\n", error->message);
@@ -363,17 +356,31 @@ multiload_create_graphs(MultiloadApplet *ma)
} graph_types[] = {
{ _("CPU Load"), "cpuload", 5, GetLoad },
{ _("Memory Load"), "memload", 5, GetMemory },
- { _("Net Load"), "netload2", 4, GetNet },
+ { _("Net Load"), "netload2", 6, GetNet },
{ _("Swap Load"), "swapload", 2, GetSwap },
{ _("Load Average"), "loadavg", 3, GetLoadAvg },
{ _("Disk Load"), "diskload", 3, GetDiskLoad }
};
gint speed, size;
+ guint net_threshold1;
+ guint net_threshold2;
+ guint net_threshold3;
gint i;
speed = g_settings_get_int (ma->settings, "speed");
size = g_settings_get_int (ma->settings, "size");
+ net_threshold1 = g_settings_get_uint (ma->settings, "netthreshold1");
+ net_threshold2 = g_settings_get_uint (ma->settings, "netthreshold2");
+ net_threshold3 = g_settings_get_uint (ma->settings, "netthreshold3");
+ if (net_threshold1 >= net_threshold2)
+ {
+ net_threshold1 = net_threshold2 - 1;
+ }
+ if (net_threshold2 >= net_threshold3)
+ {
+ net_threshold3 = net_threshold2 + 1;
+ }
speed = MAX (speed, 50);
size = CLAMP (size, 10, 400);
@@ -403,8 +410,14 @@ multiload_create_graphs(MultiloadApplet *ma)
graph_types[i].name,
graph_types[i].callback);
}
- /* for Load graph, colors[2] is grid line color, it should not be used in loop in load-graph.c */
- ma->graphs[4]->n = 2;
+ /* for Network graph, colors[4] is grid line color, it should not be used in loop in load-graph.c */
+ /* for Network graph, colors[5] is indicator color, it should not be used in loop in load-graph.c */
+ ma->graphs[2]->n = 4;
+ ma->graphs[2]->net_threshold1 = net_threshold1;
+ ma->graphs[2]->net_threshold2 = net_threshold2;
+ ma->graphs[2]->net_threshold3 = net_threshold3;
+ /* for Load graph, colors[2] is grid line color, it should not be used in loop in load-graph.c */
+ ma->graphs[4]->n = 2;
}
/* remove the old graphs and rebuild them */