[gtksourceview/wip/loader-saver] Move error_quark() from File to FileLoader



commit 4582ba8337ff3db874f69f0952fff217fae4b3ed
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Mar 31 18:22:12 2014 +0200

    Move error_quark() from File to FileLoader

 gtksourceview/gtksourcebufferoutputstream.c |    7 ++++---
 gtksourceview/gtksourcebufferoutputstream.h |    1 -
 gtksourceview/gtksourcefile.c               |   13 -------------
 gtksourceview/gtksourcefile.h               |   12 ------------
 gtksourceview/gtksourcefileloader.c         |   21 +++++++++++++++++----
 gtksourceview/gtksourcefileloader.h         |   12 ++++++++++++
 6 files changed, 33 insertions(+), 33 deletions(-)
---
diff --git a/gtksourceview/gtksourcebufferoutputstream.c b/gtksourceview/gtksourcebufferoutputstream.c
index 880772b..5fd3133 100644
--- a/gtksourceview/gtksourcebufferoutputstream.c
+++ b/gtksourceview/gtksourcebufferoutputstream.c
@@ -26,6 +26,7 @@
 #include "gtksourcebuffer.h"
 #include "gtksourcebuffer-private.h"
 #include "gtksourceencoding.h"
+#include "gtksourcefileloader.h"
 #include "gtksourceview-i18n.h"
 
 /* NOTE: never use async methods on this stream, the stream is just
@@ -833,9 +834,9 @@ gtk_source_buffer_output_stream_write (GOutputStream  *stream,
                if (ostream->priv->charset_conv == NULL &&
                    !ostream->priv->is_utf8)
                {
-                       g_set_error_literal (error, GTK_SOURCE_FILE_ERROR,
-                                            GTK_SOURCE_FILE_ERROR_ENCODING_AUTO_DETECTION_FAILED,
-                                            _("It is not possible to detect the encoding automatically"));
+                       g_set_error_literal (error, GTK_SOURCE_FILE_LOADER_ERROR,
+                                            GTK_SOURCE_FILE_LOADER_ERROR_ENCODING_AUTO_DETECTION_FAILED,
+                                            "It is not possible to detect the encoding automatically");
 
                        return -1;
                }
diff --git a/gtksourceview/gtksourcebufferoutputstream.h b/gtksourceview/gtksourcebufferoutputstream.h
index 4f93ca8..863b8bd 100644
--- a/gtksourceview/gtksourcebufferoutputstream.h
+++ b/gtksourceview/gtksourcebufferoutputstream.h
@@ -27,7 +27,6 @@
 #include "gtksourcetypes.h"
 #include "gtksourcetypes-private.h"
 #include "gtksourcebuffer.h"
-#include "gtksourcefile.h"
 
 G_BEGIN_DECLS
 
diff --git a/gtksourceview/gtksourcefile.c b/gtksourceview/gtksourcefile.c
index 740f778..55180aa 100644
--- a/gtksourceview/gtksourcefile.c
+++ b/gtksourceview/gtksourcefile.c
@@ -242,19 +242,6 @@ gtk_source_file_init (GtkSourceFile *self)
        self->priv = gtk_source_file_get_instance_private (self);
 }
 
-GQuark
-gtk_source_file_error_quark (void)
-{
-       static GQuark quark = 0;
-
-       if (G_UNLIKELY (quark == 0))
-       {
-               quark = g_quark_from_static_string ("gtk-source-file-error");
-       }
-
-       return quark;
-}
-
 /**
  * gtk_source_file_new:
  * @location: a #GFile.
diff --git a/gtksourceview/gtksourcefile.h b/gtksourceview/gtksourcefile.h
index f6b2c88..f80200b 100644
--- a/gtksourceview/gtksourcefile.h
+++ b/gtksourceview/gtksourcefile.h
@@ -39,16 +39,6 @@ G_BEGIN_DECLS
 typedef struct _GtkSourceFileClass    GtkSourceFileClass;
 typedef struct _GtkSourceFilePrivate  GtkSourceFilePrivate;
 
-#define GTK_SOURCE_FILE_ERROR gtk_source_file_error_quark ()
-
-/* TODO document the errors */
-enum
-{
-       GTK_SOURCE_FILE_ERROR_TOO_BIG,
-       GTK_SOURCE_FILE_ERROR_ENCODING_AUTO_DETECTION_FAILED,
-       GTK_SOURCE_FILE_ERROR_CONVERSION_FALLBACK
-};
-
 struct _GtkSourceFile
 {
        GObject parent;
@@ -63,8 +53,6 @@ struct _GtkSourceFileClass
 
 GType                   gtk_source_file_get_type               (void) G_GNUC_CONST;
 
-GQuark                  gtk_source_file_error_quark            (void);
-
 GtkSourceFile          *gtk_source_file_new                    (GFile                    *location,
                                                                 GtkSourceBuffer          *buffer);
 
diff --git a/gtksourceview/gtksourcefileloader.c b/gtksourceview/gtksourcefileloader.c
index 8be41d7..b44e522 100644
--- a/gtksourceview/gtksourcefileloader.c
+++ b/gtksourceview/gtksourcefileloader.c
@@ -360,8 +360,8 @@ close_input_stream_cb (GInputStream        *input_stream,
        if (gtk_source_buffer_output_stream_get_num_fallbacks (output_stream) > 0)
        {
                g_task_return_new_error (loader->priv->task,
-                                        GTK_SOURCE_FILE_ERROR,
-                                        GTK_SOURCE_FILE_ERROR_CONVERSION_FALLBACK,
+                                        GTK_SOURCE_FILE_LOADER_ERROR,
+                                        GTK_SOURCE_FILE_LOADER_ERROR_CONVERSION_FALLBACK,
                                         "There was a conversion error and it was "
                                         "needed to use a fallback char");
                return;
@@ -443,8 +443,8 @@ read_cb (GInputStream        *input_stream,
        if (loader->priv->total_bytes_read + loader->priv->chunk_bytes_read < loader->priv->total_bytes_read)
        {
                g_task_return_new_error (loader->priv->task,
-                                        GTK_SOURCE_FILE_ERROR,
-                                        GTK_SOURCE_FILE_ERROR_TOO_BIG,
+                                        GTK_SOURCE_FILE_LOADER_ERROR,
+                                        GTK_SOURCE_FILE_LOADER_ERROR_TOO_BIG,
                                         "File too big");
                return;
        }
@@ -693,6 +693,19 @@ open_file (GtkSourceFileLoader *loader)
                           loader);
 }
 
+GQuark
+gtk_source_file_loader_error_quark (void)
+{
+       static GQuark quark = 0;
+
+       if (G_UNLIKELY (quark == 0))
+       {
+               quark = g_quark_from_static_string ("gtk-source-file-loader-error");
+       }
+
+       return quark;
+}
+
 /**
  * gtk_source_file_loader_new:
  * @buffer: the output #GtkSourceBuffer.
diff --git a/gtksourceview/gtksourcefileloader.h b/gtksourceview/gtksourcefileloader.h
index 056a1a5..2732d90 100644
--- a/gtksourceview/gtksourcefileloader.h
+++ b/gtksourceview/gtksourcefileloader.h
@@ -41,6 +41,16 @@ G_BEGIN_DECLS
 typedef struct _GtkSourceFileLoaderClass   GtkSourceFileLoaderClass;
 typedef struct _GtkSourceFileLoaderPrivate GtkSourceFileLoaderPrivate;
 
+#define GTK_SOURCE_FILE_LOADER_ERROR gtk_source_file_loader_error_quark ()
+
+/* TODO document the errors */
+enum
+{
+       GTK_SOURCE_FILE_LOADER_ERROR_TOO_BIG,
+       GTK_SOURCE_FILE_LOADER_ERROR_ENCODING_AUTO_DETECTION_FAILED,
+       GTK_SOURCE_FILE_LOADER_ERROR_CONVERSION_FALLBACK
+};
+
 struct _GtkSourceFileLoader
 {
        GObject parent;
@@ -55,6 +65,8 @@ struct _GtkSourceFileLoaderClass
 
 GType                   gtk_source_file_loader_get_type        (void) G_GNUC_CONST;
 
+GQuark                  gtk_source_file_loader_error_quark     (void);
+
 GtkSourceFileLoader    *gtk_source_file_loader_new             (GtkSourceBuffer         *buffer,
                                                                 GFile                   *file);
 


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