diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/aboutWindow.vala | 1 | ||||
-rw-r--r-- | src/gui/newSliceWindow.vala | 55 | ||||
-rw-r--r-- | src/gui/preferencesWindow.vala | 38 | ||||
-rw-r--r-- | src/gui/themeList.vala | 3 |
4 files changed, 85 insertions, 12 deletions
diff --git a/src/gui/aboutWindow.vala b/src/gui/aboutWindow.vala index 896d2ba..fd38c8c 100644 --- a/src/gui/aboutWindow.vala +++ b/src/gui/aboutWindow.vala @@ -47,6 +47,7 @@ public class AboutWindow: Gtk.AboutDialog { "Moo <hazap@hotmail.com> (LT)", "Gabriel Dubatti <gdubatti@gmail.com> (ES)", "Grégoire Bellon-Gervais <greggbg@gmail.com> (FR)", + "Raphaël Rochet <raphael@rri.fr> (FR)", "Alex Maxime <cad.maxime@gmail.com> (FR)", "Eugene Roskin <pams@imail.ru> (RU)", "Ting Zhou <tzhou@haverford.edu> (ZH-CN)", diff --git a/src/gui/newSliceWindow.vala b/src/gui/newSliceWindow.vala index 6066e57..89294b5 100644 --- a/src/gui/newSliceWindow.vala +++ b/src/gui/newSliceWindow.vala @@ -57,11 +57,15 @@ public class NewSliceWindow : GLib.Object { private Gtk.Box hotkey_box = null; private Gtk.Box uri_box = null; private Gtk.Box quickaction_box = null; + private Gtk.Box clipboard_box = null; + private Gtk.Box workspace_only_box = null; private Gtk.Image icon = null; private Gtk.Entry name_entry = null; private Gtk.Entry command_entry = null; private Gtk.Entry uri_entry = null; - private Gtk.CheckButton quickaction_checkbutton = null; + private Gtk.Switch quickaction_checkbutton = null; + private Gtk.Switch workspace_only_checkbutton = null; + private Gtk.Scale clipboard_slider = null; ///////////////////////////////////////////////////////////////////// /// Two custom widgets. For Pie and hotkey selection respectively. @@ -116,16 +120,25 @@ public class NewSliceWindow : GLib.Object { this.hotkey_box.hide(); this.uri_box.hide(); this.quickaction_box.hide(); + this.workspace_only_box.hide(); + this.clipboard_box.hide(); this.current_type = type; switch (type) { - case "bookmarks": case "clipboard": case "devices": - case "menu": case "session": case "window_list": - case "workspace_window_list": + case "bookmarks": case "devices": + case "menu": case "session": this.no_options_box.show(); this.set_icon(icon); break; + case "window_list": + this.workspace_only_box.show(); + this.set_icon(icon); + break; + case "clipboard": + this.clipboard_box.show(); + this.set_icon(icon); + break; case "app": this.name_box.show(); this.command_box.show(); @@ -183,11 +196,18 @@ public class NewSliceWindow : GLib.Object { this.name_entry = builder.get_object("name-entry") as Gtk.Entry; this.uri_entry = builder.get_object("uri-entry") as Gtk.Entry; this.command_entry = builder.get_object("command-entry") as Gtk.Entry; - this.quickaction_checkbutton = builder.get_object("quick-action-checkbutton") as Gtk.CheckButton; - + this.quickaction_checkbutton = builder.get_object("quick-action-checkbutton") as Gtk.Switch; this.quickaction_box = builder.get_object("quickaction-box") as Gtk.Box; this.icon = builder.get_object("icon") as Gtk.Image; + this.workspace_only_checkbutton = builder.get_object("workspace-only-checkbutton") as Gtk.Switch; + this.workspace_only_box = builder.get_object("workspace-only-box") as Gtk.Box; + + this.clipboard_box = builder.get_object("clipboard-box") as Gtk.Box; + this.clipboard_slider = (builder.get_object("clipboard-scale") as Gtk.Scale); + clipboard_slider.set_range(2, 24); + clipboard_slider.set_value(8); + this.icon_button.clicked.connect(on_icon_button_clicked); var scroll_area = builder.get_object("slice-scrolledwindow") as Gtk.ScrolledWindow; @@ -273,6 +293,15 @@ public class NewSliceWindow : GLib.Object { } else { type = GroupRegistry.descriptions[group.get_type().name()].id; + switch (type) { + case "clipboard": + this.clipboard_slider.set_value((group as ClipboardGroup).max_items); + break; + case "window_list": + this.workspace_only_checkbutton.active = (group as WindowListGroup).current_workspace_only; + break; + + } this.select_type(type); } } @@ -314,13 +343,19 @@ public class NewSliceWindow : GLib.Object { switch (this.current_type) { case "bookmarks": group = new BookmarkGroup(this.current_id); break; - case "clipboard": group = new ClipboardGroup(this.current_id); break; case "devices": group = new DevicesGroup(this.current_id); break; case "menu": group = new MenuGroup(this.current_id); break; case "session": group = new SessionGroup(this.current_id); break; - case "window_list": group = new WindowListGroup(this.current_id); break; - case "workspace_window_list": group = new WorkspaceWindowListGroup(this.current_id); break; - + case "clipboard": + var g = new ClipboardGroup(this.current_id); + g.max_items = (int)this.clipboard_slider.get_value(); + group = g; + break; + case "window_list": + var g = new WindowListGroup(this.current_id); + g.current_workspace_only = this.workspace_only_checkbutton.active; + group = g; + break; case "app": group = new ActionGroup(this.current_id); group.add_action(new AppAction(this.name_entry.text, this.current_icon, 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&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. ///////////////////////////////////////////////////////////////////// diff --git a/src/gui/themeList.vala b/src/gui/themeList.vala index 46ae876..e6ecb3c 100644 --- a/src/gui/themeList.vala +++ b/src/gui/themeList.vala @@ -105,7 +105,8 @@ class ThemeList : Gtk.TreeView { data.set(current, DataPos.ICON, theme.preview_icon.to_pixbuf()); data.set(current, DataPos.NAME, GLib.Markup.escape_text(theme.name)+"\n" + "<span font-size='x-small'>" + GLib.Markup.escape_text(theme.description) - + "</span>"); + + " - <i>"+GLib.Markup.escape_text(_("by")+" "+theme.author) + + "</i></span>"); if(theme == Config.global.theme) { get_selection().select_iter(current); } |