Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/rpms/sugar-toolkit/0033-olpc-10363-Inhitbit-suspend-when-sharing-joining-and.patch
diff options
context:
space:
mode:
Diffstat (limited to 'rpms/sugar-toolkit/0033-olpc-10363-Inhitbit-suspend-when-sharing-joining-and.patch')
-rw-r--r--rpms/sugar-toolkit/0033-olpc-10363-Inhitbit-suspend-when-sharing-joining-and.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/rpms/sugar-toolkit/0033-olpc-10363-Inhitbit-suspend-when-sharing-joining-and.patch b/rpms/sugar-toolkit/0033-olpc-10363-Inhitbit-suspend-when-sharing-joining-and.patch
new file mode 100644
index 0000000..bbc15b2
--- /dev/null
+++ b/rpms/sugar-toolkit/0033-olpc-10363-Inhitbit-suspend-when-sharing-joining-and.patch
@@ -0,0 +1,83 @@
+From 74a60d1485781b2c9219c1ed8ac0c21f277748d6 Mon Sep 17 00:00:00 2001
+From: Anish Mangal <anish@activitycentral.com>
+Date: Mon, 6 Feb 2012 13:25:44 -0200
+Subject: [PATCH 33/33] olpc#10363: Inhitbit suspend when sharing, joining and
+ inviting (private share)
+Organization: Sugar Labs Foundation
+
+In dextrose, and as the bug history of olpc#10363 and au#1049 suggests,
+power management kicking in doesnt work well with activities that are
+collaborating.
+
+This patch inhibits the ability to suspend when sharing, joining and
+inviting to a private share.
+
+Signed-off-by: Anish Mangal <anish@activitycentral.com>
+---
+ src/sugar/activity/activity.py | 22 ++++++++++++++++++++++
+ 1 files changed, 22 insertions(+), 0 deletions(-)
+
+diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
+index 4938caf..bfdc747 100644
+--- a/src/sugar/activity/activity.py
++++ b/src/sugar/activity/activity.py
+@@ -97,6 +97,8 @@ J_DBUS_SERVICE = 'org.laptop.Journal'
+ J_DBUS_PATH = '/org/laptop/Journal'
+ J_DBUS_INTERFACE = 'org.laptop.Journal'
+
++POWERD_INHIBIT_DIR = '/var/run/powerd-inhibit-suspend'
++
+ CONN_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties'
+
+
+@@ -713,6 +715,18 @@ class Activity(Window, gtk.Container):
+ else:
+ self._jobject.metadata['share-scope'] = SCOPE_NEIGHBORHOOD
+
++ def _inhibit_suspend(self):
++ if not os.path.exists(POWERD_INHIBIT_DIR):
++ return
++
++ path = os.path.join(POWERD_INHIBIT_DIR, str(os.getpid()))
++ try:
++ fd = open(path, 'w')
++ except IOError:
++ logging.error("Inhibit Suspend: Could not create file %s", path)
++ else:
++ fd.close()
++
+ def __joined_cb(self, activity, success, err):
+ """Callback when join has finished"""
+ logging.debug('Activity.__joined_cb %r', success)
+@@ -722,6 +736,8 @@ class Activity(Window, gtk.Container):
+ logging.debug('Failed to join activity: %s', err)
+ return
+
++ self._inhibit_suspend()
++
+ self.reveal()
+ self.emit('joined')
+ self.__privacy_changed_cb(self.shared_activity, None)
+@@ -750,6 +766,8 @@ class Activity(Window, gtk.Container):
+
+ activity.props.name = self._jobject.metadata['title']
+
++ self._inhibit_suspend()
++
+ self.shared_activity = activity
+ self.shared_activity.connect('notify::private',
+ self.__privacy_changed_cb)
+@@ -866,6 +884,10 @@ class Activity(Window, gtk.Container):
+
+ self._session.unregister(self)
+
++ if os.path.exists(POWERD_INHIBIT_DIR):
++ path = os.path.join(POWERD_INHIBIT_DIR, str(os.getpid()))
++ os.unlink(path)
++
+ def close(self, skip_save=False):
+ """Request that the activity be stopped and saved to the Journal
+
+--
+1.7.4.4
+