Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gnome-settings-daemon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
246
Issues
246
List
Boards
Labels
Service Desk
Milestones
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
gnome-settings-daemon
Commits
7359ef6d
Commit
7359ef6d
authored
Jan 29, 2013
by
Bastien Nocera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
power: Make GSD_ACTION_DELAY a constant
Instead of poking at the envvars.
parent
1a9230de
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
19 deletions
+9
-19
plugins/power/Makefile.am
plugins/power/Makefile.am
+1
-1
plugins/power/gsd-power-manager.c
plugins/power/gsd-power-manager.c
+8
-17
plugins/power/test.py
plugins/power/test.py
+0
-1
No files found.
plugins/power/Makefile.am
View file @
7359ef6d
...
...
@@ -76,7 +76,7 @@ gsd_test_power_SOURCES = \
test-power.c
gsd_test_power_CFLAGS
=
$(libpower_la_CFLAGS)
gsd_test_power_CPPFLAGS
=
$(libpower_la_CPPFLAGS)
-DGSD_MOCK
=
1
gsd_test_power_CPPFLAGS
=
$(libpower_la_CPPFLAGS)
-DGSD_MOCK
=
1
-DGSD_ACTION_DELAY
=
1
gsd_test_power_LDADD
=
\
-lm
\
$(top_builddir)
/plugins/common/libcommon.la
\
...
...
plugins/power/gsd-power-manager.c
View file @
7359ef6d
...
...
@@ -86,6 +86,12 @@
/* Keep this in sync with gnome-shell */
#define SCREENSAVER_FADE_TIME 10
/* seconds */
/* Time between notifying the user about a critical action and executing it.
* This can be changed with the GSD_ACTION_DELAY constant. */
#ifndef GSD_ACTION_DELAY
#define GSD_ACTION_DELAY 20
#endif
/* !GSD_ACTION_DELAY */
static
const
gchar
introspection_xml
[]
=
"<node>"
" <interface name='org.gnome.SettingsDaemon.Power'>"
...
...
@@ -241,10 +247,6 @@ G_DEFINE_TYPE (GsdPowerManager, gsd_power_manager, G_TYPE_OBJECT)
static
gpointer
manager_object
=
NULL
;
/* Time between notifying the user about a critical action and executing it.
* This can be changed with the $GSD_ACTION_DELAY environment variable. */
static
guint
critical_action_delay
=
20
;
GQuark
gsd_power_manager_error_quark
(
void
)
{
...
...
@@ -1684,7 +1686,7 @@ engine_charge_action (GsdPowerManager *manager, UpDevice *device)
}
/* wait 20 seconds for user-panic */
timer_id
=
g_timeout_add_seconds
(
critical_action_delay
,
timer_id
=
g_timeout_add_seconds
(
GSD_ACTION_DELAY
,
(
GSourceFunc
)
manager_critical_action_do_cb
,
manager
);
g_source_set_name_by_id
(
timer_id
,
"[GsdPowerManager] battery critical-action"
);
...
...
@@ -1715,7 +1717,7 @@ engine_charge_action (GsdPowerManager *manager, UpDevice *device)
}
/* wait 20 seconds for user-panic */
timer_id
=
g_timeout_add_seconds
(
critical_action_delay
,
timer_id
=
g_timeout_add_seconds
(
GSD_ACTION_DELAY
,
(
GSourceFunc
)
manager_critical_ups_action_do_cb
,
manager
);
g_source_set_name_by_id
(
timer_id
,
"[GsdPowerManager] ups critical-action"
);
...
...
@@ -2818,21 +2820,10 @@ static void
gsd_power_manager_class_init
(
GsdPowerManagerClass
*
klass
)
{
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
klass
);
const
char
*
env_action_delay
;
object_class
->
finalize
=
gsd_power_manager_finalize
;
g_type_class_add_private
(
klass
,
sizeof
(
GsdPowerManagerPrivate
));
env_action_delay
=
g_getenv
(
"GSD_ACTION_DELAY"
);
if
(
env_action_delay
!=
NULL
)
{
critical_action_delay
=
atoi
(
env_action_delay
);
/* use the default for invalid values */
if
(
critical_action_delay
<
0
)
{
g_warning
(
"Invalid value '%s' of $GSD_ACTION_DELAY, ignoring"
,
env_action_delay
);
critical_action_delay
=
20
;
}
}
}
static
void
...
...
plugins/power/test.py
View file @
7359ef6d
...
...
@@ -84,7 +84,6 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self
.
plugin_log_write
=
open
(
os
.
path
.
join
(
self
.
workdir
,
'plugin_power.log'
),
'wb'
)
# avoid painfully long delays of actions for tests
env
=
os
.
environ
.
copy
()
env
[
'GSD_ACTION_DELAY'
]
=
'1'
env
[
'GSD_DISABLE_BACKLIGHT_HELPER'
]
=
'1'
self
.
daemon
=
subprocess
.
Popen
(
[
os
.
path
.
join
(
builddir
,
'gsd-test-power'
)],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment