Commit graph

196 commits

Author SHA1 Message Date
Jeremy Bicha
3d686de41c power: stop using deprecated up_client_get_devices
and bump required upower version to 0.99.8 which
introduced up_client_get_devices2

This is a follow-up from
https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/82
2018-12-07 14:55:43 +00:00
Robert Ancell
1b70273221 power: Fix device label alignment
Should be left-aligned, previously it was centered
2018-11-21 12:11:20 +13:00
João Paulo Rechi Vita
6efaf85e9a power: Label the PENDING_CHARGING state as "Not Charging"
The pending-charge state means AC power is on but the battery is not
being charged. This can happen because its charge is above a certain
threshold, to avoid short charging cycles and prolong the battery's
life, or because the PSU is not powerful enough to charge the batteries.

Instead of lying to the user about something being estimated, we should
simply tell the truth and set the label to "Not Charging".

Closes: #249.
2018-11-14 13:53:40 -08:00
Robert Ancell
e6bf2870c1 power: Make .ui filename match the .c filename 2018-11-12 16:41:01 +00:00
Benjamin Berg
b5711c59ec power: Correctly lookup or insert new items into combobox
The code to lookup or insert items into the combobox had a few issues.
It would assume that the items are sorted, causing existing items to not
be found and be inserted instead. It also would simply forget to insert
an item if it was larger than all existing items.

This code is now changed to iterate over all items, finding the best
insertion point in the process (next item has a larger value, or the
values are not increasing anymore). The item will only be inserted if it
has not been found.

Fixes #261
2018-11-08 12:38:51 +00:00
Philip Withnall
c07b357311 panels: Add X-GNOME-UsesNotifications to several desktop files
gnome-settings-daemon emits notifications related to these four control
panels. If we add X-GNOME-UsesNotifications to their desktop files, the
user will be able to control the notifications.

https://wiki.gnome.org/Initiatives/GnomeGoals/NotificationSource

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-01 17:22:21 +00:00
Robert Ancell
99220dad50 power: Don't use gtk_widget_show_all
It is removed in GTK+ 4
2018-10-11 22:21:34 +00:00
Jonathan Kang
4af9803f51 power: set no-show-all to TRUE on wifi and mobile rows
The Wi-Fi and mobile broadband row's visibility depends on related
device status. But calling gtk_widget_show_all on the whole list box
makes them visible even related device is not avialbe. Fix that by
setting no-show-all of these two widgets as TRUE.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/189
2018-10-11 02:07:51 +00:00
Marek Cernocky
fa08a3bfe6 Added a translation context for the time options in Power and Privacy panels 2018-10-10 20:56:14 +00:00
Andrea Azzarone
f34ea2bd5e power: Use g_signal_connect_object
Objects created using the object storage API are not disposed when the panel
that created them is disposed. In order to prevent segfaults we need to manually
disconnect signal handler connected to these objects or we can do it
automatically using g_signal_connect_object.

Fixes: https://launchpad.net/bugs/1797205
2018-10-10 20:12:19 +01:00
Benjamin Berg
75556d7c5a power: Handle cancelled kbd brightness proxy creation
The code must not access the passed panel if the operation to create the
keyboard proxy has been cancelled. This fixes a possible crash when
switching away from the power panel.
2018-09-25 02:46:54 +00:00
Robert Roth
f7798f5dfa power: set proper level offsets for battery levelbars
The battery power level level bars are using the default offsets for low, high and full battery level, 0.25, 0.75 and 1.0.

Based on the suggestion from #68, this commit changes the high and full offset to 0.1 and 0.8, and the low battery level offset to 0.03 for primary batteries and UPSs, and 0.05 for other batteries and devices.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/68
2018-09-10 15:15:09 +00:00
Georges Basile Stavracas Neto
c2eaafebc0 power: Minor adjustment in the mobile broadband string
Now it properly follows Nick's suggestion.

[skip ci]
2018-07-23 11:24:12 -03:00
Georges Basile Stavracas Neto
37a0b8e04f power: Reword some strings
Some of the current string related to saving power by
turning something off are ambiguous, and can mean both
"yes, turn off" or "yes, keep it on" at the same time.

This commit slightly rewords those sentences in order
to disambiguate them.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/53

[skip ci]
2018-07-23 11:07:43 -03:00
Robert Ancell
71383e8b50 power: Use GtkTemplate 2018-06-11 14:30:31 +00:00
Robert Ancell
3622c8ff14 power: Use g_auto for variables 2018-06-03 01:38:43 +00:00
Robert Ancell
d2959e4fe7 power: Simplify GPtrArray memory management 2018-05-30 23:17:08 +00:00
Robert Ancell
ed6ac15b5c power: Simplify cancellable destruction 2018-05-30 23:17:07 +00:00
Robert Ancell
27a64cd04b power: Replace ifdefs with #pragma once 2018-05-30 23:17:07 +00:00
Robert Ancell
f51932978f power: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-30 23:17:07 +00:00
Bastien Nocera
f26d21682a power: Automatically add values to drop-down when necessary
When a setting is set to a value that's not in the list of options, add
that custom value to the drop-down for the duration of the run, so as to
avoid the last item being selected and causing confusion.

https://bugzilla.gnome.org/show_bug.cgi?id=793448
2018-04-19 14:59:10 +02:00
Bastien Nocera
6c447dc14a power: Don't show approximate percentages
When there's a battery-level property (new in UPower 0.99.5), don't show
the percentage, as it's a rough approximation of the truth.

https://bugzilla.gnome.org/show_bug.cgi?id=780360
2018-04-19 14:39:11 +02:00
Benjamin Berg
c2f601a9d4 Move common panel code from shell/ to panel/common
This creates a new static library called libwidget which the shell links
against.
2018-04-17 15:26:59 +02:00
Georges Basile Stavracas Neto
eb62419b4b power: Cache D-Bus proxies and NMClient 2018-04-06 22:23:39 -03:00
Benjamin Berg
1d72a0b350 power: Fix crash when panel is closed quickly
Fix a use-after-free while creating the dbus proxy for
org.gnome.SettingsDaemon.Power.Keyboard. This fix is identical to the
previous fix for the screen proxy.

https://bugzilla.gnome.org/show_bug.cgi?id=794089
2018-03-05 16:47:52 +01:00
Piotr Drąg
7265bd53a0 Add translator comments to .desktop files
Icons are confusing translators, and gettext
is unlikely to get fixed any time soon.
2018-02-23 18:49:35 +01:00
Bastien Nocera
d2f1155639 power: Fix crash when panel is closed quickly
Another use-after-free on cancellation crash.

 #0  g_type_check_instance_cast (type_instance=type_instance@entry=0x1eac3c0, iface_type=32150864) at /glib/gobject/gtype.c:4057
 #1  0x0000000000494077 in got_screen_proxy_cb (source_object=<optimized out>, res=0x1eceab0, user_data=user_data@entry=0x1eac3c0)
     at panels/power/cc-power-panel.c:1083

https://bugzilla.gnome.org/show_bug.cgi?id=789464
2018-02-20 10:59:18 +01:00
Bastien Nocera
015fe8de1d power: Don't treat device batteries as power supplies
Show the "desktop" style dialogue ("Automatic suspend, when idle") even
when we have devices with batteries in use. We need "power supply"
batteries to consider the device as a laptop, or UPS-powered machine.

https://bugzilla.gnome.org/show_bug.cgi?id=793509
2018-02-16 14:40:56 +01:00
Bastien Nocera
eb88ce56a8 power: Add 20 and 25 minutes suspend timeouts
Pad out the 15-30 minutes mark with 5 minute increments. This also means
that the new 20-minute default for suspending is now in the list, and
will be selected when the panel is opened, rather than the 30 minutes
option.

See https://bugzilla.gnome.org/show_bug.cgi?id=681869

https://bugzilla.gnome.org/show_bug.cgi?id=792890
2018-01-26 00:00:02 +01:00
Iñigo Martínez
3afdaa3b2f build: Make network mandatory on every linux
In a recent commit[0], bluetooth, network and wacom panels were made
mandatory on every linux except on S390 systems. However, the
network panel should also be mandatory on S390 systems running
linux.

This changes the conditions to build bluetooh, network and wacom
panels.

https://bugzilla.gnome.org/show_bug.cgi?id=792641

[0] https://git.gnome.org/browse/gnome-control-center/commit/?id=a2b20a65c
2018-01-23 12:42:38 -02:00
Iñigo Martínez
0dd386f405 build: Migrate from Intltool to Gettext
Recent versions of Gettext are able to translate several formats
that are used in GNOME applications. This patch migrates from
Intltool to Gettext by using meson's i18n features.

https://bugzilla.gnome.org/show_bug.cgi?id=787588
2018-01-23 10:49:31 +01:00
Iñigo Martínez
a2b20a65cb build: Make bluetooth, network and wacom mandatory on linux
The bluetooh, network and wacom panels should not be optional
on linux, except on s390 systems which lack USB support. It
should also not be built at all on other systems.

This patch makes these panels mandatory on linux.

https://bugzilla.gnome.org/show_bug.cgi?id=792641
2018-01-22 23:06:45 -02:00
Michael Catanzaro
8e2305c0fc power: Add sublabel for Bluetooth switch
We already have this label for Wi-Fi and Mobile Broadband, so it looks
silly that it's missing from the Bluetooth row.

https://bugzilla.gnome.org/show_bug.cgi?id=771200
2018-01-18 11:47:08 -02:00
Iñigo Martínez
dc0988d47c build: Remove autotools
To avoid the burden of maintaining multiple build systems, this
patch removes autotools support.

