diff options
author | infirit <[email protected]> | 2014-12-18 19:44:39 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-18 19:44:39 +0100 |
commit | 01735cf7050926fb1c1de8adecb391c657ad2204 (patch) | |
tree | bc0dc5a3575654219b8f7727cac028ff52fe2970 /src/proctable.cpp | |
parent | 89c2ba95156b8ccd9d7493121f4a691ffbe927c1 (diff) | |
download | mate-system-monitor-01735cf7050926fb1c1de8adecb391c657ad2204.tar.bz2 mate-system-monitor-01735cf7050926fb1c1de8adecb391c657ad2204.tar.xz |
Save column info on change instead of quit
Taken from GSM commit: bc2a8c221604fe335b690ba7d180022bf0430fff
From: Robert Roth <[email protected]>
Gnome bug: http://bugzilla.gnome.org/show_bug.cgi?id=649398
Diffstat (limited to 'src/proctable.cpp')
-rw-r--r-- | src/proctable.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/proctable.cpp b/src/proctable.cpp index 1304077..686ca45 100644 --- a/src/proctable.cpp +++ b/src/proctable.cpp @@ -169,6 +169,28 @@ proctable_get_columns_order(GtkTreeView *treeview) return order; } +void +cb_proctable_column_resized(GtkWidget *widget) +{ + GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(widget); + gint width; + gchar *key; + int id; + GSettings *settings; + gint saved_width; + + settings = g_settings_get_child (ProcData::get_instance()->settings, "proctree"); + id = gtk_tree_view_column_get_sort_column_id (column); + width = gtk_tree_view_column_get_width (column); + key = g_strdup_printf ("col-%d-width", id); + + g_settings_get (settings, key, "i", &saved_width); + if (saved_width!=width) + { + g_settings_set_int(settings, key, width); + } + g_free (key); +} static gboolean search_equal_func(GtkTreeModel *model, @@ -293,6 +315,7 @@ proctable_new (ProcData * const procdata) gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_min_width (column, 1); + g_signal_connect(G_OBJECT(column), "notify::width", G_CALLBACK(cb_proctable_column_resized), NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (proctree), column); gtk_tree_view_set_expander_column (GTK_TREE_VIEW (proctree), column); @@ -308,6 +331,7 @@ proctable_new (ProcData * const procdata) gtk_tree_view_column_set_title(col, _(titles[i])); gtk_tree_view_column_set_resizable(col, TRUE); gtk_tree_view_column_set_sort_column_id(col, i); + g_signal_connect(G_OBJECT(col), "notify::width", G_CALLBACK(cb_proctable_column_resized), NULL); gtk_tree_view_column_set_reorderable(col, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(proctree), col); |