summaryrefslogtreecommitdiff
path: root/multiload/properties.c
diff options
context:
space:
mode:
Diffstat (limited to 'multiload/properties.c')
-rw-r--r--multiload/properties.c137
1 files changed, 69 insertions, 68 deletions
diff --git a/multiload/properties.c b/multiload/properties.c
index 47fb235e..4a091867 100644
--- a/multiload/properties.c
+++ b/multiload/properties.c
@@ -1,7 +1,7 @@
/* MATE cpuload/memload panel applet
* (C) 2002 The Free Software Foundation
*
- * Authors:
+ * Authors:
* Todd Kulesza
*
*
@@ -57,20 +57,20 @@ static void
properties_set_insensitive(MultiloadApplet *ma)
{
gint i, total_graphs, last_graph;
-
+
total_graphs = 0;
last_graph = 0;
-
+
for (i = 0; i < NGRAPHS; i++)
if (ma->graphs[i]->visible)
{
last_graph = i;
total_graphs++;
}
-
+
if (total_graphs < 2)
soft_set_sensitive(ma->check_boxes[last_graph], FALSE);
-
+
return;
}
@@ -94,7 +94,7 @@ properties_close_cb (GtkWidget *widget, gint arg, MultiloadApplet *ma)
error = NULL;
}
break;
-
+
case GTK_RESPONSE_CLOSE:
default:
gtk_widget_destroy (widget);
@@ -108,19 +108,19 @@ property_toggled_cb(GtkWidget *widget, gpointer name)
MultiloadApplet *ma;
gint prop_type, i;
gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
-
+
ma = g_object_get_data(G_OBJECT(widget), "MultiloadApplet");
prop_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "prop_type"));
-
+
/* FIXME: the first toggle button to be checked/dechecked does not work, but after that everything is cool. what gives? */
/* FIXME: check if this is still valid for gsettings */
g_settings_set_boolean (ma->settings, (gchar *)name, active);
g_settings_set_boolean (ma->settings, (gchar *)name, active);
-
+
if (active)
{
for (i = 0; i < NGRAPHS; i++)
- soft_set_sensitive(ma->check_boxes[i], TRUE);
+ soft_set_sensitive(ma->check_boxes[i], TRUE);
gtk_widget_show_all (ma->graphs[prop_type]->main_widget);
ma->graphs[prop_type]->visible = TRUE;
load_graph_start(ma->graphs[prop_type]);
@@ -132,7 +132,7 @@ property_toggled_cb(GtkWidget *widget, gpointer name)
ma->graphs[prop_type]->visible = FALSE;
properties_set_insensitive(ma);
}
-
+
return;
}
@@ -141,15 +141,15 @@ spin_button_changed_cb(GtkWidget *widget, gpointer name)
{
MultiloadApplet *ma;
gint value, 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_int (ma->settings, (gchar *)name, value);
g_settings_set_int (ma->settings, (gchar *)name, value);
-
+
switch(prop_type)
{
case PROP_SPEED:
@@ -161,7 +161,7 @@ spin_button_changed_cb(GtkWidget *widget, gpointer name)
if (ma->graphs[i]->visible)
load_graph_start(ma->graphs[i]);
}
-
+
break;
}
case PROP_SIZE:
@@ -169,25 +169,25 @@ spin_button_changed_cb(GtkWidget *widget, gpointer name)
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]->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]->main_widget,
+ ma->graphs[i]->size,
ma->graphs[i]->pixel_size);
}
-
+
break;
}
default:
g_assert_not_reached();
}
-
+
return;
}
@@ -197,14 +197,14 @@ add_page(GtkWidget *notebook, gchar *label)
{
GtkWidget *page;
GtkWidget *page_label;
-
+
page = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (page), TRUE);
page_label = gtk_label_new(label);
gtk_container_set_border_width(GTK_CONTAINER(page), 6);
-
+
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, page_label);
-
+
return page;
}
@@ -254,23 +254,23 @@ add_color_selector(GtkWidget *page, gchar *name, gchar *key, MultiloadApplet *ma
GtkWidget *color_picker;
GdkRGBA color;
gchar *color_string;
-
+
color_string = g_settings_get_string (ma->settings, key);
if (!color_string)
color_string = g_strdup ("#000000");
gdk_rgba_parse (&color, color_string);
g_free (color_string);
-
+
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
label = gtk_label_new_with_mnemonic(name);
color_picker = gtk_color_button_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), color_picker);
-
+
gtk_box_pack_start(GTK_BOX(vbox), color_picker, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- gtk_box_pack_start(GTK_BOX(page), vbox, FALSE, FALSE, 0);
-
+
+ gtk_box_pack_start(GTK_BOX(page), vbox, FALSE, FALSE, 0);
+
g_object_set_data (G_OBJECT (color_picker), "MultiloadApplet", ma);
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(color_picker), &color);
@@ -279,7 +279,7 @@ add_color_selector(GtkWidget *page, gchar *name, gchar *key, MultiloadApplet *ma
if ( ! g_settings_is_writable (ma->settings, key))
hard_set_sensitive (vbox, FALSE);
-
+
return;
}
@@ -306,7 +306,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_widget_show (vbox);
-
+
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox,
TRUE, TRUE, 0);
@@ -317,7 +317,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0);
gtk_widget_show (category_vbox);
-
+
title = g_strconcat ("<span weight=\"bold\">", _("Monitored Resources"), "</span>", NULL);
label = gtk_label_new_with_mnemonic (_(title));
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
@@ -329,24 +329,24 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
#endif
gtk_box_pack_start (GTK_BOX (category_vbox), label, FALSE, FALSE, 0);
g_free (title);
-
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
-
+
indent = gtk_label_new (HIG_IDENTATION);
gtk_label_set_justify (GTK_LABEL (indent), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0);
gtk_widget_show (indent);
-
+
control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0);
gtk_widget_show (control_vbox);
-
+
control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0);
gtk_widget_show (control_hbox);
-
+
check_box = gtk_check_button_new_with_mnemonic(_("_Processor"));
ma->check_boxes[0] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
@@ -359,7 +359,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
if ( ! g_settings_is_writable (ma->settings, "view-cpuload"))
hard_set_sensitive (check_box, FALSE);
-
+
check_box = gtk_check_button_new_with_mnemonic(_("_Memory"));
ma->check_boxes[1] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
@@ -372,7 +372,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
if ( ! g_settings_is_writable (ma->settings, "view-memload"))
hard_set_sensitive (check_box, FALSE);
-
+
check_box = gtk_check_button_new_with_mnemonic(_("_Network"));
ma->check_boxes[2] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
@@ -400,7 +400,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
hard_set_sensitive (check_box, FALSE);
check_box = gtk_check_button_new_with_mnemonic(_("_Load"));
- ma->check_boxes[4] = check_box;
+ ma->check_boxes[4] = check_box;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box),
g_settings_get_boolean (ma->settings, "view-loadavg"));
g_object_set_data(G_OBJECT(check_box), "MultiloadApplet", ma);
@@ -439,7 +439,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_box_pack_start (GTK_BOX (category_vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
g_free (title);
-
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@@ -452,19 +452,19 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0);
gtk_widget_show (control_vbox);
-
+
control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0);
gtk_widget_show (control_hbox);
-
+
label_size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
+
orient = mate_panel_applet_get_orient(ma->applet);
if ( (orient == MATE_PANEL_APPLET_ORIENT_UP) || (orient == MATE_PANEL_APPLET_ORIENT_DOWN) )
label_text = g_strdup(_("System m_onitor width: "));
else
label_text = g_strdup(_("System m_onitor height: "));
-
+
label = gtk_label_new_with_mnemonic(label_text);
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
@@ -473,13 +473,13 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
#endif
gtk_size_group_add_widget (label_size, label);
gtk_box_pack_start (GTK_BOX (control_hbox), label, FALSE, FALSE, 0);
-
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (control_hbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
spin_size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
+
spin_button = gtk_spin_button_new_with_range(10, 1000, 5);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin_button);
g_object_set_data(G_OBJECT(spin_button), "MultiloadApplet", ma);
@@ -489,7 +489,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
(gdouble)g_settings_get_int(ma->settings, "size"));
g_signal_connect(G_OBJECT(spin_button), "value_changed",
G_CALLBACK(spin_button_changed_cb), "size");
-
+
if ( ! g_settings_is_writable (ma->settings, "size")) {
hard_set_sensitive (label, FALSE);
hard_set_sensitive (hbox, FALSE);
@@ -497,7 +497,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_size_group_add_widget (spin_size, spin_button);
gtk_box_pack_start (GTK_BOX (hbox), spin_button, FALSE, FALSE, 0);
-
+
label = gtk_label_new (_("pixels"));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
@@ -505,11 +505,11 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
#endif
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
+
control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0);
gtk_widget_show (control_hbox);
-
+
label = gtk_label_new_with_mnemonic(_("Sys_tem monitor update interval: "));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
@@ -518,11 +518,11 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
#endif
gtk_size_group_add_widget (label_size, label);
gtk_box_pack_start (GTK_BOX (control_hbox), label, FALSE, FALSE, 0);
-
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (control_hbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
-
+
spin_button = gtk_spin_button_new_with_range(50, 10000, 50);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin_button);
g_object_set_data(G_OBJECT(spin_button), "MultiloadApplet", ma);
@@ -539,7 +539,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
hard_set_sensitive (label, FALSE);
hard_set_sensitive (hbox, FALSE);
}
-
+
label = gtk_label_new(_("milliseconds"));
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
@@ -547,10 +547,10 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
#endif
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
+
g_free(label_text);
-
-
+
+
category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0);
gtk_widget_show (category_vbox);
@@ -567,7 +567,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_box_pack_start (GTK_BOX (category_vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
g_free (title);
-
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@@ -583,7 +583,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
ma->notebook = gtk_notebook_new();
gtk_container_add (GTK_CONTAINER (control_vbox), ma->notebook);
-
+
page = add_page(ma->notebook, _("Processor"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
add_color_selector(page, _("_User"), "cpuload-color0", ma);
@@ -591,7 +591,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
add_color_selector(page, _("N_ice"), "cpuload-color2", ma);
add_color_selector(page, _("I_OWait"), "cpuload-color3", ma);
add_color_selector(page, _("I_dle"), "cpuload-color4", ma);
-
+
page = add_page(ma->notebook, _("Memory"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
add_color_selector(page, _("_User"), "memload-color0", ma);
@@ -599,30 +599,31 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
add_color_selector(page, _("_Buffers"), "memload-color2", ma);
add_color_selector (page, _("Cach_ed"), "memload-color3", ma);
add_color_selector(page, _("F_ree"), "memload-color4", ma);
-
+
page = add_page(ma->notebook, _("Network"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
add_color_selector (page, _("_In"), "netload2-color0", ma);
add_color_selector(page, _("_Out"), "netload2-color1", ma);
add_color_selector (page, _("_Local"), "netload2-color2", ma);
add_color_selector(page, _("_Background"), "netload2-color3", ma);
-
+
page = add_page(ma->notebook, _("Swap Space"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
add_color_selector(page, _("_Used"), "swapload-color0", ma);
add_color_selector(page, _("_Free"), "swapload-color1", ma);
-
+
page = add_page(ma->notebook, _("Load"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
add_color_selector(page, _("_Average"), "loadavg-color0", ma);
add_color_selector(page, _("_Background"), "loadavg-color1", ma);
+ add_color_selector(page, _("_Gridline"), "loadavg-color2", ma);
page = add_page (ma->notebook, _("Harddisk"));
gtk_container_set_border_width (GTK_CONTAINER (page), 12);
add_color_selector (page, _("_Read"), "diskload-color0", ma);
add_color_selector (page, _("_Write"), "diskload-color1", ma);
add_color_selector (page, _("_Background"), "diskload-color2", ma);
-
+
return;
}
@@ -644,7 +645,7 @@ multiload_properties_cb (GtkAction *action,
gtk_window_present (GTK_WINDOW (dialog));
return;
}
-
+
dialog = gtk_dialog_new_with_buttons (_("System Monitor Preferences"),
NULL, 0,
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
@@ -660,7 +661,7 @@ multiload_properties_cb (GtkAction *action,
fill_properties(dialog, ma);
properties_set_insensitive(ma);
-
+
g_signal_connect(G_OBJECT(dialog), "response",
G_CALLBACK(properties_close_cb), ma);