diff --git a/vanilla_tour/assets/tour.json b/vanilla_tour/assets/tour.json index d78f52d..bab4195 100644 --- a/vanilla_tour/assets/tour.json +++ b/vanilla_tour/assets/tour.json @@ -8,7 +8,6 @@ "resource": "/org/vanillaos/Tour/assets/solid.svg", "title": "Solid. Secure. Maintenance-free.", "description": "Vanilla OS is developed with security in mind. Updates are automatic and run in the background, they won't get in your way.", - "hasAction": true, "action": { "title": "Configure Updates", "callback": "cmd://vanilla-updates-utility" @@ -18,7 +17,6 @@ "resource": "/org/vanillaos/Tour/assets/favorite-apps.svg", "title": "Your Favorite Apps, Right Here", "description": "From your favorite music player, to your trusted web browser. They are all available, install them from the store.", - "hasAction": true, "action": { "title": "Open the Store", "callback": "cmd://gnome-software" @@ -43,7 +41,6 @@ "resource": "/org/vanillaos/Tour/assets/configure.svg", "title": "Configure Your Device", "description": "From Bluetooth devices to that wallpaper you love so much. The settings panel allows you to configure it as you like.", - "hasAction": true, "action": { "title": "Open the Settings", "callback": "cmd://gnome-control-center" @@ -53,7 +50,6 @@ "resource": "/org/vanillaos/Tour/assets/connect.svg", "title": "Connect Your Online Accounts", "description": "Do you have a Gmail, Outlook, Nextcloud or other account? Connect them to your Vanilla OS device to integrate email, calendars.. everything.", - "hasAction": true, "action": { "title": "Connect an Account", "callback": "cmd://gnome-control-center online-accounts" @@ -63,7 +59,6 @@ "resource": "/org/vanillaos/Tour/assets/end.svg", "title": "There is More", "description": "Find out more about all the Orchid news and features on our blog.", - "hasAction": true, "action": { "title": "Visit the Blog", "callback": "url://https://vanillaos.org/blog" diff --git a/vanilla_tour/blp/slide.blp b/vanilla_tour/blp/slide.blp index 2a87d5e..4e25462 100644 --- a/vanilla_tour/blp/slide.blp +++ b/vanilla_tour/blp/slide.blp @@ -11,9 +11,10 @@ template $Slide: Adw.Bin { spacing: 24; halign: center; valign: center; - hexpand: true; + Adw.Clamp { + hexpand: true; maximum-size: 600; tightening-threshold: 500; @@ -24,19 +25,22 @@ template $Slide: Adw.Bin { } } - Label title { - margin-top: 24; - wrap: true; - justify: center; + Adw.StatusPage status_page { + Box { + halign: center; + valign: center; - styles [ - "title-1", - ] - } + Button btn_action { + visible: false; - Label description { - wrap: true; - justify: center; + styles [ + "suggested-action", + "pill", + ] + } + } } + } -} + +} \ No newline at end of file diff --git a/vanilla_tour/slide.py b/vanilla_tour/slide.py index e4013fa..85f4857 100644 --- a/vanilla_tour/slide.py +++ b/vanilla_tour/slide.py @@ -17,23 +17,36 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -from gi.repository import Adw, Gtk - +from gi.repository import Adw, Gtk, GLib +import webbrowser @Gtk.Template(resource_path="/org/vanillaos/Tour/blp/slide.ui") class Slide(Adw.Bin): __gtype_name__ = "Slide" - title = Gtk.Template.Child() - description = Gtk.Template.Child() + status_page = Gtk.Template.Child() assets_svg = Gtk.Template.Child() + btn_action = Gtk.Template.Child() def __init__(self, slide, **kwargs): super().__init__(**kwargs) self.__slide = slide self.__build_ui() + self.btn_action.connect("clicked", self.__on_btn_action_clicked) + def __build_ui(self): self.assets_svg.set_resource(self.__slide["resource"]) - self.title.set_label(self.__slide["title"]) - self.description.set_label(self.__slide["description"]) \ No newline at end of file + self.status_page.set_title(self.__slide["title"]) + self.status_page.set_description(self.__slide["description"]) + + if "action" in self.__slide: + self.btn_action.set_visible(True) + self.btn_action.set_label(self.__slide["action"]["title"]) + + def __on_btn_action_clicked(self, widget): + if self.__slide["action"]["callback"].startswith("url://"): + webbrowser.open(self.__slide["action"]["callback"].split("url://")[1]) + + elif self.__slide["action"]["callback"].startswith("cmd://"): + GLib.spawn_command_line_async(self.__slide["action"]["callback"].split("cmd://")[1]) \ No newline at end of file diff --git a/vanilla_tour/vanilla-tour.gresource.xml b/vanilla_tour/vanilla-tour.gresource.xml index 17c9644..9aca404 100644 --- a/vanilla_tour/vanilla-tour.gresource.xml +++ b/vanilla_tour/vanilla-tour.gresource.xml @@ -11,7 +11,7 @@ assets/favorite-apps.svg assets/overview.svg assets/solid.svg - assets/welcome.png + assets/welcome.png assets/tour.json \ No newline at end of file