*: Add setup method on all apps that don't have it

This is needed for the apps to get enabled soon after installation. In case of
'sharing' app, a shortcut will appear on the apps page. This also brings
uniformity to help later refactoring.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-08-11 16:44:03 -07:00 committed by James Valleroy
parent 75f6abac1e
commit f6ef0135d2
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
7 changed files with 35 additions and 0 deletions

View File

@ -20,3 +20,8 @@ class ApiApp(app_module.App):
info = app_module.Info(app_id=self.app_id, version=self._version,
is_essential=True)
self.add(info)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
self.enable()

View File

@ -67,6 +67,11 @@ class DiagnosticsApp(app_module.App):
interval = 180 if cfg.develop else 3600
glib.schedule(interval, _warn_about_low_ram_space)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
self.enable()
def diagnose(self):
"""Run diagnostics and return the results."""
results = super().diagnose()

View File

@ -51,6 +51,11 @@ class FirstBootApp(app_module.App):
"""Perform post initialization operations."""
post_setup.connect(_clear_first_boot_steps)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
self.enable()
def _clear_first_boot_steps(sender, module_name, **kwargs):
"""Flush the cache of first boot steps so it is recreated."""

View File

@ -74,3 +74,8 @@ class HelpApp(app_module.App):
static_files = web_server.StaticFiles('static-files-help',
directory_map)
self.add(static_files)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
self.enable()

View File

@ -59,6 +59,11 @@ class NamesApp(app_module.App):
domain_added.connect(on_domain_added)
domain_removed.connect(on_domain_removed)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
self.enable()
def on_domain_added(sender, domain_type, name='', description='',
services=None, **kwargs):

View File

@ -40,3 +40,8 @@ class PowerApp(app_module.App):
backup_restore = BackupRestore('backup-restore-power',
**manifest.backup)
self.add(backup_restore)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
self.enable()

View File

@ -49,6 +49,11 @@ class SharingApp(app_module.App):
**manifest.backup)
self.add(backup_restore)
def setup(self, old_version):
"""Install and configure the app."""
super().setup(old_version)
self.enable()
def list_shares():
"""Return a list of shares."""