mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-09-13 16:12:32 +00:00
feat: add toasts
This commit is contained in:
parent
39762ad205
commit
67cbd55f26
1 changed files with 20 additions and 9 deletions
|
@ -61,12 +61,23 @@ class GradiencePresetRow(Adw.ActionRow):
|
||||||
|
|
||||||
@Gtk.Template.Callback()
|
@Gtk.Template.Callback()
|
||||||
def on_remove_button_clicked(self, *_args):
|
def on_remove_button_clicked(self, *_args):
|
||||||
|
|
||||||
|
try:
|
||||||
os.remove(os.path.join(
|
os.remove(os.path.join(
|
||||||
os.environ.get("XDG_CONFIG_HOME",
|
os.environ.get("XDG_CONFIG_HOME",
|
||||||
os.environ["HOME"] + "/.config"),
|
os.environ["HOME"] + "/.config"),
|
||||||
"presets",
|
"presets",
|
||||||
to_slug_case(self.old_name) + ".json",
|
to_slug_case(self.old_name) + ".json",
|
||||||
))
|
))
|
||||||
|
except Exception:
|
||||||
|
|
||||||
|
self.toast_overlay.add_toast(
|
||||||
|
Adw.Toast(title=_("Scheme could not be removed!"))
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.toast_overlay.add_toast(
|
||||||
|
Adw.Toast(title=_("Scheme successfully deleted!"))
|
||||||
|
)
|
||||||
|
|
||||||
self.win.reload_pref_group()
|
self.win.reload_pref_group()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue