mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 04:20:04 +01:00
Revert "policy: Remove policy for removed features"
This reverts commit ababfa2aaf.
Changes:
1. Drop the policy for the old APIs.
2. Add a policy for enableChargeLimit.
This commit is contained in:
parent
293e00e0f9
commit
7011b93c28
3 changed files with 62 additions and 0 deletions
|
|
@ -121,6 +121,11 @@ if systemdsystemunitdir == ''
|
||||||
systemdsystemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir')
|
systemdsystemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
datadir = get_option('datadir')
|
||||||
|
if datadir == ''
|
||||||
|
datadir = join_paths(prefix, get_option('datadir'))
|
||||||
|
endif
|
||||||
|
|
||||||
# Generate configuration file
|
# Generate configuration file
|
||||||
config_h = configure_file(output: 'config.h', configuration: cdata)
|
config_h = configure_file(output: 'config.h', configuration: cdata)
|
||||||
|
|
||||||
|
|
@ -132,6 +137,7 @@ subdir('libupower-glib')
|
||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('tools')
|
subdir('tools')
|
||||||
subdir('doc')
|
subdir('doc')
|
||||||
|
subdir('policy')
|
||||||
|
|
||||||
pkgconfig = import('pkgconfig')
|
pkgconfig = import('pkgconfig')
|
||||||
pkgconfig.generate(
|
pkgconfig.generate(
|
||||||
|
|
|
||||||
24
policy/meson.build
Normal file
24
policy/meson.build
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
if polkit.found()
|
||||||
|
#newer polkit has the ITS rules included
|
||||||
|
if polkit.version().version_compare('>0.113')
|
||||||
|
i18n.merge_file(
|
||||||
|
input: 'org.freedesktop.upower.policy.in',
|
||||||
|
output: 'org.freedesktop.upower.policy',
|
||||||
|
install: true,
|
||||||
|
install_dir: join_paths(datadir, 'polkit-1', 'actions') ,
|
||||||
|
type: 'xml',
|
||||||
|
po_dir: join_paths(meson.project_source_root(), 'po')
|
||||||
|
)
|
||||||
|
#older polkit is missing ITS rules and will fail
|
||||||
|
else
|
||||||
|
i18n.merge_file(
|
||||||
|
input: 'org.freedesktop.upower.policy.in',
|
||||||
|
output: 'org.freedesktop.upower.policy',
|
||||||
|
install: true,
|
||||||
|
install_dir: join_paths(datadir, 'polkit-1', 'actions') ,
|
||||||
|
type: 'xml',
|
||||||
|
data_dirs: join_paths(meson.project_source_root(), 'policy'),
|
||||||
|
po_dir: join_paths(meson.project_source_root(), 'po')
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
32
policy/org.freedesktop.upower.policy.in
Normal file
32
policy/org.freedesktop.upower.policy.in
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE policyconfig PUBLIC
|
||||||
|
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||||
|
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Policy definitions for UPower
|
||||||
|
|
||||||
|
Copyright (c) 2008 David Zeuthen <david@fubar.dk>
|
||||||
|
Copyright (c) 2008-2010 Richard Hughes <richard@hughsie.com>
|
||||||
|
|
||||||
|
NOTE: If you make changes to this file, make sure to validate the file
|
||||||
|
using the polkit-policy-file-validate(1) tool. Changes made to this
|
||||||
|
file are instantly applied.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<policyconfig>
|
||||||
|
<vendor>The UPower Project</vendor>
|
||||||
|
<vendor_url>http://upower.freedesktop.org/</vendor_url>
|
||||||
|
<icon_name>system-suspend</icon_name>
|
||||||
|
|
||||||
|
<action id="org.freedesktop.UPower.enable-charging-limit">
|
||||||
|
<_description>Enable battery charging limit</_description>
|
||||||
|
<_message>Authentication is required to set battery charging start and end limit.</_message>
|
||||||
|
<defaults>
|
||||||
|
<allow_inactive>no</allow_inactive>
|
||||||
|
<allow_active>yes</allow_active>
|
||||||
|
</defaults>
|
||||||
|
</action>
|
||||||
|
|
||||||
|
</policyconfig>
|
||||||
Loading…
Add table
Reference in a new issue