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

remove en, update ui, some minor changes

This commit is contained in:
2025-02-17 17:46:00 +01:00
parent b98397d17a
commit 81d2e8d92e
9 changed files with 154 additions and 175 deletions

View File

@@ -1,7 +1,7 @@
project('flashcards', 'c',
version: '1.0.0',
meson_version: '>= 1.0.0',
default_options: [ 'warning_level=2', 'werror=false', 'c_std=gnu23', ],
default_options: ['warning_level=2', 'c_std=gnu23'],
)
flashcards_deps = [
@@ -26,71 +26,71 @@ 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')
project_c_args = []
test_c_args = [
'-Wcast-align',
'-Wdeclaration-after-statement',
'-Werror=address',
'-Werror=array-bounds',
'-Werror=empty-body',
'-Werror=implicit',
'-Werror=implicit-function-declaration',
'-Werror=incompatible-pointer-types',
'-Werror=init-self',
'-Werror=int-conversion',
'-Werror=int-to-pointer-cast',
'-Werror=main',
'-Werror=misleading-indentation',
'-Werror=missing-braces',
'-Werror=missing-include-dirs',
'-Werror=nonnull',
'-Werror=overflow',
'-Werror=parenthesis',
'-Werror=pointer-arith',
'-Werror=pointer-to-int-cast',
'-Werror=redundant-decls',
'-Werror=return-type',
'-Werror=sequence-point',
'-Werror=shadow',
'-Werror=strict-prototypes',
'-Werror=trigraphs',
'-Werror=undef',
'-Werror=write-strings',
'-Wformat-nonliteral',
'-Wignored-qualifiers',
'-Wimplicit-function-declaration',
'-Wlogical-op',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wnested-externs',
'-Wno-cast-function-type',
'-Wno-dangling-pointer',
'-Wno-missing-field-initializers',
'-Wno-sign-compare',
'-Wno-unused-parameter',
'-Wold-style-definition',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wstrict-prototypes',
'-Wswitch-default',
'-Wswitch-enum',
'-Wundef',
'-Wuninitialized',
'-Wunused',
'-fno-strict-aliasing',
['-Werror=format-security', '-Werror=format=2'],
]
if get_option('buildtype') != 'plain'
test_c_args += '-fstack-protector-strong'
endif
foreach arg: test_c_args
if cc.has_multi_arguments(arg)
project_c_args += arg
endif
endforeach
add_project_arguments(project_c_args, language: 'c')
# project_c_args = []
# test_c_args = [
# '-Wcast-align',
# '-Wdeclaration-after-statement',
# '-Werror=address',
# '-Werror=array-bounds',
# '-Werror=empty-body',
# '-Werror=implicit',
# '-Werror=implicit-function-declaration',
# '-Werror=incompatible-pointer-types',
# '-Werror=init-self',
# '-Werror=int-conversion',
# '-Werror=int-to-pointer-cast',
# '-Werror=main',
# '-Werror=misleading-indentation',
# '-Werror=missing-braces',
# '-Werror=missing-include-dirs',
# '-Werror=nonnull',
# '-Werror=overflow',
# '-Werror=parenthesis',
# '-Werror=pointer-arith',
# '-Werror=pointer-to-int-cast',
# '-Werror=redundant-decls',
# '-Werror=return-type',
# '-Werror=sequence-point',
# '-Werror=shadow',
# '-Werror=strict-prototypes',
# '-Werror=trigraphs',
# '-Werror=undef',
# '-Werror=write-strings',
# '-Wformat-nonliteral',
# '-Wignored-qualifiers',
# '-Wimplicit-function-declaration',
# '-Wlogical-op',
# '-Wmissing-declarations',
# '-Wmissing-format-attribute',
# '-Wmissing-include-dirs',
# '-Wmissing-noreturn',
# '-Wnested-externs',
# '-Wno-cast-function-type',
# '-Wno-dangling-pointer',
# '-Wno-missing-field-initializers',
# '-Wno-sign-compare',
# '-Wno-unused-parameter',
# '-Wold-style-definition',
# '-Wpointer-arith',
# '-Wredundant-decls',
# '-Wstrict-prototypes',
# '-Wswitch-default',
# '-Wswitch-enum',
# '-Wundef',
# '-Wuninitialized',
# '-Wunused',
# '-fno-strict-aliasing',
# ['-Werror=format-security', '-Werror=format=2'],
# ]
# if get_option('buildtype') != 'plain'
# test_c_args += '-fstack-protector-strong'
# endif
# foreach arg: test_c_args
# if cc.has_multi_arguments(arg)
# project_c_args += arg
# endif
# endforeach
# add_project_arguments(project_c_args, language: 'c')
executable('flashcards',
sourcefiles,

View File

@@ -1,2 +1 @@
en
de

View File

@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-05 18:52+0100\n"
"POT-Creation-Date: 2025-02-17 16:10+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,7 +11,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: resources/ui/window.blp:5 resources/ui/window.blp:54 src/flashcardsapp.c:42
#: resources/ui/window.blp:5 resources/ui/window.blp:59 src/flashcardsapp.c:42
msgid "Flashcards"
msgstr "Karteikarten"
@@ -19,25 +19,22 @@ msgstr "Karteikarten"
msgid "Categories"
msgstr "Kategorien"
#: resources/ui/window.blp:96
#: resources/ui/window.blp:102
msgid "About Flashcards"
msgstr "Über Karteikarten"
#: resources/ui/create-category.blp:9
#, fuzzy
#: resources/ui/create-category.blp:5
msgid "Create a new category"
msgstr "Erstelle eine neue Kategorie"
#: resources/ui/create-category.blp:8
msgid "Cancel"
msgstr "Abbrechen"
#: resources/ui/create-category.blp:10
#: resources/ui/create-category.blp:9
msgid "Add"
msgstr "Hinzufügen"
#: src/flashcardsapp.c:45
msgid "translator-credits"
msgstr "Übersetzer-Credits"
#~ msgid "Topics"
#~ msgstr "Themen"
#~ msgid "_Replace"
#~ msgstr "Ersetzen"
#: resources/ui/create-category.blp:14
msgid "Category title"
msgstr "Kategorie-Titel"

View File

@@ -1,39 +0,0 @@
msgid ""
msgstr ""
"Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-05 18:52+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"
"Language: \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:54 src/flashcardsapp.c:42
msgid "Flashcards"
msgstr "Flashcards"
#: resources/ui/window.blp:17
msgid "Categories"
msgstr ""
#: resources/ui/window.blp:96
msgid "About Flashcards"
msgstr "About Flashcards"
#: resources/ui/create-category.blp:9
msgid "Cancel"
msgstr ""
#: resources/ui/create-category.blp:10
msgid "Add"
msgstr ""
#: src/flashcardsapp.c:45
msgid "translator-credits"
msgstr ""
#~ msgid "Topics"
#~ msgstr "Topics"

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-05 18:52+0100\n"
"POT-Creation-Date: 2025-02-17 16:10+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,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: resources/ui/window.blp:5 resources/ui/window.blp:54 src/flashcardsapp.c:42
#: resources/ui/window.blp:5 resources/ui/window.blp:59 src/flashcardsapp.c:42
msgid "Flashcards"
msgstr ""
@@ -25,18 +25,22 @@ msgstr ""
msgid "Categories"
msgstr ""
#: resources/ui/window.blp:96
#: resources/ui/window.blp:102
msgid "About Flashcards"
msgstr ""
#: resources/ui/create-category.blp:9
#: resources/ui/create-category.blp:5
msgid "Create a new category"
msgstr ""
#: resources/ui/create-category.blp:8
msgid "Cancel"
msgstr ""
#: resources/ui/create-category.blp:10
#: resources/ui/create-category.blp:9
msgid "Add"
msgstr ""
#: src/flashcardsapp.c:45
msgid "translator-credits"
#: resources/ui/create-category.blp:14
msgid "Category title"
msgstr ""

View File

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

View File

@@ -16,24 +16,26 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
Adw.NavigationPage sidebar {
title: _("Categories");
Box {
orientation: vertical;
hexpand: true;
Adw.ToolbarView {
width-request: 360;
[top]
Adw.HeaderBar {
[end]
[start]
Gtk.Button {
icon-name: "list-add-symbolic";
clicked => $on_add_category();
}
[end]
Gtk.MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
}
}
Adw.Clamp {
hexpand: true;
content: ScrolledWindow {
ListBox topics {
hexpand: true;
valign: start;
selection-mode: single;
margin-top: 12;
margin-bottom: 12;
@@ -45,28 +47,30 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
"boxed-list",
]
}
}
};
}
}
[content]
Adw.NavigationPage content {
title: _("Flashcards");
Box {
orientation: vertical;
hexpand: true;
Adw.ToolbarView {
[top]
Adw.HeaderBar {
[end]
Gtk.MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
[start]
Gtk.Button {
icon-name: "user-trash-symbolic";
clicked => $on_delete_category();
}
[title]
Adw.WindowTitle title {
title: _("Flashcards");
subtitle: _("Test");
}
}
Adw.Clamp {
hexpand: true;
content: Adw.Clamp {
Adw.Bin {
margin-top: 12;
margin-bottom: 12;
@@ -85,7 +89,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
label: "Wie viel Grad hat ein Kreis?";
};
}
}
};
}
}
}

