[Dextrose] [PATCH] Notify if powerd automatic pm is on
Martin Abente
martin.abente.lahaye at gmail.com
Tue Jan 11 09:51:46 EST 2011
When automatic power management is on, the 3G device is disabled
after one minute of inactivity.
This patch send a message notification to warn the user about
the issue.
---
extensions/deviceicon/network.py | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/extensions/deviceicon/network.py b/extensions/deviceicon/network.py
index 62026eb..b8bf7bb 100644
--- a/extensions/deviceicon/network.py
+++ b/extensions/deviceicon/network.py
@@ -31,6 +31,7 @@ import gtk
import gobject
import gconf
import dbus
+import os
from sugar.graphics.icon import get_icon_state
from sugar.graphics import style
@@ -50,6 +51,7 @@ from jarabe.model.network import Settings
from jarabe.model.network import IP4Config
from jarabe.frame.frameinvoker import FrameWidgetInvoker
from jarabe.view.pulsingicon import PulsingIcon
+from jarabe.frame import get_view
IP_ADDRESS_TEXT_TEMPLATE = _("IP address: %s")
@@ -77,6 +79,8 @@ _GSM_SHARING_NEIGHBORHOOD = 2
_GSM_SHARING_CHANNELS = [2,3,4,5,7,8,9,10,12,13]
+_POWERD_INHIBIT_FLAG = '/etc/powerd/flags/inhibit-suspend'
+
class WirelessPalette(Palette):
__gtype_name__ = 'SugarWirelessPalette'
@@ -918,7 +922,15 @@ class GsmDeviceView(TrayIcon):
self._palette.update_connection_time()
self._palette.update_stats(0, 0)
if self._palette is not None:
- self._palette.connection_info_box.show()
+ self._palette.connection_info_box.show()
+
+ if not os.access(_POWERD_INHIBIT_FLAG, os.R_OK):
+ message = _('The automatic power management is on.' \
+ ' The 3G connection will be dropped within' \
+ ' one minute of inactivity.')
+ frame = get_view()
+ frame.add_message(message, icon_name=self._ICON_NAME,
+ corner=gtk.CORNER_BOTTOM_RIGHT)
elif state is network.DEVICE_STATE_DISCONNECTED:
gsm_state = _GSM_STATE_DISCONNECTED
--
1.7.1
More information about the Dextrose
mailing list