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

Compare commits

...

11 Commits

Author SHA1 Message Date
fca51b78a1 latest changes 2025-10-28 12:37:03 +01:00
b5830c9d13 latest changes 2025-08-08 23:01:28 +02:00
cd3ea61503 add bibliography 2025-07-03 14:53:18 +02:00
5529da02db add tooltips 2025-07-03 14:49:51 +02:00
a4ab9486a1 add dummy description 2025-07-03 14:34:38 +02:00
6cf180e4f0 update translations 2025-07-03 14:33:26 +02:00
34d68d3e51 add dummy description 2025-07-03 14:32:54 +02:00
d916767369 add empty description 2025-07-03 14:31:42 +02:00
803185de87 add missing icons, cleanup translations, fix last little issues, prepare for documentation 2025-07-03 14:22:04 +02:00
a444bdd2fb push local changes 2025-06-13 20:52:25 +02:00
ed81f378a5 push local changes 2025-06-13 20:51:53 +02:00
24 changed files with 223 additions and 154 deletions

View File

@@ -8,7 +8,7 @@ docs:
- ./Flashcards.pdf
flatpak:
image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-48
image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-49
stage: build
variables:
APP_ID: "li.sopht.Flashcards"

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

6
docs/bibliography.yml Normal file
View File

@@ -0,0 +1,6 @@
electronic:
type: Web
title: Ishkur's Guide to Electronic Music
serial-number: v2.5
author: Ishkur
url: { value: http://www.techno.org/electronic-music-guide/, date: 2020-11-30 }

View File

@@ -4,64 +4,59 @@
title: "Karteikarten-Anwendung in C mit GTK4 und Libadwaita",
subtitle: "Hardwarenahe Programmierung",
authors: (
"Sophie Krause",
(
name: "Sophie Krause",
id: "18103387"
),
),
profs: (
"Prof. Dr. Gerwinski",
"Prof. Dr. rer. nat. Peter Gerwinski",
),
logo: "BO_Logo.svg"
submitted_at: none,
logo: "BO.svg"
)
= Einleitung
#lorem(100)
Das Projekt behandelt die Entwicklung einer typischen Anwendung für die GNOME-Desktop-Umgebung unter Linux.
Dementsprechend wird die Anwendung mit GTK4 und Libadwaita entwickelt, um ein natives Erlebnis zu erzielen.
Da GTK in C geschrieben ist, wird ebenfalls in dieser Sprache programmiert.
Als Thema der Anwendung wurde eine Karteikarten-App gewählt, da diese gut für die Entwicklung einer Desktop-Anwendung geeignet ist und ebenfalls eine Datenbank benötigt.
#pagebreak()
= Konzept & Tools
#lorem(100)
== SQLite
#lorem(100)
== GTK4
#lorem(100)
== Libadwaita
#lorem(100)
== Blueprint
#lorem(100)
#pagebreak()
= Implementierung
#lorem(100)
== Datenbank
#lorem(100)
== UI
#lorem(100)
=== Layout
== Logik
#lorem(100)
#pagebreak()
= Buildsystem
#lorem(100)
#pagebreak()
= Flatpak
#lorem(100)
#pagebreak()
= CI / CD
#lorem(100)
== Flatpak
#lorem(100)
== Dokumentation
#lorem(100)
#pagebreak()
= Fazit & Ausblick
#lorem(100)

View File

@@ -1,8 +1,8 @@
#import "@preview/hydra:0.6.0": hydra
#import "@preview/hydra:0.6.1": hydra
#let project(title: "", subtitle: "", authors: (), profs: (), logo: none, body) = {
#let project(title: "", subtitle: "", authors: ((name: "", id: ""),), profs: ("",), submitted_at: none, logo: none, body) = {
// Basic properties
set document(author: authors, title: title)
set document(author: "a", title: title)
set text(lang: "de")
set heading(numbering: "1.1")
@@ -27,17 +27,37 @@
set align(left)
// Author
let authors_title
if authors.len() == 1 {
authors_title = "Autor*in"
} else {
authors_title = "Autor*innen"
}
text(weight: 700, authors_title + " (Matrikelnummer):")
grid(
gutter: 1em,
..authors,
..authors.map(author => author.name + " (" + author.id + ")").flatten()
)
// Profs
let profs_title
if profs.len() == 1 {
profs_title = "Prüfer*in"
} else {
profs_title = "Prüfer*innen"
}
text(weight: 700, profs_title + ":")
grid(
gutter: 1em,
..profs,
)
// Abgabedatum
if submitted_at != none {
text(weight: 700, "Abgabedatum: ")
text(submitted_at.display("[day].[month].[year]"))
}
// Table of contents
set align(left)
set page(numbering: "I", number-align: center)
@@ -58,4 +78,7 @@
counter(page).update(1)
set par(justify: true)
body
pagebreak()
bibliography("bibliography.yml")
}

View File

@@ -1,7 +1,7 @@
{
"id": "li.sopht.Flashcards",
"runtime": "org.gnome.Platform",
"runtime-version": "48",
"runtime-version": "49",
"sdk": "org.gnome.Sdk",
"command": "flashcards",
"separate-locales": false,
@@ -33,7 +33,7 @@
{
"type": "git",
"url": "https://gitlab.gnome.org/jwestman/blueprint-compiler",
"tag": "v0.16.0"
"tag": "v0.18.0"
}
]
},

View File

