Commit Graph

196 Commits

Author SHA1 Message Date
Jasper St. Pierre
d2103995cb popupMenu: Remove some now-unused code
We don't have any sections with separators, so don't bother
tracking them.

https://bugzilla.gnome.org/show_bug.cgi?id=698427
2013-04-23 15:50:36 -04:00
Jasper St. Pierre
196fb0f16e popupMenu: Add and use GtkMenuTracker to build the remote menu
This simplifies the code required to build remote menus and
put all the items in the right place, and makes us share our
implementation with GTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=698427
2013-04-23 15:50:36 -04:00
Jasper St. Pierre
c0afe7260a popupMenu: Create and insert menu items that don't have actions yet
Instead of recreating the entire model, which can be expensive... but
keep them insensitive for now. This also matches what GTK+ does.

https://bugzilla.gnome.org/show_bug.cgi?id=698427
2013-04-23 15:50:36 -04:00
Jasper St. Pierre
099c8703ae popupMenu: Always use a PopupMenuItem
By this point, we'll know we'll always have a PopupMenuItem.

https://bugzilla.gnome.org/show_bug.cgi?id=698427
2013-04-23 15:50:36 -04:00
Jasper St. Pierre
b03e480dbf popupMenu: Use a checkmark for boolean items
This matches GTK+'s styling, and it makes most boolean switches
look more natural, as a lot of booleans are not meant for hardware
switches.

https://bugzilla.gnome.org/show_bug.cgi?id=698427
2013-04-23 15:50:36 -04:00
Jasper St. Pierre
8430353389 popupMenu: Add a check ornament
This will be used to replace switches in the remote menu

https://bugzilla.gnome.org/show_bug.cgi?id=698427
2013-04-23 15:50:36 -04:00
Jasper St. Pierre
a123ec94ef popupMenu: Use a unicode character for the ornament
This makes it easy to replace the dot with another label in the future.
Change the allocation logic, as text layout is more complicated than
simple icon logic.

https://bugzilla.gnome.org/show_bug.cgi?id=698427
2013-04-23 15:50:36 -04:00
Jasper St. Pierre
4a2f54f6ff popupMenu: Define the dot next to the menu as an "ornament"
We want to remove switches in remote menus, so make way for
a checkmark ornament for the popup menu item.

https://bugzilla.gnome.org/show_bug.cgi?id=698427
2013-04-23 15:35:55 -04:00
Ray Strode
77d3712261 popupMenu: close menu on destroy
This fixes a crash if a background menu is open
and the background changes.

https://bugzilla.gnome.org/show_bug.cgi?id=697432
2013-04-06 10:47:16 -04:00
Jasper St. Pierre
6fd5f0e3de popupMenu: Fix another child popup regression
When switching menus, we need to make sure we close all existing
grabs, not just the first one.

https://bugzilla.gnome.org/show_bug.cgi?id=695859
2013-03-27 16:32:42 -04:00
Jasper St. Pierre
e6469df065 popupMenu: Fix a missed rename
this._activeMenu was changed to this.activeMenu, but this wasn't
updated by accident.

https://bugzilla.gnome.org/show_bug.cgi?id=695859
2013-03-27 16:32:42 -04:00
Jasper St. Pierre
809295c03d popupMenu: Close all child menus when the main menu is closed
Otherwise, if something managed to call close(), it wouldn't
close any child menus.

https://bugzilla.gnome.org/show_bug.cgi?id=693572
2013-02-18 13:31:15 -05:00
Jasper St. Pierre
c9783b38c4 popupMenu: Move child menus to be a PopupMenu-only thing
It doesn't make sense for combo menus, sections, or submenus
to have child menus.

https://bugzilla.gnome.org/show_bug.cgi?id=693572
2013-02-18 13:31:15 -05:00
Jasper St. Pierre
44e4cbf04a popupMenu: Remove support for nested combo boxes
I'm sure this was originally a testcase for nested child
menus, and we never actually inteded any support for this.

