Commit Graph

62 Commits

Author SHA1 Message Date
Florian Müllner
a205f4e249 status/system: Fix session submenu visibility
Commit 147a743d8d moved the suspend and power-off actions into
the submenu that contains the log-out and switch-user actions,
but did not update the submenu visibility logic to account for
the additional actions.

As a result, the submenu is hidden when log-out and switch-user
are unavailable (like on the login screen), even if suspend and
power-off are enabled.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2169
2020-02-04 14:40:44 +00:00
Jonas Dreßler
3f21c21532 status/system: Update text of orientation lock menu entry
Since the orientation lock menu entry is a proper menu entry instead of
a icon-only button now, we also show a description-text for that entry,
so update this text depending on whether orientation is locked or not to
better reflect what clicking the menu entry will do.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/964
2020-01-28 15:49:01 +00:00
Florian Müllner
147a743d8d system: Replace action icons with regular menu items
Besides making the menu a bit less special, it allows us to fit both
shutdown and suspend actions without any hidden alt-key Easter eggs.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/270
2019-11-05 13:05:59 +00:00
Florian Müllner
2c62e45168 st: Remove StBin's align properties
They are now completely unused, so remove them and stop the confusing
shadowing of ClutterActor's own x/y-align properties.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803
2019-11-04 21:27:56 +01:00
Florian Müllner
104071acbd js: Replace child properties
Every since commit aa394754, StBoxLayout has supported ClutterActor's
expand/align properties in addition to the container-specific child
properties. Given that that's the only container left with a special
child meta, it's time to fully embrace the generic properties (and
eventually remove the child meta).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/780
2019-11-01 19:42:01 +00:00
Marco Trevisan (Treviño)
39e6fc9e9d js: Use Gjs GTypeName computation for all classes
As per previous commit we can remove the explicit GTypeName definitions
and use gjs auto computation for all the GObject registered classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/790
2019-10-29 18:38:35 +00:00
Marco Trevisan (Treviño)
55b57421dc cleanup: Replace signal connections with virtual functions
Inheriting from actors allows to use virtual functions instead of signal
connections for multiple cases, so just use them when possible.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:13 +00:00
Marco Trevisan (Treviño)
c4c5c4fd5c cleanup: Use inheritance for Actor classes instead of composition
Remove the `this.actor = ...` and `this.actor._delegate = this` patterns in most
of classes, by inheriting all the actor container classes.

Uses interfaces when needed for making sure that multiple classes will implement
some required methods or to avoid redefining the same code multiple times.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:13 +00:00
Florian Müllner
b446667df6 cleanup: Disambiguate assignments in arrow functions
As arrow functions have an implicit return value, an assignment of
this.foo = bar could have been intended as a this.foo === bar
comparison. To catch those errors, we will disallow these kinds
of assignments unless they are marked explicitly by an extra pair
of parentheses.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
52f85c9465 system: Properly separate statements
Whoops, that's some typo that sneaked into commit 9c3b3320f8 ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00
Marco Trevisan (Treviño)
a497afe695 system: Track buttonGroup visibility using a group of actors
Cleanup the visibility check on actions by using an array of actors to
track, so that we don't repeat the same variables multiple times.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700
2019-09-09 19:28:19 +00:00
Florian Müllner
e357559582 cleanup: Mark globals used from other modules as exported
eslint cannot figure out that those symbols are used from other modules
via imports, so they trigger unused-variable errors. To fix, explicitly
mark those symbols as exported.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
71759a0769 cleanup: Mark unused (but useful) variables as ignored
While we aren't using those destructured variables, they are still useful
to document the meaning of those elements. We don't want eslint to keep
warning about them though, so mark them accordingly.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
14d7897a93 style: Stop using braces for single-line arrow functions
Braces are optional for single-line arrow functions, but there's a
subtle difference:
Without braces, the expression is implicitly used as return value; with
braces, the function returns nothing unless there's an explicit return.

We currently reflect that in our style by only omitting braces when the
function is expected to have a return value, but that's not very obvious,
not an important differentiation to make, and not easy to express in an
automatic rule.

