Commit graph

314 commits

Author SHA1 Message Date
Alice Mikhaylenko
4680f362f3 Port to AdwNavigationSplitView 2023-08-25 08:00:43 +00:00
Alice Mikhaylenko
1032ab01f0 power: Port the suspend dialog to AdwWindow and AdwToolbarView 2023-08-25 08:00:43 +00:00
Alice Mikhaylenko
0921015b8b power: Port to AdwToolbarView 2023-08-25 08:00:43 +00:00
Felipe Borges
fc9251c880 Revert "cc-power-panel: add battery health section"
This reverts commit 4a0d924afd.

There are some rough edges to be polished before this is ready for
prime time.

UPower battery health capacity reporting can often be inconsistent
across vendors, and we don't want to expose unreliable information
on the UI without proper sanitization.
2023-08-07 12:18:33 +02:00
Eric Daigle
4a0d924afd cc-power-panel: add battery health section
As described in #2554, it would be useful to be able to see battery health information
such as charge capacity in Settings. This commit implements the proposed design for
battery health information, adding this functionality to the power panel.

Closes #2554
2023-08-04 09:40:07 +00:00
Mohammed Sadiq
1e4ef1fdb0 power: Fix a memory leak 2023-07-03 01:56:24 +00:00
Eric Daigle
598e71fdd2 cc-power-panel: hide automatic suspend row in vm
As described in #2521, the automatic suspend row is currently shown
when Settings is running in a VM, in which case it has no effect.

This commit checks whether Settings is running in a VM and disables
showing the automatic suspend row in this case, as is done for the
Suspend/Hibernate rows. This prevents the user from being shown a
useless row in the power panel.

Closes #2521
2023-06-13 04:17:35 +00:00
Robert Ancell
868dd6cf7e power: Use self for object variable name 2023-06-06 07:54:38 +00:00
Pablo Correa Gómez
7f7b65545c all: meson: do not specify resources from gresource files as dependencies
Meson extracts them by itself and add them as dependencies for the target.
It means one less location to keep track of files, and a lot less boilerplate
around the meson files
2023-05-24 08:34:14 +00:00
Bastien Nocera
5755f0eec7 power: Label the main "battery" as UPS if that's what it is
Change the label from "Battery" to "UPS" if the upower DisplayDevice is
a UPS. This avoids confusions like:
https://www.reddit.com/r/gnome/comments/11aws0q/battery_indicator_for_desktop_computer_seems/
https://askubuntu.com/questions/1344733/why-does-ubuntu-show-battery-and-charge-info-when-it-is-a-desktop-with-no-batter

"
Why does GNOME display a battery percentage ("Fully Charged") when I'm
running a desktop computer without any battery?
"
followed by:
"
Ha! I figured it out[...]. I have my desktop plugged into a UPS
"
2023-03-14 19:19:51 +00:00
Marco Melorio
088edd6c35 power: Remove deprecated gtk_widget_show/hide usage 2023-01-02 22:10:39 +00:00
sunflowerskater
7366eee9ee power: Show a description for Battery Percentage switch
Battery Percentage switch don't offer a description explaining where the percentage will be shown.

This commit adds a description to better explain what this option does.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1641
2022-12-15 16:24:05 -03:00
Jake Dane
89443fe550 desktop: Remove obsolete Bugzilla entries
The `X-GNOME-Bugzilla-*` entries were for use by bug-buddy, a GNOME 2
technology that's been gone for over a decade. These entries are
obsolete and can be removed from all desktop files.

The `X-GNOME-Settings-Panel` entry is also obsolete as far as I can
tell and only these panels had it in their desktop file: notifications,
sharing, sound and user-accounts. These entries can also be removed.

After removing the `X-GNOME-Bugzilla-*` entries, the desktop files have
no more variables in them. The meson `configure_file` step is therefor
pointless—there are no variables to configure. As such the
`*.desktop.in.in` files are renamed to `*.desktop.in` to reflect this
and `meson.build` files are modified to remove `configure_file` step.
2022-10-20 13:20:09 +00:00
Bastien Nocera
da7b4db162 power: Don't assert if we can't find the widget for a profile
In some cases, it was possible for a profile to be set (directly, or
through a hold) even though it wasn't supported. Don't assert in those
cases.

