summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--multiload/global.h6
-rw-r--r--multiload/main.c6
-rw-r--r--multiload/org.mate.panel.applet.multiload.gschema.xml.in3
-rw-r--r--multiload/properties.c6
4 files changed, 15 insertions, 6 deletions
diff --git a/multiload/global.h b/multiload/global.h
index ea8b6330..9074e2fc 100644
--- a/multiload/global.h
+++ b/multiload/global.h
@@ -12,6 +12,12 @@ G_BEGIN_DECLS
#define NCPUSTATES 5
#define NGRAPHS 6
+#define MIN_NET_THRESHOLD1 10
+#define MIN_NET_THRESHOLD2 11
+#define MIN_NET_THRESHOLD3 12
+#define MAX_NET_THRESHOLD1 999999998
+#define MAX_NET_THRESHOLD2 999999999
+#define MAX_NET_THRESHOLD3 1000000000
typedef struct _MultiloadApplet MultiloadApplet;
typedef struct _LoadGraph LoadGraph;
diff --git a/multiload/main.c b/multiload/main.c
index db7ef3cc..45756891 100644
--- a/multiload/main.c
+++ b/multiload/main.c
@@ -378,9 +378,9 @@ multiload_create_graphs(MultiloadApplet *ma)
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");
+ net_threshold1 = CLAMP (g_settings_get_uint (ma->settings, "netthreshold1"), MIN_NET_THRESHOLD1, MAX_NET_THRESHOLD1);
+ net_threshold2 = CLAMP (g_settings_get_uint (ma->settings, "netthreshold2"), MIN_NET_THRESHOLD2, MAX_NET_THRESHOLD2);
+ net_threshold3 = CLAMP (g_settings_get_uint (ma->settings, "netthreshold3"), MIN_NET_THRESHOLD3, MAX_NET_THRESHOLD3);
if (net_threshold1 >= net_threshold2)
{
net_threshold1 = net_threshold2 - 1;
diff --git a/multiload/org.mate.panel.applet.multiload.gschema.xml.in b/multiload/org.mate.panel.applet.multiload.gschema.xml.in
index 53bf8c76..9f199bc3 100644
--- a/multiload/org.mate.panel.applet.multiload.gschema.xml.in
+++ b/multiload/org.mate.panel.applet.multiload.gschema.xml.in
@@ -98,14 +98,17 @@
<summary>Indicator color</summary>
</key>
<key name="netthreshold1" type="u">
+ <range min="10" max="999999998"/>
<default>1000000</default>
<summary>Network threshold 1 in bytes</summary>
</key>
<key name="netthreshold2" type="u">
+ <range min="11" max="999999999"/>
<default>10000000</default>
<summary>Network threshold 2 in bytes</summary>
</key>
<key name="netthreshold3" type="u">
+ <range min="12" max="1000000000"/>
<default>100000000</default>
<summary>Network threshold 3 in bytes</summary>
</key>
diff --git a/multiload/properties.c b/multiload/properties.c
index 8849943c..d8299cde 100644
--- a/multiload/properties.c
+++ b/multiload/properties.c
@@ -723,7 +723,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
spin_size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- spin_button = gtk_spin_button_new_with_range(10, 1000000000, 5);
+ spin_button = gtk_spin_button_new_with_range (MIN_NET_THRESHOLD1, MAX_NET_THRESHOLD1, 5);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin_button);
g_object_set_data(G_OBJECT(spin_button), "MultiloadApplet", ma);
g_object_set_data(G_OBJECT(spin_button), "prop_type",
@@ -759,7 +759,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_box_pack_start (GTK_BOX (control_hbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
- spin_button = gtk_spin_button_new_with_range(10, 1000000000, 5);
+ spin_button = gtk_spin_button_new_with_range (MIN_NET_THRESHOLD2, MAX_NET_THRESHOLD2, 5);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin_button);
g_object_set_data(G_OBJECT(spin_button), "MultiloadApplet", ma);
g_object_set_data(G_OBJECT(spin_button), "prop_type",
@@ -794,7 +794,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_box_pack_start (GTK_BOX (control_hbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
- spin_button = gtk_spin_button_new_with_range(10, 1000000000, 5);
+ spin_button = gtk_spin_button_new_with_range (MIN_NET_THRESHOLD3, MAX_NET_THRESHOLD3, 5);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin_button);
g_object_set_data(G_OBJECT(spin_button), "MultiloadApplet", ma);
g_object_set_data(G_OBJECT(spin_button), "prop_type",