From e44f2e847ddb5db5b6944f6c2f993981adbd3ad4 Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 2 Mar 2016 14:44:15 +0300 Subject: 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 --- src/procman.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/procman.cpp') diff --git a/src/procman.cpp b/src/procman.cpp index b9343eb..ea50cb2 100644 --- a/src/procman.cpp +++ b/src/procman.cpp @@ -399,7 +399,8 @@ procman_get_tree_state (GSettings *settings, GtkWidget *tree, const gchar *child columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (tree)); - if(!g_strcmp0(child_schema, "proctree")) + if (g_strcmp0(child_schema, "proctree") == 0 || + g_strcmp0(child_schema, "disktreenew") == 0) { for (it = columns; it; it = it->next) { @@ -421,19 +422,17 @@ procman_get_tree_state (GSettings *settings, GtkWidget *tree, const gchar *child g_free (key); column = gtk_tree_view_get_column (GTK_TREE_VIEW (tree), id); - if(!column) continue; - gtk_tree_view_column_set_visible (column, visible); - if (visible) { - /* ensure column is really visible */ - width = MAX(width, 20); - gtk_tree_view_column_set_fixed_width(column, width); - } - } - } + if (column == NULL) + continue; + + gtk_tree_view_column_set_visible (column, visible); + if (visible) { + /* ensure column is really visible */ + width = MAX(width, 20); + gtk_tree_view_column_set_fixed_width(column, width); + } + } - if(!g_strcmp0(child_schema, "proctree") || - !g_strcmp0(child_schema, "disktreenew")) - { GVariant *value; GVariantIter iter; int sortIndex; -- cgit v1.2.1