From 65c71a524b2064bb914506353fc6685b57e93995 Mon Sep 17 00:00:00 2001 From: ranfdev Date: Fri, 27 Oct 2023 00:06:12 +0200 Subject: [PATCH] Add Discover Integrations button --- data/resources/ui/window.blp | 28 ++++++++++++++++++++-------- src/widgets/window.rs | 8 ++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/data/resources/ui/window.blp b/data/resources/ui/window.blp index 19ab375..c80bf6e 100644 --- a/data/resources/ui/window.blp +++ b/data/resources/ui/window.blp @@ -74,14 +74,26 @@ template $NotifyWindow : Adw.ApplicationWindow { Adw.StatusPage welcome_view { title: "Notify"; description: "Subscribe to one topic and start listening for notifications"; - child: Gtk.Button { - label: "Subscribe To Topic"; - clicked => $show_add_topic() swapped; - halign: center; - styles [ - "suggested-action", - "pill" - ] + child: Gtk.Box { + orientation: vertical; + spacing: 8; + Gtk.Button { + label: "Subscribe To Topic"; + clicked => $show_add_topic() swapped; + halign: center; + styles [ + "suggested-action", + "pill" + ] + } + Gtk.Button { + label: "Discover Integrations"; + clicked => $discover_integrations() swapped; + halign: center; + styles [ + "pill" + ] + } }; } ScrolledWindow list_view { diff --git a/src/widgets/window.rs b/src/widgets/window.rs index c2b191b..77013a4 100644 --- a/src/widgets/window.rs +++ b/src/widgets/window.rs @@ -139,6 +139,14 @@ mod imp { None }); } + #[template_callback] + fn discover_integrations(&self, _btn: >k::Button) { + gtk::UriLauncher::new("https://docs.ntfy.sh/integrations/").launch( + Some(&self.obj().clone()), + gio::Cancellable::NONE, + |_| {}, + ); + } } #[glib::object_subclass]