def apply(self):
"""Creates or deletes the autostart file based upon current state"""
if not self.props.sensitive: # We never got the current state
return
if self.props.active and not self._was_enabled:
logging.info('Creating autostart file')
source = Gio.File.new_for_uri('resource:///se/tingping/Trg/se.tingping.Trg.service.desktop')
if hasattr(source, 'copy_async'):
# TODO: Fix upstream in GLib
source.copy_async(self.autostart_file, Gio.FileCopyFlags.NONE, GLib.PRIORITY_DEFAULT)
else:
with suppress(GLib.Error):
source.copy(self.autostart_file, Gio.FileCopyFlags.NONE)
elif not self.props.active and self._was_enabled:
logging.info('Deleting autostart file')
self.autostart_file.delete_async(GLib.PRIORITY_DEFAULT)
preferences_dialog.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录