Re: When is a UIComponent hooked?
- From: Federico Mena Quintero <federico ximian com>
- To: Michael Meeks <michael ximian com>
- Cc: gnome-components-list gnome org
- Subject: Re: When is a UIComponent hooked?
- Date: Wed, 23 May 2001 17:39:23 -0500
Michael Meeks <michael ximian com> writes:
> On Mon, 21 May 2001, Federico Mena Quintero wrote:
> > Is there a way to know when a BonoboUIComponent gets connected to the
> > parent Bonobo_UIContainer? If I could get notification about this I
> > could set the sensitivity of my commands as soon as I can.
>
> AFAIK no, however a solution neutral problem statement would be
> good :-). Why is the container setting commands insensitive ? who
> initiates the state change ? why can the sensitivity change not be
> performed at the time of the user-initiated state change ? etc.
>
> It would be good to understand the problem before it gets
> forgotten and hacked around :-)
Okay, sorry if my question lacked context.
In the Evolution calendar I have the task list component, which embeds
itself as a control inside the Evolution shell. If zero tasks are
selected I want the Edit/Delete and toolbar/Delete items to be
insensitive; if one or more tasks are selected, I want them to be
enabled.
However, it seems that I can get notifications about changes in the
selection *before* the task list control binds itself to the parent
container. If I then call bonobo_ui_component_set_prop() before it is
hooked to its parent, I get warning spewage.
I had to fetch the container and test for it being non-NIL.
static void
selection_changed_cb (ETasks *tasks, int n_selected, gpointer data)
{
BonoboControl *control;
BonoboUIComponent *uic;
Bonobo_UIContainer ui_container;
control = BONOBO_CONTROL (data);
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
ui_container = bonobo_ui_component_get_container (uic);
if (ui_container == CORBA_OBJECT_NIL)
return;
bonobo_ui_component_set_prop (uic, "/commands/TasksDelete", "sensitive",
n_selected == 0 ? "0" : "1",
NULL);
}
but that sucks.
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]