https://bugzilla.gnome.org/show_bug.cgi?id=785414
2018-01-18 12:20:08 +01:00
Bastien Nocera
ca3779467e power: Add gaming input devices label
See https://bugs.freedesktop.org/show_bug.cgi?id=102493

https://bugzilla.gnome.org/show_bug.cgi?id=787087
2018-01-18 12:15:29 +01:00
Piotr Drąg
b65e31323a panels: Remove soft hyphens from .desktop files
With the old shell gone, there is no need to work around cut off panel
names (bug #647087). As it stands now, it only confuses translators
(invisible characters are hard to, well, see).

https://bugzilla.gnome.org/show_bug.cgi?id=792629
2018-01-18 00:12:04 -02:00
Iñigo Martínez
32edd6789e build: Port to meson build system
Meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=785414
2018-01-17 20:09:35 -02:00
Allan Day
8a8e53ab8a Standardize vertical spacing of panels
Ensure that the vertical spacing inside each panel is similar.
This makes the transition between each panel smoother and makes
the control center feel more cohesive.

Settings panels are given 32px above and below their content
and 32px vertical space between major sections. 12px space is
placed below headings.

Bluetooth, displays and printers are not addressed.

https://bugzilla.gnome.org/show_bug.cgi?id=786384
2017-08-20 18:38:42 +02:00
Allan Day
e29e97a9a4 power: harmonize header positioning
Some of the headings have horizontal margins and others don't,
creating an inconsistent layout. Remove the horizontal margins
from all headings.

https://bugzilla.gnome.org/show_bug.cgi?id=786327
2017-08-16 15:43:04 -03:00
Georges Basile Stavracas Neto
f7bdd3c969 panels: Minor adjustments for the new shell 2017-08-09 19:31:41 +02:00
Jeremy Bicha
62c86c7712 power: Restore Power Off option for Power Button
https://bugzilla.gnome.org/show_bug.cgi?id=781108
2017-08-07 13:24:11 -04:00
Michael Catanzaro
f4232a2e68 power: Fix wifi device state when opening power panel
This toggle is always set to off when the panel is opened. We should
check whether it's on or not when opening the panel. Currently we are
only subscribed to changes, so we don't check the wifi state until it's
toggled on or off after the panel has been opened the first time.

https://bugzilla.gnome.org/show_bug.cgi?id=771564
2016-09-20 10:49:25 +02:00
Bastien Nocera
4033a3dbca power: Fix "automatic suspend" label not taking batteries into account
Whether or not we have batteries was computed after we updated the
label.

https://bugzilla.gnome.org/show_bug.cgi?id=771532
2016-09-20 10:30:27 +02:00
Bastien Nocera
1abacd2970 power: Warn if automatic suspend timeouts are negative
They should probably have been unsigned integers, but they're not, so
warn if they are. The rest of the code handles negative values as if
they were 0.

https://bugzilla.gnome.org/show_bug.cgi?id=771542
2016-09-20 10:30:27 +02:00
Bastien Nocera
cc4e1349e9 power: Simplify update_automatic_suspend_label()
By replacing the magic 0 by its meaning ("never") as explained in the
gnome-settings-daemon GSettings schemas.

https://bugzilla.gnome.org/show_bug.cgi?id=771542
2016-09-20 10:30:27 +02:00
Bastien Nocera
8400d3ed81 power: Port to libnm 1.2
And make the NMClient instantiation async now that the API permits it.

https://bugzilla.gnome.org/show_bug.cgi?id=765910
2016-05-27 18:23:33 +02:00
Bastien Nocera
5c10ce45b8 panels: Fix translators comments being truncated
Commit b3be076 added soft hyphens along with a comment for translators
to use those soft hyphens. Except that gettext would only grab the one
line out of the four we wrote for translators to read. Put them all on
the same line so that gettext actually extracts those.

https://bugzilla.gnome.org/show_bug.cgi?id=765778
2016-04-28 23:38:00 +02:00
Bastien Nocera
b3be07609a panels: Fix truncated panel names for larger fonts
Note that this fix will not automatically fix translations, which will
need to add soft-hyphens (U+00AD) to their translations themselves, and
will not fix larger fonts for which the split up syllables end up
being bigger than the maximum text width.

It's the best we can do without redesigning the Settings shell, which is
already something planned.

https://bugzilla.gnome.org/show_bug.cgi?id=647087#c13
2016-04-07 16:06:35 +02:00
Cosimo Cecchi
b1e2bc6f04 power: show "Suspend & Power Off" section only when relevant
We now ask logind whether the system can suspend or hibernate, and
change the visibility of the items in the panel based on that.

Based on a patch by Mario Sanchez Prada <mario@endlessm.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=764508
2016-04-05 20:33:13 -07:00
Cosimo Cecchi
0e54ee82c8 power: move function call into section method
This function logically belongs into the section constructor. Move it
there.

https://bugzilla.gnome.org/show_bug.cgi?id=764508
2016-04-05 20:29:13 -07:00