Added clamp to make larger windows look better
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
using Shumate 1.0;
|
||||
|
||||
Adw.ApplicationWindow mainWindow {
|
||||
title: "Wince";
|
||||
@@ -27,6 +28,9 @@ Adw.ApplicationWindow mainWindow {
|
||||
Gtk.Entry locationEntry {
|
||||
placeholder-text: "Location";
|
||||
}
|
||||
Gtk.Button geolocateButton {
|
||||
icon-name: "find-location";
|
||||
}
|
||||
Gtk.Button searchButton {
|
||||
icon-name: "edit-find";
|
||||
}
|
||||
@@ -51,6 +55,15 @@ Adw.ApplicationWindow mainWindow {
|
||||
Gtk.ListBox searchResults {}
|
||||
}
|
||||
|
||||
Adw.Clamp {
|
||||
maximum-size: 450;
|
||||
tightening-threshold: 400;
|
||||
|
||||
Gtk.Label seeDetailsText {
|
||||
hexpand: true;
|
||||
label: "Select a result to see details";
|
||||
}
|
||||
|
||||
Gtk.Box detailsBox {
|
||||
orientation: vertical;
|
||||
visible: false;
|
||||
@@ -114,3 +127,4 @@ Adw.ApplicationWindow mainWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
src/modules/api/location.cr
Normal file
10
src/modules/api/location.cr
Normal file
@@ -0,0 +1,10 @@
|
||||
module Wince::Location
|
||||
extend self
|
||||
|
||||
client = Geoclue::Simple.new()
|
||||
|
||||
def find_location()
|
||||
location = client.location
|
||||
[location.latitude, location.longitude]
|
||||
end
|
||||
end
|
||||
@@ -23,6 +23,10 @@ module Wince
|
||||
handle_search
|
||||
end
|
||||
|
||||
GEOLOCATE_BUTTON.clicked_signal.connect do
|
||||
handle_geolocate
|
||||
end
|
||||
|
||||
BUSINESS_LIST.row_selected_signal.connect do
|
||||
handle_business_select
|
||||
end
|
||||
@@ -30,6 +34,10 @@ module Wince
|
||||
window.present
|
||||
end
|
||||
|
||||
def handle_geolocate
|
||||
puts "no, not yet"
|
||||
end
|
||||
|
||||
def yelp_response_to_business_ids(response : JSON::Any)
|
||||
response["businesses"].as_a.map { |b| b["id"].as_s }
|
||||
end
|
||||
@@ -106,9 +114,10 @@ module Wince
|
||||
DETAILS_CURRENT_HOURS.text = Utils.hours_for_day(response_json["hours"], Time.local.day_of_week)
|
||||
DETAILS_PRICING.text = response_json["price"].as_s? || ""
|
||||
DETAILS_ADDRESS.markup = Utils.format_address(response_json["location"]["display_address"])
|
||||
DETAILS_PHONE.text = response_json["display_phone"].as_s? || ""
|
||||
DETAILS_PHONE.text = response_json["display_phone"].as_s? || "no phone number"
|
||||
DETAILS_URL.uri = response_json["url"].as_s? || ""
|
||||
|
||||
SEE_DETAILS_TEXT.visible = false
|
||||
DETAILS_BOX.visible = true
|
||||
LEAFLET.visible_child = DETAILS_BOX
|
||||
end
|
||||
|
||||
@@ -8,11 +8,13 @@ module Wince
|
||||
|
||||
SEARCH_ENTRY = Gtk::Entry.cast(B_UI["searchEntry"])
|
||||
LOCATION_ENTRY = Gtk::Entry.cast(B_UI["locationEntry"])
|
||||
GEOLOCATE_BUTTON = Gtk::Button.cast(B_UI["geolocateButton"])
|
||||
SEARCH_BUTTON = Gtk::Button.cast(B_UI["searchButton"])
|
||||
BUSINESS_LIST = Gtk::ListBox.cast(B_UI["searchResults"])
|
||||
POWERD_BY_TEXT = Gtk::Label.cast(B_UI["poweredByText"])
|
||||
SCROLL_VIEW = Gtk::ScrolledWindow.cast(B_UI["scrollWindow"])
|
||||
LEAFLET = Adw::Leaflet.cast(B_UI["leaflet"])
|
||||
SEE_DETAILS_TEXT = Gtk::Label.cast(B_UI["seeDetailsText"])
|
||||
DETAILS_BOX = Gtk::Box.cast(B_UI["detailsBox"])
|
||||
DETAILS_TITLE = Gtk::Label.cast(B_UI["detailsTitle"])
|
||||
DETAILS_IS_OPEN = Gtk::Label.cast(B_UI["detailsIsOpen"])
|
||||
|
||||
Reference in New Issue
Block a user