feat: Remove not very useful welcome pages (#774)

## Description

Removes a bunch of code that took time and effort to write, for sake of
shorter welcome screen experience

## Type of change

<!-- What type of change does your pull request introduce? Put an `x` in
the box that apply. -->
- [ ] Bugfix (Change which fixes a issue)
- [ ] New feature (Change which adds new functionality)
- [x] Enhancement (Change which slightly improves existing code)
- [ ] Breaking change (This change will introduce incompatibility with
existing functionality)

## Changelog <!-- This is optional, but highly appreciated. -->

- Removed
  - Setup, progress and done pages

## Testing

- [x] I have tested my changes and verified that they work as expected
<!-- Make sure you did this step before marking your PR as ready for
merge. -->

### How to test the changes

<!-- Optional, it can speed up review process if you provide the
information on how to test your changes. -->
No information provided.
This commit is contained in:
0xMRTT 2023-09-04 23:22:40 +02:00 committed by GitHub
commit e73f32ed31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 158 deletions

View file

@ -63,7 +63,6 @@ template $GradienceWelcomeWindow: Adw.Window {
title: _("Welcome to Gradience");
description: _("Change the look of Adwaita, with ease");
}
}
Adw.StatusPage page_release {
@ -87,95 +86,18 @@ template $GradienceWelcomeWindow: Adw.Window {
}
}
Adw.StatusPage page_gradience {
Adw.StatusPage page_finish {
vexpand: true;
hexpand: true;
icon-name: "larger-brush-symbolic";
title: _("Customize Adwaita Theme");
description: _("Change colors of windows, buttons, lists and more; with advanced features like adding custom CSS.");
}
Adw.StatusPage page_configure {
vexpand: true;
hexpand: true;
title: _("Configure Gradience");
description: _("Install adw-gtk3 theme for legacy applications and configure system for theming.");
Adw.PreferencesPage {
Adw.PreferencesGroup {
Adw.ActionRow configure_adw_gtk3 {
title: _("Legacy Apps Theming");
activatable-widget: switch_adw_gtk3;
[suffix]
Switch switch_adw_gtk3 {
valign: center;
tooltip-text: _("Install adw-gtk3 theme for legacy app theming");
}
}
Adw.ActionRow configure_system {
title: _("System Configuration");
activatable-widget: switch_system;
[suffix]
Switch switch_system {
valign: center;
tooltip-text: _("Configure system for theming, enables Flatpak theme override");
}
}
}
}
}
Adw.StatusPage page_download {
vexpand: true;
hexpand: true;
title: _("Installing adw-gtk3");
description: _("Please wait until theme will be installed."); // i don't think we need this, just a "Installing adw-gtk3…" might be enough
Gtk.Box {
orientation: vertical;
Gtk.Button btn_install {
styles ["suggested-action", "pill"]
label: _("Continue");
use-underline: true;
halign: center;
}
Gtk.ProgressBar progressbar {
halign: center;
visible: false;
margin-top: 24;
margin-bottom: 24;
}
}
}
Adw.StatusPage page_finish {
vexpand: true;
hexpand: true;
icon-name: "selection-mode-symbolic";
title: _("Done");
description: _("Now you can make your own presets or download some online.");
Gtk.Box {
orientation: vertical;
Gtk.Button label_skip {
label: _("Please finish the setup first");
margin-bottom: 24;
visible: true;
}
description: _("Change colors of windows, buttons, lists and more, with advanced features like adding custom CSS.");
Gtk.Button btn_close {
styles ["suggested-action", "pill"]
label: _("Start Using Gradience");
use-underline: true;
halign: center;
visible: true;
}
}
}
};
@ -190,13 +112,7 @@ template $GradienceWelcomeWindow: Adw.Window {
visible: false;
tooltip-text: _("Next");
}
}
}
}
}

View file

