[libgda] gdaui-plugin: added error domain



commit 591ea164a930d6648203855749334427e12dfa6c
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Oct 10 10:51:39 2018 -0500

    gdaui-plugin: added error domain

 examples/CustomUIPlugin/libmain.c |  2 +-
 libgda-ui/Makefile.am             |  1 +
 libgda-ui/gdaui-plugin.c          | 30 ++++++++++++++++++++++++++++++
 libgda-ui/gdaui-plugin.h          | 10 +++++++++-
 libgda-ui/meson.build             |  1 +
 5 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/examples/CustomUIPlugin/libmain.c b/examples/CustomUIPlugin/libmain.c
index f2f5cf12e..a6b1d73d2 100644
--- a/examples/CustomUIPlugin/libmain.c
+++ b/examples/CustomUIPlugin/libmain.c
@@ -49,7 +49,7 @@ plugin_init (GError **error)
        file = gda_gbr_get_file_path (GDA_LIB_DIR, "libgda-6.0", "plugins", "custom-entry-password.xml", 
NULL);
        if (! g_file_test (file, G_FILE_TEST_EXISTS)) {
                if (error && !*error)
-                       g_set_error (error, 0, 0, "Missing spec. file '%s'", file);
+                       g_set_error (error, GDAUI_PLUGIN_ERROR, GDAUI_PLUGIN_GENERAL_ERROR, "Missing spec. 
file '%s'", file);
         }
        else {
                gsize len;
diff --git a/libgda-ui/Makefile.am b/libgda-ui/Makefile.am
index 61e78d477..7fe92787f 100644
--- a/libgda-ui/Makefile.am
+++ b/libgda-ui/Makefile.am
@@ -61,6 +61,7 @@ ui_sources = \
        gdaui-grid.c \
        gdaui-cloud.c \
        gdaui-login.c \
+       gdaui-plugin.c \
        gdaui-provider-selector.c \
        gdaui-raw-form.c \
        gdaui-raw-grid.c \
diff --git a/libgda-ui/gdaui-plugin.c b/libgda-ui/gdaui-plugin.c
new file mode 100644
index 000000000..d07dc2cce
--- /dev/null
+++ b/libgda-ui/gdaui-plugin.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2018 Daniel Espinosa <esodan gmail com>
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include <gmodule.h>
+
+/* module error */
+GQuark gdaui_plugin_error_quark (void)
+{
+        static GQuark quark;
+        if (!quark)
+                quark = g_quark_from_static_string ("gdaui_plugin_error");
+        return quark;
+}
+
diff --git a/libgda-ui/gdaui-plugin.h b/libgda-ui/gdaui-plugin.h
index 5fb712253..18ba170c6 100644
--- a/libgda-ui/gdaui-plugin.h
+++ b/libgda-ui/gdaui-plugin.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 - 2012 Vivien Malerba <malerba gnome-db org>
- * Copyright (C) 2013 Daniel Espinosa <esodan gmail com>
+ * Copyright (C) 2013,2018 Daniel Espinosa <esodan gmail com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,6 +26,14 @@
 #include <libgda-ui/gdaui-data-entry.h>
 #include "gdaui-decl.h"
 
+/* error reporting */
+extern GQuark gdaui_plugin_error_quark (void);
+#define GDAUI_PLUGIN_ERROR gdaui_plugin_error_quark ()
+
+typedef enum {
+       GDAUI_PLUGIN_GENERAL_ERROR
+} GdauiPluginError;
+
 /**
  * GdauiEntryCreateFunc:
  * @handler: a #GdaDataHandler
diff --git a/libgda-ui/meson.build b/libgda-ui/meson.build
index a79b9f598..d53107c3e 100644
--- a/libgda-ui/meson.build
+++ b/libgda-ui/meson.build
@@ -56,6 +56,7 @@ libgda_ui_sources = files([
        'gdaui-grid.c',
        'gdaui-cloud.c',
        'gdaui-login.c',
+       'gdaui-plugin.c',
        'gdaui-provider-selector.c',
        'gdaui-raw-form.c',
        'gdaui-raw-grid.c',


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