diff options
| author | David Lönnhager <david.l@mullvad.net> | 2025-05-06 10:22:02 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2025-05-06 10:22:02 +0200 |
| commit | ffd6f7bcf54a6d0e24233e602ace35090f805e52 (patch) | |
| tree | 55b6974ef2d3238f37526b9f980a4dcf73c56d75 | |
| parent | 7909b095fc3db2068b53a9c744d66129b2b2df4a (diff) | |
| parent | 7942d8eca1794d005f852973c4746eca2f828659 (diff) | |
| download | mullvadvpn-ffd6f7bcf54a6d0e24233e602ace35090f805e52.tar.xz mullvadvpn-ffd6f7bcf54a6d0e24233e602ace35090f805e52.zip | |
Merge branch 'set-installer-downloader-icon'
| -rw-r--r-- | installer-downloader/CHANGELOG.md | 4 | ||||
| -rw-r--r-- | installer-downloader/Cargo.toml | 2 | ||||
| -rw-r--r-- | installer-downloader/src/winapi_impl/ui.rs | 10 |
3 files changed, 15 insertions, 1 deletions
diff --git a/installer-downloader/CHANGELOG.md b/installer-downloader/CHANGELOG.md index 5749bffa2a..10211d4e0c 100644 --- a/installer-downloader/CHANGELOG.md +++ b/installer-downloader/CHANGELOG.md @@ -20,6 +20,10 @@ Line wrap the file at 100 chars. Th * **Security**: in case of vulnerabilities. ## [Unreleased] +### Added +#### Windows +- Add window icon. + ### Changed - Changed title to "Mullvad VPN loader". diff --git a/installer-downloader/Cargo.toml b/installer-downloader/Cargo.toml index bb99b592fb..01eac790fd 100644 --- a/installer-downloader/Cargo.toml +++ b/installer-downloader/Cargo.toml @@ -33,7 +33,7 @@ talpid-platform-metadata = { path = "../talpid-platform-metadata" } mullvad-update = { path = "../mullvad-update", features = ["client"] } [target.'cfg(target_os = "windows")'.dependencies] -native-windows-gui = { version = "1.0.12", features = ["frame", "image-decoder", "progress-bar"], default-features = false } +native-windows-gui = { version = "1.0.12", features = ["embed-resource", "frame", "image-decoder", "progress-bar"], default-features = false } windows-sys = { workspace = true, features = ["Win32_UI", "Win32_UI_WindowsAndMessaging", "Win32_Graphics", "Win32_Graphics_Gdi"] } mullvad-paths = { path = "../mullvad-paths" } diff --git a/installer-downloader/src/winapi_impl/ui.rs b/installer-downloader/src/winapi_impl/ui.rs index b9502d0036..79e91de915 100644 --- a/installer-downloader/src/winapi_impl/ui.rs +++ b/installer-downloader/src/winapi_impl/ui.rs @@ -48,6 +48,9 @@ pub const BETA_LINK_HANDLER_ID: usize = 0x10002; pub struct AppWindow { pub window: nwg::Window, + pub window_icon_res: nwg::EmbedResource, + pub window_icon: Option<nwg::Icon>, + pub banner: nwg::ImageFrame, pub banner_text: nwg::Label, @@ -142,10 +145,17 @@ impl AppWindow { /// Set up UI elements, position them, and register window message handlers /// Note that some additional setup happens in [Self::on_init] pub fn layout(mut self) -> Result<Rc<RefCell<AppWindow>>, nwg::NwgError> { + nwg::EmbedResource::builder().build(&mut self.window_icon_res)?; + + // Load icon embedded using the build script. This has a default id of 1. + // See `winres::WindowsResource::set_icon`. + self.window_icon = self.window_icon_res.icon(1, None); + nwg::Window::builder() .size((WINDOW_WIDTH as i32, WINDOW_HEIGHT as i32)) .center(true) .title(WINDOW_TITLE) + .icon(self.window_icon.as_ref()) .flags(WindowFlags::WINDOW) .build(&mut self.window)?; |
