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

push local changes

This commit is contained in:
2025-03-29 14:38:21 +01:00
parent a90db5b042
commit 9f5f951a9f
12 changed files with 488 additions and 495 deletions

View File

@@ -6,65 +6,86 @@
#include "flashcardsapp.h"
#include "flashcardsappwin.h"
struct _FlashcardsApp {
AdwApplication parent;
struct _FlashcardsApp
{
AdwApplication parent;
};
G_DEFINE_TYPE(FlashcardsApp, flashcards_app, ADW_TYPE_APPLICATION);
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) {
FlashcardsApp *self = user_data;
g_assert(FLASHCARDS_IS_APP(self));
g_application_quit(G_APPLICATION(self));
static void
flashcards_app_quit (__attribute__ ((unused)) GSimpleAction *action,
__attribute__ ((unused)) GVariant *parameter,
gpointer user_data)
{
FlashcardsApp *self = user_data;
g_application_quit (G_APPLICATION (self));
}
static void flashcards_app_about(__attribute__((unused)) GSimpleAction *action,
__attribute__((unused)) GVariant *parameter, gpointer user_data) {
FlashcardsApp *self = user_data;
static void
flashcards_app_about (__attribute__ ((unused)) GSimpleAction *action,
__attribute__ ((unused)) GVariant *parameter,
gpointer user_data)
{
FlashcardsApp *self = user_data;
g_assert(FLASHCARDS_IS_APP(self));
GtkWindow *window
= gtk_application_get_active_window (GTK_APPLICATION (self));
GtkWindow *window = gtk_application_get_active_window(GTK_APPLICATION(self));
AdwDialog *dialog = adw_about_dialog_new_from_appdata("/li/sopht/flashcards/appdata", nullptr);
adw_dialog_present(dialog, GTK_WIDGET(window));
AdwDialog *dialog = adw_about_dialog_new_from_appdata (
"/li/sopht/flashcards/appdata", nullptr);
adw_dialog_present (dialog, GTK_WIDGET (window));
}
static const GActionEntry app_actions[] = {
{"quit", flashcards_app_quit, nullptr, nullptr, nullptr, {0, 0, 0}},
{"about", flashcards_app_about, nullptr, nullptr, nullptr, {0, 0, 0}},
{ "quit", flashcards_app_quit, nullptr, nullptr, nullptr, { 0, 0, 0 } },
{ "about", flashcards_app_about, nullptr, nullptr, nullptr, { 0, 0, 0 } },
};
static void flashcards_app_init(FlashcardsApp *app) {
g_action_map_add_action_entries(G_ACTION_MAP(app), app_actions, G_N_ELEMENTS(app_actions), app);
gtk_application_set_accels_for_action(GTK_APPLICATION(app), "app.quit", (const char *[]) {"<primary>q", nullptr});
static void
flashcards_app_init (FlashcardsApp *app)
{
g_action_map_add_action_entries (G_ACTION_MAP (app), app_actions,
G_N_ELEMENTS (app_actions), app);
gtk_application_set_accels_for_action (
GTK_APPLICATION (app), "app.quit",
(const char *[]){ "<primary>q", nullptr });
}
static void flashcards_app_activate(GApplication *app) {
FlashcardsAppWindow *win = flashcards_app_window_new(FLASHCARDS_APP(app));
gtk_window_present(GTK_WINDOW(win));
static void
flashcards_app_activate (GApplication *app)
{
FlashcardsAppWindow *win = flashcards_app_window_new (FLASHCARDS_APP (app));
gtk_window_present (GTK_WINDOW (win));
}
static void flashcards_app_open(GApplication *app, __attribute__((unused)) GFile **files,
__attribute__((unused)) int n_files, __attribute__((unused)) const char *hint) {
FlashcardsAppWindow *win;
static void
flashcards_app_open (GApplication *app, __attribute__ ((unused)) GFile **files,
__attribute__ ((unused)) int n_files,
__attribute__ ((unused)) const char *hint)
{
FlashcardsAppWindow *win;
GList *windows = gtk_application_get_windows(GTK_APPLICATION(app));
if (windows)
win = FLASHCARDS_APP_WINDOW(windows->data);
else
win = flashcards_app_window_new(FLASHCARDS_APP(app));
GList *windows = gtk_application_get_windows (GTK_APPLICATION (app));
if (windows)
win = FLASHCARDS_APP_WINDOW (windows->data);
else
win = flashcards_app_window_new (FLASHCARDS_APP (app));
gtk_window_present(GTK_WINDOW(win));
gtk_window_present (GTK_WINDOW (win));
}
static void flashcards_app_class_init(FlashcardsAppClass *klass) {
G_APPLICATION_CLASS(klass)->activate = flashcards_app_activate;
G_APPLICATION_CLASS(klass)->open = flashcards_app_open;
static void
flashcards_app_class_init (FlashcardsAppClass *klass)
{
G_APPLICATION_CLASS (klass)->activate = flashcards_app_activate;
G_APPLICATION_CLASS (klass)->open = flashcards_app_open;
}
FlashcardsApp *flashcards_app_new(void) {
return g_object_new(FLASHCARDS_APP_TYPE, "application-id", "li.sopht.Flashcards", "flags",
G_APPLICATION_DEFAULT_FLAGS, NULL);
FlashcardsApp *
flashcards_app_new (void)
{
return g_object_new (FLASHCARDS_APP_TYPE, "application-id",
"li.sopht.Flashcards", "flags",
G_APPLICATION_DEFAULT_FLAGS, NULL);
}