Re: gtktoolbar - packed with invisible widgets ...

Michael Meeks <michael ximian com> writes:

> > If you aren't using CVS HEAD, and libbonoboui is still calling
> > gtk_container_set_border_width() on the toolbars, then you are seeing
> 	No; using CVS HEAD, just relying on a rather misleading description of
> the bug and a rather too quick code-read.

OK, but it is still a good idea to stop calling set_border_width().
GTK+ doesn't put tool items on top of the toolbar border anymore, and
actually since 2.0 gtk+ has (tried to) put the border outside the
toolbar shadow anyway.

> 	While questing for the reason why when I set my GtkToolItem insensitive
> - the popup/menu item remains sensitive (urk), I read the toggletool and
> toolbutton item's _create_menu_proxy code which is depressingly
> cut/paste - I guess unavoidably so.
> 	Anyhow - I was wondering, is gtk_tool_item_set_proxy_menu_item the
> right place to sort out state-synchronization wrt. insensitivity from
> toolitem -> menuitem ? and/or how about other state synchronisation.
> And/or may I commit this ? 

In general state changes is supposed to be handled by whoever created
the menu item. After creating a proxy menu item
gtk_tool_item_set_proxy_menu_item() should be called with the menu
item and an identifier that is unique to the caller.

Later, if something about the tool item changes, you (= the person who
created the proxy item) are supposed to call
gtk_tool_item_get_proxy_menu_item() passing in the same unique

If you get a menu item back, you should update it to reflect the
changes in the tool item. If you don't get one back, it is because
someone else has set a different proxy menu item. In that case, that
someone else is responsible for updating the menu item.

So that's why GtkToggleToolItem has this in its "toggled" handlere:

      if ((menu_item =
	   gtk_tool_item_get_proxy_menu_item (
                GTK_TOOL_ITEM (toggle_tool_button), MENU_ID)))
	  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),

The conditional ensures that it is possible to override the proxy menu
item and not have the GtkToggleToolItem messing around with menu items
it really doesn't know anything about.

So, what about sensitivity? To be in line with the above every item
should have special code that makes sure that that item's special menu
item has the right sensitivity. That's just too much hassle for too
little gain, so I think the best way is to simply:

        - have a ::notify default handler in GtkToolItem that checks
          if the "pspec->name" parameter is "sensitive" and if so,
          updates priv->menu_item (if non-NULL) accordingly.

        - in gtk_tool_item_set_proxy_menu_item() sets the sensitivity

(Note that the default notify handler in gtktoolbutton.c needs to be
 fixed to chain up to its parent).

> Also, may I commit the testtoolbar changes that add an insensitive
> item and split down the large options hbox making it difficult to
> test the pop-down ?

Yeah, go ahead and commit those.


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