diff --git a/ubuntu_smoother/gtk/window.ui b/ubuntu_smoother/gtk/window.ui
index 03aedd8..f44f711 100644
--- a/ubuntu_smoother/gtk/window.ui
+++ b/ubuntu_smoother/gtk/window.ui
@@ -26,9 +26,11 @@
+
+
vertical
@@ -114,6 +118,45 @@
+
+
+
+
+ Please Wait…
+ The changes are being applied.
+ fill
+ fill
+ true
+
+
+ center
+ center
+
+
+
+
+
+
+
+
+ emblem-default-symbolic
+ Done!
+ You can now enjoy your new Ubuntu experience.
+ fill
+ fill
+ true
+
+
+ Close
+ center
+
+
+
+
+
diff --git a/ubuntu_smoother/window.py b/ubuntu_smoother/window.py
index bb45462..38f5502 100644
--- a/ubuntu_smoother/window.py
+++ b/ubuntu_smoother/window.py
@@ -19,6 +19,7 @@ from gi.repository import Gtk, Gio, Adw
from ubuntu_smoother.models.preset import Preset
from ubuntu_smoother.models.config import Config
from ubuntu_smoother.utils.configurator import Configurator
+from ubuntu_smoother.utils.run_async import RunAsync
@Gtk.Template(resource_path='/pm/mirko/UbuntuSmoother/gtk/window.ui')
@@ -28,9 +29,15 @@ class UbuntuSmootherWindow(Adw.ApplicationWindow):
carousel = Gtk.Template.Child()
btn_start = Gtk.Template.Child()
btn_save = Gtk.Template.Child()
+ btn_close = Gtk.Template.Child()
switch_snap = Gtk.Template.Child()
switch_flatpak = Gtk.Template.Child()
switch_apport = Gtk.Template.Child()
+ page_welcome = -1
+ page_configuration = 0
+ page_progress = 1
+ page_done = 2
+ spinner = Gtk.Template.Child()
def __init__(self, **kwargs):
super().__init__(**kwargs)
@@ -50,16 +57,29 @@ class UbuntuSmootherWindow(Adw.ApplicationWindow):
def __connect_signals(self):
self.btn_start.connect('clicked', self.__on_btn_start_clicked)
self.btn_save.connect('clicked', self.on_btn_save_clicked)
+ self.btn_close.connect('clicked', self.on_btn_close_clicked)
self.switch_snap.connect('state-set', self.__on_switch_snap_state_set)
self.switch_flatpak.connect(
'state-set', self.__on_switch_flatpak_state_set)
self.switch_apport.connect(
'state-set', self.__on_switch_apport_state_set)
+ def __show_page(self, page: int):
+ _page = self.carousel.get_nth_page(page + 1)
+ self.carousel.scroll_to(_page, True)
+
def __on_btn_start_clicked(self, widget):
- index = int(self.carousel.get_position())
- next_page = self.carousel.get_nth_page(index + 1)
- self.carousel.scroll_to(next_page, True)
+ self.__show_page(self.page_configuration)
+
+ def on_btn_save_clicked(self, widget):
+ def on_done(*args):
+ self.spinner.stop()
+ self.__show_page(self.page_done)
+
+ self.__show_page(self.page_progress)
+ self.spinner.start()
+
+ RunAsync(Configurator(self.__config, fake=True).apply, on_done)
def __on_switch_snap_state_set(self, widget, state):
self.__config.snap = state
@@ -70,5 +90,5 @@ class UbuntuSmootherWindow(Adw.ApplicationWindow):
def __on_switch_apport_state_set(self, widget, state):
self.__config.apport = state
- def on_btn_save_clicked(self, widget):
- Configurator(self.__config, fake=True).apply()
+ def on_btn_close_clicked(self, widget):
+ self.get_application().quit()