Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
fix: replace logout dialog with a toast (#758) (#816)
Browse files Browse the repository at this point in the history
## Description

Replace logout message with toast
[HIG](https://developer.gnome.org/hig/patterns/feedback/toasts.html)

Fixes #758 

## Type of change

<!-- What type of change does your pull request introduce? Put an `x` in
the appropriate box . -->
- [ ] Bugfix (Change which fixes an 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)

## 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. -->
  • Loading branch information
daudix authored Sep 4, 2023
2 parents 52fbc0c + 212aef6 commit 5cdcfc9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 60 deletions.
1 change: 0 additions & 1 deletion data/gradience.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<file preprocess="xml-stripblanks">ui/custom_css_group.ui</file>
<file preprocess="xml-stripblanks">ui/error_list_row.ui</file>
<file preprocess="xml-stripblanks">ui/explore_preset_row.ui</file>
<file preprocess="xml-stripblanks">ui/log_out_dialog.ui</file>
<file preprocess="xml-stripblanks">ui/monet_theming_group.ui</file>
<file preprocess="xml-stripblanks">ui/no_plugin_window.ui</file>
<file preprocess="xml-stripblanks">ui/option_row.ui</file>
Expand Down
1 change: 0 additions & 1 deletion data/ui/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ blueprints = custom_target('blueprints',
'palette_shades.blp',
'option_row.blp',
'window.blp',
'log_out_dialog.blp',
'monet_theming_group.blp',
'app_type_dialog.blp',
'custom_css_group.blp',
Expand Down
43 changes: 0 additions & 43 deletions gradience/frontend/dialogs/log_out_dialog.py

This file was deleted.

1 change: 0 additions & 1 deletion gradience/frontend/dialogs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ dialogsdir = 'gradience/frontend/dialogs'
gradience_sources = [
'__init__.py',
'app_type_dialog.py',
'log_out_dialog.py',
'save_dialog.py',
'unsupported_shell_dialog.py'
]
Expand Down
8 changes: 4 additions & 4 deletions gradience/frontend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from gradience.frontend.views.preferences_window import GradiencePreferencesWindow

from gradience.frontend.dialogs.app_type_dialog import GradienceAppTypeDialog
from gradience.frontend.dialogs.log_out_dialog import GradienceLogOutDialog
from gradience.frontend.dialogs.save_dialog import GradienceSaveDialog
from gradience.frontend.widgets.custom_css_group import GradienceCustomCSSGroup

Expand Down Expand Up @@ -616,11 +615,12 @@ def apply_color_scheme(self, widget, response):
self.plugins_list.apply()

self.win.toast_overlay.add_toast(
Adw.Toast(title=_("Preset set successfully"))
Adw.Toast(title=_("Preset set successfully. You may need to restart some apps and log out."))
)

dialog = GradienceLogOutDialog(self.win)
dialog.present()
toast = Adw.Toast()
toast.set_title(_("Preset set successfully. You may need to restart some apps and log out."))
self.win.toast_overlay.add_toast(toast)

def show_preferences(self, *_args):
prefs = GradiencePreferencesWindow(self.win)
Expand Down
26 changes: 16 additions & 10 deletions gradience/frontend/widgets/reset_preset_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
from gradience.backend.logger import Logger
from gradience.backend.theming.preset import PresetUtils

from gradience.frontend.dialogs.log_out_dialog import GradienceLogOutDialog

logging = Logger()


Expand Down Expand Up @@ -57,8 +55,10 @@ def on_libadw_restore_button_clicked(self, *_args):
Adw.Toast(title=_("Unable to restore GTK 4 backup"))
)
else:
dialog = GradienceLogOutDialog(self.win)
dialog.present()
toast = Adw.Toast(
title=_("GTK 4 preset has been restored. Please log out to apply changes."),
)
self.parent.add_toast(toast)

@Gtk.Template.Callback()
def on_libadw_reset_button_clicked(self, *_args):
Expand All @@ -69,8 +69,10 @@ def on_libadw_reset_button_clicked(self, *_args):
Adw.Toast(title=_("Unable to delete current preset"))
)
else:
dialog = GradienceLogOutDialog(self.win)
dialog.present()
toast = Adw.Toast(
title=_("GTK 4 theme has been reset. Please log out to apply changes."),
)
self.parent.add_toast(toast)


@Gtk.Template.Callback()
Expand All @@ -82,8 +84,10 @@ def on_gtk3_restore_button_clicked(self, *_args):
Adw.Toast(title=_("Unable to restore GTK 3 backup"))
)
else:
dialog = GradienceLogOutDialog(self.win)
dialog.present()
toast = Adw.Toast(
title=_("GTK 3 preset has been restored. Please log out to apply changes."),
)
self.parent.add_toast(toast)

@Gtk.Template.Callback()
def on_gtk3_reset_button_clicked(self, *_args):
Expand All @@ -94,5 +98,7 @@ def on_gtk3_reset_button_clicked(self, *_args):
Adw.Toast(title=_("Unable to delete current preset"))
)
else:
dialog = GradienceLogOutDialog(self.win)
dialog.present()
toast = Adw.Toast(
title=_("GTK 3 theme has been reset. Please log out to apply changes."),
)
self.parent.add_toast(toast)

0 comments on commit 5cdcfc9

Please sign in to comment.