From 98f3ef2689de06e8ab8b46a91acfa7dd2056a3a6 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Mon, 5 Mar 2012 12:19:59 +0100 Subject: Imported Upstream version 0.5.1 --- src/gui/settingsWindow.vala | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'src/gui/settingsWindow.vala') diff --git a/src/gui/settingsWindow.vala b/src/gui/settingsWindow.vala index 1eaa0b4..0e7af20 100644 --- a/src/gui/settingsWindow.vala +++ b/src/gui/settingsWindow.vala @@ -32,6 +32,7 @@ public class SettingsWindow : GLib.Object { private ThemeList? theme_list = null; private Gtk.ToggleButton? indicator = null; private Gtk.ToggleButton? autostart = null; + private Gtk.ToggleButton? captions = null; ///////////////////////////////////////////////////////////////////// /// C'tor creates, the dialog. @@ -47,6 +48,14 @@ public class SettingsWindow : GLib.Object { this.window = builder.get_object("window") as Gtk.Dialog; this.theme_list = new ThemeList(); + this.theme_list.on_select_new.connect(() => { + this.captions.active = Config.global.show_captions; + if (Config.global.theme.has_slice_captions) { + this.captions.sensitive = true; + } else { + this.captions.sensitive = false; + } + }); var scroll_area = builder.get_object("theme-scrolledwindow") as Gtk.ScrolledWindow; scroll_area.add(this.theme_list); @@ -59,6 +68,9 @@ public class SettingsWindow : GLib.Object { this.indicator = (builder.get_object("indicator-checkbox") as Gtk.ToggleButton); this.indicator.toggled.connect(on_indicator_toggled); + this.captions = (builder.get_object("captions-checkbox") as Gtk.ToggleButton); + this.captions.toggled.connect(on_captions_toggled); + var scale_slider = (builder.get_object("scale-hscale") as Gtk.HScale); scale_slider.set_range(0.5, 2.0); scale_slider.set_increments(0.05, 0.25); @@ -108,8 +120,15 @@ public class SettingsWindow : GLib.Object { public void show() { this.indicator.active = Config.global.show_indicator; - this.autostart.active = Config.global.auto_start; - + this.autostart.active = Config.global.auto_start; + this.captions.active = Config.global.show_captions; + + if (Config.global.theme.has_slice_captions) { + this.captions.sensitive = true; + } else { + this.captions.sensitive = false; + } + this.window.show_all(); } @@ -119,6 +138,12 @@ public class SettingsWindow : GLib.Object { private void on_close_button_clicked() { this.window.hide(); + + Logger.stats("SETTINGS " + Config.global.theme.name + + (this.indicator.active ? " INDICATOR" : "") + + (this.autostart.active ? " AUTOSTART" : "") + + (this.captions.active ? " CAPTIONS" : "") + + " %f".printf(Config.global.global_scale)); } ///////////////////////////////////////////////////////////////////// @@ -169,6 +194,15 @@ public class SettingsWindow : GLib.Object { var check = check_box as Gtk.CheckButton; Config.global.show_indicator = check.active; } + + ///////////////////////////////////////////////////////////////////// + /// Shows or hides the captions of Slices. + ///////////////////////////////////////////////////////////////////// + + private void on_captions_toggled(Gtk.ToggleButton check_box) { + var check = check_box as Gtk.CheckButton; + Config.global.show_captions = check.active; + } } } -- cgit v1.2.3