Commit Graph

66 Commits

Author SHA1 Message Date
Florian Müllner
e68dfed1f7 cleanup: Port GObject classes to JS6 classes
GJS added API for defining GObject classes with ES6 class syntax
last cycle, use it to port the remaining Lang.Class classes to
the new syntax.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00:00
Florian Müllner
bacfdbbb03 cleanup: Port non-GObject classes to JS6 classes
ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00:00
Georges Basile Stavracas Neto
557b232c89
panel: Delegate container destruction to PanelMenu.ButtonBox
Instead of taking care of the PanelMenu.ButtonBox.container
destruction by itself, delegate that to the very object that
created it in the first place: PanelMenu.ButtonBox itself.
2018-10-08 22:43:13 -03:00
Georges Basile Stavracas Neto
fc342fe8c5
buttonBox: Drop Shell.GenericContainer usage
Another easy port.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Florian Müllner
3b1330880f cleanup: Use Function.prototype.bind()
When not using arrow notation with anonymous functions, we use Lang.bind()
to bind `this` to named callbacks. However since ES5, this functionality
is already provided by Function.prototype.bind() - in fact, Lang.bind()
itself uses it when no extra arguments are specified. Just use the built-in
function directly where possible, and use arrow notation in the few places
where we pass additional arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:02 +00:00
Florian Müllner
213e38c2ef cleanup: Use arrow notation for anonymous functions
Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:00 +00:00
Florian Müllner
76f09b1e49 cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:54:58 +00:00
Florian Müllner
2582d16ca7 Define classes with 'var' instead of 'const'
Any symbols (including class properties) that should be visible
outside the module it's defined in need to be defined as global.
For now gjs still allows the access for 'const', but get rid of
the warnings spill now by changing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Cosimo Cecchi
cad5e06041 panelMenu: consider scale factor when setting max-height
Since the workarea and margins are both in pysical pixels dimensions (we
fetch margins from Clutter, not from the theme), but the CSS expects
logical (scaled) pixels, unless we consider the scale factor when
setting max-height, it won't work on a HiDpi display.

This fixes missing scrollbars when the calendar popup is full on HiDpi
displays.

https://bugzilla.gnome.org/show_bug.cgi?id=753305
2017-04-06 18:32:04 -07:00
Florian Müllner
1092f55b54 panel: Set up 'open-state-changed' handler on menu changes
Commit 08690d658f generalized the banner-blocking behavior of the
dateMenu to all menus that would obscure the banner. However setting
up the 'open-state-changed' handler only when an indicator is added
does not work for indicators that change their entire menu (like the
app menu) - we currently end up with menus with no connected signal
handler, and throw an error when trying to disconnect an invalid
signal ID.
To address this, add a new PanelButton::menu-set signal and use that
to set up the 'open-state-changed' handler.

https://bugzilla.gnome.org/show_bug.cgi?id=745910
2015-04-30 18:12:52 +02:00
Florian Müllner
7bb7734869 panelMenu: Consider vertical margins when computing max-height
When opening a panel menu, we set it's max-height to the available
work-area height to keep menus with scrollable content from growing
outside the monitor. However a menu that extends all the way down
to the bottom edge does not look great either, so also take margins
into account here.

https://bugzilla.gnome.org/show_bug.cgi?id=744498
2015-02-15 10:23:39 +01:00
Florian Müllner
1d58ea25ab popupMenu: Handle key-press events on sourceActor
The behavior of opening/closing/navigating a menu from its source
actor is generic enough to not limit it to PanelMenu.Buttons, so
move the code into PopupMenu itself.

https://bugzilla.gnome.org/show_bug.cgi?id=735614
2014-08-28 19:12:48 +02:00
Carlos Garnacho
e545ec59b9 panelMenu: Interact to touch events
No sequence checks are done, these UI elements promptly trigger a grab that
will cancel ongoing touches and redirect later ones somewhere else, so that
works as a barrier to multi-toggling.

https://bugzilla.gnome.org/show_bug.cgi?id=733633
2014-07-24 18:15:02 +02:00
Florian Müllner
589becbc79 panelMenu: Clean up code a bit 2014-06-08 22:25:27 +02:00
Florian Müllner
deb2f30b37 js: Use EVENT_PROPAGATE/EVENT_STOP constants in event handlers
Just as SOURCE_CONTINUE/SOURCE_REMOVE in source functions, these
constants increase code clarity over plain true/false.

https://bugzilla.gnome.org/show_bug.cgi?id=719567
2013-12-16 18:27:19 +01:00
Jasper St. Pierre
33e51cc38b panelMenu: Use the accessible-name property instead of a label actor
We already have code for this in StWidget.

