class SettingsDialog : Gtk.Dialog {
List<Gtk.Button> buttons;
Gtk.Window movie_list_window;
+ private Hildon.CheckButton download_posters;
+ private Hildon.CheckButton start_movies;
+ private Hildon.Button default_source;
public SettingsDialog (Gtk.Window window) {
movie_list_window = window;
set_title (_("Settings"));
VBox vbox;
- if (CinaestProgram.plugins.length () > 5) {
+ if (CinaestProgram.plugins.length () > 4) {
vbox = new VBox (true, 0);
var pannable = new PannableArea ();
vbox = (VBox) get_content_area ();
}
+ download_posters = new Hildon.CheckButton (SizeType.FINGER_HEIGHT);
+ download_posters.set_label (_("Download movie posters"));
+ vbox.pack_start (download_posters, true, true, 0);
+
+ start_movies = new Hildon.CheckButton (SizeType.FINGER_HEIGHT);
+ start_movies.set_label (_("Show movie list on startup"));
+ vbox.pack_start (start_movies, true, true, 0);
+
+ default_source = new Hildon.Button.with_text (SizeType.FINGER_HEIGHT, ButtonArrangement.VERTICAL, _("Default movie source"), _("None"));
+ default_source.set_style (ButtonStyle.PICKER);
+ default_source.set_alignment (0, 0.5f, 0, 0.5f);
+ vbox.pack_start (default_source, true, true, 0);
+
+ start_movies.toggled.connect (on_start_movies_toggled);
+ default_source.clicked.connect (on_default_source_clicked);
+
+ HBox hbox;
+ int i = 0;
buttons = new List<Hildon.Button> ();
foreach (Plugin plugin in CinaestProgram.plugins) {
var button = new Gtk.Button.with_label (plugin.get_name ());
Hildon.gtk_widget_set_theme_size (button, SizeType.FINGER_HEIGHT);
button.set_alignment(0, 0.5f);
- vbox.pack_start (button, true, true, 0);
+ if (i++ == 0) {
+ hbox = new HBox (true, 0);
+ vbox.pack_start (hbox, true, true, 0);
+ }
+ if (i == 2)
+ i = 0;
+ hbox.pack_start (button, true, true, 0);
button.clicked.connect (on_plugin_settings);
buttons.append (button);
}
+
+ add_button (_("Done"), ResponseType.ACCEPT);
+ }
+
+ public void on_start_movies_toggled () {
+ default_source.set_sensitive (start_movies.get_active ());
+ }
+
+ public void on_default_source_clicked (Gtk.Button button) {
+ var default_source = (Hildon.Button) button;
+ var dialog = new SourceDialog (movie_list_window);
+
+ MovieSource source = null;
+ dialog.run (ref source);
+
+ if (source != null) {
+ default_source.set_value (source.get_name ());
+ }
}
public void on_plugin_settings (Gtk.Button button) {
public new int run () {
int res = 0;
+ var gc = GConf.Client.get_default ();
+
+ try {
+ download_posters.set_active (gc.get_bool ("/apps/cinaest/download_posters"));
+ start_movies.set_active (gc.get_bool ("/apps/cinaest/start_movies"));
+ default_source.set_sensitive (start_movies.get_active ());
+ string source = gc.get_string ("/apps/cinaest/default_source");
+ if (source != null && source != "")
+ default_source.set_value (source);
+ } catch (Error e) {
+ stdout.printf ("Error getting GConf option: %s\n", e.message);
+ }
show_all ();
}
} while (res >= 0);
+ if (res == ResponseType.ACCEPT) try {
+ gc.set_bool ("/apps/cinaest/download_posters", download_posters.get_active ());
+ gc.set_bool ("/apps/cinaest/start_movies", start_movies.get_active ());
+ gc.set_string ("/apps/cinaest/default_source", default_source.get_value ());
+ } catch (Error e) {
+ stdout.printf ("Error setting GConf option: %s\n", e.message);
+ }
destroy ();
return res;