Commit Graph

66 Commits

Author SHA1 Message Date
Ray Strode
13bf64a53d popupMenu: Use new convenience method for settings
All the system status menus in the panel offer a
menu item to jump to a relevant part of the
control-center.

This means each status icon has the same, or nearly the
same bit of code to:

- Add a new "action" menu item and listen for its activation.
- Hide the overview if it's showing when the menu item is activated
- Find the relevant control-center panel from its desktop file
- Launch the control-center to the relevant panel

This commit consolidates all those details in a new method,
addSettingsAction.  This refactoring reduces code duplication and
slight inconsistencies in the code resulting from that duplication.
It will also make it easier in subsequent commits to hide settings menu
items when the shell is used in the login screen.

https://bugzilla.gnome.org/show_bug.cgi?id=657082
2011-08-28 12:16:04 -04:00
Ray Strode
f96b2ee858 popupMenu: Hide separators when they aren't separating
A separator only makes sense if there are items on both
sides of it. There is quite a lot of code written
throughout the shell that manages the process of showing
and hiding separators as the items around those separators
change.

This commit drops all that code in favor of changes to the menu
implementation to dynamically hide or show separators as
appropriate, so the callers don't have to deal with it.

https://bugzilla.gnome.org/show_bug.cgi?id=657082
2011-08-28 12:15:17 -04:00
Dan Winship
2403fd0680 panelMenu: add a gap between the panel and its menus
The specs call for a 2 pixel gap between the panel and its menus,
though we need to specify this as 4 pixels, since it's relative to the
bottom of the icon/title, not the bottom of the panel (up until now,
the point of the menu arrow was actually overlapping the menu's
highlight underline).

Also, move the gap specification into the CSS, since it makes more
sense there.

https://bugzilla.gnome.org/show_bug.cgi?id=655627
2011-08-01 11:48:02 -04:00
Rui Matos
d894dedaf6 Revert "volume.js: make slider menu items activatable"
This reverts commit a50c30a4fd.
2011-07-20 00:45:29 +01:00
Rui Matos
a50c30a4fd volume.js: make slider menu items activatable
Keeping the volume menu open after setting the desired volume isn't that
useful and forces a second click (or an Esc press) to dismiss it. Allow for
the sliders to be used with a single click-hold-move-release.

https://bugzilla.gnome.org/show_bug.cgi?id=649586
2011-07-20 00:25:11 +01:00
Giovanni Campagna
5819dd3a5a NetworkMenu: take out an item from More... when another is destroyed
When one of the networks in the main menu is removed and we have
a More... submenu, we can take the first out from the submenu and
show it in the main menu.

https://bugzilla.gnome.org/show_bug.cgi?id=647175
2011-07-13 01:33:47 +02:00
Marc-Antoine Perennou
6d53d43766 PopupSwitchMenuItem: don't override switch by creating it twice
Due to an accidental addition line in commit c8670819, all switches in popup
menus accidentally gave the appearance that they were turned off.

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>

https://bugzilla.gnome.org/show_bug.cgi?id=654267
2011-07-09 19:26:24 -04:00
Giovanni Campagna
c8670819dc PopupMenu: enhance PopupSwitchMenuItem to show status labels
Moves and converts NMDeviceTitleMenuItem from network.js into
PopupSwitchMenuItem, so that it can show both a switch and a
greyed-out status label. This will be soon used by the Bluetooth menu.

https://bugzilla.gnome.org/show_bug.cgi?id=648048
2011-06-27 17:21:38 +02:00
Dan Winship
898b2b903d environment: put gettext stuff into global environment
Rather than defining _() as a local function in every module, put it
into the global environment (along with C_() and ngettext()).

https://bugzilla.gnome.org/show_bug.cgi?id=649203
2011-05-16 14:57:21 -04:00
Giovanni Campagna
d104f9210a PopupSliderMenuItem: intercept clicks outside the slider
Connect to button-press-event on the menu item actor, not on the
slider, so any part that is highlighted is also clicked. This means
that click on the left of the volume slider is a rapid way to mute.

