mirror of
https://gitlab.cvh-server.de/skrause/flashcards.git
synced 2026-04-30 21:47:05 +00:00
push local changes
This commit is contained in:
@@ -5,40 +5,55 @@
|
||||
|
||||
#include "create-category.h"
|
||||
|
||||
struct _FlashcardsCreateCategoryDialog {
|
||||
AdwAlertDialog parent;
|
||||
struct _FlashcardsCreateCategoryDialog
|
||||
{
|
||||
AdwAlertDialog parent;
|
||||
|
||||
GtkEditable *entry;
|
||||
GtkEditable *entry;
|
||||
|
||||
FlashcardsAppWindow *win;
|
||||
FlashcardsAppWindow *win;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(FlashcardsCreateCategoryDialog, flashcards_create_category_dialog, ADW_TYPE_ALERT_DIALOG);
|
||||
G_DEFINE_TYPE (FlashcardsCreateCategoryDialog,
|
||||
flashcards_create_category_dialog, ADW_TYPE_ALERT_DIALOG);
|
||||
|
||||
static void flashcards_create_category_dialog_init(FlashcardsCreateCategoryDialog *self) {
|
||||
gtk_widget_init_template(GTK_WIDGET(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) {
|
||||
FlashcardsCreateCategoryDialog *self = 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);
|
||||
const gchar *category = gtk_editable_get_text (self->entry);
|
||||
|
||||
if (strcmp(response, "add") == 0 && strlen(category) > 0) {
|
||||
flashcards_app_window_test(self->win, category);
|
||||
}
|
||||
if (strcmp (response, "add") == 0 && strlen (category) > 0)
|
||||
flashcards_app_window_test (self->win, category);
|
||||
}
|
||||
|
||||
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");
|
||||
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(klass), FlashcardsCreateCategoryDialog, entry);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (klass),
|
||||
FlashcardsCreateCategoryDialog, entry);
|
||||
|
||||
gtk_widget_class_bind_template_callback(GTK_WIDGET_CLASS(klass), 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, nullptr);
|
||||
self->win = win;
|
||||
return self;
|
||||
FlashcardsCreateCategoryDialog *
|
||||
flashcards_create_category_dialog_new (FlashcardsAppWindow *win)
|
||||
{
|
||||
FlashcardsCreateCategoryDialog *self
|
||||
= g_object_new (FLASHCARDS_CREATE_CATEGORY_DIALOG_TYPE, nullptr);
|
||||
self->win = win;
|
||||
return self;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user