Initial commit

This commit is contained in:
2022-12-16 15:19:11 -08:00
commit 81bb95cf25
13 changed files with 159 additions and 0 deletions

10
src/gtktest.cr Normal file
View File

@@ -0,0 +1,10 @@
require "libadwaita"
require "./modules/prerequisites.cr"
require "./modules/views/main.cr"
module GtkTest
B_UI = Gtk::Builder.new_from_resource("/gtktest/ui/compiled/main.ui")
APP = Adw::Application.new("dev.gtktest", Gio::ApplicationFlags::None)
end

View File

@@ -0,0 +1,9 @@
module GtkTest
extend self
VERSION = {{read_file("./shard.yml").split("version: ")[1].split("\n")[0]}}
{%
`blueprint-compiler batch-compile ./data/ui/compiled ./data/ui/ ./data/ui/*.blp`
%}
Gio.register_resource("data/gtktest.gresource.xml", "data")
end

18
src/modules/views/main.cr Normal file
View File

@@ -0,0 +1,18 @@
module GtkTest
@@main_window_id = 0_u32
def activate(app : Adw::Application)
main_window = APP.window_by_id(@@main_window_id)
return main_window.present if main_window
window = Adw::ApplicationWindow.cast(B_UI["mainWindow"])
window.application = app
@@main_window_id = window.id
window.present
end
APP.activate_signal.connect(->activate(Adw::Application))
exit(APP.run(ARGV))
end