summaryrefslogtreecommitdiff
path: root/src/gui/preferencesWindow.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-04 13:00:51 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-10-04 13:00:51 +0200
commit7556967bf57453d412a8f18633599f38806f8620 (patch)
treeb7403b6ac1b5cf5db9462c3ca6d52b973df24819 /src/gui/preferencesWindow.vala
parent16fe2e5d0525422ba6ca5db9e92a93d17caae302 (diff)
Imported Upstream version 0.6.7upstream/0.6.7
Diffstat (limited to 'src/gui/preferencesWindow.vala')
-rw-r--r--src/gui/preferencesWindow.vala38
1 files changed, 37 insertions, 1 deletions
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("<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=X65SUVC4ZTQSC'>Paypal</a>"),
_("Translating Gnome-Pie to your language is easy. Translations are managed at %s.").printf("<a href='https://translate.zanata.org/zanata/iteration/view/gnome-pie/develop'>Zanata</a>"),
_("It's easy to create new themes for Gnome-Pie. Read the <a href='%s'>Tutorial</a> 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("<a href='https://github.com/Simmesimme/Gnome-Pie'>Github</a>"),
_("Bugs can be reported at %s!").printf("<a href='https://github.com/Simmesimme/Gnome-Pie/issues'>Github</a>"),
@@ -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 {
@@ -427,6 +441,28 @@ public class PreferencesWindow : GLib.Object {
}
/////////////////////////////////////////////////////////////////////
+ /// 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.
/////////////////////////////////////////////////////////////////////