[libgda] gda-dir-blob-op: added error domain



commit 39a1ede50d6b678279ef4eec797b21171b604b99
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Oct 10 10:50:42 2018 -0500

    gda-dir-blob-op: added error domain

 doc/C/libgda/examples/blobtest.c |  2 +-
 examples/Blobs/blobtest.c        |  2 +-
 libgda/dir-blob-op.c             | 10 ++++++++++
 libgda/dir-blob-op.h             | 10 ++++++++++
 4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/doc/C/libgda/examples/blobtest.c b/doc/C/libgda/examples/blobtest.c
index b3c33aa03..b89a07a7f 100644
--- a/doc/C/libgda/examples/blobtest.c
+++ b/doc/C/libgda/examples/blobtest.c
@@ -84,7 +84,7 @@ do_store (GdaConnection *cnc, const gchar *filename, GError **error)
 {
        if (! g_file_test (filename, G_FILE_TEST_EXISTS) ||
            g_file_test (filename, G_FILE_TEST_IS_DIR)) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, GDA_DIR_BLOB_OP_ERROR, GDA_DIR_BLOB_OP_GENERAL_ERROR,
                             "%s", "File does not exist or is a directory");
                return FALSE;
        }
diff --git a/examples/Blobs/blobtest.c b/examples/Blobs/blobtest.c
index 5494e8de6..8663639b9 100644
--- a/examples/Blobs/blobtest.c
+++ b/examples/Blobs/blobtest.c
@@ -100,7 +100,7 @@ do_store (GdaConnection *cnc, const gchar *filename, GError **error)
 {
        if (! g_file_test (filename, G_FILE_TEST_EXISTS) ||
            g_file_test (filename, G_FILE_TEST_IS_DIR)) {
-               g_set_error (error, 0, 0,
+               g_set_error (error, GDA_DIR_BLOB_OP_ERROR, GDA_DIR_BLOB_OP_GENERAL_ERROR,
                             "%s", "File does not exist or is a directory");
                return FALSE;
        }
diff --git a/libgda/dir-blob-op.c b/libgda/dir-blob-op.c
index 2a6c1e444..a20d4732c 100644
--- a/libgda/dir-blob-op.c
+++ b/libgda/dir-blob-op.c
@@ -28,6 +28,16 @@
 #include <unistd.h>
 #include <glib/gstdio.h>
 
+/* module error */
+GQuark gda_dir_blob_op_error_quark (void)
+{
+        static GQuark quark;
+        if (!quark)
+                quark = g_quark_from_static_string ("gda_dir_blob_op_error");
+        return quark;
+}
+
+
 typedef struct  {
        gchar *complete_filename;
 } GdaDirBlobOpPrivate;
diff --git a/libgda/dir-blob-op.h b/libgda/dir-blob-op.h
index 5f6248481..a1218fa64 100644
--- a/libgda/dir-blob-op.h
+++ b/libgda/dir-blob-op.h
@@ -29,6 +29,16 @@
 
 G_BEGIN_DECLS
 
+
+/* error reporting */
+extern GQuark gda_dir_blob_op_error_quark (void);
+#define GDA_DIR_BLOB_OP_ERROR gda_dir_blob_op_error_quark ()
+
+typedef enum {
+       GDA_DIR_BLOB_OP_GENERAL_ERROR
+} GdaDirBlobOpError;
+
+
 #define GDA_TYPE_DIR_BLOB_OP            (gda_dir_blob_op_get_type())
 G_DECLARE_DERIVABLE_TYPE(GdaDirBlobOp, gda_dir_blob_op, GDA, DIR_BLOB_OP, GdaBlobOp)
 


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