@@ -1,12 +1,13 @@
project('flashcards', 'c',
version: '1.0.0',
meson_version: '>= 1.0.0',
default_options: ['warning_level=2', 'c_std=gnu23'],
project(
'flashcards', 'c',
version : '1.0.0',
meson_version : '>= 1.0.0',
default_options : ['warning_level=2', 'c_std=gnu23'],
)
flashcards_deps = [
dependency('gtk4'),
dependency('libadwaita-1', version: '>= 1.6'),
dependency('libadwaita-1', version : '>= 1.7'),
dependency('sqlite3'),
]
@@ -21,20 +22,21 @@ cc = meson.get_compiler('c')
config_h = configuration_data()
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('GETTEXT_PACKAGE', 'flashcards')
config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
configure_file(output: 'config.h', configuration: config_h)
add_project_arguments(['-I' + meson.project_build_root()], language: 'c')
configure_file(output : 'config.h', configuration : config_h)
add_project_arguments(['-I' + meson.project_build_root()], language : 'c')
executable('flashcards',
executable(
meson.project_name(),
sourcefiles,
resources,
dependencies: flashcards_deps,
install: true
dependencies : flashcards_deps,
install : true
)
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true,
glib_compile_schemas : true,
gtk_update_icon_cache : true,
update_desktop_database : true,
)

View File

@@ -1,18 +1,21 @@
# Copyright (C) 2025 Sophie Krause
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-04 09:50+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"POT-Creation-Date: 2025-07-03 14:48+0200\n"
"PO-Revision-Date: 2025-10-06 14:36+0200\n"
"Last-Translator: Sophie Krause\n"
"Language-Team: de\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: resources/ui/window.blp:5 resources/ui/window.blp:60
#: resources/ui/window.blp:81 resources/li.sopht.Flashcards.desktop.in:3
#: resources/ui/window.blp:81 resources/li.sopht.Flashcards.desktop.in:2
#: resources/li.sopht.Flashcards.metainfo.xml.in:7
msgid "Flashcards"
msgstr "Karteikarten"
@@ -49,19 +52,35 @@ msgstr "Wähle eine Kategorie"
msgid "Add a flashcard"
msgstr "Füge eine Karteikarte hinzu"
#: resources/ui/window.blp:136
#: resources/ui/window.blp:116
msgid "Show answer"
msgstr "Antwort zeigen"
#: resources/ui/window.blp:137
msgid "Hard"
msgstr "Schwer"
#: resources/ui/window.blp:142
#: resources/ui/window.blp:140
msgid "Reappears in 6 hours"
msgstr "Erscheint erneut in 6 Stunden"
#: resources/ui/window.blp:144
msgid "Medium"
msgstr "Mittel"
#: resources/ui/window.blp:148
#: resources/ui/window.blp:147
msgid "Reappears in 12 hours"
msgstr "Erscheint erneut in 12 Stunden"
#: resources/ui/window.blp:151
msgid "Easy"
msgstr "Einfach"
#: resources/ui/window.blp:166
#: resources/ui/window.blp:154
msgid "Reappears in 24 hours"
msgstr "Erscheint erneut in 24 Stunden"
#: resources/ui/window.blp:170
msgid "About Flashcards"
msgstr "Über Karteikarten"
@@ -89,18 +108,7 @@ msgstr "Neue Karteikarte erstellen"
msgid "Answer"
msgstr "Antwort"
#: resources/li.sopht.Flashcards.desktop.in:9
msgid "GTK;"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:8
#: resources/li.sopht.Flashcards.metainfo.xml.in:10
msgid "Learn categories with flashcards!"
msgstr "Lerne Kategorien mit Karteikarten!"
#: resources/li.sopht.Flashcards.metainfo.xml.in:10
msgid "No description"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:44
msgid "A caption"
msgstr ""

View File

@@ -1,15 +1,12 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the flashcards package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# Copyright (C) 2025 Sophie Krause
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-04 09:50+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"POT-Creation-Date: 2025-07-03 14:48+0200\n"
"PO-Revision-Date: 2025-10-06 14:36+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
@@ -18,7 +15,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
#: resources/ui/window.blp:5 resources/ui/window.blp:60
#: resources/ui/window.blp:81 resources/li.sopht.Flashcards.desktop.in:3
#: resources/ui/window.blp:81 resources/li.sopht.Flashcards.desktop.in:2
#: resources/li.sopht.Flashcards.metainfo.xml.in:7
msgid "Flashcards"
msgstr ""
@@ -55,19 +52,35 @@ msgstr ""
msgid "Add a flashcard"
msgstr ""
#: resources/ui/window.blp:136
#: resources/ui/window.blp:116
msgid "Show answer"
msgstr ""
#: resources/ui/window.blp:137
msgid "Hard"
msgstr ""
#: resources/ui/window.blp:142
#: resources/ui/window.blp:140
msgid "Reappears in 6 hours"
msgstr ""
#: resources/ui/window.blp:144
msgid "Medium"
msgstr ""
#: resources/ui/window.blp:148
#: resources/ui/window.blp:147
msgid "Reappears in 12 hours"
msgstr ""
#: resources/ui/window.blp:151
msgid "Easy"
msgstr ""
#: resources/ui/window.blp:166
#: resources/ui/window.blp:154
msgid "Reappears in 24 hours"
msgstr ""
#: resources/ui/window.blp:170
msgid "About Flashcards"
msgstr ""
@@ -95,18 +108,7 @@ msgstr ""
msgid "Answer"
msgstr ""
#: resources/li.sopht.Flashcards.desktop.in:9
msgid "GTK;"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:8
#: resources/li.sopht.Flashcards.metainfo.xml.in:10
msgid "Learn categories with flashcards!"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:10
msgid "No description"
msgstr ""
#: resources/li.sopht.Flashcards.metainfo.xml.in:44
msgid "A caption"
msgstr ""

View File

@@ -1 +1 @@
i18n.gettext(meson.project_name(), preset: 'glib')
i18n.gettext(meson.project_name(), preset : 'glib')

View File

@@ -6,4 +6,9 @@
<file preprocess="xml-stripblanks">create-card.ui</file>
<file alias="appdata" compressed="true" preprocess="xml-stripblanks">li.sopht.Flashcards.metainfo.xml</file>
</gresource>
<gresource prefix="/li/sopht/flashcards/icons/scalable/actions/">
<file preprocess="xml-stripblanks">icons/hicolor/scalable/actions/add-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/hicolor/scalable/actions/delete-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/hicolor/scalable/actions/category-symbolic.svg</file>
</gresource>
</gresources>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 7 1 v 6 h -6 v 2 h 6 v 6 h 2 v -6 h 6 v -2 h -6 v -6 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 222 B

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222"><path d="m 6 4.5 c 0 0.828125 -0.671875 1.5 -1.5 1.5 s -1.5 -0.671875 -1.5 -1.5 s 0.671875 -1.5 1.5 -1.5 s 1.5 0.671875 1.5 1.5 z m 0 0"/><path d="m 0 7.089844 c 0 0.847656 0.335938 1.660156 0.9375 2.261718 l 5.382812 5.382813 c 0.925782 0.925781 2.433594 0.925781 3.359376 0 l 4.964843 -4.964844 c 0.976563 -0.976562 0.976563 -2.5625 0 -3.539062 l -5.417969 -5.417969 c -0.519531 -0.519531 -1.226562 -0.8125 -1.960937 -0.8125 h -3.265625 c -2.207031 0 -4 1.792969 -4 4 z m 4 -5.089844 h 3.265625 c 0.207031 0 0.402344 0.082031 0.546875 0.226562 l 5.417969 5.417969 c 0.203125 0.207031 0.203125 0.503907 0 0.710938 l -4.964844 4.964843 c -0.15625 0.15625 -0.375 0.15625 -0.53125 0 l -5.382813 -5.382812 c -0.226562 -0.226562 -0.351562 -0.53125 -0.351562 -0.847656 v -3.089844 c 0 -1.117188 0.882812 -2 2 -2 z m 0 0"/></g></svg>

After

Width:  |  Height:  |  Size: 972 B

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<g fill="#2e3436">
<path d="m 1 3 h 14 c 0.550781 0 1 0.449219 1 1 s -0.449219 1 -1 1 h -14 c -0.550781 0 -1 -0.449219 -1 -1 s 0.449219 -1 1 -1 z m 0 0"/>
<path d="m 4 4 v -1.5 c 0 -1.386719 1.113281 -2.5 2.5 -2.5 h 2.980469 c 1.382812 0 2.5 1.113281 2.5 2.5 v 1.5 h -2 v -1.5 c 0 -0.269531 -0.230469 -0.5 -0.5 -0.5 h -2.980469 c -0.269531 0 -0.5 0.230469 -0.5 0.5 v 1.5 z m 0 0"/>
<path d="m 4 4 v 9 c 0 0.546875 0.453125 1 1 1 h 6 c 0.546875 0 1 -0.453125 1 -1 v -9 h 2 v 9 c 0 1.660156 -1.339844 3 -3 3 h -6 c -1.660156 0 -3 -1.339844 -3 -3 v -9 z m 0 0"/>
<path d="m 7 7 v 5 c 0 0.277344 -0.222656 0.5 -0.5 0.5 s -0.5 -0.222656 -0.5 -0.5 v -5 c 0 -0.277344 0.222656 -0.5 0.5 -0.5 s 0.5 0.222656 0.5 0.5 z m 0 0"/>
<path d="m 10 7 v 5 c 0 0.277344 -0.222656 0.5 -0.5 0.5 s -0.5 -0.222656 -0.5 -0.5 v -5 c 0 -0.277344 0.222656 -0.5 0.5 -0.5 s 0.5 0.222656 0.5 0.5 z m 0 0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -3,11 +3,22 @@ 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
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
install_dir : get_option('datadir') / 'icons' / symbolic_dir
)
action_dir = 'hicolor' / 'scalable' / 'actions'
action_icons = [
action_dir / 'add-symbolic.svg',
action_dir / 'delete-symbolic.svg',
action_dir / 'category-symbolic.svg',
]
install_data(
action_icons,
install_dir : get_option('datadir') / 'icons' / action_dir
)

