Skip to content

Commit

Permalink
Merge pull request #3725 from canonical/forbid-launch-with-deleted-name
Browse files Browse the repository at this point in the history
[gui] guard against launching an instance with the name of a deleted instance
  • Loading branch information
ricab authored Oct 23, 2024
2 parents fdf1fa1 + b1c6608 commit d285b1c
Show file tree
Hide file tree
Showing 38 changed files with 1,479 additions and 943 deletions.
2 changes: 2 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ apps:
command: bin/bundle/multipass_gui
command-chain: [bin/set-xdg-vars]
plugs:
- all-home
- desktop
- desktop-legacy
- gsettings
- network
- opengl
- removable-media
- unity7
- wayland
- x11
Expand Down
Binary file added src/client/gui/assets/FreeSans.ttf
Binary file not shown.
Binary file added src/client/gui/assets/NotoColorEmoji-Regular.ttf
Binary file not shown.
Binary file added src/client/gui/assets/UbuntuMono-B.ttf
Binary file not shown.
Binary file added src/client/gui/assets/UbuntuMono-R.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions src/client/gui/assets/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 17 additions & 46 deletions src/client/gui/lib/before_quit_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart' hide Switch;

import 'confirmation_dialog.dart';
import 'switch.dart';

class BeforeQuitDialog extends StatefulWidget {
Expand All @@ -23,54 +24,24 @@ class _BeforeQuitDialogState extends State<BeforeQuitDialog> {

@override
Widget build(BuildContext context) {
return AlertDialog(
shape: const Border(),
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
titlePadding: const EdgeInsets.symmetric(horizontal: 16).copyWith(top: 8),
buttonPadding: const EdgeInsets.symmetric(horizontal: 16),
title: Row(children: [
const Expanded(child: Text('Before quitting')),
IconButton(
onPressed: widget.onClose,
splashRadius: 15,
icon: const Icon(Icons.close),
return ConfirmationDialog(
title: 'Before quitting',
body: Column(children: [
const Text(
'When quitting this application you can leave instances running in the background or choose to stop them completely.',
),
]),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(),
const SizedBox(
width: 600,
child: Text(
'When quitting this application you can leave instances running in the background or choose to stop them completely.',
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 18),
child: Switch(
value: remember,
label: 'Remember this setting',
onChanged: (value) => setState(() => remember = value),
),
),
const Divider(),
],
),
actions: [
OutlinedButton(
onPressed: () => widget.onKeep(remember),
child: const Text('Leave instances running'),
),
TextButton(
onPressed: () => widget.onStop(remember),
style: TextButton.styleFrom(
backgroundColor: const Color(0xffC7162B),
),
child: const Text('Stop instances'),
const SizedBox(height: 12),
Switch(
value: remember,
label: 'Remember this setting',
onChanged: (value) => setState(() => remember = value),
),
],
]),
actionText: 'Stop instances',
onAction: () => widget.onStop(remember),
inactionText: 'Leave instances running',
onInaction: () => widget.onKeep(remember),
width: 500,
);
}
}
Loading

0 comments on commit d285b1c

Please sign in to comment.