1
0
mirror of https://gitlab.cvh-server.de/skrause/flashcards.git synced 2025-12-12 06:41:38 +01:00

replace deprecated classes, update code, fix errors, add missing stuff

This commit is contained in:
2025-02-05 20:52:07 +01:00
parent 81e353b449
commit b4d8f9d096
31 changed files with 767 additions and 183 deletions

View File

@@ -2,5 +2,6 @@
<gresources>
<gresource prefix="/li/sopht/flashcards">
<file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">create-category.ui</file>
</gresource>
</gresources>

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g color="#000" fill="#2e3436"><path d="M7.188 2.281c-.094.056-.192.125-.29.19L5.566 3.803a1.684 1.684 0 11-2.17 2.17L2.332 7.037c.506-.069 1.017-.136 1.2.026.242.214.139 1.031.155 1.656.213.088.427.171.657.219.04.008.085-.007.125 0 .337-.525.683-1.288 1-1.344.322-.057.905.562 1.406.937a3.67 3.67 0 00.656-.468c-.195-.595-.594-1.369-.437-1.657.158-.29 1.019-.37 1.625-.531.028-.183.062-.371.062-.562 0-.075-.027-.146-.031-.22-.587-.217-1.435-.385-1.562-.687-.128-.302.34-1.021.593-1.593a3.722 3.722 0 00-.593-.532zm3.875 3.25c-.165.475-.305 1.086-.47 1.563-.43.047-.84.14-1.218.312-.38-.322-.787-.773-1.156-1.093a5.562 5.562 0 00-.688.468c.177.46.453 1.001.625 1.469-.298.309-.531.67-.719 1.063-.494 0-1.102-.084-1.593-.094a5.68 5.68 0 00-.219.812c.435.24 1.006.468 1.438.72-.006.093-.032.185-.032.28 0 .333.049.66.125.97-.382.304-.898.63-1.28.937.015.044.04.083.058.127l.613.613c.417-.1.868-.223 1.266-.303.248.343.532.626.875.875-.027.135-.068.283-.104.428.174-.063.34-.155.482-.297l1.432-1.432a1.994 1.994 0 01.533-3.918c.919 0 1.684.623 1.918 1.467l1.338-1.338c.06-.06.11-.124.156-.191-.035-.062-.06-.13-.1-.188.096-.152.205-.31.315-.47.017-.348-.1-.7-.37-.971l-.177-.176c-.28.192-.561.387-.83.555-.345-.233-.746-.383-1.156-.5-.077-.507-.107-1.132-.187-1.625a5.44 5.44 0 00-.875-.063zm-9.247.608c-.087.068-.173.138-.254.205l.014.035z" style="marker:none" overflow="visible"/><path d="M8.707.293a1 1 0 00-1.415 0l-6.999 7a1 1 0 000 1.413l7 7.001a1 1 0 001.415 0l7-7a1 1 0 000-1.413zm-.708 2.121l5.587 5.587L8 13.586 2.414 7.999z" style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;marker:none" font-weight="400" font-family="sans-serif" overflow="visible"/></g></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,13 @@
application_id = 'li.sopht.Flashcards'
scalable_dir = 'hicolor' / 'scalable' / 'apps'
install_data(
scalable_dir / ('@0@.svg').format(application_id),
install_dir: get_option('datadir') / 'icons' / scalable_dir
)
symbolic_dir = 'hicolor' / 'symbolic' / 'apps'
install_data(
symbolic_dir / ('@0@-symbolic.svg').format(application_id),
install_dir: get_option('datadir') / 'icons' / symbolic_dir
)

View File

@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Flashcards
Exec=flashcards
Icon=li.sopht.Flashcards
Terminal=false
Type=Application
Categories=Utility;
Keywords=GTK;
StartupNotify=true

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="flashcards">
<schema id="li.sopht.Flashcards" path="/li/sopht/Flashcards/">
</schema>
</schemalist>

View File

