mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-08-26 17:32:31 +00:00
feat: add toasts
This commit is contained in:
parent
39762ad205
commit
67cbd55f26
1 changed files with 20 additions and 9 deletions
|
@ -58,18 +58,29 @@ class GradiencePresetRow(Adw.ActionRow):
|
||||||
else:
|
else:
|
||||||
self.update_value()
|
self.update_value()
|
||||||
self.value_stack.set_visible_child(self.apply_button)
|
self.value_stack.set_visible_child(self.apply_button)
|
||||||
|
|
||||||
@Gtk.Template.Callback()
|
@Gtk.Template.Callback()
|
||||||
def on_remove_button_clicked(self, *_args):
|
def on_remove_button_clicked(self, *_args):
|
||||||
os.remove(os.path.join(
|
|
||||||
os.environ.get("XDG_CONFIG_HOME",
|
try:
|
||||||
os.environ["HOME"] + "/.config"),
|
os.remove(os.path.join(
|
||||||
"presets",
|
os.environ.get("XDG_CONFIG_HOME",
|
||||||
to_slug_case(self.old_name) + ".json",
|
os.environ["HOME"] + "/.config"),
|
||||||
))
|
"presets",
|
||||||
|
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()
|
||||||
|
|
||||||
def update_value(self):
|
def update_value(self):
|
||||||
os.remove(os.path.join(
|
os.remove(os.path.join(
|
||||||
os.environ.get("XDG_CONFIG_HOME",
|
os.environ.get("XDG_CONFIG_HOME",
|
||||||
|
|
Loading…
Reference in a new issue