So just omit braces consistently as mandated by gjs' coding style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
d4582491f5 system: Drop custom styling of user submenu icon
The default style we get from .popup-menu-icon actually works better,
as it ensures consistency with all the other submenu icons used in
the aggregate menu.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/591
2019-06-29 20:01:52 +00:00
Marco Trevisan (Treviño)
9697c209c0 system: Just use buttonGroup instead of adding extra _actionsItem
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/499
2019-05-15 17:27:08 +00:00
Marco Trevisan (Treviño)
41dd744b74 js/status: Use menu items as actors
All menu items are actors now, so remove all the actor property usages.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/499
2019-05-15 17:27:07 +00:00
Florian Müllner
0089143d06 aggregateMenu: Include action buttons in width computation again
Commit 1b169655ac removed the system indicator from the list of children
that are considered for the overall menu width, because we do want the
log-out submenu to adapt to the available width.

However as a side effect, action buttons no longer contribute to the
width either, so if extensions add additional buttons, the menu is
likely to overflow.

Avoid this by only adding the button group to the list of size children.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1094
2019-03-21 10:08:29 +00:00
Florian Müllner
33e05f5912 system: Always use default avatar in switch-user submenu
It is too small to be really useful, and sticks out being the
only color icon.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/957
2019-02-10 10:33:23 +00:00
Florian Müllner
fd50b9a45e cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 07:39:20 +01: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
Florian Müllner
e77463b875 altSwitcher: Fix error when all alternatives are disabled
While we do consider the case that we don't have a child to show for the
visibility, we are still trying to move the click action unconditionally.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/783
2018-11-17 12:18:23 +00:00
Georges Basile Stavracas Neto
f433b12d6e system: Don't execute Settings
In a9ad91c831, a bug was introduced in the following code:

```c
            this._settingsAction.connect('clicked',
                                         this._onSettingsClicked().bind(this));
```

Notice that the callback is being executed! This commit
fixes that by removing the '()' from the callback.
2018-07-31 13:31:59 -03:00
Florian Müllner
a9ad91c831 system: Pick up Settings name and icon from app
The settings action button in the system menu simply launches
gnome-control-center, so we want its icon (and accessible name)
to always match the app. So instead of keeping the button in-sync
with Settings, just look up that information from the app itself.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/433
2018-07-31 16:52:47 +02:00
Florian Müllner
bd1c7774ee system: Enforce symbolic icons in action buttons
We can simply request the symbolic variant from CSS so that we don't
have to append '-symbolic' to all the names. This will always make
it easier to pick up that information from external sources (like
.desktop files).

https://gitlab.gnome.org/GNOME/gnome-shell/issues/433
2018-07-31 16:52:47 +02: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
Rares Visalom
9c3b3320f8 system: Split out system actions to its own module
In anticipation of showing the system actions in
the search results, it is fit to move action
specific code to its own module in order to
reuse it.

https://bugzilla.gnome.org/show_bug.cgi?id=691900
2017-08-22 12:09:04 +02:00
Rares Visalom
7d95275076 system: Don't leave overview when activating most items
The current behavior wasn't designed, but was introduced in commit
84efaac52b to work around technical limitations when we were still
using external tools like gnome-screensaver or gnome-session-quit
to handle the actions. Those limitations are long gone, so it makes
sense to make the actions consistent with the corresponding keyboard
shortcuts: Leave the overview when launching an application, and leave
it alone otherwise.

https://bugzilla.gnome.org/show_bug.cgi?id=691900
2017-08-22 12:09:04 +02: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
Florian Müllner
2339c39ae6 system: Emulate click action button release
Since commit 2c070d38, we add a ClickAction to the visible AltSwitcher
button to track long-presses. As a result, we now have two components
that will grab and ungrab the pointer for the button, so to make sure
we don't end up with a stuck grab, we need to release the second's
component grab when the first activates.

Currently we only drop the StButton grab on long-press, we also need
to cancel any initiated long-press on click.

https://bugzilla.gnome.org/show_bug.cgi?id=781738
2017-07-13 12:27:47 +02:00
Florian Müllner
2c070d38fb system: Switch between alternatives on long-press
On systems that support both shutdown and suspend, the latter operation
is currently only accessible via pressing the Alt key. As using the
keyboard may be inconvenient or simply not possible (e.g. on touch),
allow switching between alternatives via long-press as well.

https://bugzilla.gnome.org/show_bug.cgi?id=721173
2017-02-15 23:20:14 +01:00
Florian Müllner
2425b11df6 system: Do not disable suspend action when locked
gnome-settings-daemon now allows the corresponding keybinding, so
for consistency it makes sense to show the button as well.

