1 /* This file is part of Cinaest.
3 * Copyright (C) 2009 Philipp Zabel
5 * Cinaest is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * Cinaest is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Cinaest. If not, see <http://www.gnu.org/licenses/>.
22 class SettingsDialog : Gtk.Dialog {
23 List<Gtk.Button> buttons;
24 Gtk.Window movie_list_window;
25 private Hildon.CheckButton download_posters;
27 public SettingsDialog (Gtk.Window window) {
28 movie_list_window = window;
29 set_transient_for (window);
33 set_title (_("Settings"));
36 if (CinaestProgram.plugins.length () > 5) {
37 vbox = new VBox (true, 0);
39 var pannable = new PannableArea ();
40 pannable.add_with_viewport (vbox);
42 VBox area = (VBox) get_content_area ();
43 area.pack_start (pannable, true, true, 0);
44 area.set_size_request (-1, 5*70);
46 vbox = (VBox) get_content_area ();
49 download_posters = new Hildon.CheckButton (SizeType.FINGER_HEIGHT);
50 download_posters.set_label (_("Download movie posters"));
51 vbox.pack_start (download_posters, true, true, 0);
55 buttons = new List<Hildon.Button> ();
56 foreach (Plugin plugin in CinaestProgram.plugins) {
57 var button = new Gtk.Button.with_label (plugin.get_name ());
59 Hildon.gtk_widget_set_theme_size (button, SizeType.FINGER_HEIGHT);
60 button.set_alignment(0, 0.5f);
63 hbox = new HBox (true, 0);
64 vbox.pack_start (hbox, true, true, 0);
68 hbox.pack_start (button, true, true, 0);
70 button.clicked.connect (on_plugin_settings);
72 buttons.append (button);
75 add_button (_("Done"), ResponseType.ACCEPT);
78 public void on_plugin_settings (Gtk.Button button) {
79 int n = buttons.index (button);
84 public new int run () {
86 var gc = GConf.Client.get_default ();
89 download_posters.set_active (gc.get_bool ("/apps/cinaest/download_posters"));
91 stdout.printf ("Error getting GConf option: %s\n", e.message);
99 var plugin = CinaestProgram.plugins.nth_data (res);
100 plugin.settings_dialog (movie_list_window);
104 if (res == ResponseType.ACCEPT) try {
105 gc.set_bool ("/apps/cinaest/download_posters", download_posters.get_active ());
107 stdout.printf ("Error setting GConf option: %s\n", e.message);