Initial search layout and rename to wince

This commit is contained in:
2022-12-16 16:35:38 -08:00
parent 81bb95cf25
commit 00814dd7e4
8 changed files with 53 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
# gtktest
# Wince
Crystal GTK test application
A GTK 4 frontend for yelp
## Build

View File

@@ -2,13 +2,32 @@ using Gtk 4.0;
using Adw 1;
Adw.ApplicationWindow mainWindow {
title: "Hello world";
default-width: 300;
default-height: 400;
title: "Wince";
default-width: 400;
default-height: 500;
Gtk.Box {
orientation: vertical;
Adw.HeaderBar {}
Gtk.Box {
orientation: horizontal;
margin-top: 10;
margin-start: 14;
margin-end: 14;
styles ["linked"]
Gtk.Entry searchEntry {
placeholder-text: "Search";
}
Gtk.Entry locationEntry {
placeholder-text: "Location";
}
Gtk.Button searchButton {
icon-name: "edit-find";
}
}
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/gtktest">
<gresource prefix="/wince">
<file compressed="true" preprocess="xml-stripblanks">ui/compiled/main.ui</file>
</gresource>
</gresources>

View File

@@ -1,4 +1,4 @@
name: gtktest
name: wince
version: 0.1.0
authors:
@@ -6,7 +6,7 @@ authors:
targets:
gtktest:
main: src/gtktest.cr
main: src/wince.cr
dependencies:
gtk4:

View File

@@ -1,10 +0,0 @@
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

@@ -1,9 +1,9 @@
module GtkTest
module Wince
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")
Gio.register_resource("data/wince.gresource.xml", "data")
end

View File

@@ -1,4 +1,4 @@
module GtkTest
module Wince
@@main_window_id = 0_u32
def activate(app : Adw::Application)
@@ -10,9 +10,18 @@ module GtkTest
@@main_window_id = window.id
SEARCH_BUTTON.clicked_signal.connect do
handle_search
end
window.present
end
def handle_search
puts "searched for " + SEARCH_ENTRY.buffer.text
puts "location for " + LOCATION_ENTRY.buffer.text
end
APP.activate_signal.connect(->activate(Adw::Application))
exit(APP.run(ARGV))
end

14
src/wince.cr Normal file
View File

@@ -0,0 +1,14 @@
require "libadwaita"
require "./modules/prerequisites.cr"
require "./modules/views/main.cr"
module Wince
B_UI = Gtk::Builder.new_from_resource("/wince/ui/compiled/main.ui")
SEARCH_ENTRY = Gtk::Entry.cast(B_UI["searchEntry"])
LOCATION_ENTRY = Gtk::Entry.cast(B_UI["locationEntry"])
SEARCH_BUTTON = Gtk::Button.cast(B_UI["searchButton"])
APP = Adw::Application.new("dev.wince", Gio::ApplicationFlags::None)
end