From 2fce117d157cefd28be10e6b1be25a2d04f1d8aa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 26 Oct 2022 21:27:24 -0400 Subject: [PATCH] Add GtkDialogError This error domain will be used by async apis in future commits. --- gtk/gtk.h | 1 + gtk/gtkdialogerror.c | 27 +++++++++++++++++++ gtk/gtkdialogerror.h | 62 ++++++++++++++++++++++++++++++++++++++++++++ gtk/meson.build | 2 ++ 4 files changed, 92 insertions(+) create mode 100644 gtk/gtkdialogerror.c create mode 100644 gtk/gtkdialogerror.h diff --git a/gtk/gtk.h b/gtk/gtk.h index 21727f7abc..ae9bb22f80 100644 --- a/gtk/gtk.h +++ b/gtk/gtk.h @@ -95,6 +95,7 @@ #include #include #include +#include #include #include #include diff --git a/gtk/gtkdialogerror.c b/gtk/gtkdialogerror.c new file mode 100644 index 0000000000..a968c68b65 --- /dev/null +++ b/gtk/gtkdialogerror.c @@ -0,0 +1,27 @@ +/* GTK - The GIMP Toolkit + * + * Copyright (C) 2022 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +#include "config.h" + +#include "gtk/gtkdialogerror.h" + +GQuark +gtk_dialog_error_quark (void) +{ + return g_quark_from_static_string ("gtk-dialog-error-quark"); +} diff --git a/gtk/gtkdialogerror.h b/gtk/gtkdialogerror.h new file mode 100644 index 0000000000..f2ce55c065 --- /dev/null +++ b/gtk/gtkdialogerror.h @@ -0,0 +1,62 @@ +/* GTK - The GIMP Toolkit + * + * Copyright (C) 2022 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +#pragma once + +#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +/** + * GTK_DIALOG_ERROR: + * + * The error domain for errors returned by async dialog functions. + * + * Since: 4.10 + */ +#define GTK_DIALOG_ERROR (gtk_dialog_error_quark ()) + +/** + * GtkDialogError: + * @GTK_DIALOG_ERROR_FAILED: Generic error condition for when + * an operation fails and no more specific code is applicable + * @GTK_DIALOG_ERROR_ABORTED: The async function call was aborted + * programmatically (via its `GCancellable`) + * @GTK_DIALOG_ERROR_CANCELLED: The async operation was cancelled + * by the user (via a Close button) + * + * Error codes in the `GTK_DIALOG_ERROR` domain that can be returned + * by async dialog functions. + * + * Since: 4.10 + */ +typedef enum +{ + GTK_DIALOG_ERROR_FAILED, + GTK_DIALOG_ERROR_ABORTED, + GTK_DIALOG_ERROR_CANCELLED +} GtkDialogError; + +GDK_AVAILABLE_IN_4_10 +GQuark gtk_dialog_error_quark (void); + +G_END_DECLS diff --git a/gtk/meson.build b/gtk/meson.build index d7357d8576..2a4b9556f4 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -199,6 +199,7 @@ gtk_public_sources = files([ 'gtkcustomlayout.c', 'gtkcustomsorter.c', 'gtkdialog.c', + 'gtkdialogerror.c', 'gtkdirectorylist.c', 'gtkdragicon.c', 'gtkdragsource.c', @@ -455,6 +456,7 @@ gtk_public_headers = files([ 'gtkcustomsorter.h', 'gtkdebug.h', 'gtkdialog.h', + 'gtkdialogerror.h', 'gtkdirectorylist.h', 'gtkdragicon.h', 'gtkdragsource.h',