Skip to content
Snippets Groups Projects
Verified Commit 443535a3 authored by Bruce Cowan's avatar Bruce Cowan :airplane:
Browse files

Use blueprint

parent 9c0134bb
No related branches found
No related tags found
No related merge requests found
# SPDX-FileCopyrightText: 2016 Bruce Cowan <bruce@bcowan.me.uk>
# SPDX-FileCopyrightText: 2016-2022 Bruce Cowan <bruce@bcowan.me.uk>
#
# SPDX-License-Identifier: CC0-1.0
data/countdown.gresource
src/__pycache__
/subprojects/blueprint-compiler
# SPDX-FileCopyrightText: 2018 Bruce Cowan <bruce@bcowan.me.uk>
# SPDX-FileCopyrightText: 2018-2022 Bruce Cowan <bruce@bcowan.me.uk>
#
# SPDX-License-Identifier: CC0-1.0
blueprints = custom_target('blueprints',
input: files(
'ui/countdown.blp',
'ui/countdown-label.blp',
'ui/digital-clock.blp',
'ui/time-popover.blp',
),
output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
gnome = import('gnome')
subdir('ui')
......@@ -11,5 +23,5 @@ gnome.compile_resources('countdown',
source_dir: meson.current_build_dir(),
install: true,
install_dir: pkgdatadir,
dependencies: about_dialogue
dependencies: blueprints
)
// SPDX-FileCopyrightText: 2022 Bruce Cowan <bruce@bcowan.me.uk>
//
// SPDX-License-Identifier: LGPL-3.0-or-later
using Gtk 4.0;
template CountdownLabel : Box {
spacing: 6;
halign: center;
Label _time_label {
styles ["countdown-label"]
label: "0\n0\n\0\n0";
justify: right;
width-chars: 3;
}
Label {
styles ["countdown-label"]
label: "Days\nHours\nMinutes\nSeconds";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2020-2021 Bruce Cowan <bruce@bcowan.me.uk>
SPDX-License-Identifier: LGPL-3.0-or-later
-->
<interface>
<requires lib="gtk" version="4.0"/>
<template class="CountdownLabel" parent="GtkBox">
<property name="spacing">6</property>
<property name="halign">center</property>
<child>
<object class="GtkLabel" id="_time_label">
<property name="label" translatable="yes">0
0
0
0</property>
<property name="justify">right</property>
<property name="width_chars">3</property>
<style>
<class name="countdown-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Days
Hours
Minutes
Seconds</property>
<style>
<class name="countdown-label"/>
</style>
</object>
</child>
</template>
</interface>
// SPDX-FileCopyrightText: 2022 Bruce Cowan <bruce@bcowan.me.uk>
//
// SPDX-License-Identifier: LGPL-3.0-or-later
using Gtk 4.0;
using Adw 1;
template ApplicationWindow : Gtk.ApplicationWindow {
title: "Countdown";
styles ["devel"]
[titlebar]
HeaderBar {
MenuButton _set_time_button {
icon-name: "appointment-new";
}
[end]
MenuButton {
direction: none;
menu-model: app_menu;
}
}
Box _main_box {
orientation: vertical;
}
}
menu app_menu {
section {
item ("About Countdown", "app.about")
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2020-2022 Bruce Cowan <bruce@bcowan.me.uk>
SPDX-License-Identifier: LGPL-3.0-or-later
-->
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0"/>
<menu id="menu">
<section>
<item>
<attribute name="label" translatable="yes">_About Countdown</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
<template class="ApplicationWindow" parent="GtkApplicationWindow">
<property name="title">Countdown</property>
<style>
<class name="devel"/>
</style>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkMenuButton">
<property name="direction">none</property>
<property name="menu_model">menu</property>
</object>
</child>
<child>
<object class="GtkMenuButton" id="_set_time_button">
<property name="icon-name">appointment-new</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="_main_box">
<property name="orientation">vertical</property>
</object>
</child>
</template>
</interface>
// SPDX-FileCopyrightText: 2020-2021 Bruce Cowan <bruce@bcowan.me.uk>
//
// SPDX-License-Identifier: LGPL-3.0-or-later
using Gtk 4.0;
template DigitalClock : Label {
styles ["clock-label"]
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2020-2021 Bruce Cowan <bruce@bcowan.me.uk>
SPDX-License-Identifier: LGPL-3.0-or-later
-->
<interface>
<requires lib="gtk" version="4.0"/>
<template class="DigitalClock" parent="GtkLabel">
<style>
<class name="clock-label"/>
</style>
</template>
</interface>
# SPDX-FileCopyrightText: 2020 Bruce Cowan <bruce@bcowan.me.uk>
# SPDX-FileCopyrightText: 2020-2022 Bruce Cowan <bruce@bcowan.me.uk>
#
# SPDX-License-Identifier: CC0-1.0
about_dialogue = vcs_tag(
......
// SPDX-FileCopyrightText: 2022 Bruce Cowan <bruce@bcowan.me.uk>
//
// SPDX-License-Identifier: LGPL-3.0-or-later
using Gtk 4.0;
template TimePopover : Popover {
Grid {
column-spacing: 3;
row-spacing: 3;
Calendar _calendar {
layout {
column: 0;
row: 0;
column-span: 5;
}
}
SpinButton _hours_spin {
hexpand: true;
orientation: vertical;
adjustment: Adjustment {
upper: 23;
step-increment: 1;
page-increment: 6;
};
output => _on_spin_output();
layout {
column: 0;
row: 1;
}
}
Label {
label: ":";
layout {
column: 1;
row: 1;
}
}
SpinButton _minutes_spin {
hexpand: true;
orientation: vertical;
adjustment: Adjustment {
upper: 59;
step-increment: 1;
page-increment: 10;
};
output => _on_spin_output();
layout {
column: 2;
row: 1;
}
}
Label {
label: ":";
layout {
column: 3;
row: 1;
}
}
SpinButton _seconds_spin {
hexpand: true;
orientation: vertical;
adjustment: Adjustment {
upper: 59;
step-increment: 1;
page-increment: 10;
};
output => _on_spin_output();
layout {
column: 4;
row: 1;
}
}
Button {
label: "Apply";
receives-default: true;
clicked => _on_time_apply_clicked();
styles ["suggested-action"]
layout {
column: 0;
row: 2;
column-span: 5;
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2020-2022 Bruce Cowan <bruce@bcowan.me.uk>
SPDX-License-Identifier: LGPL-3.0-or-later
-->
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">23</property>
<property name="step_increment">1</property>
<property name="page_increment">6</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">59</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">59</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<template class="TimePopover" parent="GtkPopover">
<child>
<object class="GtkGrid">
<property name="column_spacing">3</property>
<property name="row_spacing">3</property>
<child>
<object class="GtkCalendar" id="_calendar">
<layout>
<property name="column">0</property>
<property name="row">0</property>
<property name="column-span">5</property>
</layout>
</object>
</child>
<child>
<object class="GtkSpinButton" id="_hours_spin">
<property name="hexpand">1</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment1</property>
<signal name="output" handler="_on_spin_output" swapped="no"/>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkSpinButton" id="_minutes_spin">
<property name="hexpand">1</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment2</property>
<signal name="output" handler="_on_spin_output" swapped="no"/>
<layout>
<property name="column">2</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkSpinButton" id="_seconds_spin">
<property name="hexpand">1</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment3</property>
<signal name="output" handler="_on_spin_output" swapped="no"/>
<layout>
<property name="column">4</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">:</property>
<layout>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">:</property>
<layout>
<property name="column">3</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Apply</property>
<property name="receives_default">1</property>
<signal name="clicked" handler="_on_time_apply_clicked" swapped="no"/>
<style>
<class name="suggested-action"/>
</style>
<layout>
<property name="column">0</property>
<property name="row">2</property>
<property name="column-span">5</property>
</layout>
</object>
</child>
</object>
</child>
</template>
</interface>
# SPDX-FileCopyrightText: 2018-2021 Bruce Cowan <bruce@bcowan.me.uk>
# SPDX-FileCopyrightText: 2018-2022 Bruce Cowan <bruce@bcowan.me.uk>
#
# SPDX-License-Identifier: CC0-1.0
......
[wrap-git]
directory = blueprint-compiler
url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
revision = v0.2.0
depth = 1
[provide]
program_names = blueprint-compiler
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment