1 /* This file is part of Beifahrer.
3 * Copyright (C) 2010 Philipp Zabel
5 * Beifahrer 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 * Beifahrer 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 Beifahrer. If not, see <http://www.gnu.org/licenses/>.
22 public class SettingsDialog : Gtk.Dialog {
23 public const string GCONF_KEY_USE_LOCATION = "/apps/beifahrer/use_location";
24 public const string GCONF_KEY_PRELOAD = "/apps/beifahrer/preload";
26 Hildon.CheckButton use_location;
27 Hildon.CheckButton preload;
30 public SettingsDialog (Gtk.Window window) {
31 set_title (_("Settings"));
32 set_transient_for (window);
34 var vbox = (VBox) get_content_area ();
35 use_location = new Hildon.CheckButton (SizeType.FINGER_HEIGHT);
36 use_location.set_label (_("Determine point of departure automatically"));
37 preload = new Hildon.CheckButton (SizeType.FINGER_HEIGHT);
38 preload.set_label (_("Preload lift details in the background"));
39 vbox.pack_start (use_location, true, true, 0);
40 vbox.pack_start (preload, true, true, 0);
43 add_button (_("Save"), ResponseType.APPLY);
45 gconf = GConf.Client.get_default ();
47 use_location.set_active (gconf.get_bool (GCONF_KEY_USE_LOCATION));
48 preload.set_active (gconf.get_bool (GCONF_KEY_PRELOAD));
50 use_location.set_active (true);
53 response.connect (on_response);
56 void on_response (int response_id) {
57 if (response_id == ResponseType.APPLY) try {
58 gconf.set_bool (GCONF_KEY_USE_LOCATION, use_location.get_active ());
59 gconf.set_bool (GCONF_KEY_PRELOAD, preload.get_active ());