[Gtk-sharp-list] Help needed.

Todd Berman tberman@off.net
Wed, 09 Mar 2005 19:09:42 -0800


On Wed, 2005-03-09 at 23:24 +0100, Fredrik Nilsson wrote:
>Hi,
>
>I'm trying to port e-sidebar from evolution to Gtk#.
>Have ported most of the code but having problem with the following
>method that overrides container_class->forall :
>
>
>static void
>impl_forall (GtkContainer *container,
>	     gboolean include_internals,
>	     GtkCallback callback,
>	     void *callback_data)
>{
>	ESidebar *sidebar = E_SIDEBAR (container);
>	GSList *p;
>
>	if (sidebar->priv->selection_widget != NULL)
>		(* callback) (sidebar->priv->selection_widget, callback_data);
>
>	for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
>		GtkWidget *widget = ((Button *) p->data)->button_widget;
>		(* callback) (widget, callback_data);
>	}
>}
>


In this example you want to do:

protected override void ForAll (bool include_internals, CallbackInvoker
invoker)
{
	if (selection_widget != null)
		invoker.Invoke (selection_widget);

	foreach (Widget button in buttons)
	{
		invoker.Invoke (button);
	}
}

--Todd