Figured out how to use gi-crystal with libadwaita, added find location function

This commit is contained in:
2022-12-23 18:03:06 -08:00
parent 0c0f7d881e
commit 23e48e7d4d
4 changed files with 8 additions and 5 deletions

View File

@@ -9,10 +9,9 @@ targets:
main: src/wince.cr
dependencies:
gtk4:
github: hugopl/gtk4.cr
libadwaita:
github: GeopJr/libadwaita.cr
branch: main
crystal: 1.6.2

View File

@@ -1,10 +1,10 @@
module Wince::Location
extend self
client = Geoclue::Simple.new()
@@client = Geoclue::Simple.new_sync("space.quietfeathers.Wince", Geoclue::AccuracyLevel::Street, nil)
def find_location()
location = client.location
location = @@client.location
[location.latitude, location.longitude]
end
end

View File

@@ -3,6 +3,7 @@ require "time"
require "../templates/businessrow.cr"
require "../templates/hourrow.cr"
require "../api/location.cr"
require "../api/yelp.cr"
require "../utils/utils.cr"
@@ -42,7 +43,8 @@ module Wince
end
def handle_geolocate
puts "no, not yet"
latlon = Location.find_location()
LOCATION_ENTRY.text = "#{latlon[0]}, #{latlon[1]}"
end
def yelp_response_to_business_ids(response : JSON::Any)

View File

@@ -1,4 +1,6 @@
require "libadwaita"
require "../lib/libadwaita/lib/gi-crystal/src/auto/geoclue-2.0/*"
require "../lib/libadwaita/lib/gi-crystal/src/auto/shumate-1.0/*"
require "./modules/prerequisites.cr"
require "./modules/views/main.cr"