https://bugzilla.gnome.org/show_bug.cgi?id=693572
2013-02-18 13:31:15 -05:00
Jasper St. Pierre
30179bb60d popupMenu: Treat a menu will all invisible menu items as empty
As an example, a menu that has only settings actions might
be "empty" if allowSettings is false.

https://bugzilla.gnome.org/show_bug.cgi?id=681540
2013-02-14 18:16:21 -05:00
Jasper St. Pierre
5d1de33026 Use the standard apps tree for gnome-control-center panels desktop files
gnome-control-center is planning on removing its own tree in the
future. Since it already installs these applications into
/usr/share/applications, just use this for now.

https://bugzilla.gnome.org/show_bug.cgi?id=692483
2013-01-26 19:56:01 -05:00
Jasper St. Pierre
9548cd8341 js: Explicitly dispose all cairo contexts
Due to limitations and bugs in SpiderMonkey's GC, wrapper objects
for cairo contexts and similar may not get cleaned up immediately
after repainting, leading to leaking memory. Explicitly disposing
of such objects after they're not needed can clean up large portions
of memory for cairo surfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=685513
2013-01-08 13:07:51 -05:00
Jasper St. Pierre
8d4855f100 volume: Add smooth scrolling to adjust output volume
Allow users to smoothly scroll on the volume indicator icon
to adjust the volume. Do this by simply passing the scroll
event to the slider inside the menu.

https://bugzilla.gnome.org/show_bug.cgi?id=687573
2012-12-20 08:40:04 -05:00
Jasper St. Pierre
7d4e14f384 popupMenu: Add smooth scrolling support for sliders
Allowing smooth scrolling on the Y axis to accurately adjust the value
of the slider.

https://bugzilla.gnome.org/show_bug.cgi?id=687573
2012-12-20 08:40:04 -05:00
Tanner Doshier
b48a7d5cfd popupMenu: Break separator drawing code out of PopupSeparatorMenuItem
And into a separate HorizontalSeparatorClass.

https://bugzilla.gnome.org/show_bug.cgi?id=681797
2012-12-10 16:50:53 -05:00
Jasper St. Pierre
b42af9aa99 popupMenu: Don't slide menus when we're changing them
As calling close() will drop the grab, we were inadverdently
re-closing menus, causing them to re-animate with a full animation.

https://bugzilla.gnome.org/show_bug.cgi?id=689954
2012-12-10 14:38:07 -05:00
Jasper St. Pierre
ca2ee22827 popupMenu: Display the proper animations for popup menus
BoxPointer's API changed to take a BoxPointer.PopupAnimation
enumeration value, but the code was accidentally replaced with
older code when porting the PopupMenuManager code to GrabHelper.

https://bugzilla.gnome.org/show_bug.cgi?id=689954
2012-12-10 14:38:07 -05:00
Jasper St. Pierre
13a2b28bf1 popupMenu: Complete the dummy fake menu
"toggle" is used when clicking on the source actor. As we don't
actually have a menu, we don't want to actually take any grabs
through the menu system, so make it a no-op rather than have it
toggle the menu state.

https://bugzilla.gnome.org/show_bug.cgi?id=689954
2012-12-10 14:38:06 -05:00
Jasper St. Pierre
fc9a96ac85 popupMenu: Introduce PopupDummyMenu
This is designed for things like the activities button that sort of
need a menu to make navigation work, but not really have it do anything.