https://bugzilla.gnome.org/show_bug.cgi?id=725960
2016-05-27 17:04:47 +02:00
Florian Müllner
9c483dd9a6 system: Only show rotation lock when a builtin output is present
We currently show the orientation lock button when an accelerometer
is present, however gnome-settings-daemon's xrandr plugin only applies
rotation when a builtin monitor is present. Update the button's
visibility to match gnome-settings-daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 21:16:50 +02:00
Florian Müllner
fa0e54edbb status: Refine system status menu
* switch to a one-column layout (and adjust strings/widths
   accordingly
 * remove separator before system menu
 * add link to account settings to user submenu for consistency

https://bugzilla.gnome.org/show_bug.cgi?id=751377
2015-08-20 13:53:36 +02:00
Bastien Nocera
2e77f6b34b system: Use iio-sensor-proxy to detect accelerometer
Instead of using gnome-settings-daemon's D-Bus interface's presence.
iio-sensor-proxy now offers a D-Bus interface, which will exported
"HasAccelerometer = true" when an accelerometer is present.

https://bugzilla.gnome.org/show_bug.cgi?id=749671
2015-05-27 10:13:38 +02:00
Giovanni Campagna
8327dbd611 System: update lock screen at construction
Will make sure that change notifications are enabled by reading
the value at least once

https://bugzilla.gnome.org/show_bug.cgi?id=746509
2015-03-27 13:12:25 -07:00
Giovanni Campagna
e1b575dddc System: remove unused GSettings
https://bugzilla.gnome.org/show_bug.cgi?id=746509
2015-03-27 13:12:22 -07:00
Florian Müllner
c647be375a system: Fix visibility of suspend button
It depends on the availability of suspend, not shutdown ...
2015-02-04 12:03:18 +01:00
Bastien Nocera
9c6180afa2 system: Fix orientation lock never appearing
Typos meant that the orientation service was never detected as running
and that the orientation lock menu item didn't appear.

https://bugzilla.gnome.org/show_bug.cgi?id=733498
2014-07-21 14:35:27 +02:00
Jasper St. Pierre
83cb26d70e js: Adapt to GSettings API change
The 'schema' property has been deprecated for a long time. Even though
this will likely be reverted in glib, let's stop using it.
2014-06-24 15:17:09 -04:00
Florian Müllner
011fef4b2b system: Keep key focus when switching between alternatives
When switching between alternatives in AltSwitcher, the currently
visible child is replaced with the alternative. If the original
child has the key focus when it is removed from the stage, the
focus is lost. Detect this case and manually move the focus to
the new child.

https://bugzilla.gnome.org/show_bug.cgi?id=727259
2014-05-06 14:25:39 +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
Florian Müllner
d456c3f62e system: Restore support for 'disable-restart-buttons'
The org.gnome.login-screen schema contains a key to disable the
power/restart buttons; our support for this fell victim to the
new combined status menu, add it back.

https://bugzilla.gnome.org/show_bug.cgi?id=711244
2013-11-01 13:08:02 +01:00
Giovanni Campagna
3b1b9f589b SystemMenu: wait for a completed paint before switching VT
Activating the GDM login screen switches VT and causes X to freeze
event processing (because it lost the drm master), so must make
sure to have painted the lock screen at least once before proceeding,
or the user can go back and see the unlocked desktop.

https://bugzilla.gnome.org/show_bug.cgi?id=708051
2013-09-26 10:46:42 +02:00
Jasper St. Pierre
f0da08bbb1 system: Hide the AltSwitcher when we have nothing to show
https://bugzilla.gnome.org/show_bug.cgi?id=706852
2013-08-29 15:17:12 -04:00
Jasper St. Pierre
ef2345ea85 system: Add a way to suspend from the system menu
When we implemented the new designs, we lost the ability to suspend
from the system menu. Re-enable this ability by re-adding the hidden
"Alt" shortcut item.

https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-26 10:02:44 -04:00
Jasper St. Pierre
2e65c852c3 endSessionDialog: List other users and sessions in with the inhibitors
Instead of in a separate dialog. This does not meet the designs right
now, but it's a good first start.

https://bugzilla.gnome.org/show_bug.cgi?id=706612
2013-08-26 10:02:44 -04:00
Jasper St. Pierre
51485396c7 popupMenu: Remove our custom allocation code
With support for column-based layout gone, simply use a box layout
and allow items to use their own layouts without any "framework".

https://bugzilla.gnome.org/show_bug.cgi?id=705845
2013-08-13 06:50:25 -04:00