Skip to content

Commit 932a5ed

Browse files
committed
First app to use the new responsive AboutWindow work.
1 parent f97bb68 commit 932a5ed

File tree

3 files changed

+153
-147
lines changed

3 files changed

+153
-147
lines changed

data/ui/window.blp

Lines changed: 145 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -12,168 +12,170 @@ template $VictrolaMainWindow : He.ApplicationWindow {
1212
Box {
1313
orientation: vertical;
1414

15-
Bis.Album album {
16-
can-navigate-back: true;
17-
can-navigate-forward: true;
18-
visible-child: listgrid;
19-
20-
Bis.AlbumPage {
21-
navigatable: false;
22-
child: Box {
23-
orientation: vertical;
24-
He.AppBar {
25-
show-left-title-buttons: true;
26-
show-right-title-buttons: false;
27-
width-request: 113; // Chunky enough for the rail
28-
}
29-
He.NavigationRail {
30-
stack: stack;
31-
}
32-
};
33-
}
34-
35-
Bis.AlbumPage {
36-
child: He.SideBar listgrid {
37-
vexpand: true;
38-
hexpand: true;
39-
show-left-title-buttons: bind album.folded;
40-
show-right-title-buttons: bind album.folded;
41-
show-back: false;
42-
has-margins: false;
43-
titlewidget: He.ViewTitle {
44-
label: _("Music");
15+
Overlay about_overlay {
16+
child: Bis.Album album {
17+
can-navigate-back: true;
18+
can-navigate-forward: true;
19+
visible-child: listgrid;
20+
21+
Bis.AlbumPage {
22+
navigatable: false;
23+
child: Box {
24+
orientation: vertical;
25+
He.AppBar {
26+
show-left-title-buttons: true;
27+
show-right-title-buttons: false;
28+
width-request: 113; // Chunky enough for the rail
29+
}
30+
He.NavigationRail {
31+
stack: stack;
32+
}
4533
};
46-
47-
styles [
48-
"main-view"
49-
]
50-
51-
[titlebar-toggle]
52-
ToggleButton search_btn {
53-
icon-name: "edit-find-symbolic";
54-
active: bind search_bar.search-mode-enabled no-sync-create bidirectional;
55-
tooltip-text: _("Search music");
56-
}
57-
58-
[titlebar-menu]
59-
MenuButton menu_btn {
60-
valign: center;
61-
icon-name: "open-menu-symbolic";
62-
menu-model: primary_menu;
63-
}
64-
65-
SearchBar search_bar {
66-
key-capture-widget: template;
67-
child: SearchEntry search_entry {
68-
hexpand: true;
69-
margin-start: 18;
70-
halign: start;
71-
placeholder-text: "";
72-
73-
styles [
74-
"search",
75-
"text-field",
76-
"outline"
77-
]
34+
}
35+
36+
Bis.AlbumPage {
37+
child: He.SideBar listgrid {
38+
vexpand: true;
39+
hexpand: true;
40+
show-left-title-buttons: bind album.folded;
41+
show-right-title-buttons: bind album.folded;
42+
show-back: false;
43+
has-margins: false;
44+
titlewidget: He.ViewTitle {
45+
label: _("Music");
7846
};
7947

8048
styles [
81-
"search-bar",
49+
"main-view"
8250
]
83-
}
8451

85-
ScrolledWindow scroll_view {
86-
hscrollbar-policy: never;
87-
vexpand: true;
88-
89-
Stack stack {
90-
margin-start: 18;
91-
margin-end: 18;
92-
margin-bottom: 18;
93-
94-
StackPage {
95-
icon-name: "audio-x-generic-symbolic";
96-
title: "Titles";
97-
name: "title";
98-
child:
99-
ListView list_view3 {
100-
single-click-activate: true;
101-
102-
styles [
103-
"content-list",
104-
"music-list"
105-
]
106-
}
107-
;
108-
}
109-
}
52+
[titlebar-toggle]
53+
ToggleButton search_btn {
54+
icon-name: "edit-find-symbolic";
55+
active: bind search_bar.search-mode-enabled no-sync-create bidirectional;
56+
tooltip-text: _("Search music");
11057
}
11158

112-
Box info_box_mobile {
113-
orientation: vertical;
114-
visible: bind album.folded;
115-
}
116-
He.NavigationRail {
117-
stack: stack;
118-
orientation: horizontal;
119-
visible: bind album.folded;
120-
styles [
121-
"music-navrail"
122-
]
123-
}
124-
};
125-
}
59+
[titlebar-menu]
60+
MenuButton menu_btn {
61+
valign: center;
62+
icon-name: "open-menu-symbolic";
63+
menu-model: primary_menu;
64+
}
12665

127-
Bis.AlbumPage {
128-
child:
129-
Box infogrid {
130-
orientation: vertical;
131-
hexpand-set: true;
66+
SearchBar search_bar {
67+
key-capture-widget: template;
68+
child: SearchEntry search_entry {
69+
hexpand: true;
70+
margin-start: 18;
71+
halign: start;
72+
placeholder-text: "";
13273

133-
He.AppBar info_title {
134-
show-back: bind album.folded;
135-
show-left-title-buttons: bind album.folded;
136-
show-right-title-buttons: true;
74+
styles [
75+
"search",
76+
"text-field",
77+
"outline"
78+
]
79+
};
13780

138-
[titlebar-toggle]
139-
ToggleButton lyrics_btn {
140-
icon-name: "show-lyrics-symbolic";
141-
tooltip-text: _("Show Lyrics");
142-
}
81+
styles [
82+
"search-bar",
83+
]
14384
}
14485

145-
Stack infostack {
146-
StackPage {
147-
name: "info";
148-
child:
149-
Box info_box {
150-
orientation: vertical;
151-
vexpand: true;
152-
153-
styles [
154-
"side-pane"
155-
]
86+
ScrolledWindow scroll_view {
87+
hscrollbar-policy: never;
88+
vexpand: true;
89+
90+
Stack stack {
91+
margin-start: 18;
92+
margin-end: 18;
93+
margin-bottom: 18;
94+
95+
StackPage {
96+
icon-name: "audio-x-generic-symbolic";
97+
title: "Titles";
98+
name: "title";
99+
child:
100+
ListView list_view3 {
101+
single-click-activate: true;
102+
103+
styles [
104+
"content-list",
105+
"music-list"
106+
]
107+
}
108+
;
156109
}
157-
;
158110
}
111+
}
112+
113+
Box info_box_mobile {
114+
orientation: vertical;
115+
visible: bind album.folded;
116+
}
117+
He.NavigationRail {
118+
stack: stack;
119+
orientation: horizontal;
120+
visible: bind album.folded;
121+
styles [
122+
"music-navrail"
123+
]
124+
}
125+
};
126+
}
127+
128+
Bis.AlbumPage {
129+
child:
130+
Box infogrid {
131+
orientation: vertical;
132+
hexpand-set: true;
133+
134+
He.AppBar info_title {
135+
show-back: bind album.folded;
136+
show-left-title-buttons: bind album.folded;
137+
show-right-title-buttons: true;
138+
139+
[titlebar-toggle]
140+
ToggleButton lyrics_btn {
141+
icon-name: "show-lyrics-symbolic";
142+
tooltip-text: _("Show Lyrics");
143+
}
144+
}
159145

160-
StackPage {
161-
name: "lyrics";
162-
child:
163-
Box lyrics_box {
164-
orientation: vertical;
165-
vexpand: true;
146+
Stack infostack {
147+
StackPage {
148+
name: "info";
149+
child:
150+
Box info_box {
151+
orientation: vertical;
152+
vexpand: true;
153+
154+
styles [
155+
"side-pane"
156+
]
157+
}
158+
;
159+
}
166160

167-
styles [
168-
"side-pane"
169-
]
161+
StackPage {
162+
name: "lyrics";
163+
child:
164+
Box lyrics_box {
165+
orientation: vertical;
166+
vexpand: true;
167+
168+
styles [
169+
"side-pane"
170+
]
171+
}
172+
;
170173
}
171-
;
172-
}
174+
}
173175
}
174-
}
175-
;
176-
}
176+
;
177+
}
178+
};
177179
}
178180
}
179181
}

src/application.vala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace Victrola {
4444
private Settings _settings = new Settings ("com.fyralabs.Victrola");
4545
private MprisPlayer? _mpris = null;
4646
private uint _mpris_id = 0;
47+
private MainWindow window;
4748

4849
public signal void loading_changed (bool loading, uint size);
4950
public signal void index_changed (int index, uint size);
@@ -138,7 +139,7 @@ namespace Victrola {
138139
typeof (PlayBar).ensure ();
139140
typeof (SongEntry).ensure ();
140141

141-
new MainWindow (this);
142+
window = new MainWindow (this);
142143

143144
// Must load tag cache after the app register (GLib init), to make sort works
144145
_song_store.load_tag_cache_async.begin ((obj, res) => {
@@ -382,8 +383,8 @@ namespace Victrola {
382383

383384
public void show_about () {
384385
var about = new He.AboutWindow (
385-
active_window,
386-
"Victrola" + Config.NAME_SUFFIX,
386+
window,
387+
"Victrola",
387388
Config.APP_ID,
388389
Config.VERSION,
389390
Config.APP_ID,
@@ -396,6 +397,7 @@ namespace Victrola {
396397
He.AboutWindow.Licenses.GPLV3,
397398
He.Colors.ORANGE
398399
);
400+
window.about_overlay.add_overlay (about);
399401
about.present ();
400402
}
401403

@@ -460,4 +462,4 @@ namespace Victrola {
460462
}
461463
}
462464
}
463-
}
465+
}

src/window.vala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ namespace Victrola {
5454
private unowned He.AppBar info_title;
5555
[GtkChild]
5656
private unowned Gtk.Box info_box_mobile;
57+
[GtkChild]
58+
public unowned Gtk.Overlay about_overlay;
5759

5860
private string _search_text = "";
5961
private string _search_property = "";

0 commit comments

Comments
 (0)