[gtk/image-loading: 8/38] texture: Add error enum




commit 2b4be0b9a2d802365d6411c03d4a21337914ab23
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 13 20:51:42 2021 -0400

    texture: Add error enum

 gdk/gdktexture.c |  2 ++
 gdk/gdktexture.h | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index edcf7a9d9c..ed5b7816b3 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -47,6 +47,8 @@
 
 #include <graphene.h>
 
+G_DEFINE_QUARK (gdk-texture-error-quark, gdk_texture_error)
+
 /* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
 void
 gtk_snapshot_append_texture (GdkSnapshot            *snapshot,
diff --git a/gdk/gdktexture.h b/gdk/gdktexture.h
index 7cccdb5928..fa04135a90 100644
--- a/gdk/gdktexture.h
+++ b/gdk/gdktexture.h
@@ -38,6 +38,25 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkTexture, g_object_unref)
 
 typedef struct _GdkTextureClass        GdkTextureClass;
 
+#define GDK_TEXTURE_ERROR       (gdk_texture_error_quark ())
+
+GDK_AVAILABLE_IN_4_6
+GQuark gdk_texture_error_quark (void);
+
+/**
+ * GdkTextureError:
+ * @GDK_TEXTURE_ERROR_INSUFFICIENT_MEMORY: Not enough memory to handle this image
+ * @GDK_TEXTURE_ERROR_CORRUPT_IMAGE: The image data appears corrupted
+ * @GDK_TEXTURE_ERROR_UNSUPPORTED: The image format is not supported
+ *
+ * Possible errors that can be returned by `GdkTexture` constructors.
+ */
+typedef enum
+{
+  GDK_TEXTURE_ERROR_INSUFFICIENT_MEMORY,
+  GDK_TEXTURE_ERROR_CORRUPT_IMAGE,
+  GDK_TEXTURE_ERROR_UNSUPPORTED,
+} GdkTextureError;
 
 GDK_AVAILABLE_IN_ALL
 GType                   gdk_texture_get_type                   (void) G_GNUC_CONST;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]