/* This file is part of Beifahrer. * * Copyright (C) 2010 Philipp Zabel * * Beifahrer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Beifahrer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Beifahrer. If not, see . */ using Gtk; using Hildon; public class SettingsDialog : Gtk.Dialog { public const string GCONF_KEY_USE_LOCATION = "/apps/beifahrer/use_location"; Hildon.CheckButton use_location; GConf.Client gconf; public SettingsDialog (Gtk.Window window) { set_title (_("Settings")); set_transient_for (window); var vbox = (VBox) get_content_area (); use_location = new Hildon.CheckButton (SizeType.FINGER_HEIGHT); use_location.set_label (_("Determine point of departure automatically")); vbox.pack_start (use_location, true, true, 0); vbox.show_all (); add_button (_("Save"), ResponseType.APPLY); gconf = GConf.Client.get_default (); try { use_location.set_active (gconf.get_bool (GCONF_KEY_USE_LOCATION)); } catch (Error e) { use_location.set_active (true); } response.connect (on_response); } void on_response (int response_id) { if (response_id == ResponseType.APPLY) try { gconf.set_bool (GCONF_KEY_USE_LOCATION, use_location.get_active ()); this.destroy (); } catch (Error e) { } } }