Add GtkDialogError
authorMatthias Clasen <mclasen@redhat.com>
Thu, 27 Oct 2022 01:27:24 +0000 (21:27 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 29 Oct 2022 14:18:37 +0000 (10:18 -0400)
This error domain will be used by async apis
in future commits.

gtk/gtk.h
gtk/gtkdialogerror.c [new file with mode: 0644]
gtk/gtkdialogerror.h [new file with mode: 0644]
gtk/meson.build

index 21727f7abc89f1ca57f2fdaff7da4638fb578a47..ae9bb22f808a2e8befe23d36ddc88d89899703eb 100644 (file)
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -95,6 +95,7 @@
 #include <gtk/gtkcustomsorter.h>
 #include <gtk/gtkdebug.h>
 #include <gtk/gtkdialog.h>
+#include <gtk/gtkdialogerror.h>
 #include <gtk/gtkdirectorylist.h>
 #include <gtk/gtkdragicon.h>
 #include <gtk/gtkdragsource.h>
diff --git a/gtk/gtkdialogerror.c b/gtk/gtkdialogerror.c
new file mode 100644 (file)
index 0000000..a968c68
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+#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 (file)
index 0000000..f2ce55c
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#include <gdk/gdk.h>
+
+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
index d7357d8576710eae7b61c16ccb4d0042be190555..2a4b9556f43394d9a19eb892dd336d46b3558649 100644 (file)
@@ -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',