Closes: #1504
2022-09-16 11:07:09 +00:00
Felipe Borges
3a31e34514 power: Fix "Power Button Behavior" setting now applying
The AdwComboRow widget has a selected-item property, while we were
connecting to selected-index (which doesn't exist.

It is likely that selected-index existed in the past in libhandy
or libadwaita and this is a regression during the port to GTK4.

Fixes #2025
2022-08-23 15:26:46 +00:00
Felipe Borges
37f5cbe6af power: Fix blank-screen settings not applying
The AdwComboRow widget has a selected-item property, while we were
connecting to selected-index (which doesn't exist.

It is likely that selected-index existed in the past in libhandy
or libadwaita and this is a regression during the port to GTK4.

Fixes #2025
2022-08-23 15:26:46 +00:00
Lukáš Tyrychtr
de8d28c3eb Improve accessibility of the power panel 2022-05-10 22:14:35 +00:00
Pablo Correa Gómez
ddfacc6b81 power: Only update ALS state if it has changed
Ambient light sensors can be quite sensitive and the LightLevel
property might be changing very often. That has two undesired
consequences:
* The `als_enabled_state_changed` callback gets constantly called
  due to a change in a property which it does not care about, as
  only `HasAmbientLight` is relevant. Therefore, limit the code
  execution to when something needs to be changed.
* During debugging, the terminal gets spammed with "ALS enabled: on/off"
  messages.
2022-05-10 04:32:12 +00:00
Bastien Nocera
0947ae2557 power: Fix scenario tester running upowerd under jhbuild
A logic error meant that the systemd upowerd would always be used.
2022-02-17 14:55:13 +00:00
Sam Hewitt
65b109763b Cleanup private use symbolics
- remove references to deprecated app symbolics
- reduce file size of private-use icons
- update dated icons
2022-02-04 18:12:41 +00:00
Jakub Steiner
13376ecb8b Add individual app icons 2022-01-31 14:08:22 +00:00
Bastien Nocera
fa01d3f10a power: Add scenario for a 2nd non-charging laptop battery 2022-01-27 02:52:20 +00:00
Bastien Nocera
6c6d9f4f38 power: Fix launching upower from scenario tester
Not everyone would have upower built under jhbuild, so use the system
one if we can't find it.
2022-01-27 02:52:20 +00:00
Georges Basile Stavracas Neto
07e3f5c3f3 power: Add go-next-symbolic icon to automatic suspend row
See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1587
2022-01-21 16:13:21 +00:00
Georges Basile Stavracas Neto
0ab20af9ba panels: Switch to CcPanel content
Start porting panels to the new panel format. This commit
temporarily makes panels have two titlebar, which will be
fixed soon.
2022-01-20 02:23:42 +00:00
Bastien Nocera
595f04ea12 power: Remove ad-hoc UI debugging ifdef's
Remove the static UI debugging tools in the power panel code, and use
the scenario tester instead.
2022-01-18 16:06:15 +01:00
Bastien Nocera
bcf2d54772 power: Add helper to launch the Power Settings in scenarios
This helper tool launches the Power Settings panel in a fake
environment, making it easy to test the UI in different scenarios. The
tool allows:
- cycling through power-profiles-daemon degraded performance reasons
- adding and removing a laptop battery, keyboard, mouse or UPS

UPS support needs umockdev 0.17.4 to work correctly
2022-01-18 16:06:15 +01:00
Bastien Nocera
bd4c27e7ab power: Remove support for power-profiles-daemon < 0.9.0 2022-01-14 13:46:50 +00:00
Jan Beich
37b29c32cb meson: drop unused argument for i18n.merge_file()
Ignored in Meson < 0.60.0, deprecated since 0.60.1 and fatal since 0.61.0.

panels/applications/meson.build:10:5: ERROR: Function does not take positional arguments.
panels/background/meson.build:10:5: ERROR: Function does not take positional arguments.
panels/camera/meson.build:10:5: ERROR: Function does not take positional arguments.
[...]
2022-01-07 17:22:43 +00:00
Christopher Davis
981a8cea7b panels: Use .boxed-list instead of .content
The `.content` style class is deprecated in favor
of the `.boxed-list` style class, which is named
after the design pattern it's used for.
2021-12-16 12:52:44 -08:00
Georges Basile Stavracas Neto
a0d49cb3a8 power: Port to GTK4
Extra care was needed for the combo boxes, and the way we currently
use GtkStringList is kind of hacky, but overall things seem to be
working fine.
2021-12-14 22:34:21 -03:00
Frédéric Péters
667af4f521 power: Use translated strings for power button action behaviors
Fixes: #1476
2021-09-29 17:58:46 +00:00
Bastien Nocera
2b7cccf13b power: Update power profile labels
Use "Balanced" instead of "Balanced Power", and make sure to add a
context for all the profiles for translators.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4530#note_1243075
2021-08-09 13:31:12 +00:00
Bastien Nocera
e4c496158e power: Change "Balanced" power profile label
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4530#note_1241985
2021-08-05 15:28:02 +02:00
Allan Day
8fb8a340bf power: Align power profile info boxes with profiles text
See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1421
2021-08-05 15:28:02 +02:00
Bastien Nocera
19fb4e4a0c power: Remove icons from power profiles
They were originally included was to educate users about what the icons
mean, for when they appeared in the top bar. However, since we no
longer plan on showing the status icon in the top bar, it's not so
important that people learn the meaning of the icons.

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1421
2021-08-05 15:28:02 +02:00
Bastien Nocera
7b21494774 power: Dim the info box icon
This brings less focus to the icon and more to the text.

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1421
2021-08-05 15:28:02 +02:00
Bastien Nocera
dafbd54fe0 power: Update and add subtitle to automatic brightness row
As per:
https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1020#note_1210702
2021-07-28 11:55:34 +00:00
Bastien Nocera
3a289fe502 power: Remove unused CcBrightnessScale 2021-07-28 11:55:34 +00:00
Bastien Nocera
bb30b04ed6 power: Remove Brightness scales
From https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1020#note_1211728
"
They are out of place - fine-grained control over brightness isn't what the
power settings are for. As a result, they confuse the settings overall.

In both cases we have alternative controls, through keyboard hot keys or
through the shell's screen brightness slider.
"
2021-07-28 11:55:34 +00:00
Bastien Nocera
fd53f569f1 power: Tweak labels in "Power Saving Options" section
To match the latest mockups.

The lack of subtitles for most of the items in that section made the
section look pretty bizarre.
2021-07-28 11:55:34 +00:00
Bastien Nocera
f03cf178dd power: Remove Bluetooth power switch button
See previous commit.
2021-07-28 11:55:34 +00:00
Bastien Nocera
2f2ea3aed6 power: Remove Wi-Fi and WWAN "power saving" toggles
It's pretty clear from their experiences on smartphones that our users
know that Wi-Fi and other wireless technologies use enough battery that
turning them off is a power saving move.

The switches and text were also pretty confusing as we would be turning
"off" the devices to turn "on" the power saving.
2021-07-28 11:55:34 +00:00
Bastien Nocera
93cf2405ee power: Fix logic when showing profile holds
A logic error meant that the power profiles info boxes container
would not be shown if there wasn't a "degraded" performance as well.

Spotted by Allan Day
2021-07-27 15:49:26 +02:00
Bastien Nocera
1144db552e power: Add UI for "power-saver profile when battery is low"
See https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/merge_requests/247
2021-07-26 18:53:20 +02:00
Bastien Nocera
738c15be66 power: Fix D-Bus proxy leak 2021-07-21 13:53:59 +00:00
Bastien Nocera
98b921b46f power: Reword lap mode info message
Reword the lap mode info message slightly as the performance mode might
not have been what the user requested, but the warning should stay until
cleared nonetheless.
2021-07-20 00:51:48 +02:00
Bastien Nocera
06d110a3d0 power: Tweak power profile info boxes horizontal spacing
A bit too much whitespace around the info icon.
2021-07-20 00:51:48 +02:00
Bastien Nocera
c0ce1e53ab power: Show power profile info boxes for profile holds
Applications can request that power-profiles-daemon "hold" a particular
power profile for the duration of a task or event, such as launching a
taxing application, or saving power because of low battery.

Show those holds in the same type of info boxes we already use to show
"degraded" performance.

See https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/merge_requests/46
2021-07-20 00:51:48 +02:00
Bastien Nocera
05997b424c power: Move variant_lookup_string() helper function 2021-07-20 00:51:48 +02:00