From fece7eef2512cea872fa77252d726c355f9f65c6 Mon Sep 17 00:00:00 2001 From: Martin Abente Lahaye Date: Fri, 1 Sep 2023 10:51:09 -0400 Subject: [PATCH] window: Add confirmation step before reloading applications Closes #187 --- src/widgets/window.js | 14 ++++++++++- src/widgets/window.ui | 55 ++++++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/src/widgets/window.js b/src/widgets/window.js index 651962ce..6e4af296 100644 --- a/src/widgets/window.js +++ b/src/widgets/window.js @@ -53,6 +53,7 @@ var FlatsealWindow = GObject.registerClass({ InternalChildren: [ 'actionBar', 'appInfoGroup', + 'applicationsToastOverlay', 'applicationsSearchButton', 'applicationsSearchBar', 'applicationsSearchEntry', @@ -137,10 +138,21 @@ var FlatsealWindow = GObject.registerClass({ this._applicationsSearchBar.set_key_capture_widget(this.root); + this._applicationsToast = new Adw.Toast(); + this._applicationsToast.title = _('Installation changed'); + this._applicationsToast.button_label = _('Reload'); + this._applicationsToast.timeout = null; + this._applicationsToast.connect('button-clicked', this._setupApplications.bind(this)); + this._monitor = new FlatpakMonitorModel(); - this._monitor.connect('changed', this._setupApplications.bind(this)); + this._monitor.connect('changed', this._showApplicationsToast.bind(this)); + } + + _showApplicationsToast() { + this._applicationsToastOverlay.add_toast(this._applicationsToast); } + _setupApplications() { for (const row of Array.from(this._applicationsListBox)) { if (row instanceof Adw.ActionRow) diff --git a/src/widgets/window.ui b/src/widgets/window.ui index 2cb5cedf..e2c613fc 100644 --- a/src/widgets/window.ui +++ b/src/widgets/window.ui @@ -54,30 +54,41 @@ - - - - - - - - + - - + True - browse - - - system-search-symbolic - No applications found. - - - + 360 + vertical + + + + + + + + + + + + + True + browse + + + system-search-symbolic + No applications found. + + + + + + +