From 7556967bf57453d412a8f18633599f38806f8620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 4 Oct 2015 13:00:51 +0200 Subject: Imported Upstream version 0.6.7 --- src/gui/preferencesWindow.vala | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src/gui/preferencesWindow.vala') diff --git a/src/gui/preferencesWindow.vala b/src/gui/preferencesWindow.vala index d671501..09d8a3c 100644 --- a/src/gui/preferencesWindow.vala +++ b/src/gui/preferencesWindow.vala @@ -43,6 +43,7 @@ public class PreferencesWindow : GLib.Object { private Gtk.EventBox? preview_background = null; private Gtk.Button? remove_pie_button = null; private Gtk.Button? edit_pie_button = null; + private Gtk.Button? theme_delete_button = null; private ThemeList? theme_list = null; private Gtk.ToggleButton? indicator = null; @@ -149,6 +150,11 @@ public class PreferencesWindow : GLib.Object { } else { this.captions.sensitive = false; } + if (Config.global.theme.is_local()) { + this.theme_delete_button.sensitive = true; + } else { + this.theme_delete_button.sensitive = false; + } }); scroll_area = builder.get_object("theme-scrolledwindow") as Gtk.ScrolledWindow; @@ -164,6 +170,8 @@ public class PreferencesWindow : GLib.Object { (builder.get_object("theme-export-button") as Gtk.Button).clicked.connect(on_export_theme_button_clicked); (builder.get_object("theme-import-button") as Gtk.Button).clicked.connect(on_import_theme_button_clicked); + this.theme_delete_button = (builder.get_object("theme-delete-button") as Gtk.Button); + this.theme_delete_button.clicked.connect(on_delete_theme_button_clicked); this.autostart = (builder.get_object("autostart-checkbox") as Gtk.ToggleButton); this.autostart.toggled.connect(on_autostart_toggled); @@ -230,7 +238,7 @@ public class PreferencesWindow : GLib.Object { _("You can support the development of Gnome-Pie by donating via %s.").printf("Paypal"), _("Translating Gnome-Pie to your language is easy. Translations are managed at %s.").printf("Zanata"), _("It's easy to create new themes for Gnome-Pie. Read the Tutorial online.").printf("http://simmesimme.github.io/lessons/2015/04/26/themes-for-gnome-pie/"), - _("It's usually a good practive to have at most twelve slices per pie."), + _("It's usually a good practice to have at most twelve slices per pie."), _("You can export themes you created and share them with the community!"), _("The source code of Gnome-Pie is available on %s.").printf("Github"), _("Bugs can be reported at %s!").printf("Github"), @@ -284,6 +292,12 @@ public class PreferencesWindow : GLib.Object { this.captions.sensitive = false; } + if (Config.global.theme.is_local()) { + this.theme_delete_button.sensitive = true; + } else { + this.theme_delete_button.sensitive = false; + } + if (!Deamon.disable_stack_switcher) { this.stack.set_visible_child_full("2", Gtk.StackTransitionType.NONE); } else { @@ -426,6 +440,28 @@ public class PreferencesWindow : GLib.Object { dialog.show(); } + ///////////////////////////////////////////////////////////////////// + /// Deleted the slected theme. + ///////////////////////////////////////////////////////////////////// + + private void on_delete_theme_button_clicked(Gtk.Button button) { + + var dialog = new Gtk.MessageDialog((Gtk.Window)this.window.get_toplevel(), Gtk.DialogFlags.MODAL, + Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, + _("Do you really want to delete the selected theme from %s?").printf(Config.global.theme.directory)); + + dialog.response.connect((response) => { + if (response == Gtk.ResponseType.YES) { + Paths.delete_directory(Config.global.theme.directory); + Config.global.load_themes(""); + this.theme_list.reload(); + } + }); + + dialog.run(); + dialog.destroy(); + } + ///////////////////////////////////////////////////////////////////// /// Shows or hides the indicator. ///////////////////////////////////////////////////////////////////// -- cgit v1.2.3