1
0
mirror of https://gitlab.cvh-server.de/skrause/flashcards.git synced 2026-04-30 21:47:05 +00:00

formatting, small changes

This commit is contained in:
2026-03-06 15:48:11 +01:00
parent 527d098aa1
commit ecf0403227
22 changed files with 563 additions and 406 deletions

View File

@@ -1,12 +1,11 @@
#include <gtk/gtk.h>
#include <adwaita.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "create-category.h"
struct _FlashcardsCreateCategoryDialog
{
struct _FlashcardsCreateCategoryDialog {
AdwAlertDialog parent;
GtkEditable *entry;
@@ -16,41 +15,30 @@ struct _FlashcardsCreateCategoryDialog
G_DEFINE_TYPE(FlashcardsCreateCategoryDialog, flashcards_create_category_dialog, ADW_TYPE_ALERT_DIALOG);
static void
flashcards_create_category_dialog_init(FlashcardsCreateCategoryDialog *self)
{
static void flashcards_create_category_dialog_init(FlashcardsCreateCategoryDialog *self) {
gtk_widget_init_template(GTK_WIDGET(self));
}
static void
on_response(__attribute__((unused)) AdwAlertDialog *dialog,
gchar *response,
gpointer user_data)
{
static void on_response(__attribute__((unused)) AdwAlertDialog *dialog, gchar *response, gpointer user_data) {
FlashcardsCreateCategoryDialog *self = user_data;
const gchar *category = gtk_editable_get_text(self->entry);
if (strcmp(response, "add") == 0 && strlen(category) > 0)
{
if (strcmp(response, "add") == 0 && strlen(category) > 0) {
flashcards_app_window_test(self->win, category);
}
}
static void
flashcards_create_category_dialog_class_init(FlashcardsCreateCategoryDialogClass *class)
{
gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS(class), "/li/sopht/flashcards/create-category.ui");
static void flashcards_create_category_dialog_class_init(FlashcardsCreateCategoryDialogClass *klass) {
gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS(klass), "/li/sopht/flashcards/create-category.ui");
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(class), FlashcardsCreateCategoryDialog, entry);
gtk_widget_class_bind_template_child(GTK_WIDGET_CLASS(klass), FlashcardsCreateCategoryDialog, entry);
gtk_widget_class_bind_template_callback(GTK_WIDGET_CLASS(class), on_response);
gtk_widget_class_bind_template_callback(GTK_WIDGET_CLASS(klass), on_response);
}
FlashcardsCreateCategoryDialog *
flashcards_create_category_dialog_new(FlashcardsAppWindow *win)
{
FlashcardsCreateCategoryDialog *self = g_object_new(FLASHCARDS_CREATE_CATEGORY_DIALOG_TYPE, NULL);
FlashcardsCreateCategoryDialog *flashcards_create_category_dialog_new(FlashcardsAppWindow *win) {
FlashcardsCreateCategoryDialog *self = g_object_new(FLASHCARDS_CREATE_CATEGORY_DIALOG_TYPE, nullptr);
self->win = win;
return self;
}
}