https://bugzilla.gnome.org/show_bug.cgi?id=689109
2012-12-07 19:55:28 -05:00
Jasper St. Pierre
9dfc3af9d7 popupMenu: Port to GrabHelper
https://bugzilla.gnome.org/show_bug.cgi?id=689109
2012-12-07 19:55:28 -05:00
Florian Müllner
98b313c75f popupMenu: Overwrite ongoing animations when calling close repeatedly
Currently close() is a no-op when the menu has already been closed.
However, repeated calls could pass different animation parameters.
For instance in the user menu, we try to hide the menu immediately
before locking the screen, to avoid the popup jumping across the
screen while fading out - as we do this from the corresponding
item's activate handler, the closing is still animated if the menu's
own handler (which requests a full animation) is run first.
Fix this by changing close() to overwrite ongoing animations before
bailing out early.

https://bugzilla.gnome.org/show_bug.cgi?id=686484
2012-10-23 22:21:45 +02:00
Florian Müllner
e8ebe4de14 popupMenu: Set initial visibility of settings items
With the recent session mode changes, the visibility of settings
items is now only set on sessionMode::updated - while the signal
is emitted when the session mode is initialized, settings items
that are added after that are visible regardless of the allowSettings
setting until the next sessionMode::updated signal is received.
Fix this by explicitly setting the initial visibility of settings
items.

https://bugzilla.gnome.org/show_bug.cgi?id=684473
2012-09-20 20:04:05 +02:00
Giovanni Campagna
7499b04638 Fix insensitive styling for popup menu items
The selector for insensitive popup menu items was wrong (a PopupMenuItem is
a ShellGenericContainer, not a StButton). Fixing it showed that previous
:insensitive tracking was manual for a reason: we have many items that are
not reactive, but don't want the insensitive styling (for example those in
the battery menu).
Fix it by adding a new style-class, popup-inactive-menu-item, that is added
to all new PopupMenuItems that are not activatable.

https://bugzilla.gnome.org/show_bug.cgi?id=683988
2012-09-13 23:48:17 +02:00
Florian Müllner
2ed28211ed popupMenu: Don't always ignore SubMenu children in width requests
Hidden children are currently ignored in width requests; in the
case of submenu items, this results in abrupt width changes of
open menus when the corresponding SubMenuMenuItem is toggled.
To fix, only ignore SubMenu children when the corresponding
SubMenuMenuItem is hidden as well.

https://bugzilla.gnome.org/show_bug.cgi?id=683485
2012-09-06 13:56:44 +02:00
Florian Müllner
58477282fe popupSubMenu: Only remove padding when scrollbar is shown
The special padding rules for submenu items currently ensure that
content aligns properly when the scrollbar is shown. While they
work nicely for the network menu, it looks odd for non-scrolled
submenus, so make this case explicit by introducing a :scrolled
pseudo class and adjust the style rules to use it.

https://bugzilla.gnome.org/show_bug.cgi?id=683009
2012-09-06 13:56:44 +02:00
Jasper St. Pierre
ca2e09fe8b sessionMode: Allow changing the session mode at runtime
Since we eventually want to add a system for changing the top panel
contents depending on the current state of the shell, let's use the
"session mode" feature for this, and add a mechanism for updating the
session mode at runtime. Add support for every key besides the two
functional keys, and make all the components update automatically when the
session mode is changed. Add a new lock-screen mode, and make the lock
screen change to this when locked.

https://bugzilla.gnome.org/show_bug.cgi?id=683156
2012-09-04 18:42:44 -03:00
Giovanni Campagna
04d1a35cb5 PopupMenu: propagate all open-state-changed down to PopupMenuSection
PopupMenuBase relies on open-state-changed to update the separator
visibility, but PopupMenuSection were only emitting when the parent
closed, so the first time the menu was opened, separator visiblity was
wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=682998
2012-08-30 01:10:47 +02:00
Jasper St. Pierre
8a86540090 Revert the other half of "St: don't attempt to give focus to non reactive actors"
This reverts commit 26d3b1929e.

