using Hildon;
public class LiftListWindow : StackableWindow {
+ public const string GCONF_KEY_PRELOAD = "/apps/beifahrer/preload";
+
AdacMitfahrclub adac;
ListStore store;
TreeView tree;
TreeViewColumn route_column;
Label no_lifts;
+ GConf.Client gconf;
+ bool preload = false;
public LiftListWindow (AdacMitfahrclub _adac) {
adac = _adac;
construct {
set_title ("Beifahrer");
+ gconf = GConf.Client.get_default ();
store = new ListStore (6, typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (Lift));
tree = (TreeView) Hildon.gtk_tree_view_new_with_model (UIMode.NORMAL, store);
}
if (lift_list.length () == 0)
no_lifts.show ();
+
+ bool preload = false;
+ try {
+ preload = gconf.get_bool (GCONF_KEY_PRELOAD);
+ } catch (Error e) {
+ }
+ if (preload) {
+ if (store.get_iter_first (out iter)) do {
+ Lift lift2;
+ store.@get (iter, 5, out lift2);
+ if (lift2 == null)
+ continue;
+ if (lift2.description == null)
+ yield adac.update_lift_details (lift2);
+ } while (store.iter_next (ref iter));
+ }
+
Hildon.gtk_window_set_progress_indicator (this, 0);
}
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";
Hildon.CheckButton use_location;
+ Hildon.CheckButton preload;
GConf.Client gconf;
public SettingsDialog (Gtk.Window window) {
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"));
vbox.pack_start (use_location, true, true, 0);
+ vbox.pack_start (preload, 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));
+ preload.set_active (gconf.get_bool (GCONF_KEY_PRELOAD));
} catch (Error e) {
use_location.set_active (true);
}
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 ());
+ this.destroy ();
} catch (Error e) {
}
}