https://bugzilla.gnome.org/show_bug.cgi?id=705898
2013-08-13 11:22:03 -04:00
Jasper St. Pierre
73e1f238cf panelMenu: Remove the gicon parameter from addIndicator, and make private
There's only two uses of the parameter left, which can easily be added as a
separate line below. Since it's really a private interface meant for the
indicators, make it private as well so external users are less likely to
use it.

https://bugzilla.gnome.org/show_bug.cgi?id=705845
2013-08-13 06:50:24 -04:00
Jasper St. Pierre
4ba6791043 panelMenu: Show/hide the indicators box based on indicator visibility
This ensures that there's no empty space in the indicators box, and we don't
have to manage it manually.

https://bugzilla.gnome.org/show_bug.cgi?id=705845
2013-08-13 06:50:24 -04:00
Jasper St. Pierre
54bec54765 panel: Align the arrows together in the status menus
To align the arrows, we need to allocate panel buttons the full
height of the tray. Fix up all of the panel buttons to support this,
and align the arrows in the middle.

https://bugzilla.gnome.org/show_bug.cgi?id=705845
2013-08-13 06:50:24 -04:00
Jasper St. Pierre
5c8c4e0aad panel: Move statuses to the aggregate menu
Swap out the implementation of SystemIndicator with a dummy,
and build the aggregate menu. At the same time, remove the
poweroff and login screen menus, as those were fake aggregate
menus beforehand.

We lose some flexibility as we lose session-mode-based menu
layout, but as each component of the aggregate menu is supposed
to be "smart" in response to updating itself when session
state changes, I believe it's better than a declarative model.

https://bugzilla.gnome.org/show_bug.cgi?id=705845
2013-08-13 06:50:24 -04:00
Jasper St. Pierre
5cca26a565 status: Port to a new SystemIndicator framework
We can't silently replace the old behavior of separate status
icons into a new system. Replace SystemStatusButton with a new
SystemIndicator class which will allow for the flexibility we
need. For now, make it a subclass of Button so that it mostly
feels the same, but we'll soon be swapping it out with a dummy
implementation that the aggregate menu will use.

I think the code cleanup here is worth it.

https://bugzilla.gnome.org/show_bug.cgi?id=705845
2013-08-13 06:50:24 -04:00
Florian Müllner
dabcd29fb6 panelMenu: Close menu when hiding the corresponding button
A PanelMenuButton added to the top bar might not be visible at all
times. If it is hidden while the corresponding menu is open, we
currently don't do anything at all, e.g. the menu remains open
pointing to an arbitrary location in the top bar.
Instead, close the menu automatically in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=703540
2013-07-11 17:14:02 +02:00
Tanner Doshier
d9a4688e98 panelMenu: Attempt to navigate menus only if we can't navigate inside the menu
This enables key navigation in the calendar.

https://bugzilla.gnome.org/show_bug.cgi?id=667434
2013-05-03 23:20:02 -04:00
Jasper St. Pierre
12ac2e5534 Switch all external uses of Main.panel.actor.height to the work area
https://bugzilla.gnome.org/show_bug.cgi?id=692680
2013-02-06 22:35:49 -05:00
Jasper St. Pierre
1d136cacfb lockScreenMenu: Construct actual panel icons much more accurately
Instead of faking it by adding a bunch of main icons and secondary
icons to our own box, try and recreate the original button box
with the original icons.

https://bugzilla.gnome.org/show_bug.cgi?id=690589
2012-12-21 12:28:00 -05:00
Jasper St. Pierre
994021d77f panelMenu: Remove inaccurate comment
This has been out of date ever since the -symbolic fallbacks
have gone away.

https://bugzilla.gnome.org/show_bug.cgi?id=690589
2012-12-21 12:26:32 -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
Florian Müllner
6f5e5672bb panelMenu: Fix exception when destroying menuless button
There's explicit API to create PanelMenu.Buttons with no menu, so
guard against this case in destroy().

https://bugzilla.gnome.org/show_bug.cgi?id=686763
2012-10-26 15:49:26 +02:00
Giovanni Campagna
657887b241 Revert "userMenu: Don't update the presence icon immediately"
This reverts commit f1ca96bbf0.
We're moving towards atomic panel upgrade, so we don't need this.

https://bugzilla.gnome.org/show_bug.cgi?id=683526
2012-09-06 21:38:17 +02:00
Giovanni Campagna
7c244b01c6 Panel: move the _panelContainer down to PanelMenu
Panel already forces each item to be a PanelMenu.Button, so it's better
to have the latter handle the bin container too, instead of attaching
a private property that might collide with internal usage by the indicator.

https://bugzilla.gnome.org/show_bug.cgi?id=683156
2012-09-04 23:52:41 +02:00
Jasper St. Pierre
f1ca96bbf0 userMenu: Don't update the presence icon immediately
If we don't freeze the presence icon, we can end up in a place where
we'll be updating the icon before we fade out the panel indicators when
coming back from the lock screen.