https://bugzilla.gnome.org/show_bug.cgi?id=667439
2012-08-26 11:56:45 -03:00
Alejandro Piñeiro
8ebd2ff9eb a11y: adding a proper state for menu items with a dot
https://bugzilla.gnome.org/show_bug.cgi?id=682366
2012-08-21 18:17:21 +02:00
Dan Winship
c540cb5e16 st-scroll-bar: use clutter_grab_pointer()
StScrollBar was intercepting motion events by using captured-event on
the stage, which required additional dirty tricks, which required
additional hacks. Simplify it by just using clutter_grab_pointer()
instead.

https://bugzilla.gnome.org/show_bug.cgi?id=671001
2012-08-19 18:41:51 -04:00
Alejandro Piñeiro
dafa27fccd a11y: can_focus=!reactive as a general rule is not true anymore
In some cases can_focus value is taken directly as
!reactive. But this is not the case anymore, as
we are interested on navigate on non reactive items

https://bugzilla.gnome.org/show_bug.cgi?id=667439
2012-08-17 17:32:52 +02:00
Jasper St. Pierre
414fe75d02 st-widget: Move reactivity tracking to StWidget, use "insensitive"
This lets use remove another few pieces of code that do the tracking
manually.

https://bugzilla.gnome.org/show_bug.cgi?id=680426
2012-07-24 06:11:21 -03:00
Giovanni Campagna
c3afe1a83a Show the panel above the screenshield when locked
Track locked status and use it to provide a reduced version of
the panel in the locked screen. Accessibility, input sources and
volume menus are preserved, without the link to the control center.
Network, battery and user menu are reduced to pure indicators,
with no menu.
This is similar to the design but not exactly, because designers
in IRC said that network needs more analysis before exposing, and
because the design didn't account for a11y and IM (so the one menu
metaphor is not really appropriate).

https://bugzilla.gnome.org/show_bug.cgi?id=619955
2012-07-21 15:40:28 +02:00
Giovanni Campagna
26d3b1929e St: don't attempt to give focus to non reactive actors
Non reactive actors don't expect to be interacted with, and thus
should not get keyboard focus.

https://bugzilla.gnome.org/show_bug.cgi?id=619955
2012-07-21 15:40:28 +02:00
Rui Matos
cf6f149888 boxpointer: Change 'animate' parameter on show/hide to a bitmask
This allows us to have more control of the animation.

https://bugzilla.gnome.org/show_bug.cgi?id=678337
2012-07-06 16:04:42 +02:00
Jasper St. Pierre
c9296191a8 js: Remove unnecessary versions of clutter_actor_get_children
clutter_actor_get_children requires making a temporary GSList from
a linked list structure, and then creating a JS Array from that GSList.
For simple cases like the number of children, use clutter_actor_get_n_children.

https://bugzilla.gnome.org/show_bug.cgi?id=677426
2012-06-11 13:10:25 -04:00
Alban Browaeys
f850e92524 popupMenu: do not overflow the currentItems
Do not overflow currentItems array. If the Menu section is filled
via model items-changed callback the position in the model passed to
the RemoteMenu _modelChanged can be a to be added asynchronously
action-added. Thus the item does not yet exists in the currentItems.

https://bugzilla.gnome.org/show_bug.cgi?id=676447
2012-06-05 16:28:40 +02:00
Alban Browaeys
cc9d53e038 popupMenu: bypass changeSignal callback if action is already handled
https://bugzilla.gnome.org/show_bug.cgi?id=676447
2012-06-05 16:28:40 +02:00
Florian Müllner
a3fcb8c284 sessionMode: Add allowSettings property
Add a sessionMode.allowSettings property, which determines whether
menus in the top bar should allow access to System Settings or not.

https://bugzilla.gnome.org/show_bug.cgi?id=676156
2012-05-22 19:42:28 +02:00
Florian Müllner
3d26224180 Delegate mode information to a dedicated object
Rather than accessing global.session_type / global.session_mode
all over the place, delegate mode information to a dedicated
sessionMode object. While not very useful for now, we will replace
checks for a particular mode with checks for particular properties
that sessionMode defines based on global.session_mode.

