Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Flavor compatible desktop settings #1542

Merged
merged 2 commits into from Mar 7, 2023
Merged

Conversation

jpnurmi
Copy link
Contributor

@jpnurmi jpnurmi commented Mar 6, 2023

Following up on what was promised in #1535. :)

Make the desktop settings a plain service because it's no longer notifying anything now that the app locale was moved out, give it a bit more explicit name, and let flavors pass their own into runInstallerApp().

The default implementation for GNOME has been also generalized a tiny bit to make it able to switch between Foo and Foo-dark themes where Foo can be anything instead of being hardcoded to Yaru. :)

Ref: #1533

@jpnurmi jpnurmi requested a review from d-loose March 6, 2023 17:09
@jpnurmi jpnurmi marked this pull request as draft March 7, 2023 06:25
@jpnurmi
Copy link
Contributor Author

jpnurmi commented Mar 7, 2023

Hmm, I've got an idea. Instead of adding more and more runInstallerApp() arguments, perhaps we could let flavors pre-register services before calling the method. This could be more flexible and powerful...

import 'package:ubuntu_desktop_installer/installer.dart';

import 'budgie_slides.dart';

Future<void> main(List<String> args) {
  return runInstallerApp(
    args,
    flavor: FlavorData(
      name: 'Ubuntu Flavor',
      theme: yaruFooLight,
      darkTheme: yaruFooDark,
      localizationsDelegates: AppLocalizations.localizationsDelegates,
    ),
    slides: [...],
    settings: BudgieSettings(), // <==
  );
}

vs.

import 'package:ubuntu_desktop_installer/installer.dart';
import 'package:ubuntu_service/ubuntu_service.dart';

import 'budgie_slides.dart';
import 'budgie_settings.dart';

Future<void> main(List<String> args) {
  registerService<DesktopSettings>(BudgieSettings.new);  // <==

  return runInstallerApp(
    args,
    flavor: FlavorData(
      name: 'Ubuntu Flavor',
      theme: yaruFooLight,
      darkTheme: yaruFooDark,
      localizationsDelegates: AppLocalizations.localizationsDelegates,
    ),
    slides: [...],
  );
}

@jpnurmi jpnurmi force-pushed the desktop-settings branch 2 times, most recently from 69c3880 to 77f9c55 Compare March 7, 2023 10:34
@jpnurmi jpnurmi marked this pull request as ready for review March 7, 2023 10:58
Copy link
Member

@d-loose d-loose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jpnurmi jpnurmi merged commit 7a9098a into canonical:main Mar 7, 2023
@jpnurmi jpnurmi deleted the desktop-settings branch March 7, 2023 11:56
kenvandine pushed a commit that referenced this pull request Mar 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants