Skip to content
Snippets Groups Projects
Verified Commit 81d2e8d9 authored by Sophie Krause's avatar Sophie Krause :rabbit2:
Browse files

remove en, update ui, some minor changes

parent b98397d1
No related branches found
No related tags found
No related merge requests found
Pipeline #1765 passed
project('flashcards', 'c', project('flashcards', 'c',
version: '1.0.0', version: '1.0.0',
meson_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 = [ flashcards_deps = [
...@@ -26,71 +26,71 @@ config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir')) ...@@ -26,71 +26,71 @@ config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
configure_file(output: 'config.h', configuration: config_h) configure_file(output: 'config.h', configuration: config_h)
add_project_arguments(['-I' + meson.project_build_root()], language: 'c') add_project_arguments(['-I' + meson.project_build_root()], language: 'c')
project_c_args = [] # project_c_args = []
test_c_args = [ # test_c_args = [
'-Wcast-align', # '-Wcast-align',
'-Wdeclaration-after-statement', # '-Wdeclaration-after-statement',
'-Werror=address', # '-Werror=address',
'-Werror=array-bounds', # '-Werror=array-bounds',
'-Werror=empty-body', # '-Werror=empty-body',
'-Werror=implicit', # '-Werror=implicit',
'-Werror=implicit-function-declaration', # '-Werror=implicit-function-declaration',
'-Werror=incompatible-pointer-types', # '-Werror=incompatible-pointer-types',
'-Werror=init-self', # '-Werror=init-self',
'-Werror=int-conversion', # '-Werror=int-conversion',
'-Werror=int-to-pointer-cast', # '-Werror=int-to-pointer-cast',
'-Werror=main', # '-Werror=main',
'-Werror=misleading-indentation', # '-Werror=misleading-indentation',
'-Werror=missing-braces', # '-Werror=missing-braces',
'-Werror=missing-include-dirs', # '-Werror=missing-include-dirs',
'-Werror=nonnull', # '-Werror=nonnull',
'-Werror=overflow', # '-Werror=overflow',
'-Werror=parenthesis', # '-Werror=parenthesis',
'-Werror=pointer-arith', # '-Werror=pointer-arith',
'-Werror=pointer-to-int-cast', # '-Werror=pointer-to-int-cast',
'-Werror=redundant-decls', # '-Werror=redundant-decls',
'-Werror=return-type', # '-Werror=return-type',
'-Werror=sequence-point', # '-Werror=sequence-point',
'-Werror=shadow', # '-Werror=shadow',
'-Werror=strict-prototypes', # '-Werror=strict-prototypes',
'-Werror=trigraphs', # '-Werror=trigraphs',
'-Werror=undef', # '-Werror=undef',
'-Werror=write-strings', # '-Werror=write-strings',
'-Wformat-nonliteral', # '-Wformat-nonliteral',
'-Wignored-qualifiers', # '-Wignored-qualifiers',
'-Wimplicit-function-declaration', # '-Wimplicit-function-declaration',
'-Wlogical-op', # '-Wlogical-op',
'-Wmissing-declarations', # '-Wmissing-declarations',
'-Wmissing-format-attribute', # '-Wmissing-format-attribute',
'-Wmissing-include-dirs', # '-Wmissing-include-dirs',
'-Wmissing-noreturn', # '-Wmissing-noreturn',
'-Wnested-externs', # '-Wnested-externs',
'-Wno-cast-function-type', # '-Wno-cast-function-type',
'-Wno-dangling-pointer', # '-Wno-dangling-pointer',
'-Wno-missing-field-initializers', # '-Wno-missing-field-initializers',
'-Wno-sign-compare', # '-Wno-sign-compare',
'-Wno-unused-parameter', # '-Wno-unused-parameter',
'-Wold-style-definition', # '-Wold-style-definition',
'-Wpointer-arith', # '-Wpointer-arith',
'-Wredundant-decls', # '-Wredundant-decls',
'-Wstrict-prototypes', # '-Wstrict-prototypes',
'-Wswitch-default', # '-Wswitch-default',
'-Wswitch-enum', # '-Wswitch-enum',
'-Wundef', # '-Wundef',
'-Wuninitialized', # '-Wuninitialized',
'-Wunused', # '-Wunused',
'-fno-strict-aliasing', # '-fno-strict-aliasing',
['-Werror=format-security', '-Werror=format=2'], # ['-Werror=format-security', '-Werror=format=2'],
] # ]
if get_option('buildtype') != 'plain' # if get_option('buildtype') != 'plain'
test_c_args += '-fstack-protector-strong' # test_c_args += '-fstack-protector-strong'
endif # endif
foreach arg: test_c_args # foreach arg: test_c_args
if cc.has_multi_arguments(arg) # if cc.has_multi_arguments(arg)
project_c_args += arg # project_c_args += arg
endif # endif
endforeach # endforeach
add_project_arguments(project_c_args, language: 'c') # add_project_arguments(project_c_args, language: 'c')
executable('flashcards', executable('flashcards',
sourcefiles, sourcefiles,
......
en
de de
...@@ -2,7 +2,7 @@ msgid "" ...@@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: flashcards\n" "Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -11,7 +11,7 @@ msgstr "" ...@@ -11,7 +11,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\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" msgid "Flashcards"
msgstr "Karteikarten" msgstr "Karteikarten"
...@@ -19,25 +19,22 @@ msgstr "Karteikarten" ...@@ -19,25 +19,22 @@ msgstr "Karteikarten"
msgid "Categories" msgid "Categories"
msgstr "Kategorien" msgstr "Kategorien"
#: resources/ui/window.blp:96 #: resources/ui/window.blp:102
msgid "About Flashcards" msgid "About Flashcards"
msgstr "Über Karteikarten" msgstr "Über Karteikarten"
#: resources/ui/create-category.blp:9 #: resources/ui/create-category.blp:5
#, fuzzy msgid "Create a new category"
msgstr "Erstelle eine neue Kategorie"
#: resources/ui/create-category.blp:8
msgid "Cancel" msgid "Cancel"
msgstr "Abbrechen" msgstr "Abbrechen"
#: resources/ui/create-category.blp:10 #: resources/ui/create-category.blp:9
msgid "Add" msgid "Add"
msgstr "Hinzufügen" msgstr "Hinzufügen"
#: src/flashcardsapp.c:45 #: resources/ui/create-category.blp:14
msgid "translator-credits" msgid "Category title"
msgstr "Übersetzer-Credits" msgstr "Kategorie-Titel"
#~ msgid "Topics"
#~ msgstr "Themen"
#~ msgid "_Replace"
#~ msgstr "Ersetzen"
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"
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: flashcards\n" "Project-Id-Version: flashcards\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -17,7 +17,7 @@ msgstr "" ...@@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\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" msgid "Flashcards"
msgstr "" msgstr ""
...@@ -25,18 +25,22 @@ msgstr "" ...@@ -25,18 +25,22 @@ msgstr ""
msgid "Categories" msgid "Categories"
msgstr "" msgstr ""
#: resources/ui/window.blp:96 #: resources/ui/window.blp:102
msgid "About Flashcards" msgid "About Flashcards"
msgstr "" 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" msgid "Cancel"
msgstr "" msgstr ""
#: resources/ui/create-category.blp:10 #: resources/ui/create-category.blp:9
msgid "Add" msgid "Add"
msgstr "" msgstr ""
#: src/flashcardsapp.c:45 #: resources/ui/create-category.blp:14
msgid "translator-credits" msgid "Category title"
msgstr "" msgstr ""
...@@ -2,8 +2,7 @@ using Gtk 4.0; ...@@ -2,8 +2,7 @@ using Gtk 4.0;
using Adw 1; using Adw 1;
template $FlashcardsCreateCategoryDialog : Adw.AlertDialog { template $FlashcardsCreateCategoryDialog : Adw.AlertDialog {
heading: "Create a new category"; heading: _("Create a new category");
default-response: "add";
close-response: "cancel"; close-response: "cancel";
responses [ responses [
cancel: _("Cancel"), cancel: _("Cancel"),
...@@ -12,7 +11,7 @@ template $FlashcardsCreateCategoryDialog : Adw.AlertDialog { ...@@ -12,7 +11,7 @@ template $FlashcardsCreateCategoryDialog : Adw.AlertDialog {
response => $on_response(); response => $on_response();
Adw.EntryRow entry { Adw.EntryRow entry {
title: "Category name"; title: _("Category title");
styles [ styles [
"card", "card",
] ]
......
...@@ -16,24 +16,26 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow { ...@@ -16,24 +16,26 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
Adw.NavigationPage sidebar { Adw.NavigationPage sidebar {
title: _("Categories"); title: _("Categories");
Box { Adw.ToolbarView {
orientation: vertical;
hexpand: true;
width-request: 360; width-request: 360;
[top]
Adw.HeaderBar { Adw.HeaderBar {
[end] [start]
Gtk.Button { Gtk.Button {
icon-name: "list-add-symbolic"; icon-name: "list-add-symbolic";
clicked => $on_add_category(); clicked => $on_add_category();
} }
[end]
Gtk.MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
}
} }
Adw.Clamp { content: ScrolledWindow {
hexpand: true;
ListBox topics { ListBox topics {
hexpand: true; valign: start;
selection-mode: single; selection-mode: single;
margin-top: 12; margin-top: 12;
margin-bottom: 12; margin-bottom: 12;
...@@ -45,28 +47,30 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow { ...@@ -45,28 +47,30 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
"boxed-list", "boxed-list",
] ]
} }
} };
} }
} }
[content] [content]
Adw.NavigationPage content { Adw.NavigationPage content {
title: _("Flashcards"); title: _("Flashcards");
Box {
orientation: vertical;
hexpand: true;
Adw.ToolbarView {
[top]
Adw.HeaderBar { Adw.HeaderBar {
[end] [start]
Gtk.MenuButton { Gtk.Button {
icon-name: "open-menu-symbolic"; icon-name: "user-trash-symbolic";
menu-model: primary_menu; clicked => $on_delete_category();
}
[title]
Adw.WindowTitle title {
title: _("Flashcards");
subtitle: _("Test");
} }
} }
Adw.Clamp { content: Adw.Clamp {
hexpand: true;
Adw.Bin { Adw.Bin {
margin-top: 12; margin-top: 12;
margin-bottom: 12; margin-bottom: 12;
...@@ -85,7 +89,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow { ...@@ -85,7 +89,7 @@ template $FlashcardsAppWindow : Adw.ApplicationWindow {
label: "Wie viel Grad hat ein Kreis?"; label: "Wie viel Grad hat ein Kreis?";
}; };
} }
} };
} }
} }
} }
......
...@@ -23,7 +23,7 @@ flashcards_create_category_dialog_init(FlashcardsCreateCategoryDialog *self) ...@@ -23,7 +23,7 @@ flashcards_create_category_dialog_init(FlashcardsCreateCategoryDialog *self)
} }
static void static void
on_response(AdwAlertDialog *dialog, on_response(__attribute__((unused)) AdwAlertDialog *dialog,
gchar *response, gchar *response,
gpointer user_data) gpointer user_data)
{ {
......
...@@ -17,6 +17,7 @@ struct _FlashcardsAppWindow ...@@ -17,6 +17,7 @@ struct _FlashcardsAppWindow
GArray *categories; GArray *categories;
AdwWindowTitle *title;
AdwNavigationSplitView *split_view; AdwNavigationSplitView *split_view;
AdwNavigationPage *sidebar; AdwNavigationPage *sidebar;
AdwNavigationPage *content; AdwNavigationPage *content;
...@@ -29,7 +30,7 @@ struct _FlashcardsAppWindow ...@@ -29,7 +30,7 @@ struct _FlashcardsAppWindow
G_DEFINE_TYPE(FlashcardsAppWindow, flashcards_app_window, ADW_TYPE_APPLICATION_WINDOW); G_DEFINE_TYPE(FlashcardsAppWindow, flashcards_app_window, ADW_TYPE_APPLICATION_WINDOW);
static void 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; FlashcardsAppWindow *win;
int id; int id;
...@@ -38,16 +39,19 @@ on_category_selected(GtkListBox *box, GtkListBoxRow *row, gpointer user_data) ...@@ -38,16 +39,19 @@ on_category_selected(GtkListBox *box, GtkListBoxRow *row, gpointer user_data)
{ {
return; return;
} }
printf("Test\n");
win = user_data; win = user_data;
adw_navigation_split_view_set_show_content(ADW_NAVIGATION_SPLIT_VIEW(win->split_view), TRUE); 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)); id = gtk_list_box_row_get_index(gtk_list_box_get_selected_row(win->topics));
printf("%d\n", id); printf("%d\n", id);
char test[2];
sprintf(test, "%d", id);
adw_window_title_set_subtitle(ADW_WINDOW_TITLE(win->title), test);
} }
static void static void
on_add_category(GtkButton *self, on_add_category(__attribute__((unused)) GtkButton *self,
gpointer user_data) gpointer user_data)
{ {
FlashcardsCreateCategoryDialog *dialog; FlashcardsCreateCategoryDialog *dialog;
...@@ -56,6 +60,15 @@ on_add_category(GtkButton *self, ...@@ -56,6 +60,15 @@ on_add_category(GtkButton *self,
adw_dialog_present(ADW_DIALOG(dialog), GTK_WIDGET(user_data)); 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) void flashcards_app_window_test(FlashcardsAppWindow *win, const gchar *test)
{ {
GtkWidget *child; GtkWidget *child;
...@@ -81,7 +94,7 @@ flashcards_app_window_init(FlashcardsAppWindow *win) ...@@ -81,7 +94,7 @@ flashcards_app_window_init(FlashcardsAppWindow *win)
categories = win->categories; categories = win->categories;
for (int i = 0; i < categories->len; i++) for (guint i = 0; i < categories->len; i++)
{ {
GtkWidget *child; GtkWidget *child;
category c; category c;
...@@ -101,6 +114,7 @@ flashcards_app_window_class_init(FlashcardsAppWindowClass *class) ...@@ -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_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, 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, sidebar);
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, content); gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsAppWindow, content);
...@@ -109,6 +123,7 @@ flashcards_app_window_class_init(FlashcardsAppWindowClass *class) ...@@ -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_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_add_category);
gtk_widget_class_bind_template_callback(GTK_WIDGET_CLASS(class), on_delete_category);
} }
FlashcardsAppWindow * FlashcardsAppWindow *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment