Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
3929a8d9
Commit
3929a8d9
authored
13 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
[Kamil Paral & I] upower support. Fixes #1962
parent
da6bafb8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/features_window.py
+4
-0
4 additions, 0 deletions
src/features_window.py
src/gui_interface.py
+3
-0
3 additions, 0 deletions
src/gui_interface.py
src/upower_listener.py
+50
-0
50 additions, 0 deletions
src/upower_listener.py
with
57 additions
and
0 deletions
src/features_window.py
+
4
−
0
View file @
3929a8d9
...
@@ -111,6 +111,10 @@ class FeaturesWindow:
...
@@ -111,6 +111,10 @@ class FeaturesWindow:
_
(
'
Ability to request your router to forward port for file transfer.
'
),
_
(
'
Ability to request your router to forward port for file transfer.
'
),
_
(
'
Requires python-gupnp-igd.
'
),
_
(
'
Requires python-gupnp-igd.
'
),
_
(
'
Feature not available under Windows.
'
)),
_
(
'
Feature not available under Windows.
'
)),
_
(
'
UPower
'
):
(
self
.
gupnp_igd_available
,
_
(
'
Ability to disconnect properly just before suspending the machine.
'
),
_
(
'
Requires upower and python-dbus.
'
),
_
(
'
Feature not available under Windows.
'
)),
}
}
# name, supported
# name, supported
...
...
This diff is collapsed.
Click to expand it.
src/gui_interface.py
+
3
−
0
View file @
3929a8d9
...
@@ -2723,6 +2723,9 @@ class Interface:
...
@@ -2723,6 +2723,9 @@ class Interface:
dbus_support
.
supported
:
dbus_support
.
supported
:
import
network_manager_listener
import
network_manager_listener
if
dbus_support
.
supported
:
import
upower_listener
# Handle gnome screensaver
# Handle gnome screensaver
if
dbus_support
.
supported
:
if
dbus_support
.
supported
:
def
gnome_screensaver_ActiveChanged_cb
(
active
):
def
gnome_screensaver_ActiveChanged_cb
(
active
):
...
...
This diff is collapsed.
Click to expand it.
src/upower_listener.py
0 → 100644
+
50
−
0
View file @
3929a8d9
## src/upower_listener.py
##
## Copyright (C) 2006-2011 Yann Leboulanger <asterix AT lagaule.org>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 3 only.
##
## Gajim is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
supported
=
False
from
common
import
dbus_support
from
common
import
gajim
def
on_suspend
(
*
args
,
**
kwargs
):
for
name
,
conn
in
gajim
.
connections
.
items
():
if
gajim
.
account_is_connected
(
name
):
conn
.
old_show
=
gajim
.
SHOW_LIST
[
conn
.
connected
]
st
=
conn
.
status
conn
.
change_status
(
'
offline
'
,
_
(
'
Machine going to sleep
'
))
conn
.
status
=
st
conn
.
time_to_reconnect
=
5
if
dbus_support
.
supported
:
import
dbus
import
dbus.glib
try
:
from
common.dbus_support
import
system_bus
bus
=
system_bus
.
bus
()
if
'
org.freedesktop.UPower
'
in
bus
.
list_names
():
up_object
=
bus
.
get_object
(
'
org.freedesktop.UPower
'
,
'
/org/freedesktop/UPower
'
)
bus
.
add_signal_receiver
(
on_suspend
,
'
Sleeping
'
,
'
org.freedesktop.UPower
'
,
'
org.freedesktop.UPower
'
,
'
/org/freedesktop/UPower
'
)
supported
=
True
except
Exception
:
pass
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment