diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 11:21:16 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 11:21:16 +0000 |
commit | d2ad7b4cf05551da4e832a6cc038f57e308ba8ca (patch) | |
tree | 845573e88803453145729a7731e9a4f4d34b14d6 /views | |
parent | ebdd2018d86f879cdfd8f33eacbc4218bd606f27 (diff) | |
download | chromium_src-d2ad7b4cf05551da4e832a6cc038f57e308ba8ca.zip chromium_src-d2ad7b4cf05551da4e832a6cc038f57e308ba8ca.tar.gz chromium_src-d2ad7b4cf05551da4e832a6cc038f57e308ba8ca.tar.bz2 |
views: Implement NativeTableGtk::RemoveColumn method.
Also fix the following error when we try to get the width of column that does not exist anymore.
(views_examples:3921): Gtk-CRITICAL **: gtk_tree_view_column_get_width: assertion `GTK_IS_TREE_VIEW_COLUMN (tree_column)' failed
BUG=None
TEST=export GYP_DEFINES="toolkit_views" && gclient runhooks && make -j4 -k views_examples
out/Debug/views_examples, go to the table tab. Now clicking in one of the checkboxes,
the corresponded column should be removed.
Review URL: http://codereview.chromium.org/6256004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/table/native_table_gtk.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/views/controls/table/native_table_gtk.cc b/views/controls/table/native_table_gtk.cc index 633705b..99569995 100644 --- a/views/controls/table/native_table_gtk.cc +++ b/views/controls/table/native_table_gtk.cc @@ -69,14 +69,24 @@ void NativeTableGtk::InsertColumn(const TableColumn& column, int index) { NOTIMPLEMENTED(); } -void NativeTableGtk::RemoveColumn(int index) { - NOTIMPLEMENTED(); +void NativeTableGtk::RemoveColumn(int column_index) { + if (!native_view()) + return; + + GtkTreeViewColumn* column = gtk_tree_view_get_column(tree_view_, + column_index); + if (column) { + gtk_tree_view_remove_column(tree_view_, column); + + if (table_->model()->RowCount() > 0) + OnRowsChanged(0, table_->model()->RowCount() - 1); + } } int NativeTableGtk::GetColumnWidth(int column_index) const { GtkTreeViewColumn* column = gtk_tree_view_get_column(tree_view_, column_index); - return gtk_tree_view_column_get_width(column); + return column ? gtk_tree_view_column_get_width(column) : -1; } void NativeTableGtk::SetColumnWidth(int column_index, int width) { |