View File

@@ -4,6 +4,5 @@ Exec=flashcards
Icon=li.sopht.Flashcards
Terminal=false
Type=Application
Categories=Utility;
Keywords=GTK;
Categories=Utility
StartupNotify=true

View File

@@ -7,9 +7,10 @@
<name>Flashcards</name>
<summary>Learn categories with flashcards!</summary>
<description>
<p>No description</p>
<p>Learn categories with flashcards!</p>
</description>
<developer id="li.sopht">
<name translate="no">Sophie Krause</name>
</developer>
@@ -38,13 +39,6 @@
<color type="primary" scheme_preference="dark">#993d3d</color>
</branding>
<screenshots>
<screenshot type="default">
<image>https://example.org/example1.png</image>
<caption>A caption</caption>
</screenshot>
</screenshots>
<releases>
<release version="1.0.0" date="2025-02-18">
</release>

View File

@@ -1,53 +1,59 @@
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()])
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'
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'
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])
test('Validate desktop file', desktop_utils, args : [desktop_file])
endif
appstream_file = i18n.merge_file(
input : 'li.sopht.Flashcards.metainfo.xml.in',
output : 'li.sopht.Flashcards.metainfo.xml',
po_dir : '../po',
install : true,
install_dir : get_option('datadir') / 'metainfo'
input : 'li.sopht.Flashcards.metainfo.xml.in',
output : 'li.sopht.Flashcards.metainfo.xml',
po_dir : '../po',
install : true,
install_dir : get_option('datadir') / 'metainfo'
)
appstreamcli = find_program('appstreamcli', required : false, disabler : true)
test('Validate appstream file', appstreamcli,
args : ['validate', '--no-net', '--explain', appstream_file])
test(
'Validate appstream file', appstreamcli,
args : ['validate', '--no-net', '--explain', appstream_file]
)
service_conf = configuration_data()
service_conf.set('bindir', get_option('prefix') / get_option('bindir'))
configure_file(
input : 'li.sopht.Flashcards.service.in',
output : 'li.sopht.Flashcards.service',
configuration : service_conf,
install_dir : get_option('datadir') / 'dbus-1' / 'services'
input : 'li.sopht.Flashcards.service.in',
output : 'li.sopht.Flashcards.service',
configuration : service_conf,
install_dir : get_option('datadir') / 'dbus-1' / 'services'
)
subdir('ui')
resources = gnome.compile_resources('resources',
'flashcards.gresource.xml',
dependencies : [blueprints, appstream_file],
c_name : 'flashcards'
resources = gnome.compile_resources(
'resources',
'flashcards.gresource.xml',
dependencies : [blueprints, appstream_file],
c_name : 'flashcards'
)
subdir('icons')

View File

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

View File

@@ -24,7 +24,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
Adw.HeaderBar {
[start]
Gtk.Button {
icon-name: "list-add-symbolic";
icon-name: "add-symbolic";
clicked => $on_add_category();
tooltip-text: _("Create category");
}
@@ -64,14 +64,14 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
Adw.HeaderBar {
[start]
Gtk.Button add_card_button {
icon-name: "list-add-symbolic";
icon-name: "add-symbolic";
clicked => $on_add_card();
tooltip-text: _("Add flashcard");
visible: false;
}
[start]
Gtk.Button delete_card_button {
icon-name: "user-trash-symbolic";
icon-name: "delete-symbolic";
clicked => $on_delete_card();
tooltip-text: _("Delete flashcard");
visible: false;
@@ -86,14 +86,14 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
Adw.ViewStackPage {
child: Adw.StatusPage placeholder_category {
title: _("Select a category");
icon-name: "edit-find-symbolic";
icon-name: "category-symbolic";
};
}
Adw.ViewStackPage {
child: Adw.StatusPage placeholder_card {
title: _("Add a flashcard");
icon-name: "list-add-symbolic";
icon-name: "add-symbolic";
};
}
@@ -113,6 +113,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
styles ["card", "activatable"]
halign: center;
clicked => $on_flip_card();
tooltip-text: _("Show answer");
Label card_title {
styles ["title-4"]
margin-top: 24;
@@ -121,7 +122,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
margin-end: 48;
hexpand: true;
justify: center;
label: "Wie viele Bäume sind in einem Wald?";
label: "";
wrap: true;
wrap-mode: word_char;
}
@@ -136,18 +137,21 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
label: _("Hard");
hexpand: true;
clicked => $on_answer_hard();
tooltip-text: _("Reappears in 6 hours");
}
Button {
styles ["pill"]
label: _("Medium");
hexpand: true;
clicked => $on_answer_medium();
tooltip-text: _("Reappears in 12 hours");
}
Button {
styles ["pill"]
label: _("Easy");
hexpand: true;
clicked => $on_answer_easy();
tooltip-text: _("Reappears in 24 hours");
}
}
}

View File

@@ -5,8 +5,8 @@
#include <adwaita.h>
#include <gtk/gtk.h>
#define FLASHCARDS_CREATE_CARD_DIALOG_TYPE \
(flashcards_create_card_dialog_get_type ())
#define FLASHCARDS_CREATE_CARD_DIALOG_TYPE \
(flashcards_create_card_dialog_get_type ())
G_DECLARE_FINAL_TYPE (FlashcardsCreateCardDialog,
flashcards_create_card_dialog, FLASHCARDS,
CREATE_CARD_DIALOG, AdwAlertDialog)

View File

@@ -69,7 +69,6 @@ database_save_category (sqlite3 *db, const char *c)
{
sqlite3_stmt *stmt;
fprintf (stdout, "%s\n", c);
int rc = sqlite3_prepare_v2 (db, "INSERT INTO categories (name) VALUES(?)",
-1, &stmt, nullptr);
if (rc == SQLITE_OK)

View File

@@ -52,7 +52,6 @@ load_categories (FlashcardsAppWindow *win)
for (guint i = 0; i < win->categories->len; i++)
{
category c = g_array_index (win->categories, category, i);
printf ("%d: %s\n", c.id, c.name);
GtkWidget *child = gtk_list_box_row_new ();
GtkWidget *label = gtk_label_new (c.name);
@@ -71,10 +70,12 @@ next_card (FlashcardsAppWindow *win)
if (win->cards->length <= 0)
{
adw_view_stack_set_visible_child (win->main_view, win->placeholder_card);
gtk_widget_set_visible (GTK_WIDGET (win->delete_card_button), FALSE);
return;
}
win->current_card = g_queue_pop_head (win->cards);
gtk_label_set_label (win->card_title, win->current_card->title);
gtk_widget_set_visible (GTK_WIDGET (win->delete_card_button), TRUE);
}
static void
@@ -82,14 +83,14 @@ load_cards (FlashcardsAppWindow *win, category c)
{
GArray *card_array = database_load_cards (win->db, c.id);
adw_view_stack_set_visible_child (win->main_view, win->flashcard);
win->cards = g_queue_new ();
for (guint i = 0; i < card_array->len; i++)
{
g_queue_push_tail (win->cards, &g_array_index (card_array, card, i));
;
}
printf ("Flashcards: %d\n", win->cards->length);
next_card (win);
}
@@ -112,7 +113,6 @@ on_select_category (__attribute__ ((unused)) GtkListBox *box,
adw_view_stack_set_visible_child (win->main_view, win->flashcard);
gtk_widget_set_visible (GTK_WIDGET (win->add_card_button), TRUE);
gtk_widget_set_visible (GTK_WIDGET (win->delete_card_button), TRUE);
gtk_widget_set_visible (GTK_WIDGET (win->delete_category_button), TRUE);
load_cards (win, c);
@@ -202,7 +202,7 @@ flashcards_app_window_add_card (FlashcardsAppWindow *win, const gchar *title,
const gchar *answer)
{
database_save_card (win->db, win->current_category.id, title, answer);
printf ("Added card\n");
load_cards (win, win->current_category);
}
void
@@ -217,7 +217,6 @@ static void
on_flashcards_app_window_show (GtkWidget *self, gpointer user_data)
{
FlashcardsAppWindow *win = user_data;
printf ("Show\n");
load_categories (win);
gtk_list_box_unselect_all (win->topics);

View File

@@ -1,7 +1,8 @@
sourcefiles = files('main.c',
'flashcardsapp.c',
'flashcardsappwin.c',
'create-category.c',
'create-card.c',
'database.c'
sourcefiles = files(
'main.c',
'flashcardsapp.c',
'flashcardsappwin.c',
'create-category.c',
'create-card.c',
'database.c'
)