View File

@@ -23,7 +23,7 @@ flashcards_create_category_dialog_init(FlashcardsCreateCategoryDialog *self)
}
static void
on_response(AdwAlertDialog *dialog,
on_response(__attribute__((unused)) AdwAlertDialog *dialog,
gchar *response,
gpointer user_data)
{

View File

@@ -17,6 +17,7 @@ struct _FlashcardsAppWindow
GArray *categories;
AdwWindowTitle *title;
AdwNavigationSplitView *split_view;
AdwNavigationPage *sidebar;
AdwNavigationPage *content;
@@ -29,7 +30,7 @@ struct _FlashcardsAppWindow
G_DEFINE_TYPE(FlashcardsAppWindow, flashcards_app_window, ADW_TYPE_APPLICATION_WINDOW);
static void
on_category_selected(GtkListBox *box, GtkListBoxRow *row, gpointer user_data)
on_category_selected(__attribute__((unused)) GtkListBox *box, GtkListBoxRow *row, gpointer user_data)
{
FlashcardsAppWindow *win;
int id;
@@ -38,16 +39,19 @@ on_category_selected(GtkListBox *box, GtkListBoxRow *row, gpointer user_data)
{
return;
}
printf("Test\n");
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);
}
static void
on_add_category(GtkButton *self,
on_add_category(__attribute__((unused)) GtkButton *self,
gpointer user_data)
{
FlashcardsCreateCategoryDialog *dialog;
@@ -56,6 +60,15 @@ on_add_category(GtkButton *self,
adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(user_data));
}
static void
on_delete_category(__attribute__((unused)) GtkButton *self,
gpointer user_data)
{
FlashcardsAppWindow *win = user_data;
printf("Delete category\n");
}
void flashcards_app_window_test(FlashcardsAppWindow *win, const gchar *test)
{
GtkWidget *child;
@@ -81,7 +94,7 @@ flashcards_app_window_init(FlashcardsAppWindow *win)
categories = win->categories;
for (int i = 0; i < categories->len; i++)
for (guint i = 0; i < categories->len; i++)
{
GtkWidget *child;
category c;
@@ -101,6 +114,7 @@ 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);
@@ -109,6 +123,7 @@ flashcards_app_window_class_init(FlashcardsAppWindowClass *class)
gtk_widget_class_bind_template_callback(GTK_WIDGET_CLASS(class), on_category_selected);
gtk_widget_class_bind_template_callback(GTK_WIDGET_CLASS(class), on_add_category);
gtk_widget_class_bind_template_callback(GTK_WIDGET_CLASS(class), on_delete_category);
}
FlashcardsAppWindow *