[Gtk-sharp-list] TreeView context menu.

Pokey the Penguin pokey@linuxmail.org
19 Feb 2003 20:26:21 +0000


On Thu, 2003-02-20 at 01:01, Lee Mallabone wrote:
> On Wed, 2003-02-19 at 12:42, George Farris wrote:
> > Well actually I've gotten a bit further since I emailed the list I have
> > a function that looks like so:
> > ..snip..			
> > 	if (book.Selection.GetSelected(out model, ref iter))
> > 	{
> > 		model.GetValue(iter, 1, value);
> > 	}
> > }
> > 
> > I'm just not clear on the whole "value" thing yet.  Any ideas?
> 
> This is a bug in the C# wrapper. The value argument should be an 'out'
> parameter, but it's been wrapped as a normal 'in' parameter.

Moreover, the original C implementation of this function is lacking.
Take a look at the prototype:

void        gtk_tree_model_get_value        (GtkTreeModel *tree_model,
                                             GtkTreeIter *iter,
                                             gint column,
                                             GValue *value);

The discovered iter really ought to be the return type of the function.
There's no sense in using an out parameter in this case. Bugs like these
should be reported to the Gtk+ bugzilla system and possibly worked
around in Gtk#.

To implement the workaround, it might be worthwhile doing a test in the
Gtk# code generator to identify methods with a signature like:

(out_parameter, not_an_out parameter, ...)

and automatically use the out parameter as the return type.

It's really a lot nicer to work with code like:

TreeIter iter = model.GetValue (1, value);

What do you think?