Port UI to blueprints
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
8264406462
commit
87b4f223c7
8 changed files with 105 additions and 82 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
.vscode
|
||||
.cache
|
||||
.test
|
||||
.test
|
||||
/subprojects/blueprint-compiler
|
||||
|
|
|
@ -5,4 +5,4 @@ data/io.gitlab.nekocwd.pipetap.metainfo.xml.in
|
|||
data/io.gitlab.nekocwd.pipetap.gschema.xml
|
||||
src/main.vala
|
||||
src/window.vala
|
||||
src/window.ui
|
||||
src/window.blp
|
||||
|
|
24
src/gtk/help-overlay.blp
Normal file
24
src/gtk/help-overlay.blp
Normal file
|
@ -0,0 +1,24 @@
|
|||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkShortcutsWindow" id="help_overlay">
|
||||
<property name="modal">True</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsSection">
|
||||
<property name="section-name">shortcuts</property>
|
||||
<property name="max-height">10</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup">
|
||||
<property name="title" translatable="yes" context="shortcut window">General</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Show Shortcuts</property>
|
||||
<property name="action-name">win.show-help-overlay</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Quit</property>
|
||||
<property name="action-name">app.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -10,7 +10,28 @@ pipetap_deps = [
|
|||
dependency('libadwaita-1', version: '>= 1.4'),
|
||||
]
|
||||
|
||||
pipetap_sources += gnome.compile_resources('pipetap-resources', 'pipetap.gresource.xml', c_name: 'pipetap')
|
||||
blueprints = custom_target(
|
||||
'blueprints',
|
||||
input: files(
|
||||
'gtk/help-overlay.blp',
|
||||
'window.blp',
|
||||
),
|
||||
output: '.',
|
||||
command: [
|
||||
find_program('blueprint-compiler'),
|
||||
'batch-compile',
|
||||
'@OUTPUT@',
|
||||
'@CURRENT_SOURCE_DIR@',
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
|
||||
pipetap_sources += gnome.compile_resources(
|
||||
'pipetap-resources',
|
||||
'pipetap.gresource.xml',
|
||||
c_name: 'pipetap',
|
||||
dependencies: blueprints,
|
||||
)
|
||||
|
||||
executable(
|
||||
'pipetap',
|
||||
|
|
48
src/window.blp
Normal file
48
src/window.blp
Normal file
|
@ -0,0 +1,48 @@
|
|||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $PipeTapWindow: Adw.ApplicationWindow {
|
||||
title: _("PipeTap");
|
||||
default-width: 800;
|
||||
default-height: 600;
|
||||
|
||||
content: Adw.ToolbarView {
|
||||
[top]
|
||||
Adw.HeaderBar {
|
||||
[end]
|
||||
MenuButton {
|
||||
primary: true;
|
||||
icon-name: "open-menu-symbolic";
|
||||
tooltip-text: _("Main Menu");
|
||||
menu-model: primary_menu;
|
||||
}
|
||||
}
|
||||
|
||||
content: Label label {
|
||||
label: _("Hello, World!");
|
||||
|
||||
styles [
|
||||
"title-1",
|
||||
]
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
menu primary_menu {
|
||||
section {
|
||||
item {
|
||||
label: _("_Preferences");
|
||||
action: "app.preferences";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("_Keyboard Shortcuts");
|
||||
action: "win.show-help-overlay";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("_About PipeTap");
|
||||
action: "app.about";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<requires lib="Adw" version="1.0" />
|
||||
<template class="PipeTapWindow" parent="AdwApplicationWindow">
|
||||
<property name="title" translatable="yes">PipeTap</property>
|
||||
<property name="default-width">800</property>
|
||||
<property name="default-height">600</property>
|
||||
<property name="content">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar">
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="primary">True</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Main Menu</property>
|
||||
<property name="menu-model">primary_menu</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="label" translatable="yes">Hello, World!</property>
|
||||
<style>
|
||||
<class name="title-1" />
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
<menu id="primary_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
||||
<attribute name="action">app.preferences</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
|
||||
<attribute name="action">win.show-help-overlay</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About PipeTap</attribute>
|
||||
<attribute name="action">app.about</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
</interface>
|
8
subprojects/blueprint-compiler.wrap
Normal file
8
subprojects/blueprint-compiler.wrap
Normal file
|
@ -0,0 +1,8 @@
|
|||
[wrap-git]
|
||||
directory = blueprint-compiler
|
||||
url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
|
||||
revision = v0.16.0
|
||||
depth = 1
|
||||
|
||||
[provide]
|
||||
program_names = blueprint-compiler
|
Loading…
Add table
Add a link
Reference in a new issue