https://bugzilla.gnome.org/show_bug.cgi?id=646660
2011-04-26 15:40:51 +02:00
Giovanni Campagna
625a4c0766 NetworkMenu: destroy More... submenu when empty
Add a .length property to PopupMenuBase, and use it from the network
menu to destroy the menu when removing a network without rebuilding.

https://bugzilla.gnome.org/show_bug.cgi?id=645981
2011-04-11 10:38:00 -04:00
Florian Müllner
d25418ba04 popup-sub-menu: Adjust scrollbar style
Slightly adjust the style, so that scrollbars in submenus look
slightly less disconnected from the scrolled content.

https://bugzilla.gnome.org/show_bug.cgi?id=646001
2011-04-04 15:54:26 -04:00
Owen W. Taylor
50951d15ea popupMenu: make submenus scrollable if needed
Right now, the network menu will overflow the screen if More...
is selected with many access points. As a short-term workaround
for this, add a scrollbar for submenus of panel dropdown menus
if they would cause the toplevel menu to overflow the screen.

- Put the actors in a PopupSubMenu in a StScrollView so we get
  a scrollbar if the allocated space is smaller than the height
  of the menu. Expand animation is turned off in the scrolled case
  to avoid weirdness.
- When we pop up a panel menu, set a max-height style property
  on the panel menu to limit it to the height of the screen.
- Hack event handling while the scrollbar is dragged to make
  the scrollbar work properly.

https://bugzilla.gnome.org/show_bug.cgi?id=646001
2011-04-04 15:46:46 -04:00
Owen W. Taylor
82e2ab89c5 Fix expand animation for submenus
Figuring out the size of an unmapped actor is not completely
reliable because styles aren't fully assigned until an actor
is mapped. So show the submenu before computing the size we
want to tween to.

https://bugzilla.gnome.org/show_bug.cgi?id=645949
2011-04-04 08:23:37 -04:00
Owen W. Taylor
3bbdecc6b3 popupMenu: round spacing to an integer
StThemeNode.get_length() doesn't necessarily return an integer pixel
value, and our code produces non-integer positions in that case. So
round the spacing.

https://bugzilla.gnome.org/show_bug.cgi?id=645647
2011-03-25 18:55:40 -04:00
Dan Winship
924b31233b popupMenu: fix relayout after submenu open/close
Because of the GtkSizeGroup-like trickiness we're doing with
PopupMenuItems, we need to force Clutter to discard its cached size
requests for them any time the menu itself changes size.

https://bugzilla.gnome.org/show_bug.cgi?id=645647
2011-03-25 18:55:06 -04:00
Giovanni Campagna
cbd187369e PopupMenu: invert the menu when in RTL locales
Change the way menu items allocate their contents to take text
direction into account, so they're fully reversed in RTL locales,
and St.Align.START / END are respected.

https://bugzilla.gnome.org/show_bug.cgi?id=645524
2011-03-22 18:26:18 +01:00
Owen W. Taylor
bea2d40f79 popupMenu: Add the ability to block sending events to the source actor
It can be useful to avoid sending enter/leave events to the source actor
of a menu: this would be the case when the source actor isn't a menu item
that should participate in menu navigation but rather is some object
(like an app icon) that we want to indicate corresponds to the menu.

https://bugzilla.gnome.org/show_bug.cgi?id=642871
2011-03-22 12:38:25 -04:00
Dan Winship
e375e1789b popupMenu: don't include hidden items in the width computation
https://bugzilla.gnome.org/show_bug.cgi?id=621707
2011-03-14 09:28:06 -04:00
Adel Gadllah
3466829766 popupMenu: Restyle the slider to use a color for the 'active' area
In the mockups the slider does not have an uniform color but uses
one color (shade of blue) to indicate the current value and one
to indicate "the rest" (shade of grey).

So adjust the slider to look like that to be closer to the look
in the mockups and thus to the design.

https://bugzilla.gnome.org/show_bug.cgi?id=644600
2011-03-13 19:33:03 +01:00
Hellyna Ng
868bf5838d MessageTray: add right click menu for summary items
This provides straight forward controls for opening the corresponding
application or removing the summary item.

