1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
|
using Gtk 4.0;
using Adw 1;
menu app-menu {
section {
id: "search-section";
item {
label: _("Paste & Search");
action: "win.paste-search";
}
item {
label: _("Search Selected Text");
action: "win.search-selected";
}
item {
label: _("_Random Word");
action: "win.random-word";
}
}
section {
id: "help-section";
item {
label: _("_Preferences");
action: "win.preferences";
}
item {
label: _("_Keyboard Shortcuts");
action: "win.show-help-overlay";
}
item {
label: _("_About Wordbook");
action: "app.about";
}
}
}
template $WordbookWindow: Adw.ApplicationWindow {
default-width: 800;
default-height: 600;
focus-widget: search_entry;
default-widget: search_button;
icon-name: "accesories-dictionary";
Adw.Breakpoint {
condition ("max-width: 550sp")
setters {
main_split_view.collapsed: true;
}
}
content: Adw.ToastOverlay toast_overlay {
child: Adw.OverlaySplitView main_split_view {
min-sidebar-width: 200;
max-sidebar-width: 200;
sidebar: Adw.ToolbarView {
[top]
Adw.HeaderBar {
[title]
Adw.WindowTitle {
title: _("History");
}
[start]
ToggleButton favorites_filter_button {
icon-name: "non-starred-symbolic";
tooltip-text: _("Show Favorites Only");
action-name: "win.toggle-favorites";
styles [
"flat",
]
}
[end]
Button clear_history_button {
icon-name: "user-trash-symbolic";
tooltip-text: _("Clear History");
sensitive: false;
styles [
"flat",
]
}
}
content: Adw.ViewStack history_stack {
vexpand: true;
Adw.ViewStackPage {
name: "list";
child: ScrolledWindow {
hscrollbar-policy: never;
has-frame: false;
child: Viewport {
child: ListBox history_listbox {
selection-mode: none;
styles [
"navigation-sidebar",
]
};
};
};
}
Adw.ViewStackPage {
name: "empty";
child: Adw.StatusPage {
icon-name: "document-open-recent-symbolic";
title: _("No recent searches or favorites");
styles [
"compact",
]
};
}
};
};
content: Adw.ToolbarView {
[top]
Adw.HeaderBar header_bar {
centering-policy: strict;
[title]
Adw.Clamp title_clamp {
tightening-threshold: 300;
Box {
hexpand: true;
spacing: 4;
Entry search_entry {
hexpand: true;
primary-icon-name: "edit-find-symbolic";
primary-icon-activatable: false;
primary-icon-sensitive: false;
activates-default: true;
secondary-icon-tooltip-text: _("Clear");
}
Button search_button {
icon-name: "edit-find-symbolic";
tooltip-text: _("Search");
styles [
"suggested-action",
]
}
}
}
ToggleButton split_view_toggle_button {
icon-name: "sidebar-show-symbolic";
tooltip-text: _("Show History");
}
[end]
MenuButton wordbook_menu_button {
menu-model: app-menu;
receives-default: true;
direction: none;
tooltip-text: _("Main Menu");
}
}
content: ScrolledWindow main_scroll {
hexpand: true;
vexpand: true;
hscrollbar-policy: never;
child: Adw.Clamp main_clamp {
tightening-threshold: 500;
Adw.ViewStack main_stack {
Adw.ViewStackPage {
name: "download_page";
child: Adw.StatusPage download_status_page {
title: _("Setting things up…");
description: _("Downloading WordNet…");
child: Adw.Clamp {
tightening-threshold: 200;
ProgressBar loading_progress {
ellipsize: end;
}
};
};
}
Adw.ViewStackPage {
name: "welcome_page";
child: Adw.StatusPage before_search_page {
icon-name: "dev.mufeed.Wordbook-symbolic";
title: _("Wordbook");
description: _("Look up definitions of any English term");
};
}
Adw.ViewStackPage {
name: "content_page";
child: Box {
orientation: vertical;
Box {
hexpand: false;
Box {
margin-start: 18;
margin-end: 18;
margin-top: 12;
margin-bottom: 16;
orientation: vertical;
hexpand: false;
Label term_view {
label: "Term";
use-markup: true;
selectable: true;
single-line-mode: true;
ellipsize: end;
xalign: 0;
hexpand: false;
styles [
"term-view",
]
}
Label pronunciation_view {
label: "/Pronunciation/";
use-markup: true;
selectable: true;
ellipsize: end;
single-line-mode: true;
xalign: 0;
hexpand: false;
styles [
"pronunciation-view",
]
}
}
Button speak_button {
margin-start: 4;
margin-end: 12;
margin-top: 12;
margin-bottom: 12;
receives-default: true;
halign: center;
valign: center;
icon-name: "audio-volume-high-symbolic";
has-frame: false;
hexpand: false;
tooltip-text: _("Listen to Pronunciation");
styles [
"circular",
]
}
}
ListBox definitions_listbox {
margin-start: 12;
margin-end: 12;
margin-bottom: 12;
selection-mode: none;
show-separators: false;
vexpand: true;
styles [
"boxed-list-separate",
]
}
};
}
Adw.ViewStackPage {
name: "search_fail_page";
child: Adw.StatusPage search_fail_status_page {
vexpand: true;
icon-name: "edit-find-symbolic";
title: _("No definition found");
child: Label search_fail_description_label {
use-markup: true;
wrap: true;
selectable: true;
};
};
}
Adw.ViewStackPage {
name: "network_fail_page";
child: Adw.StatusPage network_fail_status_page {
icon-name: "network-error-symbolic";
title: _("Download failed");
child: Box {
spacing: 12;
halign: center;
Button retry_button {
label: _("Retry");
styles [
"pill",
"suggested-action",
]
}
Button exit_button {
label: _("Exit");
styles [
"pill",
]
}
};
};
}
Adw.ViewStackPage {
name: "spinner_page";
child: Adw.Spinner {};
}
}
};
};
};
};
};
EventControllerKey key_ctrlr {}
}
|