Commit Graph

34 Commits

Author SHA1 Message Date
Giovanni Campagna
bfc7b98e1d PopupMenu: restore the arrow when fast closing the menu
When closing a submenu because the parent is closing, we skip the
animation, but we need to restore the arrow anyway.
2010-12-20 18:16:59 +01:00
Giovanni Campagna
6024b87d27 PopupMenu: handle submenus inline
Instead of showing submenus on the left side, make PopupSubMenuMenuItem
act like an expander. The sub menu is toggled on click, opened on
right/enter/space on the parent item, closed on left on any item
or when closing the parent menu.

https://bugzilla.gnome.org/show_bug.cgi?id=633476
2010-12-20 17:46:31 +01:00
Dan Winship
7eec8a899a popupMenu: Improve menu item layout
Mixing submenu menuitems and toggle menuitems results in poor layout.
The fix is to right-align the submenu arrows. Since we already need to
right-align the battery percentages as well, add alignment support to
PopupBaseMenuItem.addActor(), and update stuff for that.

Also remove the "column" param from addActor() since it hadn't
actually been implemented correctly before.

https://bugzilla.gnome.org/show_bug.cgi?id=633476
2010-12-16 09:01:24 -05:00
Giovanni Campagna
d5bfc503fe Sound Menu: only show the slider
Reimplement UI without any indication of percentage or mutedness,
and whitout switches. The only interaction point is slider, but
it still supports mute changing for applications that track it,
and will react appropriately to external changes.

https://bugzilla.gnome.org/show_bug.cgi?id=634329
2010-11-19 23:13:32 +01:00
Giovanni Campagna
0c5d87d79b PopupMenu: allow insertion of items at any point
Add a "position" argument to addMenuItem, and pass it to the
underlying box layout. If undefined or null, it adds at the end.
2010-11-16 20:42:53 +01:00
Owen W. Taylor
0e3431ac47 Use St.Icon for named icons
Switch from St.TextureCache.load_named_icon() to using St.Icon for named
icons. Along with the advantage of getting colorization right for symbolic
icons, this allows moving some icon sizes into the CSS.

In the CSS, the system status icon size is changed to be 1em (=16px for the
default font size), at the request of the artists. See bug 613448.

https://bugzilla.gnome.org/show_bug.cgi?id=633865
2010-11-12 17:36:26 -05:00
Giovanni Campagna
bff553e978 PopupSliderMenuItem: connect to scroll-event on the whole actor
Connect to scroll-event on .actor, not ._slider, so you can scroll
on the whole menu item.

https://bugzilla.gnome.org/show_bug.cgi?id=633668
2010-11-01 14:25:59 +01:00
Giovanni Campagna
a19e8d58f5 Do not remove destroyed actors from their container
The container already connects to destroy and will do that for us,
preventing a warning.

https://bugzilla.gnome.org/show_bug.cgi?id=633028
2010-10-29 20:05:32 +02:00
Dan Winship
548a23a969 PopupMenu: redo keynav using St.FocusManager
Each menu is a focus manager group, but there is also some explicit
focus handling between non-hierarchically-related widgets. Eg, to move
between menus, or from a menubutton into its menu.

https://bugzilla.gnome.org/show_bug.cgi?id=621671
2010-10-29 08:38:05 -04:00
Dan Winship
f365484a5c popupMenu: fix spacing between columns
This patch didn't get updated for the st_theme_node_get_spacing() change.
2010-10-28 14:03:45 -04:00
Dan Winship
e5dd86276d PopupSwitchMenuItem: don't misuse this.active
The constructor was setting this.active to reflect the switch state,
which is wrong; this.active indicates whether or not the item is
highlighted.

https://bugzilla.gnome.org/show_bug.cgi?id=621671
2010-10-26 10:16:03 -04:00
Dan Winship
9d94da83d7 statusMenu: show a radio button-style dot next to the presence status
Adding a "PopupMenuRadioButtonItem" wouldn't work well, because we'll
need radio-button indicators on multiple different styles of menu
item. Also, the current design draws the indicator in the menu item's
padding, so it's sort of special anyway. So just add support at the
BaseMenuItem level.

