summaryrefslogtreecommitdiff
path: root/src/procdialogs.cpp
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-03-02 14:44:15 +0300
committermonsta <[email protected]>2016-03-02 14:49:11 +0300
commite44f2e847ddb5db5b6944f6c2f993981adbd3ad4 (patch)
tree871df644b8dbd6d4861d42421e1b03790ff3c490 /src/procdialogs.cpp
parent2e5e07b81f18fa4b3cfa8dfdbb08d716d58845ce (diff)
downloadmate-system-monitor-e44f2e847ddb5db5b6944f6c2f993981adbd3ad4.tar.bz2
mate-system-monitor-e44f2e847ddb5db5b6944f6c2f993981adbd3ad4.tar.xz
disks: implement saving and loading width and visibility of columns
adapted from https://git.gnome.org/browse/gnome-system-monitor/commit/?id=f589439a966151b2589bca21a4d6b40455eb201a with necessary changes from https://github.com/mate-desktop/mate-system-monitor/commit/eebc190a5aeb6ebaf5c3a868b68434679adddc74
Diffstat (limited to 'src/procdialogs.cpp')
-rw-r--r--src/procdialogs.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp
index f76d639..96cf39c 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -355,17 +355,15 @@ private:
};
-
-
static void
-field_toggled (GtkCellRendererToggle *cell, gchar *path_str, gpointer data)
+field_toggled (const gchar *child_schema, GtkCellRendererToggle *cell, gchar *path_str, gpointer data)
{
GtkTreeModel *model = static_cast<GtkTreeModel*>(data);
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
GtkTreeIter iter;
GtkTreeViewColumn *column;
gboolean toggled;
- GSettings *settings = g_settings_get_child (ProcData::get_instance()->settings, "proctree");
+ GSettings *settings = g_settings_get_child (ProcData::get_instance()->settings, child_schema);
gchar *key;
int id;
@@ -387,11 +385,22 @@ field_toggled (GtkCellRendererToggle *cell, gchar *path_str, gpointer data)
g_free (key);
gtk_tree_path_free (path);
+}
+
+static void
+proc_field_toggled (GtkCellRendererToggle *cell, gchar *path_str, gpointer data)
+{
+ field_toggled ("proctree", cell, path_str, data);
+}
+static void
+disk_field_toggled (GtkCellRendererToggle *cell, gchar *path_str, gpointer data)
+{
+ field_toggled ("disktreenew", cell, path_str, data);
}
static GtkWidget *
-create_field_page(GtkWidget *tree, const char* text)
+create_field_page(GtkWidget *tree, const gchar *child_schema, const gchar *text)
{
GtkWidget *vbox;
GtkWidget *scrolled;
@@ -433,7 +442,11 @@ create_field_page(GtkWidget *tree, const char* text)
gtk_tree_view_column_set_attributes (column, cell,
"active", 0,
NULL);
- g_signal_connect (G_OBJECT (cell), "toggled", G_CALLBACK (field_toggled), model);
+ if (g_strcmp0 (child_schema, "proctree") == 0)
+ g_signal_connect (G_OBJECT (cell), "toggled", G_CALLBACK (proc_field_toggled), model);
+ else if (g_strcmp0 (child_schema, "disktreenew") == 0)
+ g_signal_connect (G_OBJECT (cell), "toggled", G_CALLBACK (disk_field_toggled), model);
+
gtk_tree_view_column_set_clickable (column, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
@@ -663,7 +676,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
label = gtk_label_new (" ");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- vbox2 = create_field_page (procdata->tree, _("Process i_nformation shown in list:"));
+ vbox2 = create_field_page (procdata->tree, "proctree", _("Process i_nformation shown in list:"));
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
sys_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -823,7 +836,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
label = gtk_label_new (" ");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- vbox3 = create_field_page (procdata->disk_list, _("File system i_nformation shown in list:"));
+ vbox3 = create_field_page (procdata->disk_list, "disktreenew", _("File system i_nformation shown in list:"));
gtk_box_pack_start (GTK_BOX (hbox), vbox3, TRUE, TRUE, 0);
gtk_widget_show_all (dialog);