summaryrefslogtreecommitdiff
path: root/multiload
diff options
context:
space:
mode:
authormarosg42 <[email protected]>2018-04-01 17:08:33 +0200
committerraveit65 <[email protected]>2018-05-12 22:33:58 +0200
commite5ecb8b2b584b4895b8567eb9037769d0f202f39 (patch)
tree1765d7dd4a386553365f4ffe53951837dba11af3 /multiload
parent55fe8e449d16d8dc463b5b0649fdb539bc9bb1a7 (diff)
downloadmate-applets-e5ecb8b2b584b4895b8567eb9037769d0f202f39.tar.bz2
mate-applets-e5ecb8b2b584b4895b8567eb9037769d0f202f39.tar.xz
only text formatting to prepare for real change
Diffstat (limited to 'multiload')
-rw-r--r--multiload/properties.c175
1 files changed, 83 insertions, 92 deletions
diff --git a/multiload/properties.c b/multiload/properties.c
index 9eb8683c..5f2c68c9 100644
--- a/multiload/properties.c
+++ b/multiload/properties.c
@@ -142,100 +142,91 @@ property_toggled_cb(GtkWidget *widget, gpointer name)
static void
spin_button_changed_cb(GtkWidget *widget, gpointer name)
{
- MultiloadApplet *ma;
- gint value;
- gint prop_type, i;
-
- ma = g_object_get_data(G_OBJECT(widget), "MultiloadApplet");
- prop_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "prop_type"));
- value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
-
- /* FIXME: the first toggle button to be checked/dechecked does not work, but after that everything is cool. what gives? */
- g_settings_set_uint (ma->settings, (gchar *)name, value);
- g_settings_set_uint (ma->settings, (gchar *)name, value);
-
- switch(prop_type)
- {
- case PROP_SPEED:
- {
- for (i = 0; i < NGRAPHS; i++)
- {
- load_graph_stop(ma->graphs[i]);
- ma->graphs[i]->speed = value;
- if (ma->graphs[i]->visible)
- load_graph_start(ma->graphs[i]);
- }
-
- break;
- }
- case PROP_SIZE:
- {
- for (i = 0; i < NGRAPHS; i++)
- {
- ma->graphs[i]->size = value ;
-
- if (ma->graphs[i]->orient)
- gtk_widget_set_size_request (
- ma->graphs[i]->main_widget,
- ma->graphs[i]->pixel_size,
- ma->graphs[i]->size);
- else
- gtk_widget_set_size_request (
- ma->graphs[i]->main_widget,
- ma->graphs[i]->size,
- ma->graphs[i]->pixel_size);
- }
-
- break;
- case PROP_NET_THRESHOLD1:
- {
- if (value >= ma->graphs[2]->net_threshold2)
- {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
- (gdouble)g_settings_get_uint (ma->settings, "netthreshold2") - 1);
- ma->graphs[2]->net_threshold1 = g_settings_get_uint (ma->settings, "netthreshold2") - 1;
- }
+ MultiloadApplet *ma;
+ gint value;
+ gint prop_type, i;
+
+ ma = g_object_get_data(G_OBJECT(widget), "MultiloadApplet");
+ prop_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "prop_type"));
+ value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+
+ /* FIXME: the first toggle button to be checked/dechecked does not work, but after that everything is cool. what gives? */
+ g_settings_set_uint (ma->settings, (gchar *)name, value);
+ g_settings_set_uint (ma->settings, (gchar *)name, value);
+
+ switch(prop_type)
+ {
+ case PROP_SPEED:
+ for (i = 0; i < NGRAPHS; i++)
+ {
+ load_graph_stop(ma->graphs[i]);
+ ma->graphs[i]->speed = value;
+ if (ma->graphs[i]->visible)
+ load_graph_start(ma->graphs[i]);
+ }
+
+ break;
+
+ case PROP_SIZE:
+ for (i = 0; i < NGRAPHS; i++)
+ {
+ ma->graphs[i]->size = value ;
+
+ if (ma->graphs[i]->orient)
+ gtk_widget_set_size_request (
+ ma->graphs[i]->main_widget,
+ ma->graphs[i]->pixel_size,
+ ma->graphs[i]->size);
else
- ma->graphs[2]->net_threshold1 = value;
-
- break;
- }
- case PROP_NET_THRESHOLD2:
- {
- if (value >= ma->graphs[2]->net_threshold3)
- {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
- (gdouble)g_settings_get_uint (ma->settings, "netthreshold3") - 1);
- ma->graphs[2]->net_threshold2 = g_settings_get_uint (ma->settings, "netthreshold3") - 1;
- }
- else if (value <= ma->graphs[2]->net_threshold1)
- {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
- (gdouble)g_settings_get_uint (ma->settings, "netthreshold1") + 1);
- ma->graphs[2]->net_threshold2 = g_settings_get_uint (ma->settings, "netthreshold1") + 1;
- }
- else
- ma->graphs[2]->net_threshold2 = value;
-
- break;
- }
- case PROP_NET_THRESHOLD3:
- {
- if (value <= ma->graphs[2]->net_threshold2)
- {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
- (gdouble)g_settings_get_uint (ma->settings, "netthreshold2") + 1);
- ma->graphs[2]->net_threshold3 = g_settings_get_uint (ma->settings, "netthreshold2") + 1;
- }
- else
- ma->graphs[2]->net_threshold3 = value;
- break;
- }
+ gtk_widget_set_size_request (
+ ma->graphs[i]->main_widget,
+ ma->graphs[i]->size,
+ ma->graphs[i]->pixel_size);
+ }
+ break;
- }
- default:
- g_assert_not_reached();
- }
+ case PROP_NET_THRESHOLD1:
+ if (value >= ma->graphs[2]->net_threshold2)
+ {
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
+ (gdouble)g_settings_get_uint (ma->settings, "netthreshold2") - 1);
+ ma->graphs[2]->net_threshold1 = g_settings_get_uint (ma->settings, "netthreshold2") - 1;
+ }
+ else
+ ma->graphs[2]->net_threshold1 = value;
+ break;
+
+ case PROP_NET_THRESHOLD2:
+ if (value >= ma->graphs[2]->net_threshold3)
+ {
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
+ (gdouble)g_settings_get_uint (ma->settings, "netthreshold3") - 1);
+ ma->graphs[2]->net_threshold2 = g_settings_get_uint (ma->settings, "netthreshold3") - 1;
+ }
+ else if (value <= ma->graphs[2]->net_threshold1)
+ {
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
+ (gdouble)g_settings_get_uint (ma->settings, "netthreshold1") + 1);
+ ma->graphs[2]->net_threshold2 = g_settings_get_uint (ma->settings, "netthreshold1") + 1;
+ }
+ else
+ ma->graphs[2]->net_threshold2 = value;
+
+ break;
+
+ case PROP_NET_THRESHOLD3:
+ if (value <= ma->graphs[2]->net_threshold2)
+ {
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
+ (gdouble)g_settings_get_uint (ma->settings, "netthreshold2") + 1);
+ ma->graphs[2]->net_threshold3 = g_settings_get_uint (ma->settings, "netthreshold2") + 1;
+ }
+ else
+ ma->graphs[2]->net_threshold3 = value;
+ break;
+ default:
+ g_assert_not_reached();
+ }
return;
}