Also, redo the menu/menuitem padding so that all the horizontal
padding is in the menu item, or else the indicator dot will show up in
the wrong spot.

https://bugzilla.gnome.org/show_bug.cgi?id=631193
2010-10-25 17:04:30 -04:00
Dan Winship
5661946de1 popupMenu: make menu layout more table-like
When there are menu items with right-aligned items, all the
right-aligned items should appear to the right of all the left-aligned
items.

Clutter doesn't have an equivalent of GtkSizeGroup, so hack something up
using ShellGenericContainer and some javascript.

https://bugzilla.gnome.org/show_bug.cgi?id=631193
2010-10-25 17:01:10 -04:00
Dan Winship
86efdc906a PopupImageMenuItem: always show icon, on the right, not the left
In the new mockups, the user menu icons are on the right, not the
left.

Also, get rid of the idea of optional icons; the design doesn't have
icons on those items, and there probably aren't going to be symbolic
versions of some of those icons anyway. So if the caller specifies
PopupImageMenuItem, then always show an icon, and just use regular
PopupMenuItems for the items that don't have icons in the current
design.

https://bugzilla.gnome.org/show_bug.cgi?id=631193
2010-10-25 16:54:45 -04:00
Adel Gadllah
3dbee0b833 PopupSliderMenuItem: Implement mousewheel support
Allow changing the slider's value using the mousewheel.

https://bugzilla.gnome.org/show_bug.cgi?id=632743
2010-10-21 22:48:39 +02:00
Dan Winship
8886b7433c StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.

So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)

And update the code to use either the old or new methods as appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-10-21 15:02:33 -04:00
Giovanni Campagna
0547a582d1 Add volume indicator
Add volume control indicator which uses API from gnome-volume-control
to interact with PulseAudio and shows both input and output volumes.
Also adds a small wrapper around libcanberra in ShellGlobal, used by the
volume indicator to provide auditive feedback.

https://bugzilla.gnome.org/show_bug.cgi?id=629455
2010-10-20 16:59:12 +02:00
Maxim Ermilov
3efc7bf7f1 boxpointer: add setPosition method
split out this function from popupMenu
https://bugzilla.gnome.org/show_bug.cgi?id=624900
2010-10-19 23:23:05 +04:00
Maxim Ermilov
4d18d54d9d boxpointer: add animateDisappear/animateAppear methods
https://bugzilla.gnome.org/show_bug.cgi?id=624900
2010-10-19 23:23:00 +04:00
Giovanni Campagna
f336564e19 PopupMenu: add horizontal sliders
Introduce Cairo-drawn sliders to be used in PopupMenus (for example for
volume). They are stylable to some extent (colors, border width, slider
height) and have the standard behaviour of a slider, except they are
completely modal (once you start dragging, all events are intercepted by
the slider, which thus is kept active and highlighted at all times).
They show numeric values between 0 and 1 (scaling must be performed outside)
and emit value-changed on button release, but no activate, keeping the
menu open.

https://bugzilla.gnome.org/show_bug.cgi?id=625029
2010-10-01 15:18:36 -04:00
Giovanni Campagna
aebdf79430 Connect PopupMenuManager to destroy signal
PopupMenuManager now connects to the destroy signal of PopupMenu, so
that destroying a PopupMenu is now enough for removing it from the
relevant manager. Useful if menu come and go on-the-fly (like in
app views or sidebars).

https://bugzilla.gnome.org/show_bug.cgi?id=630914
2010-10-01 12:37:06 -04:00
Dan Winship
a6e4bab990 Add symbolic icons to TextureCache's load_icon_name()
Icons can be loaded as St.Icon.SYMBOLIC, FULLCOLOR, APPLICATION or
DOCUMENT. The first will look for a symbolic equivalent, the second
looks for a full-color version (and does fallback, eg, from
"drive-harddisk-usb" to "drive-harddisk"). APPLICATION and DOCUMENT do
full-color icons without fallback (as specified by the icon spec).

And update various callers to use the right flags.

Based on a patch from Matt Novenstern.

