Commit Graph

28 Commits

Author SHA1 Message Date
Florian Müllner
7bbd59838a status/brightness: Port to quick settings
Using QuickSlider, this is another easy port.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2393>
2022-08-03 12:41:05 +00:00
Florian Müllner
ed2ae06f35 status/brightness: Improve proxy error handling
On error, we currently print a warning and bail out early. That
means we don't hide the slider, despite it being non-functional
without the proxy.

Fix this by making sure _sync() is called in any case. While at
it, use an appropriate log level for the warning message.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
87e4eda46d status/brightness: Hide when proxy has no owner
Properties are null while a proxy has no owner. Javascript helpfully
coerces that into `Number(null)` (a.k.a. 0), so we end up with a
broken slider.

Explicitly check that the value is an integer before doing the
comparison to catch that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>
2022-08-01 12:33:36 +00:00
Florian Müllner
2b45a01517 cleanup: Use new indentation style for object literals
We have made good progress on object literals as well, although there
are still a lot that use the old style, given how ubiquitous object
literals are.

But the needed reindentation isn't overly intrusive, as changes are
limited to the object literals themselves (i.e. they don't affect
surrounding code).

And given that object literals account for quite a bit of the remaining
differences between regular and legacy rules, doing the transition now
is still worthwhile.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2200>
2022-02-23 12:23:52 +00:00
Peter Simonyi
87606c6a6b status: Pass scroll events to volume and brightness sliders
Sliders can be operated by mouse scroll, but the mouse has to be over
the slider control.  Make the brightness and volume system menu entries
forward scroll events to the sliders they contain so that scrolling
anywhere on the menu item operates the slider.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2795
2020-05-18 11:30:28 +00: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
Florian Müllner
284ace5b5f cleanup: Use (un)block_signal_handler() convenience wrapper
We now depend on a gjs version that is guaranteed to provide those
more idiomatic wrappers, so use them instead of the clunkier static
methods.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/795
2019-10-30 19:40:15 +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
21e14bd46f brightness: Ignore slider changes we initiated ourselves
Since we set the proxy value when the slider changes and set the slider
value on proxy property changes, we run into a cycle.

Before commit 3d3dca4aa this was addressed by not notifying on all slider
changes, but only in reaction to direct user action. Given that since the
splitting out of the BarLevel class those events are handled in a subclass,
that approach is at least unconvential and fairly fragile.

Instead, make the brightness indicator ignore any changes to the slider it
initiated itself.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1500
2019-08-13 16:35:17 +02:00
Florian Müllner
3d3dca4aa2 js: Actorize animated objects
We have a couple of places where we don't tween the actor, but a
custom property on the delegate object. In order to move those
to Clutter animations, we will need an animatable, so turn those
objects into widget subclasses.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/666
2019-08-06 23:54:29 +02:00
Florian Müllner
b970ee7293 barLevel: Use setters instead of methods
Switching to getters/setters make the code suitable for using
with Tweener and as GObject properties, both of which we'll
do soon enough.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/385
2019-07-28 17:27:53 +02: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
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
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
94423151b2 dbus: Move all interface descriptions into the resource
https://gitlab.gnome.org/GNOME/gnome-shell/issues/537
2018-09-17 07:34:49 +00:00
Marco Trevisan (Treviño)
dbf993300a js: use ES6 template strings for dbus interfaces
Use multiline template strings for dbus interfaces as they're easier to maintain
2018-08-27 19:23:00 +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
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
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
Tim Lunn
b908a3d70a Stringify the xml definitions for E4X removal
https://bugzilla.gnome.org/show_bug.cgi?id=691409
2013-10-25 08:57:27 +11:00
Alejandro Piñeiro
dd1651f2d1 Setting proper name and role for system menu sliders
https://bugzilla.gnome.org/show_bug.cgi?id=706391
2013-08-22 17:18:33 +02:00
Alejandro Piñeiro
aa569304bc Fix key navigation on system menu sliders
Rely key press events management if the menu item contains
a slider.

https://bugzilla.gnome.org/show_bug.cgi?id=706386
2013-08-22 16:02:35 +02:00
Jasper St. Pierre
cb09ae5cc0 status: Add new brightness slider widget
This is a simple slider that shows the current brightness of the
screen, and offers a way to change it.

This is a part of the new system status design, see
https://wiki.gnome.org/GnomeShell/Design/Guidelines/SystemStatus/
for design details.

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