Re: GtkTree*



On Wed, Oct 04, 2000 at 09:08:12PM -0400, jrb redhat com wrote:
> I just committed the new GtkTree class of widgets to CVS.  It should be
> useable at a basic level now, and I'd love some "real-world" API
> feedback if anyone would like to play with it.

This isn't real-world feedback, yet (sorry I didn't comment on this
before the checking, but I was a bit busy at the time), but it looks as
if you can add a column to a view, but not remove a column from a view;
could "gtk_tree_view_remove_column()" be added, e.g.:

gint
gtk_tree_view_remove_column (GtkTreeView   *tree_view,
			     GtkTreeViewColumn *column)
{
  g_return_val_if_fail (tree_view != NULL, -1);
  g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
  g_return_val_if_fail (column != NULL, -1);
  g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
  g_return_val_if_fail (column->tree_view == NULL, -1);

  tree_view->priv->column = g_list_remove (tree_view->priv->column,
					   column);
  return tree_view->priv->columns--;
}

I might also be tempted to rename "gtk_tree_view_add_column()" to
"gtk_tree_view_append_column()", and also add
"gtk_tree_view_insert_column()":

gint
gtk_tree_view_insert_column (GtkTreeView   *tree_view,
			     GtkTreeViewColumn *column,
			     gint position)
{
  g_return_val_if_fail (tree_view != NULL, -1);
  g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
  g_return_val_if_fail (column != NULL, -1);
  g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
  g_return_val_if_fail (column->tree_view == NULL, -1);

  tree_view->priv->column = g_list_insert (tree_view->priv->column,
					   column, position);
  column->tree_view = GTK_WIDGET (tree_view);
  return tree_view->priv->columns++;
}

In Ethereal, for example, this would let you add new columns to the
packet summary display other than on the right-hand edge (I'm assuming,
perhaps incorrectly, that the list of columns in
"tree_view->priv->column" goes from left to right), and remove columns
from the packet summary display, without Ethereal having to destroy the
view and reconstruct it (or have I missed a way to do that?).

(One could also imagine allowing the user to move columns around by
dragging them - Microsoft's Network Monitor lets you do that in its
packet summary display.)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]