1 Commits

Author SHA1 Message Date
bbc2cc5733 Demonstrate broken gi crystal imports 2023-02-10 22:06:23 -08:00
4 changed files with 14 additions and 21 deletions

View File

@@ -1,13 +1,13 @@
# NOTICE: This lockfile contains some overrides from shard.override.yml # NOTICE: This lockfile contains some overrides from shard.override.yml
version: 2.0 version: 2.0
shards: shards:
gi-crystal: # Overridden gi-crystal:
git: https://github.com/hugopl/gi-crystal.git git: https://github.com/hugopl/gi-crystal.git
version: 0.15.0+git.commit.bcf127b37c309a52f4b17566e9663029c16dcbb2 version: 0.14.0+git.commit.569f8d4b77effe312c642fc60929000e3e9514e2
gtk4: # Overridden gtk4: # Overridden
git: https://github.com/hugopl/gtk4.cr.git git: https://github.com/hugopl/gtk4.cr.git
version: 0.12.0+git.commit.a46b9295a7cffcc4ed2af596276c17196b2948fb version: 0.12.0+git.commit.ef2eb03b38b25ea2780e83cf50af3a6807ac6293
libadwaita: libadwaita:
git: https://github.com/geopjr/libadwaita.cr.git git: https://github.com/geopjr/libadwaita.cr.git

View File

@@ -2,6 +2,3 @@ dependencies:
gtk4: gtk4:
github: hugopl/gtk4.cr github: hugopl/gtk4.cr
branch: master branch: master
gi-crystal:
github: hugopl/gi-crystal
branch: master

View File

@@ -1,29 +1,25 @@
module Wince::Location module Wince::Location
extend self extend self
@@channel = Channel(Geoclue::Simple).new(1)
@@client : Geoclue::Simple? = nil @@client : Geoclue::Simple? = nil
@@fiber : Fiber = spawn setup_client
def setup_client def setup_client
callback = ->(object : GObject::Object | Nil, result : Gio::AsyncResult) { @@channel.send Geoclue::Simple.new_sync("space.quietfeathers.Wince", Geoclue::AccuracyLevel::Street, nil)
@@client = Geoclue::Simple.new_finish(result) Fiber.yield
puts "location callback"
}
Geoclue::Simple.new(
"space.quietfeathers.Wince",
Geoclue::AccuracyLevel::Street,
nil,
callback,
nil
)
end end
# returns latlon if available, otherwise empty array # returns latlon if available, otherwise empty array
def find_location def find_location
if @@client.nil? if !@@fiber.dead?
return [] of Float64 return [] of Float64
end end
if @@client.nil?
@@client = @@channel.receive
end
location = @@client.try do |c| location = @@client.try do |c|
[c.location.latitude, c.location.longitude] [c.location.latitude, c.location.longitude]
end || [] of Float64 end || [] of Float64

View File

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