https://bugzilla.gnome.org/show_bug.cgi?id=617224
2011-03-07 11:14:11 -05:00
Dan Winship
ef6cce8988 popupMenu, panelMenu: split up panel and non-panel keynav
PopupMenuManager was pretending that it knew nothing about the menu's
sourceActors, while also trying to handle keynav between them. This
was a big mess, and resulted in bugs in navigation between panel menus
and the Activities button, and it totally gets in the way when trying
to add keynav to the dash (whose menu sources are arranged vertically
rather than horizontally).

Fix this up by moving the panel-specific parts to PanelMenuButton
instead.

https://bugzilla.gnome.org/show_bug.cgi?id=641253
2011-03-07 10:57:45 -05:00
Giovanni Campagna
b9cb37da5e PopupMenuManager: don't throw exceptions if don't have focus
stage.key_focus can be null, but passing null to _activeMenuContains
throws (from gjs marshalling). In that case, just assume it returned
false.

https://bugzilla.gnome.org/show_bug.cgi?id=642976
2011-03-02 16:30:38 +01:00
Ray Strode
610c2b5987 popupMenu: add alternate menu item
This is special menu item that can alternate
between two choices when you hit the alt key.

It will be useful for getting a hybrid
suspend/power off menu item.

https://bugzilla.gnome.org/show_bug.cgi?id=636680
2011-02-22 18:46:57 -05:00
Giovanni Campagna
f34ce9271c PopupMenu: introduce PopupMenuSection
Complex popup menus require the ability to manager sequences of items
as "sections", to which you can add and and remove items, as well
as hide and show.
PopupMenuSection does exactly that, leveraging the existing machinery
for submenus, but without being exposed as a submenu to the user.
Also, make getMenuItems() private, since it is used for different things
now and may change semantics in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=621707
2011-02-21 19:54:10 +01:00
Giovanni Campagna
6e236546ea PopupMenu: make parameters overridable in items
Make all subclasses of PopupMenuBase accept a params argument, which
can be used to make the item non reactive, not responsive to hover
and, as a new feature, with a different style class.

https://bugzilla.gnome.org/show_bug.cgi?id=621707
2011-02-21 19:54:10 +01:00
Dan Winship
1224e959b6 StThemeNode: use (out caller-allocates) on ClutterColor-returning methods
Properly annotate the themenode methods that return ClutterColors, and
update their JS callers to take advantage of that.

https://bugzilla.gnome.org/show_bug.cgi?id=642295
2011-02-14 10:49:26 -05:00
Dan Winship
5eb28e162f popupMenu: minor code rearrangement
Move the Switch class to right before PopupSwitchMenuItem (and add
some missing semicolons).
2011-02-08 16:08:50 -05:00
Giovanni Campagna
4de15b2b57 PopupMenuManager: only navigate visible menus
When doing keyboard navigation, ignore menus whose sourceActor is
hidden.
This is needed to hide status icons, as otherwise the menu would
appear despite having no icon.

https://bugzilla.gnome.org/show_bug.cgi?id=638306
2011-01-06 19:54:28 +01:00
Giovanni Campagna
493844d005 PopupMenu: fix addMenuItem with explicit position
Only real menu items should be considered, fix this using the new
API in StBoxLayout.

https://bugzilla.gnome.org/show_bug.cgi?id=637681
2011-01-06 19:50:53 +01:00
Dan Winship
1694148bdb popupMenu: don't animate menus when switching from one to another
Don't do the "slide" effect when moving from one menu to another; only
do it when opening the first menu, or closing a menu without opening
another one.

https://bugzilla.gnome.org/show_bug.cgi?id=634755
2010-12-21 17:11:38 -05:00
Dan Winship
f326595202 popupMenu: fix up grab/ungrab handling
Fix the panel menus to avoid unnecessarily bouncing out of modal (bug
634194) and to do a better job of keeping the keyboard focus in the
right place

https://bugzilla.gnome.org/show_bug.cgi?id=618885
2010-12-20 17:43:00 -05:00
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