[libgda] gdaui-rt-editor: added error domain
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] gdaui-rt-editor: added error domain
- Date: Wed, 10 Oct 2018 16:58:58 +0000 (UTC)
commit ad487eb690e09dba878188ba6f7fc1a3b36a0439
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Oct 10 10:31:21 2018 -0500
gdaui-rt-editor: added error domain
libgda-ui/gdaui-rt-editor.c | 11 +++++++++++
libgda-ui/gdaui-rt-editor.h | 9 +++++++++
testing/gdaui-test-rt-editor.c | 10 +++++-----
3 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/libgda-ui/gdaui-rt-editor.c b/libgda-ui/gdaui-rt-editor.c
index 143072f2d..4866959a4 100644
--- a/libgda-ui/gdaui-rt-editor.c
+++ b/libgda-ui/gdaui-rt-editor.c
@@ -26,6 +26,17 @@
#define MAX_BULLETS 2
//gchar * bullet_strings[] = {"•", "◦"};
#include <libgda-ui.h>
+
+
+/* module error */
+GQuark gdaui_rt_editor_error_quark (void)
+{
+ static GQuark quark;
+ if (!quark)
+ quark = g_quark_from_static_string ("gdaui_rt_editor_error");
+ return quark;
+}
+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
GdkPixbuf *bullet_pix[MAX_BULLETS] = {NULL};
diff --git a/libgda-ui/gdaui-rt-editor.h b/libgda-ui/gdaui-rt-editor.h
index b0b14f3c2..2010c7a27 100644
--- a/libgda-ui/gdaui-rt-editor.h
+++ b/libgda-ui/gdaui-rt-editor.h
@@ -25,6 +25,15 @@
G_BEGIN_DECLS
+/* error reporting */
+extern GQuark gdaui_rt_editor_error_quark (void);
+#define GDAUI_RT_EDITOR_ERROR gdaui_rt_editor_error_quark ()
+
+typedef enum {
+ GDAUI_RT_EDITOR_GENERAL_ERROR
+} GdauiRtEditorError;
+
+
#define GDAUI_TYPE_RT_EDITOR (gdaui_rt_editor_get_type())
G_DECLARE_DERIVABLE_TYPE(GdauiRtEditor, gdaui_rt_editor, GDAUI, RT_EDITOR, GtkBox)
/* struct for the object's class */
diff --git a/testing/gdaui-test-rt-editor.c b/testing/gdaui-test-rt-editor.c
index 603273c4d..d1814ed2e 100644
--- a/testing/gdaui-test-rt-editor.c
+++ b/testing/gdaui-test-rt-editor.c
@@ -40,7 +40,7 @@ textbuffers_equal (GtkTextBuffer *buffer1, GtkTextBuffer *buffer2, GError **erro
ch1 = gtk_text_iter_get_char (&iter1);
ch2 = gtk_text_iter_get_char (&iter2);
if (ch1 != ch2) {
- g_set_error (error, 0, 0, "difference at line %d, offset %d",
+ g_set_error (error, GDAUI_RT_EDITOR_ERROR, GDAUI_RT_EDITOR_GENERAL_ERROR, "difference
at line %d, offset %d",
gtk_text_iter_get_line (&iter1),
gtk_text_iter_get_line_offset (&iter1));
return FALSE;
@@ -67,7 +67,7 @@ textbuffers_equal (GtkTextBuffer *buffer1, GtkTextBuffer *buffer2, GError **erro
}
}
if (!p2) {
- g_set_error (error, 0, 0, "Missing text tag in textbuffer2 "
+ g_set_error (error, GDAUI_RT_EDITOR_ERROR, GDAUI_RT_EDITOR_GENERAL_ERROR,
"Missing text tag in textbuffer2 "
"at line %d, offset %d",
gtk_text_iter_get_line (&iter1),
gtk_text_iter_get_line_offset (&iter1));
@@ -80,7 +80,7 @@ textbuffers_equal (GtkTextBuffer *buffer1, GtkTextBuffer *buffer2, GError **erro
break;
}
if (!p1) {
- g_set_error (error, 0, 0, "Missing text tag in textbuffer1 "
+ g_set_error (error, GDAUI_RT_EDITOR_ERROR, GDAUI_RT_EDITOR_GENERAL_ERROR,
"Missing text tag in textbuffer1 "
"at line %d, offset %d",
gtk_text_iter_get_line (&iter1),
gtk_text_iter_get_line_offset (&iter1));
@@ -97,11 +97,11 @@ textbuffers_equal (GtkTextBuffer *buffer1, GtkTextBuffer *buffer2, GError **erro
gtk_text_buffer_get_end_iter (buffer1, &end1);
gtk_text_buffer_get_end_iter (buffer2, &end2);
if (gtk_text_iter_compare (&iter1, &end1)) {
- g_set_error (error, 0, 0, "%s", "textbuffer1 is shorter than textbuffer2");
+ g_set_error (error, GDAUI_RT_EDITOR_ERROR, GDAUI_RT_EDITOR_GENERAL_ERROR, "%s", "textbuffer1
is shorter than textbuffer2");
return FALSE;
}
if (gtk_text_iter_compare (&iter2, &end2)) {
- g_set_error (error, 0, 0, "%s", "textbuffer2 is shorter than textbuffer1");
+ g_set_error (error, GDAUI_RT_EDITOR_ERROR, GDAUI_RT_EDITOR_GENERAL_ERROR, "%s", "textbuffer2
is shorter than textbuffer1");
return FALSE;
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]