https://bugzilla.gnome.org/show_bug.cgi?id=683156
2012-09-04 18:42:45 -03:00
Jasper St. Pierre
ec01f5d5ee userMenu: Make the user menu insensitive in the lock screen
And show a lock icon as well.

https://bugzilla.gnome.org/show_bug.cgi?id=683156
2012-09-04 18:42:44 -03: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
Jasper St. Pierre
c21b1e5fe0 st: Remove StIconType
GTK+ works by explicitly specifying a -symbolic suffix for all icons.
Do the same here.

https://bugzilla.gnome.org/show_bug.cgi?id=682540
2012-08-29 16:41:09 -03:00
Giovanni Campagna
c1de2788b1 Add a new lock screen menu to combine volume network and power
The design has a combined volume-network-power indicator in the lock
screen, which when opened shows a volume slider. Implement it by abstracting
the volume menu into a PopupMenuSection, and by creating three StIcons
bound to the real ones.

https://bugzilla.gnome.org/show_bug.cgi?id=682540
2012-08-29 01:13:23 +02:00
Giovanni Campagna
41dc9e0894 PanelMenu: Allow multiple icons in one SystemStatusButton
This generalizes the code previously used by NetworkMenu, so that all
SystemStatusButton now can add multiple icons.

https://bugzilla.gnome.org/show_bug.cgi?id=682540
2012-08-29 01:13:23 +02:00
Jasper St. Pierre
0711a70398 js: Use global.focus_manager, rather than grabbing it ourselves 2012-08-19 21:15:48 -04: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
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
Giovanni Campagna
ff92d962f3 PanelMenuButton: set max-width every time the menu is opened
Previously, PanelMenuButton would only set max width if the user
explicitly clicked the menu button, resulting in submenus without scrollbars
if opened via keyboard navigation or mouse over.

https://bugzilla.gnome.org/show_bug.cgi?id=658946
2012-03-02 01:24:12 +01:00
Jasper St. Pierre
d81958a074 st: Remove st-tooltip
StTooltip has been plagued by lots of issues, and we recently ditched
it in the dash. Remove it for good.

https://bugzilla.gnome.org/show_bug.cgi?id=670034
2012-02-15 20:12:49 -05: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
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
566bdb50c2 Port PanelMenu to new class framework
Second patch in the class framework, now it's the turn of
PanelMenu (buttons, menus and status indicators).

https://bugzilla.gnome.org/show_bug.cgi?id=664436
2011-11-24 09:50:04 +01: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
Dan Winship
ae00f86887 panel: allow padding around panel buttons to shrink
for narrow screens (eg, portrait orientation)

https://bugzilla.gnome.org/show_bug.cgi?id=651299
2011-09-19 17:43:54 -04:00
Dan Winship
9fbd79316a panel: merge statusBox into rightBox
Simplify the layout in rightBox by getting rid of statusBox, and just
putting everything into rightBox directly.

Simplify the handling of the user menu by adding it like it was a
status icon rather than special-casing it. Rename the "tray_icon"
variables to "status_area" to reflect this better.

https://bugzilla.gnome.org/show_bug.cgi?id=651299
2011-09-16 14:15:49 -04:00
Ray Strode
388cfa3695 panelMenu: Separate from ui chrome layer
The chrome layer contains the user interface elements (e.g.,
the panel) that disappear when fullscreen windows get displayed.

Panel menus are currently put in the chrome layer, but don't need
to be, since they are only displayed when the user is interacting
with the shell and not a fullscreen application.

Putting panel menus in the chrome layer does mean they will get
stacked below shell interface elements that aren't in the chrome layer,
though.

This commit changes panel menus to be on the same layer as most other
shell elements, so they get properly stacked above those elements.

https://bugzilla.gnome.org/show_bug.cgi?id=657082
2011-08-28 12:17:13 -04:00
Giovanni Campagna
08126e5a38 panel: Add an easier way of adding items to the system status area
Extensions often want to add items to the system status area, so it
is useful to add a convenience API for it. Also, we now allow
for cleaner destruction of panel objects, by just calling destroy()
on it.
Based on a patch by Jasper St. Pierre.

https://bugzilla.gnome.org/show_bug.cgi?id=653205
2011-08-25 13:34:45 -04:00
Dan Winship
c1acf992fa layout: make Chrome an implementation detail of LayoutManager
Make the Chrome object be a private member of LayoutManager, and add
new LayoutManager methods to proxy to the old Chrome methods.

https://bugzilla.gnome.org/show_bug.cgi?id=655813
2011-08-03 09:18:30 -04:00