Skip to content

Commit 408a19a

Browse files
Manuals: Improve design and use TreeExpander (#457)
1 parent f2e994b commit 408a19a

File tree

5 files changed

+271
-142
lines changed

5 files changed

+271
-142
lines changed

src/DocumentationViewer.blp

Lines changed: 63 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,73 +3,77 @@ using Adw 1;
33
using GObject 2.0;
44
using WebKit 6.0;
55

6-
Window documentation_viewer {
7-
title: _("Documentation");
6+
Adw.Window documentation_viewer {
7+
width-request: 400;
8+
height-request: 400;
89
default-width: 1024;
910
default-height: 768;
1011
hide-on-close: true;
11-
titlebar: Adw.HeaderBar {
12-
Button button_back{
13-
icon-name: "go-previous-symbolic";
14-
tooltip-text: _("Back");
15-
styles ["flat"]
16-
}
17-
Button button_forward {
18-
icon-name: "go-next-symbolic";
19-
tooltip-text: _("Forward");
20-
styles ["flat"]
21-
}
22-
ToggleButton button_sidebar {
23-
active: false;
24-
icon-name: "dock-left-symbolic";
25-
tooltip-text: _("Toggle Sidepanel");
26-
}
27-
ToggleButton button_search {
28-
icon-name: "loupe-large-symbolic";
29-
tooltip-text: _("Search");
30-
}
31-
};
32-
12+
title: _("Manuals");
3313

34-
Paned documentation_paned {
35-
position: 400;
14+
content: Adw.NavigationSplitView split_view {
15+
sidebar: Adw.NavigationPage {
16+
child: Adw.ToolbarView {
17+
[top]
18+
Adw.HeaderBar {
19+
title-widget: Adw.WindowTitle {
20+
title: bind documentation_viewer.title;
21+
};
22+
}
3623

37-
[end]
38-
WebKit.WebView webview {
39-
settings: WebKit.Settings {
40-
enable-back-forward-navigation-gestures: true;
41-
enable-developer-extras: true;
42-
enable-smooth-scrolling: true;
43-
};
44-
}
24+
content: ScrolledWindow {
25+
vexpand: true;
26+
width-request: 400;
4527

46-
[start]
47-
Box sidebar {
48-
visible: bind button_sidebar.active;
49-
orientation: vertical;
50-
vexpand: true;
28+
ListView list_view {
29+
enable-rubberband: true;
30+
factory: BuilderListItemFactory {
5131

32+
template ListItem {
33+
child: TreeExpander expander {
34+
list-row: bind template.item;
35+
child: Inscription {
36+
hexpand: true;
37+
nat-chars: 10;
38+
text-overflow: ellipsize_end;
39+
text: bind expander.item as <$DocumentationPage>.name;
40+
};
41+
};
42+
}
43+
};
44+
styles ["navigation-sidebar"]
45+
}
46+
};
47+
};
48+
};
5249

53-
SearchBar search_bar {
54-
key-capture-widget: sidebar;
55-
SearchEntry search_entry{
56-
hexpand: true;
50+
content: Adw.NavigationPage {
51+
child: Adw.ToolbarView {
52+
[top]
53+
Adw.HeaderBar {
54+
//show-title: false;
55+
[start]
56+
Button button_back {
57+
icon-name: "go-previous-symbolic";
58+
tooltip-text: _("Back");
59+
styles ["flat"]
60+
}
61+
[start]
62+
Button button_forward {
63+
icon-name: "go-next-symbolic";
64+
tooltip-text: _("Forward");
65+
styles ["flat"]
66+
}
5767
}
58-
}
5968

60-
ScrolledWindow {
61-
ListBox listbox {
62-
margin-top: 12;
63-
margin-bottom: 12;
64-
margin-start: 12;
65-
margin-end: 12;
66-
hexpand: true;
67-
vexpand: true;
68-
valign: start;
69-
styles ["boxed-list"]
70-
}
71-
}
72-
styles ["background"]
73-
}
74-
}
69+
content: WebKit.WebView webview {
70+
settings: WebKit.Settings {
71+
enable-back-forward-navigation-gestures: true;
72+
enable-developer-extras: true;
73+
enable-smooth-scrolling: true;
74+
};
75+
};
76+
};
77+
};
78+
};
7579
}

0 commit comments

Comments
 (0)