Init with GTK Rust Template
This commit is contained in:
20
data/resources/meson.build
Normal file
20
data/resources/meson.build
Normal file
@ -0,0 +1,20 @@
|
||||
# Resources
|
||||
|
||||
blueprints = custom_target('blueprints',
|
||||
input: files(
|
||||
'ui/window.blp',
|
||||
'ui/shortcuts.blp',
|
||||
),
|
||||
output: '.',
|
||||
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
|
||||
)
|
||||
|
||||
resources = gnome.compile_resources(
|
||||
'resources',
|
||||
'resources.gresource.xml',
|
||||
gresource_bundle: true,
|
||||
source_dir: meson.current_build_dir(),
|
||||
install: true,
|
||||
install_dir: pkgdatadir,
|
||||
dependencies: blueprints,
|
||||
)
|
||||
9
data/resources/resources.gresource.xml
Normal file
9
data/resources/resources.gresource.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/com/ranfdev/Notify/">
|
||||
<!-- see https://gtk-rs.org/gtk4-rs/git/docs/gtk4/struct.Application.html#automatic-resources -->
|
||||
<file compressed="true" preprocess="xml-stripblanks" alias="gtk/help-overlay.ui">ui/shortcuts.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">ui/window.ui</file>
|
||||
<file compressed="true">style.css</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
BIN
data/resources/screenshots/screenshot1.png
Normal file
BIN
data/resources/screenshots/screenshot1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
4
data/resources/style.css
Normal file
4
data/resources/style.css
Normal file
@ -0,0 +1,4 @@
|
||||
.title-header{
|
||||
font-size: 36px;
|
||||
font-weight: bold;
|
||||
}
|
||||
25
data/resources/ui/shortcuts.blp
Normal file
25
data/resources/ui/shortcuts.blp
Normal file
@ -0,0 +1,25 @@
|
||||
using Gtk 4.0;
|
||||
|
||||
ShortcutsWindow help_overlay {
|
||||
modal: true;
|
||||
|
||||
ShortcutsSection {
|
||||
section-name: "shortcuts";
|
||||
max-height: 10;
|
||||
|
||||
ShortcutsGroup {
|
||||
title: C_("shortcut window", "General");
|
||||
|
||||
ShortcutsShortcut {
|
||||
title: C_("shortcut window", "Show Shortcuts");
|
||||
action-name: "win.show-help-overlay";
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
title: C_("shortcut window", "Quit");
|
||||
action-name: "app.quit";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
79
data/resources/ui/window.blp
Normal file
79
data/resources/ui/window.blp
Normal file
@ -0,0 +1,79 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
menu primary_menu {
|
||||
section {
|
||||
item {
|
||||
label: _("_Preferences");
|
||||
action: "app.preferences";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("_Keyboard Shortcuts");
|
||||
action: "win.show-help-overlay";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("_About Notify");
|
||||
action: "app.about";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template $ExampleApplicationWindow : Adw.ApplicationWindow {
|
||||
width-request: 240;
|
||||
height-request: 480;
|
||||
Adw.Breakpoint {
|
||||
condition ("max-width: 400sp")
|
||||
setters {
|
||||
split_view.collapsed: true;
|
||||
show_hello_btn.visible: true;
|
||||
}
|
||||
}
|
||||
Adw.NavigationSplitView split_view {
|
||||
sidebar: Adw.NavigationPage {
|
||||
title: "Sidebar";
|
||||
child: Adw.ToolbarView {
|
||||
[top]
|
||||
Adw.HeaderBar {
|
||||
[end]
|
||||
MenuButton appmenu_button {
|
||||
icon-name: "open-menu-symbolic";
|
||||
menu-model: primary_menu;
|
||||
primary: true;
|
||||
tooltip-text: _("Main Menu");
|
||||
}
|
||||
}
|
||||
|
||||
content: Adw.StatusPage {
|
||||
title: "Sidebar";
|
||||
child: Gtk.Button show_hello_btn {
|
||||
label: "Show Hello Page";
|
||||
visible: false;
|
||||
styles [
|
||||
"pill"
|
||||
]
|
||||
action-name: "navigation.push";
|
||||
action-target: "'hello'";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
content: Adw.NavigationPage {
|
||||
title: "Hello Page";
|
||||
tag: "hello";
|
||||
child: Adw.ToolbarView {
|
||||
[top]
|
||||
Adw.HeaderBar headerbar {
|
||||
// this will have a title label inherited from the Adw.NavigationPage
|
||||
}
|
||||
|
||||
content: Adw.StatusPage {
|
||||
title: "Hello World!";
|
||||
description: "Hello to everyone!";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user