@ -41,24 +41,15 @@ class GradienceWelcomeWindow(Adw.Window):
btn_close = Gtk.Template.Child()
btn_back = Gtk.Template.Child()
btn_next = Gtk.Template.Child()
btn_install = Gtk.Template.Child()
btn_agree = Gtk.Template.Child()
switch_system = Gtk.Template.Child()
switch_adw_gtk3 = Gtk.Template.Child()
progressbar = Gtk.Template.Child()
img_welcome = Gtk.Template.Child()
label_skip = Gtk.Template.Child()
carousel_pages = [
"welcome", # 0
"release", # 1
"agreement", # 2
"gradience", # 3
"configure", # 4
"download", # 5
"finish", # 6
"finish", # 3
]
page_welcome = Gtk.Template.Child()
@ -81,7 +72,6 @@ class GradienceWelcomeWindow(Adw.Window):
self.btn_close.connect("clicked", self.close_window)
self.btn_back.connect("clicked", self.previous_page)
self.btn_next.connect("clicked", self.next_page)
self.btn_install.connect("clicked", self.install_runner)
self.btn_agree.connect("clicked", self.agree)
self.connect("close-request", self.quit)
@ -90,8 +80,6 @@ class GradienceWelcomeWindow(Adw.Window):
self.page_release.set_title(f"Gradience {rel_ver}")
self.btn_close.set_sensitive(False)
self.page_changed()
def get_page(self, index):
@ -107,26 +95,18 @@ class GradienceWelcomeWindow(Adw.Window):
self.carousel.set_interactive(True)
if page == "finish":
self.btn_back.set_visible(False)
self.btn_next.set_visible(False)
self.carousel.set_interactive(False)
elif page == "agreement":
self.btn_back.set_visible(True)
self.btn_next.set_visible(False)
self.btn_agree.set_visible(True)
self.carousel.set_interactive(False)
elif page == "download":
self.btn_back.set_visible(True)
self.btn_next.set_visible(False)
self.btn_install.set_visible(True)
self.carousel.set_interactive(False)
elif page == "welcome":
self.btn_back.set_visible(False)
self.btn_next.set_visible(True)
else:
self.btn_back.set_visible(True)
self.btn_next.set_visible(True)
self.btn_install.set_visible(False)
self.carousel.set_interactive(True)
def agree(self, widget):
@ -137,7 +117,7 @@ class GradienceWelcomeWindow(Adw.Window):
if self.update:
self.btn_close.set_sensitive(True)
self.label_skip.set_visible(False)
self.next_page(index=5)
self.next_page()
else:
self.next_page()
@ -145,45 +125,6 @@ class GradienceWelcomeWindow(Adw.Window):
self.destroy()
sys.exit()
# TODO: Add adw-gtk3 check
def check_adw_gtk3(self, *args):
logging.debug("check if adw-gtk3 installed")
return True
def adw_gtk3(self):
if not self.check_adw_gtk3(): # install
logging.debug("install adw-gtk3")
def configure_system(self):
logging.debug("configure system")
self.allow_flatpak_theming_user_toggled()
def allow_flatpak_theming_user_toggled(self, *args):
create_gtk_user_override(self.gio_settings, "gtk4", self)
def install_runner(self, widget):
def set_completed(result, error=False):
self.label_skip.set_visible(False)
self.btn_close.set_sensitive(True)
self.window.settings.set_boolean("first-run", False)
self.next_page()
self.installing = True
self.set_deletable(False)
def install():
if self.switch_adw_gtk3.get_active():
self.adw_gtk3()
if self.switch_system.get_active():
self.configure_system()
RunAsync(self.pulse)
RunAsync(
install,
callback=set_completed,
)
def previous_page(self, widget=False, index=None):
if index is None:
index = int(self.carousel.get_position())
@ -198,12 +139,6 @@ class GradienceWelcomeWindow(Adw.Window):
next_page = self.carousel.get_nth_page(index + 1)
self.carousel.scroll_to(next_page, True)
def pulse(self):
# This function updates the progress bar every 1s.
while True:
time.sleep(0.5)
self.progressbar.pulse()
def close_window(self, widget):
self.destroy()
self.window.present()