diff options
author | rbuj <[email protected]> | 2020-07-15 01:04:01 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-07-26 11:11:51 +0200 |
commit | 626b731a6bcd701bf16b1164972eb11af344271c (patch) | |
tree | 65562f149820cf96cc8e8b14faa82fd97fba2c2b /multiload/main.c | |
parent | e1e531145476d424ef7a882447fd411d18a974e8 (diff) | |
download | mate-applets-626b731a6bcd701bf16b1164972eb11af344271c.tar.bz2 mate-applets-626b731a6bcd701bf16b1164972eb11af344271c.tar.xz |
multiload: Do not add the same global variables within all graphs
Diffstat (limited to 'multiload/main.c')
-rw-r--r-- | multiload/main.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/multiload/main.c b/multiload/main.c index cd647cba..db7ef3cc 100644 --- a/multiload/main.c +++ b/multiload/main.c @@ -209,6 +209,9 @@ multiload_destroy_cb(GtkWidget *widget, gpointer data) g_free(ma->graphs[i]); } + netspeed_delete (ma->netspeed_in); + netspeed_delete (ma->netspeed_out); + if (ma->about_dialog) gtk_widget_destroy (ma->about_dialog); @@ -267,10 +270,13 @@ void multiload_applet_tooltip_update(LoadGraph *g) { gchar *tooltip_text, *name; + MultiloadApplet *multiload; g_assert(g); g_assert(g->name); + multiload = g->multiload; + /* label the tooltip intuitively */ if (!strncmp(g->name, "cpuload", strlen("cpuload"))) name = g_strdup(_("Processor")); @@ -308,12 +314,12 @@ multiload_applet_tooltip_update(LoadGraph *g) } else if (!strcmp(g->name, "loadavg")) { tooltip_text = g_strdup_printf(_("The system load average is %0.02f"), - g->loadavg1); + multiload->loadavg1); } else if (!strcmp(g->name, "netload2")) { char *tx_in, *tx_out; - tx_in = netspeed_get(g->netspeed_in); - tx_out = netspeed_get(g->netspeed_out); + tx_in = netspeed_get(multiload->netspeed_in); + tx_out = netspeed_get(multiload->netspeed_out); /* xgettext: same as in graphic tab of g-s-m */ tooltip_text = g_strdup_printf(_("%s:\n" "Receiving %s\n" @@ -415,9 +421,11 @@ multiload_create_graphs(MultiloadApplet *ma) /* 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; + ma->net_threshold1 = net_threshold1; + ma->net_threshold2 = net_threshold2; + ma->net_threshold3 = net_threshold3; + ma->netspeed_in = netspeed_new(ma->graphs[2]); + ma->netspeed_out = netspeed_new(ma->graphs[2]); /* 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; } |