Initial search layout and rename to wince
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# gtktest
|
# Wince
|
||||||
|
|
||||||
Crystal GTK test application
|
A GTK 4 frontend for yelp
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,32 @@ using Gtk 4.0;
|
|||||||
using Adw 1;
|
using Adw 1;
|
||||||
|
|
||||||
Adw.ApplicationWindow mainWindow {
|
Adw.ApplicationWindow mainWindow {
|
||||||
title: "Hello world";
|
title: "Wince";
|
||||||
default-width: 300;
|
default-width: 400;
|
||||||
default-height: 400;
|
default-height: 500;
|
||||||
|
|
||||||
Gtk.Box {
|
Gtk.Box {
|
||||||
orientation: vertical;
|
orientation: vertical;
|
||||||
|
|
||||||
Adw.HeaderBar {}
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/gtktest">
|
<gresource prefix="/wince">
|
||||||
<file compressed="true" preprocess="xml-stripblanks">ui/compiled/main.ui</file>
|
<file compressed="true" preprocess="xml-stripblanks">ui/compiled/main.ui</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: gtktest
|
name: wince
|
||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
@@ -6,7 +6,7 @@ authors:
|
|||||||
|
|
||||||
targets:
|
targets:
|
||||||
gtktest:
|
gtktest:
|
||||||
main: src/gtktest.cr
|
main: src/wince.cr
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
gtk4:
|
gtk4:
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
module GtkTest
|
module Wince
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
VERSION = {{read_file("./shard.yml").split("version: ")[1].split("\n")[0]}}
|
VERSION = {{read_file("./shard.yml").split("version: ")[1].split("\n")[0]}}
|
||||||
{%
|
{%
|
||||||
`blueprint-compiler batch-compile ./data/ui/compiled ./data/ui/ ./data/ui/*.blp`
|
`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
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module GtkTest
|
module Wince
|
||||||
@@main_window_id = 0_u32
|
@@main_window_id = 0_u32
|
||||||
|
|
||||||
def activate(app : Adw::Application)
|
def activate(app : Adw::Application)
|
||||||
@@ -10,9 +10,18 @@ module GtkTest
|
|||||||
|
|
||||||
@@main_window_id = window.id
|
@@main_window_id = window.id
|
||||||
|
|
||||||
|
SEARCH_BUTTON.clicked_signal.connect do
|
||||||
|
handle_search
|
||||||
|
end
|
||||||
|
|
||||||
window.present
|
window.present
|
||||||
end
|
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))
|
APP.activate_signal.connect(->activate(Adw::Application))
|
||||||
exit(APP.run(ARGV))
|
exit(APP.run(ARGV))
|
||||||
end
|
end
|
||||||
14
src/wince.cr
Normal file
14
src/wince.cr
Normal 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
|
||||||
Reference in New Issue
Block a user