X-Git-Url: http://git.maemo.org/git/?p=beifahrer;a=blobdiff_plain;f=src%2Fsettings-dialog.vala;h=aea80c17f3ca9e0cd5063fea7e1c51c459ff1524;hp=c8724557f65b3904d7b91cec69e2f7cd23567b30;hb=HEAD;hpb=5de50390257b07bed7c802816c413f691475316c diff --git a/src/settings-dialog.vala b/src/settings-dialog.vala index c872455..aea80c1 100644 --- a/src/settings-dialog.vala +++ b/src/settings-dialog.vala @@ -19,10 +19,24 @@ using Gtk; using Hildon; +namespace Hildon { + [CCode (cname = "hildon_gtk_entry_set_placeholder_text")] + extern static void gtk_entry_set_placeholder_text (Gtk.Entry entry, string placeholder_text); + + [CCode (cname = "hildon_gtk_entry_set_input_mode")] + extern static void gtk_entry_set_input_mode (Gtk.Entry entry, Hildon.GtkInputMode mode); +} + public class SettingsDialog : Gtk.Dialog { public const string GCONF_KEY_USE_LOCATION = "/apps/beifahrer/use_location"; + public const string GCONF_KEY_PRELOAD = "/apps/beifahrer/preload"; + public const string GCONF_KEY_USERNAME = "/apps/beifahrer/adac/username"; + public const string GCONF_KEY_PASSWORD = "/apps/beifahrer/adac/password"; Hildon.CheckButton use_location; + Hildon.CheckButton preload; + Hildon.Entry username; + Hildon.Entry password; GConf.Client gconf; public SettingsDialog (Gtk.Window window) { @@ -32,7 +46,17 @@ public class SettingsDialog : Gtk.Dialog { var vbox = (VBox) get_content_area (); use_location = new Hildon.CheckButton (SizeType.FINGER_HEIGHT); use_location.set_label (_("Determine point of departure automatically")); + preload = new Hildon.CheckButton (SizeType.FINGER_HEIGHT); + preload.set_label (_("Preload lift details in the background")); + username = new Hildon.Entry (SizeType.FINGER_HEIGHT); + Hildon.gtk_entry_set_placeholder_text (username, _("Username")); + password = new Hildon.Entry (SizeType.FINGER_HEIGHT); + password.set_visibility (false); + Hildon.gtk_entry_set_placeholder_text (password, _("Password")); vbox.pack_start (use_location, true, true, 0); + vbox.pack_start (preload, true, true, 0); + vbox.pack_start (username, true, true, 0); + vbox.pack_start (password, true, true, 0); vbox.show_all (); add_button (_("Save"), ResponseType.APPLY); @@ -40,6 +64,9 @@ public class SettingsDialog : Gtk.Dialog { gconf = GConf.Client.get_default (); try { use_location.set_active (gconf.get_bool (GCONF_KEY_USE_LOCATION)); + preload.set_active (gconf.get_bool (GCONF_KEY_PRELOAD)); + username.set_text (gconf.get_string (GCONF_KEY_USERNAME)); + password.set_text (gconf.get_string (GCONF_KEY_PASSWORD)); } catch (Error e) { use_location.set_active (true); } @@ -50,7 +77,10 @@ public class SettingsDialog : Gtk.Dialog { 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 (); + gconf.set_bool (GCONF_KEY_PRELOAD, preload.get_active ()); + gconf.set_string (GCONF_KEY_USERNAME, username.get_text ()); + gconf.set_string (GCONF_KEY_PASSWORD, password.get_text ()); + this.destroy (); } catch (Error e) { } }