https://bugzilla.gnome.org/show_bug.cgi?id=676156
2012-05-22 19:42:27 +02:00
Florian Müllner
43fd29f9bf Revert "popupMenu: Fix RemoteMenu items with boolean state action"
This reverts commit 7293ddb22c.
2012-04-29 10:38:52 +02:00
Florian Müllner
7293ddb22c popupMenu: Fix RemoteMenu items with boolean state action
Stateful actions are expected to pass their state when activated,
but we currently only do this for actions with a string state.

https://bugzilla.gnome.org/show_bug.cgi?id=674932
2012-04-27 12:30:16 +02:00
Stefano Facchini
3422e1dca7 popupMenu: make sure to break the grab when the slider is not visible
Otherwise the grab will persist for example after closing the PopupMenu
with Escape.

https://bugzilla.gnome.org/show_bug.cgi?id=672713
2012-04-24 22:37:19 +02:00
Alejandro Piñeiro
c2fdec188e a11y: adding checked state on the popup menu items
https://bugzilla.gnome.org/show_bug.cgi?id=668366
2012-03-15 20:04:28 +01:00
Alejandro Piñeiro
06354a8c9a a11y: userMenu: support for IMStatus combobox and
suspend/power-off label

https://bugzilla.gnome.org/show_bug.cgi?id=671404
2012-03-15 19:04:54 +01:00
Alejandro Piñeiro
7c25dead17 a11y: Setting role on several panel ui elements
https://bugzilla.gnome.org/show_bug.cgi?id=667432
2012-03-15 18:58:44 +01:00
Jasper St. Pierre
15f881f967 st: Remove custom text direction stuff
Clutter has its own built-in system for managing text directions, like GTK+.
Convert over to use this.

https://bugzilla.gnome.org/show_bug.cgi?id=670034
2012-02-28 08:14:06 -05:00
Jasper St. Pierre
a8b081661c st-box-layout: Remove insert_actor/insert_before
Now that 'insert_child_at_index' and 'insert_child_below' exist
on ClutterActor, these aren't necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=670034
2012-02-22 17:00:44 -05:00
Giovanni Campagna
ee6bc33cea PopupSwitchMenuItem: allow toggling without closing the menu
Similar to what Gtk does, now toggling with Space does not close
the menu.

https://bugzilla.gnome.org/show_bug.cgi?id=664416
2012-02-06 16:49:15 +01:00
Florian Müllner
55308917f9 popup-menu: Do not open empty menus
There is little point in showing an empty menu, so return early from
open() if the menu does not contain any items.

https://bugzilla.gnome.org/show_bug.cgi?id=643867
2012-01-27 13:32:43 +01:00
Alejandro Piñeiro
74dd298891 a11y: Setting a name/label_actor for several items on the panel
https://bugzilla.gnome.org/show_bug.cgi?id=667376
2012-01-27 12:29:52 +01:00
Giovanni Campagna
b087191d2b RemoteMenu: add support for section labels
According to the GIO docs, sections can have labels too. We support
them by inserting a non reactive menu item at the beginning of the
section. This item is specially flagged to be ignored while processing
changed signals from the model (since it does not correspond to any
model item)

https://bugzilla.gnome.org/show_bug.cgi?id=666681
2012-01-16 19:29:50 +01:00
Giovanni Campagna
a7bd9f811b PopupMenu: disconnect from 'destroy' signals of destroyed items
After an item is destroyed, all its signals were disconnected,
except for 'destroy' itself. This could lead to exceptions, if
destroy was called more than once on the item.