https://bugzilla.gnome.org/show_bug.cgi?id=621311
2010-09-24 10:57:27 -04:00
Dan Winship
d188a7b32a PopupSwitchMenuItem: use SVG switches
https://bugzilla.gnome.org/show_bug.cgi?id=629954
2010-09-22 11:12:31 -04:00
William Jon McCann
516fe49bb0 Style fixes for the popup menu
https://bugzilla.gnome.org/show_bug.cgi?id=629954
2010-09-20 17:20:58 -04:00
Giovanni Campagna
4e1de26a02 PopupMenu: Add support for submenus
Adds class PopupSubMenuMenuItem, which is an item holding a submenu,
that is opened when the corresponding item is active, and is keyboard
and mouse navigable like its Gtk counterpart.

https://bugzilla.gnome.org/show_bug.cgi?id=623498
2010-09-15 14:02:22 -04:00
Giovanni Campagna
b5ee89459a Support setting the image after construction
This patch allows the icon in PopupImageMenuItems to be changed at
any time, while preserving the item and all other properties (style,
signals) attached and without rebuilding the whole menu. This is useful
for images reflecting a dynamic status (e.g. cellular strength
indicator or battery level)

https://bugzilla.gnome.org/show_bug.cgi?id=623652
2010-09-15 13:34:28 -04:00
Giovanni Campagna
0c38f49dde Fix typo inside Switch class
Corrects setToogleState into setToggleState, slipped from 4dfc869e

https://bugzilla.gnome.org/show_bug.cgi?id=621880
2010-07-22 12:49:48 -04:00
Giovanni Campagna
4dfc869e9d Add support for toggle switches in menus
Adds class PopupSwitchMenuItem, which is a two-state switch similar
to those in system status indicators mockups. Also adds class Switch,
which represents the switch itself, in case it is useful somewhere
else.

https://bugzilla.gnome.org/show_bug.cgi?id=621880
2010-07-22 09:06:01 -04:00
Giovanni Campagna
d8df46d4a1 Enable insertion and removal of menus
This patch adds the method "removeMenu" to PopupMenuManager, to allow
for removal of menus after they're inserted. In order to do this, it
needs to store along with the menu all the relevant signal connections,
that are disconnected when the menu is removed.
Also adds a parameter "position" to "addMenu", so that menus can added
in arbitrary order (in particular to reintroduce those which were removed).
This patch is intended towards dynamic menu users, like extensions for
application lists, docks, sidebars showing recent documents or favourites,
as well as advanced system tray implementations.

https://bugzilla.gnome.org/show_bug.cgi?id=622730
2010-07-20 09:35:12 -04:00
Giovanni Campagna
4aa80105ca Fix possible property access on undefined object
PopupMenuManager allows the insertion of menu without a sourceActor
(or with a null one), but never checks before calling contains() on
it.

https://bugzilla.gnome.org/show_bug.cgi?id=622730
2010-07-20 09:35:12 -04:00
Florian Müllner
4632db177a Clean up unused includes
Some late spring cleaning ...
2010-07-19 01:46:01 +02:00
Adel Gadllah
a691192ffa [popupMenu] Fix wrong positioning when showing for the first time
We query the transformed position and size of the popupMenu before actually showing
it which results into wrong positioning, when displaying it for the first time.

In case of the statusMenu this can even result into it being offscreen.

https://bugzilla.gnome.org/show_bug.cgi?id=621385
2010-06-12 18:15:52 +02:00
Dan Winship
a4befeba53 De-duplicate "actor contains actor" code
Add _st_actor_contains() in st-private for use within St, and
monkey-patch in a Clutter.Actor.contains() for use by javascript, and
then replace all the duplicate implementations with one or the other
of those.

https://bugzilla.gnome.org/show_bug.cgi?id=621197
2010-06-11 10:05:46 -04:00
Dan Winship
7fbf8ae4c9 [popupMenu] split this out from panel.js
We want to use this menu style in other places as well

https://bugzilla.gnome.org/show_bug.cgi?id=619541
2010-06-10 15:04:42 -04:00