Re: Menu groups vs. use of separators

2007-06-14 Thread Sven Neumann
Hi,

On Thu, 2007-06-14 at 03:26 +0100, Alex Jones wrote:

 I've been looking at how Rhythmbox allows plugins to manipulate menus
 (via UI manager magic), and it dawned on me that there is no way to
 separate these out visually, other than to attempt to guess whether
 there should be a separator placed above and/or below what you're trying
 to insert. Of course, what I really want GTK to do is to insert
 separators *between* groups of menu items. Having this kind of ability
 would greatly simplify much goofy logic that is currently in place in a
 lot of applications to decide where separators should be placed.

You can already do that using GtkUIManager. Your application should add
placeholders for the groups that you described. Then add separators
between the placeholders. Plug-ins can then register in the placeholder
items. The smart separators will only be shown when needed.


Sven


___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Menu groups vs. use of separators

2007-06-14 Thread Alex Jones
On Thu, 2007-06-14 at 08:15 +0200, Sven Neumann wrote:
 Hi,
 
 On Thu, 2007-06-14 at 03:26 +0100, Alex Jones wrote:
 
  I've been looking at how Rhythmbox allows plugins to manipulate menus
  (via UI manager magic), and it dawned on me that there is no way to
  separate these out visually, other than to attempt to guess whether
  there should be a separator placed above and/or below what you're trying
  to insert. Of course, what I really want GTK to do is to insert
  separators *between* groups of menu items. Having this kind of ability
  would greatly simplify much goofy logic that is currently in place in a
  lot of applications to decide where separators should be placed.
 
 You can already do that using GtkUIManager. Your application should add
 placeholders for the groups that you described. Then add separators
 between the placeholders. Plug-ins can then register in the placeholder
 items. The smart separators will only be shown when needed.

OK, but I need to know how many groups are needed here in advance. I'm
not sure this solves the problem, because when I go to programatically
add another group to the end of the list I have to decide whether there
is a separator already at the end or not.
-- 
Alex Jones
http://alex.weej.com/

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Menu groups vs. use of separators

2007-06-14 Thread Matthias Clasen
On 6/14/07, Alex Jones [EMAIL PROTECTED] wrote:
 On Thu, 2007-06-14 at 08:15 +0200, Sven Neumann wrote:
  Hi,
 
  On Thu, 2007-06-14 at 03:26 +0100, Alex Jones wrote:
 
   I've been looking at how Rhythmbox allows plugins to manipulate menus
   (via UI manager magic), and it dawned on me that there is no way to
   separate these out visually, other than to attempt to guess whether
   there should be a separator placed above and/or below what you're trying
   to insert. Of course, what I really want GTK to do is to insert
   separators *between* groups of menu items. Having this kind of ability
   would greatly simplify much goofy logic that is currently in place in a
   lot of applications to decide where separators should be placed.
 
  You can already do that using GtkUIManager. Your application should add
  placeholders for the groups that you described. Then add separators
  between the placeholders. Plug-ins can then register in the placeholder
  items. The smart separators will only be shown when needed.

 OK, but I need to know how many groups are needed here in advance. I'm
 not sure this solves the problem, because when I go to programatically
 add another group to the end of the list I have to decide whether there
 is a separator already at the end or not.
 --

That is the bit that smart separators save you from. They hide when
they end up next to the edge of the menu or next to another separator.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Menu groups vs. use of separators

2007-06-13 Thread Alex Jones
Hi list

I've been looking at how Rhythmbox allows plugins to manipulate menus
(via UI manager magic), and it dawned on me that there is no way to
separate these out visually, other than to attempt to guess whether
there should be a separator placed above and/or below what you're trying
to insert. Of course, what I really want GTK to do is to insert
separators *between* groups of menu items. Having this kind of ability
would greatly simplify much goofy logic that is currently in place in a
lot of applications to decide where separators should be placed.

I think it would make more sense for menus to implement groups (and
hence separation) in a similar fashion to submenus, and deprecate the
use of separators.

The implementation could even be implemented *as* submenus, but with a
flag set on the parent (e.g. flatten) to tell GTK whether to display
it as a single menu with separators between child menus. We could take
advantage of the inherent label a group (which is really just a submenu)
would have and incorporate it into the UI, or we could hide it. Either
way, it's probably useful for a11y. Here's an example for Ephy's
Bookmarks menu

File
Edit
View
Go
Bookmarks (flatten=true, labels_visible=false)
Bookmark Management
Add Bookmark...
Edit Bookmarks
Topics
Topic 1
Bookmark
Bookmark
Topic 2
Bookmark
Bookmark
Uncategorised
Bookmark
Bookmark
Tools
Tabs
Help

Sometimes separators are used very heavily, and implementation by
submenus might be tedious. Perhaps some API could help.

If I'm not clear somewhere, feel free to bounce back an email and I'll
try to clear it up.

Thoughts?
-- 
Alex Jones
http://alex.weej.com/

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list