https://bugzilla.gnome.org/show_bug.cgi?id=665680
2011-12-22 18:00:52 +01:00
Matthias Clasen
4aa1fe9ca2 Another update for GLib API changes
GDBusActionGroup api has changed again, adapt to that.
Also, use a GActionMuxer to add the 'app.' prefix to actions,
instead of manually stripping it out of the action names.
In the future, the muxer will also contain per-window actions
with a 'win.' prefix.
2011-12-20 17:36:59 -05:00
Colin Walters
8a029f333f popupMenu: Remove app. from app actions 2011-12-20 17:36:59 -05:00
Giovanni Campagna
4debedb275 Application Menu: add support for showing GApplication actions
Use the new GApplication support in ShellApp to create the application
menu. Supports plain (no state), boolean and double actions.
Includes a test application (as no other application uses GApplication
for actions)

https://bugzilla.gnome.org/show_bug.cgi?id=621203
2011-12-20 17:36:59 -05:00
Giovanni Campagna
17c46c2452 Port everything to class framework
The last patch in the sequence. Every place that was previously
setting prototype has been ported to Lang.Class, to make code more
concise and allow for better toString().

https://bugzilla.gnome.org/show_bug.cgi?id=664436
2011-11-24 09:50:04 +01:00
Giovanni Campagna
2b57603271 Port PopupMenu to new Lang.Class framework
The Lang module in gjs has recently gained a small yet powerful
Class framework, that should help improve the readability of code
when using complex inheritance.
This commit starts porting shell code, by rewriting all classes in
popupMenu.js (and all derived classes) to Lang.Class.

https://bugzilla.gnome.org/show_bug.cgi?id=664436
2011-11-24 09:50:04 +01:00
Florian Müllner
b88657ab83 combo-box-menu-item: Propagate pseudo classes to the combo menu
ComboBoxMenuItems use ClutterClones to reconstruct the active item
in the associated ComboMenu, so pseudo class changes due to state
changes of the ComboBoxMenuItem don't have the intended effect
(since the actual style information is taken from the associated
ComboBoxMenu item).
As a fix, propagate relevant pseudo class changes to the active
ComboBoxMenu item.

https://bugzilla.gnome.org/show_bug.cgi?id=662799
2011-11-15 13:54:29 +01:00
Florian Müllner
d20e646ed6 combo-box-menu-item: Propagate style changes to the combo menu
ComboBoxMenuItems use ClutterClones to reconstruct the active item
in the associated ComboMenu to not impose a particular MenuItem type
in the menu. However, this results in style changes (for instance
those triggered by icon-theme or text-scaling-factor changes) of
the ComboBoxMenuItem not having a visual effect until the ComboBoxMenu
is shown.
As a fix, force a style update on the ComboBoxMenu when the item's
style changes.

https://bugzilla.gnome.org/show_bug.cgi?id=662799
2011-11-15 13:46:08 +01:00
Florian Müllner
398489f661 popup-menu: Add minimal handling of open/close to Sections
SubMenuMenuItems close automatically with their parent, however
closing fails when the parent item is a MenuSection, as those
currently ignore any open()/close() requests.
At some minimal handling by emitting the 'open-state-changed' signal,
so children like SubMenuMenuItems work as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=661029
2011-11-03 15:36:57 +01:00
Florian Müllner
85520e34ab popup-menu: Allow adjusting where in the source the arrow points to
Currently BoxPointer/Menus always point to the center of the
associated source actor. This is generally what we want, but
add some API to adjust that behavior for the cases where it
isn't.

https://bugzilla.gnome.org/show_bug.cgi?id=659274
2011-10-13 15:03:32 +02:00
Dan Winship
75b824d032 *.js: Make emacs modelines consistent
js2-mode is no longer developed and we recommend js-mode these days,
so switch the modelines to specify that, and make them consistent
across all files.

https://bugzilla.gnome.org/show_bug.cgi?id=660358
2011-10-11 08:05:12 -04:00
Florian Müllner
5f6dce2b5c popup-menu: Fix allocation in RTL locales
Commit ed7d4928e5 fixed some width-for-height cases in popup menu items,
but did not consider RTL locales. Fix this.