@@ -1,10 +1,4 @@
blueprints = custom_target('blueprints',
input: files(
'window.blp'
),
output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
subdir('ui')
resources = gnome.compile_resources('resources',
'flashcards.gresource.xml',
@@ -12,4 +6,27 @@ resources = gnome.compile_resources('resources',
c_name: 'flashcards'
)
schemas = gnome.compile_schemas()
compile_schemas = find_program('glib-compile-schemas', required: false, disabler: true)
test('Validate schema file',
compile_schemas,
args: ['--strict', '--dry-run', meson.current_source_dir()])
install_data('li.sopht.Flashcards.gschema.xml',
install_dir: get_option('datadir') / 'glib-2.0/schemas',
)
desktop_file = i18n.merge_file(
input: 'li.sopht.Flashcards.desktop.in',
output: 'li.sopht.Flashcards.desktop',
type: 'desktop',
po_dir: '../po',
install: true,
install_dir: get_option('datadir') / 'applications'
)
desktop_utils = find_program('desktop-file-validate', required: false)
if desktop_utils.found()
test('Validate desktop file', desktop_utils, args: [desktop_file])
endif
subdir('icons')

View File

@@ -0,0 +1,20 @@
using Gtk 4.0;
using Adw 1;
template $FlashcardsCreateCategoryDialog : Adw.AlertDialog {
heading: "Create a new category";
default-response: "add";
close-response: "cancel";
responses [
cancel: _("Cancel"),
add: _("Add") suggested,
]
response => $on_response();
Adw.EntryRow entry {
title: "Category name";
styles [
"card",
]
}
}

8
resources/ui/meson.build Normal file
View File

@@ -0,0 +1,8 @@
blueprints = custom_target('blueprints',
input: files(
'window.blp',
'create-category.blp'
),
output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)

100
resources/ui/window.blp Normal file
View File

@@ -0,0 +1,100 @@
using Gtk 4.0;
using Adw 1;
template $FlashcardsAppWindow : Adw.ApplicationWindow {
title: _("Flashcards");
Adw.Breakpoint {
condition ( "max-width: 400sp" )
setters {
split_view.collapsed: true;
}
}
Adw.NavigationSplitView split_view {
[sidebar]
Adw.NavigationPage sidebar{
title: _("Categories");
Box {
orientation: vertical;
hexpand: true;
width-request: 360;
Adw.HeaderBar {
[end]
Gtk.Button {
icon-name: "list-add-symbolic";
clicked => $on_add_category();
}
}
Adw.Clamp {
hexpand: true;
ListBox topics {
hexpand: true;
selection-mode: single;
margin-top: 12;
margin-bottom: 12;
margin-start: 12;
margin-end: 12;
row-selected => $on_category_selected();
styles [
"boxed-list",
]
}
}
}
}
[content]
Adw.NavigationPage content {
title: _("Flashcards");
Box {
orientation: vertical;
hexpand: true;
Adw.HeaderBar {
[end]
Gtk.MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
}
}
Adw.Clamp {
hexpand: true;
child: Adw.Bin {
margin-top: 12;
margin-bottom: 12;
margin-start: 12;
margin-end: 12;
styles [
"card",
]
child: Label {
margin-top: 24;
margin-bottom: 24;
margin-start: 24;
margin-end: 24;
wrap: true;
label: "Wie viel Grad hat ein Kreis?";
};
};
}
}
}
}
}
menu primary_menu {
section {
item {
label: _("About Flashcards");
action: "app.about";
}
}
}

View File

@@ -1,102 +0,0 @@
using Gtk 4.0;
using Adw 1;
template FlashcardsAppWindow : Adw.ApplicationWindow {
title: _("Flashcards");
Adw.Leaflet leaflet {
can-navigate-back: true;
Box {
orientation: vertical;
hexpand: true;
width-request: 360;
Adw.HeaderBar {
show-end-title-buttons: bind leaflet.folded;
[title]
Adw.WindowTitle {
title: _("Topics");
}
}
Adw.Clamp {
hexpand: true;
child: ListBox topics {
hexpand: true;
selection-mode: single;
margin-top: 12;
margin-bottom: 12;
margin-start: 12;
margin-end: 12;
row-selected => on_category_selected();
styles [
"boxed-list",
]
};
}
}
Adw.LeafletPage {
navigatable: false;
child: Separator {};
}
Box {
orientation: vertical;
hexpand: true;
Adw.HeaderBar {
show-start-title-buttons: bind leaflet.folded;
Button leaflet_previous {
visible: bind leaflet.folded;
icon-name: "go-previous-symbolic";
clicked => on_navigate_back();
}
[end]
Gtk.MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
}
}
Adw.Clamp {
hexpand: true;
child: Adw.Bin {
margin-top: 12;
margin-bottom: 12;
margin-start: 12;
margin-end: 12;
styles [
"card",
]
child: Label {
margin-top: 24;
margin-bottom: 24;
margin-start: 24;
margin-end: 24;
wrap: true;
label: "Wie viel Grad hat ein Kreis?";
};
};
}
}
}
}
menu primary_menu {
section {
item {
label: _("Upgrade Assistant");
action: "win.show-upgrade-assistant";
}
item {
label: _("About Flashcards");
action: "app.about";
}
}
}