Compare commits
2 Commits
broken-gi-
...
fix-geoclu
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e2c7a6efa | |||
| 5a1111855f |
@@ -1,13 +1,13 @@
|
||||
# NOTICE: This lockfile contains some overrides from shard.override.yml
|
||||
version: 2.0
|
||||
shards:
|
||||
gi-crystal:
|
||||
gi-crystal: # Overridden
|
||||
git: https://github.com/hugopl/gi-crystal.git
|
||||
version: 0.14.0+git.commit.569f8d4b77effe312c642fc60929000e3e9514e2
|
||||
version: 0.15.0+git.commit.bcf127b37c309a52f4b17566e9663029c16dcbb2
|
||||
|
||||
gtk4: # Overridden
|
||||
git: https://github.com/hugopl/gtk4.cr.git
|
||||
version: 0.12.0+git.commit.ef2eb03b38b25ea2780e83cf50af3a6807ac6293
|
||||
version: 0.12.0+git.commit.a46b9295a7cffcc4ed2af596276c17196b2948fb
|
||||
|
||||
libadwaita:
|
||||
git: https://github.com/geopjr/libadwaita.cr.git
|
||||
|
||||
@@ -2,3 +2,6 @@ dependencies:
|
||||
gtk4:
|
||||
github: hugopl/gtk4.cr
|
||||
branch: master
|
||||
gi-crystal:
|
||||
github: hugopl/gi-crystal
|
||||
branch: master
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
module Wince::Location
|
||||
extend self
|
||||
|
||||
@@channel = Channel(Geoclue::Simple).new(1)
|
||||
@@client : Geoclue::Simple? = nil
|
||||
@@fiber : Fiber = spawn setup_client
|
||||
|
||||
def setup_client
|
||||
@@channel.send Geoclue::Simple.new_sync("space.quietfeathers.Wince", Geoclue::AccuracyLevel::Street, nil)
|
||||
Fiber.yield
|
||||
callback = ->(object : GObject::Object | Nil, result : Gio::AsyncResult) {
|
||||
@@client = Geoclue::Simple.new_finish(result)
|
||||
puts "location callback"
|
||||
}
|
||||
|
||||
Geoclue::Simple.new(
|
||||
"space.quietfeathers.Wince",
|
||||
Geoclue::AccuracyLevel::Street,
|
||||
nil,
|
||||
callback,
|
||||
nil
|
||||
)
|
||||
end
|
||||
|
||||
# returns latlon if available, otherwise empty array
|
||||
def find_location
|
||||
if !@@fiber.dead?
|
||||
return [] of Float64
|
||||
end
|
||||
|
||||
if @@client.nil?
|
||||
@@client = @@channel.receive
|
||||
return [] of Float64
|
||||
end
|
||||
|
||||
location = @@client.try do |c|
|
||||
|
||||
@@ -1,6 +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/*"
|
||||
GICrystal.require("Geoclue", "2.0")
|
||||
GICrystal.require("Shumate", "1.0")
|
||||
|
||||
require "./modules/prerequisites.cr"
|
||||
require "./modules/views/main.cr"
|
||||
|
||||
Reference in New Issue
Block a user