gui: Port to Blueprint

This was mostly done with `blueprint-compiler port`.

Since Blueprint doesn't know about custom templates, I had to manually change some values from strings to literals.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/567>
This commit is contained in:
Jamie Gravendeel
2025-06-08 14:31:01 +02:00
parent 2aceaa816f
commit a509de8b1e
90 changed files with 3278 additions and 3867 deletions
+78
View File
@@ -0,0 +1,78 @@
using Gtk 4.0;
using Adw 1;
template $GcalImportDialog: Adw.Dialog {
title: _("Import Files…");
height-request: 294;
follows-content-size: true;
Adw.ToastOverlay toast_overlay {
Adw.ToolbarView {
[top]
Adw.HeaderBar headerbar {
show-end-title-buttons: false;
show-start-title-buttons: false;
[start]
Button cancel_button {
label: _("_Cancel");
use-underline: true;
action-name: "sheet.close";
}
[end]
Button import_button {
label: _("_Import");
use-underline: true;
clicked => $on_import_button_clicked_cb(template) not-swapped;
styles [
"suggested-action",
]
}
}
content: ScrolledWindow {
propagate-natural-height: true;
propagate-natural-width: true;
Adw.Clamp {
margin-top: 24;
margin-bottom: 24;
margin-start: 12;
margin-end: 12;
Box calendars_box {
orientation: vertical;
spacing: 18;
Adw.PreferencesGroup {
$GcalCalendarComboRow calendar_combo_row {
title: _("C_alendar");
use-underline: true;
}
}
Adw.PreferencesGroup files_group {
Adw.Spinner placeholder_spinner {
halign: center;
valign: center;
}
}
}
}
};
}
}
ShortcutController {
Shortcut {
trigger: "Escape";
action: "action(sheet.close)";
}
}
}
SizeGroup title_sizegroup {
mode: horizontal;
}
-110
View File
@@ -1,110 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GcalImportDialog" parent="AdwDialog">
<property name="title" translatable="yes">Import Files…</property>
<property name="height-request">294</property>
<property name="follows-content-size">True</property>
<child>
<object class="AdwToastOverlay" id="toast_overlay">
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar" id="headerbar">
<property name="show-end-title-buttons">False</property>
<property name="show-start-title-buttons">False</property>
<!-- Cancel button -->
<child type="start">
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">_Cancel</property>
<property name="use-underline">True</property>
<property name="action-name">sheet.close</property>
</object>
</child>
<!-- Import button -->
<child type="end">
<object class="GtkButton" id="import_button">
<property name="label" translatable="yes">_Import</property>
<property name="use-underline">True</property>
<signal name="clicked" handler="on_import_button_clicked_cb" object="GcalImportDialog" swapped="no" />
<style>
<class name="suggested-action" />
</style>
</object>
</child>
</object>
</child>
<property name="content">
<object class="GtkScrolledWindow">
<property name="propagate-natural-height">True</property>
<property name="propagate-natural-width">True</property>
<child>
<object class="AdwClamp">
<property name="margin-top">24</property>
<property name="margin-bottom">24</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
<object class="GtkBox" id="calendars_box">
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<!-- Calendar -->
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="GcalCalendarComboRow" id="calendar_combo_row">
<property name="title" translatable="yes">C_alendar</property>
<property name="use-underline">True</property>
</object>
</child>
</object>
</child>
<!-- Files overview -->
<child>
<object class="AdwPreferencesGroup" id="files_group">
<child>
<object class="AdwSpinner" id="placeholder_spinner">
<property name="halign">center</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</child>
<!-- Shortcuts -->
<child>
<object class="GtkShortcutController">
<child>
<object class="GtkShortcut">
<property name="trigger">Escape</property>
<property name="action">action(sheet.close)</property>
</object>
</child>
</object>
</child>
</template>
<object class="GtkSizeGroup" id="title_sizegroup">
<property name="mode">horizontal</property>
</object>
</interface>
+12
View File
@@ -0,0 +1,12 @@
using Gtk 4.0;
using Adw 1;
template $GcalImportFileRow: Adw.Bin {
ListBox events_listbox {
selection-mode: none;
styles [
"boxed-list",
]
}
}
-16
View File
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GcalImportFileRow" parent="AdwBin">
<!-- Event preview listbox -->
<child>
<object class="GtkListBox" id="events_listbox">
<property name="selection-mode">none</property>
<style>
<class name="boxed-list" />
</style>
</object>
</child>
</template>
</interface>
+17
View File
@@ -1,9 +1,26 @@
calendar_incs += include_directories('.')
blueprints = custom_target(
'blueprints',
input: files(
'gcal-import-dialog.blp',
'gcal-import-file-row.blp',
),
output: '.',
command: [
find_program('blueprint-compiler'),
'batch-compile',
'@OUTPUT@',
'@CURRENT_SOURCE_DIR@',
'@INPUT@',
],
)
built_sources += gnome.compile_resources(
'importer-resources',
'importer.gresource.xml',
c_name: 'importer',
dependencies: blueprints,
)
sources += files(