Save to the journal when switching to another activity.
This commit is contained in:
@@ -146,6 +146,10 @@ class Activity(Window, gtk.Container):
|
||||
'joined': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([]))
|
||||
}
|
||||
|
||||
__gproperties__ = {
|
||||
'active': (bool, None, None, False, gobject.PARAM_READWRITE)
|
||||
}
|
||||
|
||||
def __init__(self, handle, create_jobject=True):
|
||||
"""Initialise the Activity
|
||||
|
||||
@@ -175,6 +179,7 @@ class Activity(Window, gtk.Container):
|
||||
|
||||
self.connect('destroy', self._destroy_cb)
|
||||
|
||||
self._active = False
|
||||
self._activity_id = handle.activity_id
|
||||
self._pservice = presenceservice.get_instance()
|
||||
self._shared_activity = None
|
||||
@@ -213,6 +218,17 @@ class Activity(Window, gtk.Container):
|
||||
else:
|
||||
self.jobject = None
|
||||
|
||||
def do_set_property(self, pspec, value):
|
||||
if pspec.name == 'active':
|
||||
if self._active != value:
|
||||
self._active = value
|
||||
if not self._active and self.jobject:
|
||||
self.save()
|
||||
|
||||
def do_get_property(self, pspec):
|
||||
if pspec.name == 'active':
|
||||
return self._active
|
||||
|
||||
def _internal_jobject_create_cb(self):
|
||||
pass
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
import logging
|
||||
|
||||
import dbus
|
||||
import dbus.service
|
||||
|
||||
@@ -81,3 +83,7 @@ class ActivityService(dbus.service.Object):
|
||||
def execute(self, command, args):
|
||||
return self._activity.execute(command, args)
|
||||
|
||||
@dbus.service.method(_ACTIVITY_INTERFACE)
|
||||
def set_active(self, active):
|
||||
logging.debug('ActivityService.set_active: %s.' % active)
|
||||
self._activity.props.active = active
|
||||
|
||||
Reference in New Issue
Block a user