+static void default_location_cb ( GtkAction *a, VikWindow *vw )
+{
+ /* Simplistic repeat of preference setting
+ Only the name & type are important for setting the preference via this 'external' way */
+ VikLayerParam pref_lat[] = {
+ { VIKING_PREFERENCES_NAMESPACE "default_latitude",
+ VIK_LAYER_PARAM_DOUBLE,
+ VIK_LOCATION_LAT,
+ NULL,
+ VIK_LAYER_WIDGET_SPINBUTTON,
+ NULL,
+ NULL },
+ };
+ VikLayerParam pref_lon[] = {
+ { VIKING_PREFERENCES_NAMESPACE "default_longitude",
+ VIK_LAYER_PARAM_DOUBLE,
+ VIK_LOCATION_LONG,
+ NULL,
+ VIK_LAYER_WIDGET_SPINBUTTON,
+ NULL,
+ NULL },
+ };
+
+ /* Get current center */
+ struct LatLon ll;
+ vik_coord_to_latlon ( vik_viewport_get_center ( vw->viking_vvp ), &ll );
+
+ /* Apply to preferences */
+ VikLayerParamData vlp_data;
+ vlp_data.d = ll.lat;
+ a_preferences_run_setparam (vlp_data, pref_lat);
+ vlp_data.d = ll.lon;
+ a_preferences_run_setparam (vlp_data, pref_lon);
+ /* Remember to save */
+ a_preferences_save_to_file();
+}
+