mirror of
https://gitlab.cvh-server.de/skrause/flashcards.git
synced 2025-12-12 06:41:38 +01:00
update ui, add metainfo
This commit is contained in:
@@ -4,3 +4,6 @@ src/flashcardsapp.c
|
||||
src/flashcardsappwin.c
|
||||
src/create-category.c
|
||||
src/database.c
|
||||
resources/li.sopht.Flashcards.desktop.in
|
||||
resources/li.sopht.Flashcards.metainfo.xml.in
|
||||
resources/li.sopht.Flashcards.gschema.xml
|
||||
30
po/de.po
30
po/de.po
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: flashcards\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-02-17 16:10+0100\n"
|
||||
"POT-Creation-Date: 2025-02-18 18:49+0100\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"
|
||||
@@ -11,15 +11,21 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: resources/ui/window.blp:5 resources/ui/window.blp:59 src/flashcardsapp.c:42
|
||||
#: resources/ui/window.blp:5 resources/ui/window.blp:63
|
||||
#: resources/ui/window.blp:75 resources/li.sopht.Flashcards.desktop.in:3
|
||||
#: resources/li.sopht.Flashcards.metainfo.xml.in:7
|
||||
msgid "Flashcards"
|
||||
msgstr "Karteikarten"
|
||||
|
||||
#: resources/ui/window.blp:17
|
||||
#: resources/ui/window.blp:19
|
||||
msgid "Categories"
|
||||
msgstr "Kategorien"
|
||||
|
||||
#: resources/ui/window.blp:102
|
||||
#: resources/ui/window.blp:88
|
||||
msgid "Select a category"
|
||||
msgstr "Wähle eine Kategorie"
|
||||
|
||||
#: resources/ui/window.blp:106
|
||||
msgid "About Flashcards"
|
||||
msgstr "Über Karteikarten"
|
||||
|
||||
@@ -38,3 +44,19 @@ msgstr "Hinzufügen"
|
||||
#: resources/ui/create-category.blp:14
|
||||
msgid "Category title"
|
||||
msgstr "Kategorie-Titel"
|
||||
|
||||
#: resources/li.sopht.Flashcards.desktop.in:9
|
||||
msgid "GTK;"
|
||||
msgstr ""
|
||||
|
||||
#: resources/li.sopht.Flashcards.metainfo.xml.in:8
|
||||
msgid "Learn categories with flashcards!"
|
||||
msgstr "Lerne Kategorien mit Karteikarten!"
|
||||
|
||||
#: resources/li.sopht.Flashcards.metainfo.xml.in:11
|
||||
msgid "Sophie Krause"
|
||||
msgstr ""
|
||||
|
||||
#: resources/li.sopht.Flashcards.metainfo.xml.in:30
|
||||
msgid "A caption"
|
||||
msgstr ""
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: flashcards\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-02-17 16:10+0100\n"
|
||||
"POT-Creation-Date: 2025-02-18 18:49+0100\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"
|
||||
@@ -17,15 +17,21 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: resources/ui/window.blp:5 resources/ui/window.blp:59 src/flashcardsapp.c:42
|
||||
#: resources/ui/window.blp:5 resources/ui/window.blp:63
|
||||
#: resources/ui/window.blp:75 resources/li.sopht.Flashcards.desktop.in:3
|
||||
#: resources/li.sopht.Flashcards.metainfo.xml.in:7
|
||||
msgid "Flashcards"
|
||||
msgstr ""
|
||||
|
||||
#: resources/ui/window.blp:17
|
||||
#: resources/ui/window.blp:19
|
||||
msgid "Categories"
|
||||
msgstr ""
|
||||
|
||||
#: resources/ui/window.blp:102
|
||||
#: resources/ui/window.blp:88
|
||||
msgid "Select a category"
|
||||
msgstr ""
|
||||
|
||||
#: resources/ui/window.blp:106
|
||||
msgid "About Flashcards"
|
||||
msgstr ""
|
||||
|
||||
@@ -44,3 +50,19 @@ msgstr ""
|
||||
#: resources/ui/create-category.blp:14
|
||||
msgid "Category title"
|
||||
msgstr ""
|
||||
|
||||
#: resources/li.sopht.Flashcards.desktop.in:9
|
||||
msgid "GTK;"
|
||||
msgstr ""
|
||||
|
||||
#: resources/li.sopht.Flashcards.metainfo.xml.in:8
|
||||
msgid "Learn categories with flashcards!"
|
||||
msgstr ""
|
||||
|
||||
#: resources/li.sopht.Flashcards.metainfo.xml.in:11
|
||||
msgid "Sophie Krause"
|
||||
msgstr ""
|
||||
|
||||
#: resources/li.sopht.Flashcards.metainfo.xml.in:30
|
||||
msgid "A caption"
|
||||
msgstr ""
|
||||
|
||||
33
resources/li.sopht.Flashcards.metainfo.xml.in
Normal file
33
resources/li.sopht.Flashcards.metainfo.xml.in
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>li.sopht.Flashcards</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MIT</project_license>
|
||||
|
||||
<name>Flashcards</name>
|
||||
<summary>Learn categories with flashcards!</summary>
|
||||
|
||||
<developer id="li.sopht">
|
||||
<name>Sophie Krause</name>
|
||||
</developer>
|
||||
|
||||
<url type="homepage">https://gitlab.cvh-server.de/skrause/flashcards</url>
|
||||
<url type="vcs-browser">https://gitlab.cvh-server.de/skrause/flashcards</url>
|
||||
<url type="bugtracker">https://gitlab.cvh-server.de/skrause/flashcards/-/issues</url>
|
||||
|
||||
<translation type="gettext">flashcards</translation>
|
||||
<launchable type="desktop-id">li.sopht.Flashcards.desktop</launchable>
|
||||
<content_rating type="oars-1.1" />
|
||||
|
||||
<branding>
|
||||
<color type="primary" scheme_preference="light">#ff00ff</color>
|
||||
<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>
|
||||
</component>
|
||||
3
resources/li.sopht.Flashcards.service.in
Normal file
3
resources/li.sopht.Flashcards.service.in
Normal file
@@ -0,0 +1,3 @@
|
||||
[D-BUS Service]
|
||||
Name=li.sopht.Flashcards
|
||||
Exec=@bindir@/flashcards --gapplication-service
|
||||
@@ -6,7 +6,7 @@ test('Validate schema file',
|
||||
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_dir: get_option('datadir') / 'glib-2.0' / 'schemas'
|
||||
)
|
||||
|
||||
desktop_file = i18n.merge_file(
|
||||
@@ -23,4 +23,25 @@ if desktop_utils.found()
|
||||
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'
|
||||
)
|
||||
|
||||
appstreamcli = find_program('appstreamcli', required: false, disabler: true)
|
||||
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'
|
||||
)
|
||||
|
||||
subdir('icons')
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
<gresource prefix="/li/sopht/flashcards">
|
||||
<file preprocess="xml-stripblanks">window.ui</file>
|
||||
<file preprocess="xml-stripblanks">create-category.ui</file>
|
||||
<file alias="appdata" compressed="true" preprocess="xml-stripblanks">../li.sopht.Flashcards.metainfo.xml</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
@@ -3,6 +3,8 @@ using Adw 1;
|
||||
|
||||
template $FlashcardsAppWindow : Adw.ApplicationWindow {
|
||||
title: _("Flashcards");
|
||||
default-width: 1200;
|
||||
default-height: 600;
|
||||
|
||||
Adw.Breakpoint {
|
||||
condition ( "max-width: 600sp" )
|
||||
@@ -26,6 +28,11 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
|
||||
icon-name: "list-add-symbolic";
|
||||
clicked => $on_add_category();
|
||||
}
|
||||
[start]
|
||||
Gtk.Button {
|
||||
icon-name: "user-trash-symbolic";
|
||||
clicked => $on_delete_category();
|
||||
}
|
||||
[end]
|
||||
Gtk.MenuButton {
|
||||
icon-name: "open-menu-symbolic";
|
||||
@@ -66,27 +73,25 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
|
||||
[title]
|
||||
Adw.WindowTitle title {
|
||||
title: _("Flashcards");
|
||||
subtitle: _("Test");
|
||||
subtitle: "Test";
|
||||
}
|
||||
}
|
||||
|
||||
content: Adw.Clamp {
|
||||
Adw.Bin {
|
||||
margin-top: 12;
|
||||
margin-bottom: 12;
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
content: Adw.ViewStack main_view {
|
||||
Adw.ViewStackPage {
|
||||
child: Adw.StatusPage placeholder {
|
||||
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?";
|
||||
title: _("Select a category");
|
||||
icon-name: "edit-find-symbolic";
|
||||
};
|
||||
}
|
||||
|
||||
Adw.ViewStackPage {
|
||||
child: Adw.Bin flashcard {
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,9 +16,10 @@ struct _FlashcardsApp
|
||||
G_DEFINE_TYPE(FlashcardsApp, flashcards_app, ADW_TYPE_APPLICATION);
|
||||
|
||||
static void
|
||||
flashcards_app_quit(__attribute__((unused)) GSimpleAction *action,
|
||||
__attribute__((unused)) GVariant *parameter,
|
||||
gpointer user_data)
|
||||
flashcards_app_quit(
|
||||
__attribute__((unused)) GSimpleAction *action,
|
||||
__attribute__((unused)) GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
FlashcardsApp *self = user_data;
|
||||
g_assert(FLASHCARDS_IS_APP(self));
|
||||
@@ -26,28 +27,30 @@ flashcards_app_quit(__attribute__((unused)) GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
flashcards_app_about(__attribute__((unused)) GSimpleAction *action,
|
||||
__attribute__((unused)) GVariant *parameter,
|
||||
gpointer user_data)
|
||||
flashcards_app_about(
|
||||
__attribute__((unused)) GSimpleAction *action,
|
||||
__attribute__((unused)) GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
static const char *developers[] = {"Sophie Krause", NULL};
|
||||
FlashcardsApp *self = user_data;
|
||||
GtkWindow *window = NULL;
|
||||
GtkWindow *window;
|
||||
AdwDialog *dialog;
|
||||
|
||||
g_assert(FLASHCARDS_IS_APP(self));
|
||||
|
||||
window = gtk_application_get_active_window(GTK_APPLICATION(self));
|
||||
|
||||
adw_show_about_dialog(GTK_WIDGET(window),
|
||||
/*adw_show_about_dialog(GTK_WIDGET(window),
|
||||
"application-name", _("Flashcards"),
|
||||
"application-icon", "li.sopht.Flashcards",
|
||||
"developer-name", "Sophie Krause",
|
||||
"translator-credits", "Sophie Krause",
|
||||
"version", "1.0.0",
|
||||
"developers", developers,
|
||||
"issue-url", "https://gitlab.cvh-server.de/skrause/flashcards/-/issues",
|
||||
"copyright", "© 2025 Sophie Krause",
|
||||
"license-type", GTK_LICENSE_MIT_X11,
|
||||
NULL);
|
||||
NULL);*/
|
||||
dialog = adw_about_dialog_new_from_appdata("/li/sopht/flashcards/appdata", NULL);
|
||||
adw_dialog_present(dialog, GTK_WIDGET(window));
|
||||
}
|
||||
|
||||
static const GActionEntry app_actions[] = {
|
||||
@@ -76,10 +79,11 @@ flashcards_app_activate(GApplication *app)
|
||||
}
|
||||
|
||||
static void
|
||||
flashcards_app_open(GApplication *app,
|
||||
__attribute__((unused)) GFile **files,
|
||||
__attribute__((unused)) int n_files,
|
||||
__attribute__((unused)) const char *hint)
|
||||
flashcards_app_open(
|
||||
GApplication *app,
|
||||
__attribute__((unused)) GFile **files,
|
||||
__attribute__((unused)) int n_files,
|
||||
__attribute__((unused)) const char *hint)
|
||||
{
|
||||
GList *windows;
|
||||
FlashcardsAppWindow *win;
|
||||
|
||||
@@ -14,17 +14,21 @@ struct _FlashcardsAppWindow
|
||||
AdwApplicationWindow parent;
|
||||
|
||||
sqlite3 *db;
|
||||
|
||||
GArray *categories;
|
||||
|
||||
AdwWindowTitle *title;
|
||||
|
||||
AdwNavigationSplitView *split_view;
|
||||
AdwNavigationPage *sidebar;
|
||||
AdwNavigationPage *content;
|
||||
|
||||
AdwDialog *create_category_dialog;
|
||||
AdwViewStack *main_view;
|
||||
GtkWidget *placeholder;
|
||||
GtkWidget *flashcard;
|
||||
|
||||
GtkListBox *topics;
|
||||
|
||||
bool started;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(FlashcardsAppWindow, flashcards_app_window, ADW_TYPE_APPLICATION_WINDOW);
|
||||
@@ -34,20 +38,30 @@ on_category_selected(__attribute__((unused)) GtkListBox *box, GtkListBoxRow *row
|
||||
{
|
||||
FlashcardsAppWindow *win;
|
||||
int id;
|
||||
category c;
|
||||
|
||||
win = user_data;
|
||||
|
||||
if (!win->started)
|
||||
{
|
||||
win->started = true;
|
||||
gtk_list_box_unselect_all(win->topics);
|
||||
return;
|
||||
}
|
||||
|
||||
if (row == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
win = user_data;
|
||||
adw_navigation_split_view_set_show_content(ADW_NAVIGATION_SPLIT_VIEW(win->split_view), TRUE);
|
||||
|
||||
id = gtk_list_box_row_get_index(gtk_list_box_get_selected_row(win->topics));
|
||||
printf("%d\n", id);
|
||||
|
||||
char test[2];
|
||||
sprintf(test, "%d", id);
|
||||
adw_window_title_set_subtitle(ADW_WINDOW_TITLE(win->title), test);
|
||||
c = g_array_index(win->categories, category, id);
|
||||
adw_window_title_set_subtitle(ADW_WINDOW_TITLE(win->title), c.name);
|
||||
|
||||
adw_view_stack_set_visible_child(win->main_view, win->flashcard);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -64,35 +78,24 @@ static void
|
||||
on_delete_category(__attribute__((unused)) GtkButton *self,
|
||||
gpointer user_data)
|
||||
{
|
||||
FlashcardsAppWindow *win = user_data;
|
||||
FlashcardsAppWindow *win;
|
||||
|
||||
win = user_data;
|
||||
|
||||
printf("Delete category\n");
|
||||
}
|
||||
|
||||
void flashcards_app_window_test(FlashcardsAppWindow *win, const gchar *test)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
database_save_category(win->db, test);
|
||||
|
||||
child = adw_action_row_new();
|
||||
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(child), test);
|
||||
|
||||
gtk_list_box_append(GTK_LIST_BOX(win->topics), child);
|
||||
gtk_list_box_unselect_all(win->topics);
|
||||
adw_view_stack_set_visible_child(win->main_view, win->placeholder);
|
||||
}
|
||||
|
||||
static void
|
||||
flashcards_app_window_init(FlashcardsAppWindow *win)
|
||||
load_categories(FlashcardsAppWindow *win)
|
||||
{
|
||||
GArray *categories;
|
||||
|
||||
gtk_widget_init_template(GTK_WIDGET(win));
|
||||
gtk_list_box_remove_all(win->topics);
|
||||
|
||||
win->db = database_connect(g_get_user_data_dir());
|
||||
database_create_tables(win->db);
|
||||
win->categories = database_load_categories(win->db);
|
||||
|
||||
categories = win->categories;
|
||||
categories = database_load_categories(win->db);
|
||||
win->categories = categories;
|
||||
|
||||
for (guint i = 0; i < categories->len; i++)
|
||||
{
|
||||
@@ -105,20 +108,42 @@ flashcards_app_window_init(FlashcardsAppWindow *win)
|
||||
child = adw_action_row_new();
|
||||
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(child), c.name);
|
||||
|
||||
gtk_list_box_append(GTK_LIST_BOX(win->topics), child);
|
||||
gtk_list_box_append(win->topics, child);
|
||||
}
|
||||
}
|
||||
|
||||
void flashcards_app_window_test(FlashcardsAppWindow *win, const gchar *test)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
database_save_category(win->db, test);
|
||||
load_categories(win);
|
||||
}
|
||||
|
||||
static void
|
||||
flashcards_app_window_init(FlashcardsAppWindow *win)
|
||||
{
|
||||
gtk_widget_init_template(GTK_WIDGET(win));
|
||||
|
||||
win->db = database_connect(g_get_user_data_dir());
|
||||
load_categories(win);
|
||||
}
|
||||
|
||||
static void
|
||||
flashcards_app_window_class_init(FlashcardsAppWindowClass *class)
|
||||
{
|
||||
gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS(class), "/li/sopht/flashcards/window.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, title);
|
||||
|
||||
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, split_view);
|
||||
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, sidebar);
|
||||
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, content);
|
||||
|
||||
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, main_view);
|
||||
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, placeholder);
|
||||
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, flashcard);
|
||||
|
||||
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, topics);
|
||||
|
||||
gtk_widget_class_bind_template_callback(GTK_WIDGET_CLASS(class), on_category_selected);
|
||||
|
||||
Reference in New Issue
Block a user