https://bugzilla.gnome.org/show_bug.cgi?id=659827
2011-09-22 21:52:26 +02:00
Dan Winship
ab67c0f8b0 userMenu: fix line wrapping
The previous wrapping code hardcoded a width in pixels, making it
non-text-zoom-friendly. Specify a CSS width in pts, and fix the
userMenu code to completely opt out of the popupMenu column behavior.
Hack PopupComboBoxMenuItem slightly to deal with the fact that the
pop-up no longer gets setColumnWidth'ed.

https://bugzilla.gnome.org/show_bug.cgi?id=652837
2011-09-19 17:36:13 -04:00
Dan Winship
ed7d4928e5 popupMenu: fix a few width-for-height cases
specifically, non-columned menus, and span==-1

https://bugzilla.gnome.org/show_bug.cgi?id=652837
2011-09-19 17:36:13 -04:00
Florian Müllner
361652d028 popup-menu: Use correct St.Align values
It is not St.Align.CENTER, but St.Align.MIDDLE - in contrast to
St.TextAlign, where it *is* CENTER. Yay consistency!
2011-09-19 22:06:31 +02:00
Florian Müllner
824220356f popup-menu: Add 'sensitive' flag to item parameters
A menu action may not make sense at any time, so add API to mark
an item insensitive to indicate that its action is currently
unavailable, but may become activatable at a later point.

https://bugzilla.gnome.org/show_bug.cgi?id=659270
2011-09-19 18:54:15 +02:00
Dan Winship
caade78e79 popupMenu: do height-for-width negotiation
https://bugzilla.gnome.org/show_bug.cgi?id=652837
2011-09-08 08:47:10 -04:00
Florian Müllner
86aa4fe0a9 popup-menu: Allow updating combobox items with scroll wheel
Rather than opening the combobox menu, allow using the scroll wheel
to cycle through the visible items.

https://bugzilla.gnome.org/show_bug.cgi?id=657973
2011-09-02 18:08:54 +02:00
Florian Müllner
709193d680 popup-menu: Expand switch menu items
Given that our menus contain at most two columns, all switch widgets
in menus end up in the last columns, and thus aligned with the right
menu edge.
However, the updated user status menu will contain a section which
ignores the menu's column layout, so the switch might end up in
the middle of the menu if the overall width is determined by said
section.
At least for now, we always want the switch to align with the end,
so just expand switch menu items rather than adding an option.

https://bugzilla.gnome.org/show_bug.cgi?id=652837
2011-08-29 22:11:14 +02:00
Florian Müllner
d0d82cdf7e popup-menu: Add combo box menu item
Introduce a new menu widget, which displays the active item from
a set of options, and pops up a child menu to allow changing the
active item when activated.

https://bugzilla.gnome.org/show_bug.cgi?id=652837
2011-08-29 22:11:14 +02:00
Florian Müllner
5d2b7e2c9e popup-menu: Add support for child menus
Allow opening a popup menu from another menu. While the child menu
is open, events on the parent menu are blocked. The parent menu
is kept open when the child menu is closed; the child menu on the
other hand is closed with the parent, e.g. when the focus moves
to another toplevel menu.
This feature will be used to implement combo box menu items.

https://bugzilla.gnome.org/show_bug.cgi?id=652837
2011-08-29 22:11:14 +02:00
Ray Strode
7f767c49d8 popupMenu: Raise menu when popping it up
When a menu gets popped up, it should never
pop behind anything else in the shell.

https://bugzilla.gnome.org/show_bug.cgi?id=657082
2011-08-29 14:11:35 -04:00
Ray Strode
239a9e4816 popupMenu: Hide settings menus outside user session
The control-center contains user-pertinent settings
panels. These panels don't make sense to show outside
of a user's session, so hide them for session types other
than SessionType.USER.

https://bugzilla.gnome.org/show_bug.cgi?id=657082
2011-08-28 12:31:34 -04:00
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