Skip to content

Commit 7219626

Browse files
committed
Show close btn on small window size
1 parent b8bbaf6 commit 7219626

2 files changed

Lines changed: 36 additions & 22 deletions

File tree

data/resources/ui/window.blp

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,37 @@ template GeopardWindow: Adw.ApplicationWindow {
3131
tightening-threshold: 720;
3232
width-request: 360;
3333
Gtk.SearchEntry url_bar {
34-
hexpand: true;
35-
text: bind GeopardWindow.url;
36-
}
37-
}
34+
hexpand: true;
35+
text: bind GeopardWindow.url;
36+
}
37+
}
3838
[end]
3939
Gtk.MenuButton {
4040
icon-name: "open-menu";
4141
menu-model: primary_menu;
42-
}
42+
}
4343
}
44-
Adw.HeaderBar header_small {
45-
show-end-title-buttons: false;
46-
show-start-title-buttons: false;
47-
[title]
48-
Gtk.SearchEntry small_url_bar {
49-
hexpand: true;
50-
text: bind GeopardWindow.url;
44+
Gtk.WindowHandle header_small {
45+
Gtk.Box {
46+
margin-top: 6;
47+
margin-bottom: 6;
48+
margin-start: 6;
49+
margin-end: 6;
50+
spacing: 6;
51+
styles ["headerbar"]
52+
Gtk.WindowControls ws {
53+
side: start;
54+
visible: bind ws.empty inverted;
55+
}
56+
[title]
57+
Gtk.SearchEntry small_url_bar {
58+
hexpand: true;
59+
text: bind GeopardWindow.url;
60+
}
61+
Gtk.WindowControls we {
62+
side: end;
63+
visible: bind we.empty inverted;
64+
}
5165
}
5266
}
5367
}
@@ -56,22 +70,22 @@ template GeopardWindow: Adw.ApplicationWindow {
5670
}
5771
Gtk.Overlay {
5872
Adw.TabView tab_view {
59-
vexpand: true;
60-
hexpand: true;
73+
vexpand: true;
74+
hexpand: true;
6175
}
6276
[overlay]
6377
Gtk.ProgressBar progress_bar {
64-
styles ["osd"]
65-
valign: start;
66-
text: bind GeopardWindow.progress;
78+
styles ["osd"]
79+
valign: start;
80+
text: bind GeopardWindow.progress;
6781
}
6882
[overlay]
6983
Gtk.Revealer bottom_bar_revealer {
7084
transition-type: slide_up;
7185
valign: end;
72-
[child]
73-
Adw.HeaderBar bottom_bar {
74-
show-end-title-buttons: false;
86+
[child]
87+
Adw.HeaderBar bottom_bar {
88+
show-end-title-buttons: false;
7589
show-start-title-buttons: false;
7690
[start]
7791
Gtk.Button {

src/window.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub mod imp {
3636
#[template_child]
3737
pub(crate) bottom_bar_revealer: TemplateChild<gtk::Revealer>,
3838
#[template_child]
39-
pub(crate) header_small: TemplateChild<adw::HeaderBar>,
39+
pub(crate) header_small: TemplateChild<gtk::WindowHandle>,
4040
#[template_child]
4141
pub(crate) squeezer: TemplateChild<adw::Squeezer>,
4242
#[template_child]
@@ -448,7 +448,7 @@ impl Window {
448448
.visible_child()
449449
.map(|child| child.downcast().ok())
450450
.flatten()
451-
.map(|w: adw::HeaderBar| w == self.imp().header_small.get())
451+
.map(|w: gtk::WindowHandle| w == self.imp().header_small.get())
452452
.unwrap_or(false)
453453
}
454454
fn squeezer_changed(&self) {

0 commit comments

Comments
 (0)