[gtksourceview/wip/chergert/snippets: 15/119] file: modernize GtkSourceFileLoader



commit c888344eb9f23ac0aa4467ebc716b2399aba67f6
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 8 20:03:57 2020 -0800

    file: modernize GtkSourceFileLoader
    
     - Use G_DECLARE_ macros
     - Use get_instance_private
     - Fix spacing style for multi-line functions

 gtksourceview/gtksourceautocleanups.h |   1 -
 gtksourceview/gtksourcefileloader.c   | 251 +++++++++++++++++-----------------
 gtksourceview/gtksourcefileloader.h   |  96 ++++---------
 3 files changed, 155 insertions(+), 193 deletions(-)
---
diff --git a/gtksourceview/gtksourceautocleanups.h b/gtksourceview/gtksourceautocleanups.h
index 7141b7aa..2ed4003b 100644
--- a/gtksourceview/gtksourceautocleanups.h
+++ b/gtksourceview/gtksourceautocleanups.h
@@ -28,7 +28,6 @@ G_BEGIN_DECLS
 
 #ifndef __GI_SCANNER__
 
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSourceFileLoader, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSourceFileSaver, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSourceGutter, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSourceGutterRenderer, g_object_unref)
diff --git a/gtksourceview/gtksourcefileloader.c b/gtksourceview/gtksourcefileloader.c
index 54e446be..09b329a3 100644
--- a/gtksourceview/gtksourcefileloader.c
+++ b/gtksourceview/gtksourcefileloader.c
@@ -87,8 +87,10 @@ enum
                                G_FILE_ATTRIBUTE_STANDARD_SIZE "," \
                                G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE
 
-struct _GtkSourceFileLoaderPrivate
+struct _GtkSourceFileLoader
 {
+       GObject parent_instance;
+
        /* Weak ref to the GtkSourceBuffer. A strong ref could create a
         * reference cycle in an application. For example a subclass of
         * GtkSourceBuffer can have a strong ref to the FileLoader.
@@ -117,8 +119,7 @@ struct _GtkSourceFileLoaderPrivate
        GTask *task;
 };
 
-typedef struct _TaskData TaskData;
-struct _TaskData
+typedef struct
 {
        /* The two streams cannot be spliced directly, because:
         * (1) We need to call the progress callback.
@@ -142,11 +143,11 @@ struct _TaskData
 
        guint guess_content_type_from_content : 1;
        guint tried_mount : 1;
-};
+} TaskData;
 
-G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceFileLoader, gtk_source_file_loader, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GtkSourceFileLoader, gtk_source_file_loader, G_TYPE_OBJECT)
 
-static void open_file (GTask *task);
+static void open_file       (GTask *task);
 static void read_file_chunk (GTask *task);
 
 static TaskData *
@@ -195,36 +196,36 @@ get_compression_type_from_content_type (const gchar *content_type)
 
 static void
 gtk_source_file_loader_set_property (GObject      *object,
-                                    guint         prop_id,
-                                    const GValue *value,
-                                    GParamSpec   *pspec)
+                                     guint         prop_id,
+                                     const GValue *value,
+                                     GParamSpec   *pspec)
 {
        GtkSourceFileLoader *loader = GTK_SOURCE_FILE_LOADER (object);
 
        switch (prop_id)
        {
                case PROP_BUFFER:
-                       g_assert (loader->priv->source_buffer == NULL);
-                       loader->priv->source_buffer = g_value_get_object (value);
-                       g_object_add_weak_pointer (G_OBJECT (loader->priv->source_buffer),
-                                                  (gpointer *)&loader->priv->source_buffer);
+                       g_assert (loader->source_buffer == NULL);
+                       loader->source_buffer = g_value_get_object (value);
+                       g_object_add_weak_pointer (G_OBJECT (loader->source_buffer),
+                                                  (gpointer *)&loader->source_buffer);
                        break;
 
                case PROP_FILE:
-                       g_assert (loader->priv->file == NULL);
-                       loader->priv->file = g_value_get_object (value);
-                       g_object_add_weak_pointer (G_OBJECT (loader->priv->file),
-                                                  (gpointer *)&loader->priv->file);
+                       g_assert (loader->file == NULL);
+                       loader->file = g_value_get_object (value);
+                       g_object_add_weak_pointer (G_OBJECT (loader->file),
+                                                  (gpointer *)&loader->file);
                        break;
 
                case PROP_LOCATION:
-                       g_assert (loader->priv->location == NULL);
-                       loader->priv->location = g_value_dup_object (value);
+                       g_assert (loader->location == NULL);
+                       loader->location = g_value_dup_object (value);
                        break;
 
                case PROP_INPUT_STREAM:
-                       g_assert (loader->priv->input_stream_property == NULL);
-                       loader->priv->input_stream_property = g_value_dup_object (value);
+                       g_assert (loader->input_stream_property == NULL);
+                       loader->input_stream_property = g_value_dup_object (value);
                        break;
 
                default:
@@ -235,28 +236,28 @@ gtk_source_file_loader_set_property (GObject      *object,
 
 static void
 gtk_source_file_loader_get_property (GObject    *object,
-                                    guint       prop_id,
-                                    GValue     *value,
-                                    GParamSpec *pspec)
+                                     guint       prop_id,
+                                     GValue     *value,
+                                     GParamSpec *pspec)
 {
        GtkSourceFileLoader *loader = GTK_SOURCE_FILE_LOADER (object);
 
        switch (prop_id)
        {
                case PROP_BUFFER:
-                       g_value_set_object (value, loader->priv->source_buffer);
+                       g_value_set_object (value, loader->source_buffer);
                        break;
 
                case PROP_FILE:
-                       g_value_set_object (value, loader->priv->file);
+                       g_value_set_object (value, loader->file);
                        break;
 
                case PROP_LOCATION:
-                       g_value_set_object (value, loader->priv->location);
+                       g_value_set_object (value, loader->location);
                        break;
 
                case PROP_INPUT_STREAM:
-                       g_value_set_object (value, loader->priv->input_stream_property);
+                       g_value_set_object (value, loader->input_stream_property);
                        break;
 
                default:
@@ -270,28 +271,28 @@ gtk_source_file_loader_dispose (GObject *object)
 {
        GtkSourceFileLoader *loader = GTK_SOURCE_FILE_LOADER (object);
 
-       if (loader->priv->source_buffer != NULL)
+       if (loader->source_buffer != NULL)
        {
-               g_object_remove_weak_pointer (G_OBJECT (loader->priv->source_buffer),
-                                             (gpointer *)&loader->priv->source_buffer);
+               g_object_remove_weak_pointer (G_OBJECT (loader->source_buffer),
+                                             (gpointer *)&loader->source_buffer);
 
-               loader->priv->source_buffer = NULL;
+               loader->source_buffer = NULL;
        }
 
-       if (loader->priv->file != NULL)
+       if (loader->file != NULL)
        {
-               g_object_remove_weak_pointer (G_OBJECT (loader->priv->file),
-                                             (gpointer *)&loader->priv->file);
+               g_object_remove_weak_pointer (G_OBJECT (loader->file),
+                                             (gpointer *)&loader->file);
 
-               loader->priv->file = NULL;
+               loader->file = NULL;
        }
 
-       g_clear_object (&loader->priv->location);
-       g_clear_object (&loader->priv->input_stream_property);
-       g_clear_object (&loader->priv->task);
+       g_clear_object (&loader->location);
+       g_clear_object (&loader->input_stream_property);
+       g_clear_object (&loader->task);
 
-       g_slist_free (loader->priv->candidate_encodings);
-       loader->priv->candidate_encodings = NULL;
+       g_slist_free (loader->candidate_encodings);
+       loader->candidate_encodings = NULL;
 
        G_OBJECT_CLASS (gtk_source_file_loader_parent_class)->dispose (object);
 }
@@ -309,12 +310,12 @@ set_default_candidate_encodings (GtkSourceFileLoader *loader)
         */
        list = gtk_source_encoding_get_default_candidates ();
 
-       if (loader->priv->file == NULL)
+       if (loader->file == NULL)
        {
                goto end;
        }
 
-       file_encoding = gtk_source_file_get_encoding (loader->priv->file);
+       file_encoding = gtk_source_file_get_encoding (loader->file);
 
        if (file_encoding == NULL)
        {
@@ -340,8 +341,8 @@ set_default_candidate_encodings (GtkSourceFileLoader *loader)
        list = g_slist_prepend (list, (gpointer) file_encoding);
 
 end:
-       g_slist_free (loader->priv->candidate_encodings);
-       loader->priv->candidate_encodings = list;
+       g_slist_free (loader->candidate_encodings);
+       loader->candidate_encodings = list;
 }
 
 static void
@@ -349,18 +350,18 @@ gtk_source_file_loader_constructed (GObject *object)
 {
        GtkSourceFileLoader *loader = GTK_SOURCE_FILE_LOADER (object);
 
-       if (loader->priv->file != NULL)
+       if (loader->file != NULL)
        {
                set_default_candidate_encodings (loader);
 
-               if (loader->priv->location == NULL &&
-                   loader->priv->input_stream_property == NULL)
+               if (loader->location == NULL &&
+                   loader->input_stream_property == NULL)
                {
-                       loader->priv->location = gtk_source_file_get_location (loader->priv->file);
+                       loader->location = gtk_source_file_get_location (loader->file);
 
-                       if (loader->priv->location != NULL)
+                       if (loader->location != NULL)
                        {
-                               g_object_ref (loader->priv->location);
+                               g_object_ref (loader->location);
                        }
                        else
                        {
@@ -464,13 +465,13 @@ gtk_source_file_loader_class_init (GtkSourceFileLoaderClass *klass)
 static void
 gtk_source_file_loader_init (GtkSourceFileLoader *loader)
 {
-       loader->priv = gtk_source_file_loader_get_instance_private (loader);
+       loader = gtk_source_file_loader_get_instance_private (loader);
 }
 
 static void
 close_input_stream_cb (GObject      *source_object,
-                      GAsyncResult *result,
-                      gpointer      user_data)
+                       GAsyncResult *result,
+                       gpointer      user_data)
 {
        GInputStream *input_stream = G_INPUT_STREAM (source_object);
        GTask *task = G_TASK (user_data);
@@ -594,8 +595,8 @@ write_file_chunk (GTask *task)
 
 static void
 read_cb (GObject      *source_object,
-        GAsyncResult *result,
-        gpointer      user_data)
+         GAsyncResult *result,
+         gpointer      user_data)
 {
        GInputStream *input_stream = G_INPUT_STREAM (source_object);
        GTask *task = G_TASK (user_data);
@@ -655,10 +656,10 @@ read_cb (GObject      *source_object,
                /* Flush the stream to ensure proper line ending detection. */
                g_output_stream_flush (G_OUTPUT_STREAM (task_data->output_stream), NULL, NULL);
 
-               loader->priv->auto_detected_encoding =
+               loader->auto_detected_encoding =
                        gtk_source_buffer_output_stream_get_guessed (task_data->output_stream);
 
-               loader->priv->auto_detected_newline_type =
+               loader->auto_detected_newline_type =
                        gtk_source_buffer_output_stream_detect_newline_type (task_data->output_stream);
 
                write_complete (task);
@@ -715,11 +716,11 @@ create_input_stream (GTask *task)
        loader = g_task_get_source_object (task);
        task_data = g_task_get_task_data (task);
 
-       loader->priv->auto_detected_compression_type = GTK_SOURCE_COMPRESSION_TYPE_NONE;
+       loader->auto_detected_compression_type = GTK_SOURCE_COMPRESSION_TYPE_NONE;
 
-       if (loader->priv->input_stream_property != NULL)
+       if (loader->input_stream_property != NULL)
        {
-               task_data->input_stream = g_object_ref (loader->priv->input_stream_property);
+               task_data->input_stream = g_object_ref (loader->input_stream_property);
        }
        else if (g_file_info_has_attribute (task_data->info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE))
        {
@@ -729,7 +730,7 @@ create_input_stream (GTask *task)
                {
                        case GTK_SOURCE_COMPRESSION_TYPE_GZIP:
                                add_gzip_decompressor_stream (task);
-                               loader->priv->auto_detected_compression_type = 
GTK_SOURCE_COMPRESSION_TYPE_GZIP;
+                               loader->auto_detected_compression_type = GTK_SOURCE_COMPRESSION_TYPE_GZIP;
                                break;
 
                        case GTK_SOURCE_COMPRESSION_TYPE_NONE:
@@ -749,8 +750,8 @@ create_input_stream (GTask *task)
 
 static void
 query_info_cb (GObject      *source_object,
-              GAsyncResult *result,
-              gpointer      user_data)
+               GAsyncResult *result,
+               gpointer      user_data)
 {
        GFile *location = G_FILE (source_object);
        GTask *task = G_TASK (user_data);
@@ -793,8 +794,8 @@ query_info_cb (GObject      *source_object,
 
 static void
 mount_cb (GObject      *source_object,
-         GAsyncResult *result,
-         gpointer      user_data)
+          GAsyncResult *result,
+          gpointer      user_data)
 {
        GFile *location = G_FILE (source_object);
        GTask *task = G_TASK (user_data);
@@ -827,7 +828,7 @@ recover_not_mounted (GTask *task)
        loader = g_task_get_source_object (task);
        task_data = g_task_get_task_data (task);
 
-       mount_operation = _gtk_source_file_create_mount_operation (loader->priv->file);
+       mount_operation = _gtk_source_file_create_mount_operation (loader->file);
 
        DEBUG ({
               g_print ("%s\n", G_STRFUNC);
@@ -835,7 +836,7 @@ recover_not_mounted (GTask *task)
 
        task_data->tried_mount = TRUE;
 
-       g_file_mount_enclosing_volume (loader->priv->location,
+       g_file_mount_enclosing_volume (loader->location,
                                       G_MOUNT_MOUNT_NONE,
                                       mount_operation,
                                       g_task_get_cancellable (task),
@@ -847,8 +848,8 @@ recover_not_mounted (GTask *task)
 
 static void
 open_file_cb (GObject      *source_object,
-             GAsyncResult *result,
-             gpointer      user_data)
+              GAsyncResult *result,
+              gpointer      user_data)
 {
        GFile *location = G_FILE (source_object);
        GTask *task = G_TASK (user_data);
@@ -900,7 +901,7 @@ open_file (GTask *task)
 
        loader = g_task_get_source_object (task);
 
-       g_file_read_async (loader->priv->location,
+       g_file_read_async (loader->location,
                           g_task_get_priority (task),
                           g_task_get_cancellable (task),
                           open_file_cb,
@@ -936,7 +937,7 @@ gtk_source_file_loader_error_quark (void)
  */
 GtkSourceFileLoader *
 gtk_source_file_loader_new (GtkSourceBuffer *buffer,
-                           GtkSourceFile   *file)
+                            GtkSourceFile   *file)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_BUFFER (buffer), NULL);
        g_return_val_if_fail (GTK_SOURCE_IS_FILE (file), NULL);
@@ -960,8 +961,8 @@ gtk_source_file_loader_new (GtkSourceBuffer *buffer,
  */
 GtkSourceFileLoader *
 gtk_source_file_loader_new_from_stream (GtkSourceBuffer *buffer,
-                                       GtkSourceFile   *file,
-                                       GInputStream    *stream)
+                                        GtkSourceFile   *file,
+                                        GInputStream    *stream)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_BUFFER (buffer), NULL);
        g_return_val_if_fail (GTK_SOURCE_IS_FILE (file), NULL);
@@ -996,18 +997,18 @@ gtk_source_file_loader_new_from_stream (GtkSourceBuffer *buffer,
  */
 void
 gtk_source_file_loader_set_candidate_encodings (GtkSourceFileLoader *loader,
-                                               GSList              *candidate_encodings)
+                                                GSList              *candidate_encodings)
 {
        GSList *list;
 
        g_return_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader));
-       g_return_if_fail (loader->priv->task == NULL);
+       g_return_if_fail (loader->task == NULL);
 
        list = g_slist_copy (candidate_encodings);
        list = _gtk_source_encoding_remove_duplicates (list, GTK_SOURCE_ENCODING_DUPLICATES_KEEP_FIRST);
 
-       g_slist_free (loader->priv->candidate_encodings);
-       loader->priv->candidate_encodings = list;
+       g_slist_free (loader->candidate_encodings);
+       loader->candidate_encodings = list;
 }
 
 /**
@@ -1022,7 +1023,7 @@ gtk_source_file_loader_get_buffer (GtkSourceFileLoader *loader)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader), NULL);
 
-       return loader->priv->source_buffer;
+       return loader->source_buffer;
 }
 
 /**
@@ -1037,7 +1038,7 @@ gtk_source_file_loader_get_file (GtkSourceFileLoader *loader)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader), NULL);
 
-       return loader->priv->file;
+       return loader->file;
 }
 
 /**
@@ -1053,7 +1054,7 @@ gtk_source_file_loader_get_location (GtkSourceFileLoader *loader)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader), NULL);
 
-       return loader->priv->location;
+       return loader->location;
 }
 
 /**
@@ -1069,7 +1070,7 @@ gtk_source_file_loader_get_input_stream (GtkSourceFileLoader *loader)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader), NULL);
 
-       return loader->priv->input_stream_property;
+       return loader->input_stream_property;
 }
 
 /**
@@ -1100,36 +1101,36 @@ gtk_source_file_loader_get_input_stream (GtkSourceFileLoader *loader)
  */
 void
 gtk_source_file_loader_load_async (GtkSourceFileLoader   *loader,
-                                  gint                   io_priority,
-                                  GCancellable          *cancellable,
-                                  GFileProgressCallback  progress_callback,
-                                  gpointer               progress_callback_data,
-                                  GDestroyNotify         progress_callback_notify,
-                                  GAsyncReadyCallback    callback,
-                                  gpointer               user_data)
+                                   gint                   io_priority,
+                                   GCancellable          *cancellable,
+                                   GFileProgressCallback  progress_callback,
+                                   gpointer               progress_callback_data,
+                                   GDestroyNotify         progress_callback_notify,
+                                   GAsyncReadyCallback    callback,
+                                   gpointer               user_data)
 {
        TaskData *task_data;
        gboolean implicit_trailing_newline;
 
        g_return_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader));
        g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
-       g_return_if_fail (loader->priv->task == NULL);
+       g_return_if_fail (loader->task == NULL);
 
-       loader->priv->task = g_task_new (loader, cancellable, callback, user_data);
-       g_task_set_priority (loader->priv->task, io_priority);
+       loader->task = g_task_new (loader, cancellable, callback, user_data);
+       g_task_set_priority (loader->task, io_priority);
 
        task_data = task_data_new ();
-       g_task_set_task_data (loader->priv->task, task_data, task_data_free);
+       g_task_set_task_data (loader->task, task_data, task_data_free);
 
        task_data->progress_cb = progress_callback;
        task_data->progress_cb_data = progress_callback_data;
        task_data->progress_cb_notify = progress_callback_notify;
 
-       if (loader->priv->source_buffer == NULL ||
-           loader->priv->file == NULL ||
-           (loader->priv->location == NULL && loader->priv->input_stream_property == NULL))
+       if (loader->source_buffer == NULL ||
+           loader->file == NULL ||
+           (loader->location == NULL && loader->input_stream_property == NULL))
        {
-               g_task_return_boolean (loader->priv->task, FALSE);
+               g_task_return_boolean (loader->task, FALSE);
                return;
        }
 
@@ -1144,36 +1145,36 @@ gtk_source_file_loader_load_async (GtkSourceFileLoader   *loader,
         * location is directly needed (for example to display the filename in a
         * tab or an info bar with the progress information).
         */
-       if (loader->priv->input_stream_property != NULL)
+       if (loader->input_stream_property != NULL)
        {
-               gtk_source_file_set_location (loader->priv->file, NULL);
+               gtk_source_file_set_location (loader->file, NULL);
        }
        else
        {
-               gtk_source_file_set_location (loader->priv->file,
-                                             loader->priv->location);
+               gtk_source_file_set_location (loader->file,
+                                             loader->location);
        }
 
-       implicit_trailing_newline = gtk_source_buffer_get_implicit_trailing_newline 
(loader->priv->source_buffer);
+       implicit_trailing_newline = gtk_source_buffer_get_implicit_trailing_newline (loader->source_buffer);
 
        /* The BufferOutputStream has a strong reference to the buffer.
          * We create the BufferOutputStream here so we are sure that the
          * buffer will not be destroyed during the file loading.
          */
-       task_data->output_stream = gtk_source_buffer_output_stream_new (loader->priv->source_buffer,
-                                                                       loader->priv->candidate_encodings,
+       task_data->output_stream = gtk_source_buffer_output_stream_new (loader->source_buffer,
+                                                                       loader->candidate_encodings,
                                                                        implicit_trailing_newline);
 
-       if (loader->priv->input_stream_property != NULL)
+       if (loader->input_stream_property != NULL)
        {
                task_data->guess_content_type_from_content = TRUE;
                task_data->info = g_file_info_new ();
 
-               create_input_stream (loader->priv->task);
+               create_input_stream (loader->task);
        }
        else
        {
-               open_file (loader->priv->task);
+               open_file (loader->task);
        }
 }
 
@@ -1194,8 +1195,8 @@ gtk_source_file_loader_load_async (GtkSourceFileLoader   *loader,
  */
 gboolean
 gtk_source_file_loader_load_finish (GtkSourceFileLoader  *loader,
-                                   GAsyncResult         *result,
-                                   GError              **error)
+                                    GAsyncResult         *result,
+                                    GError              **error)
 {
        gboolean ok;
        gboolean update_file_properties;
@@ -1224,7 +1225,7 @@ gtk_source_file_loader_load_finish (GtkSourceFileLoader  *loader,
                                        real_error->domain == GTK_SOURCE_FILE_LOADER_ERROR &&
                                        real_error->code == GTK_SOURCE_FILE_LOADER_ERROR_CONVERSION_FALLBACK);
 
-       if (update_file_properties && loader->priv->file != NULL)
+       if (update_file_properties && loader->file != NULL)
        {
                TaskData *task_data;
 
@@ -1234,24 +1235,24 @@ gtk_source_file_loader_load_finish (GtkSourceFileLoader  *loader,
                 * operation.
                 */
 
-               _gtk_source_file_set_encoding (loader->priv->file,
-                                              loader->priv->auto_detected_encoding);
+               _gtk_source_file_set_encoding (loader->file,
+                                              loader->auto_detected_encoding);
 
-               _gtk_source_file_set_newline_type (loader->priv->file,
-                                                  loader->priv->auto_detected_newline_type);
+               _gtk_source_file_set_newline_type (loader->file,
+                                                  loader->auto_detected_newline_type);
 
-               _gtk_source_file_set_compression_type (loader->priv->file,
-                                                      loader->priv->auto_detected_compression_type);
+               _gtk_source_file_set_compression_type (loader->file,
+                                                      loader->auto_detected_compression_type);
 
-               _gtk_source_file_set_externally_modified (loader->priv->file, FALSE);
-               _gtk_source_file_set_deleted (loader->priv->file, FALSE);
+               _gtk_source_file_set_externally_modified (loader->file, FALSE);
+               _gtk_source_file_set_deleted (loader->file, FALSE);
 
                if (g_file_info_has_attribute (task_data->info, G_FILE_ATTRIBUTE_TIME_MODIFIED))
                {
                        GTimeVal modification_time;
 
                        g_file_info_get_modification_time (task_data->info, &modification_time);
-                       _gtk_source_file_set_modification_time (loader->priv->file, modification_time);
+                       _gtk_source_file_set_modification_time (loader->file, modification_time);
                }
 
                if (g_file_info_has_attribute (task_data->info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
@@ -1261,15 +1262,15 @@ gtk_source_file_loader_load_finish (GtkSourceFileLoader  *loader,
                        readonly = !g_file_info_get_attribute_boolean (task_data->info,
                                                                       G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
 
-                       _gtk_source_file_set_readonly (loader->priv->file, readonly);
+                       _gtk_source_file_set_readonly (loader->file, readonly);
                }
                else
                {
-                       _gtk_source_file_set_readonly (loader->priv->file, FALSE);
+                       _gtk_source_file_set_readonly (loader->file, FALSE);
                }
        }
 
-       g_clear_object (&loader->priv->task);
+       g_clear_object (&loader->task);
 
        if (real_error != NULL)
        {
@@ -1291,7 +1292,7 @@ gtk_source_file_loader_get_encoding (GtkSourceFileLoader *loader)
 {
        g_return_val_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader), NULL);
 
-       return loader->priv->auto_detected_encoding;
+       return loader->auto_detected_encoding;
 }
 
 /**
@@ -1307,7 +1308,7 @@ gtk_source_file_loader_get_newline_type (GtkSourceFileLoader *loader)
        g_return_val_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader),
                              GTK_SOURCE_NEWLINE_TYPE_LF);
 
-       return loader->priv->auto_detected_newline_type;
+       return loader->auto_detected_newline_type;
 }
 
 /**
@@ -1323,5 +1324,5 @@ gtk_source_file_loader_get_compression_type (GtkSourceFileLoader *loader)
        g_return_val_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader),
                              GTK_SOURCE_COMPRESSION_TYPE_NONE);
 
-       return loader->priv->auto_detected_compression_type;
+       return loader->auto_detected_compression_type;
 }
diff --git a/gtksourceview/gtksourcefileloader.h b/gtksourceview/gtksourcefileloader.h
index 1f45380f..09071090 100644
--- a/gtksourceview/gtksourcefileloader.h
+++ b/gtksourceview/gtksourcefileloader.h
@@ -33,17 +33,8 @@
 
 G_BEGIN_DECLS
 
-#define GTK_SOURCE_TYPE_FILE_LOADER              (gtk_source_file_loader_get_type())
-#define GTK_SOURCE_FILE_LOADER(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), 
GTK_SOURCE_TYPE_FILE_LOADER, GtkSourceFileLoader))
-#define GTK_SOURCE_FILE_LOADER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), 
GTK_SOURCE_TYPE_FILE_LOADER, GtkSourceFileLoaderClass))
-#define GTK_SOURCE_IS_FILE_LOADER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), 
GTK_SOURCE_TYPE_FILE_LOADER))
-#define GTK_SOURCE_IS_FILE_LOADER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GTK_SOURCE_TYPE_FILE_LOADER))
-#define GTK_SOURCE_FILE_LOADER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), 
GTK_SOURCE_TYPE_FILE_LOADER, GtkSourceFileLoaderClass))
-
-typedef struct _GtkSourceFileLoaderClass   GtkSourceFileLoaderClass;
-typedef struct _GtkSourceFileLoaderPrivate GtkSourceFileLoaderPrivate;
-
-#define GTK_SOURCE_FILE_LOADER_ERROR gtk_source_file_loader_error_quark ()
+#define GTK_SOURCE_TYPE_FILE_LOADER  (gtk_source_file_loader_get_type())
+#define GTK_SOURCE_FILE_LOADER_ERROR (gtk_source_file_loader_error_quark())
 
 /**
  * GtkSourceFileLoaderError:
@@ -62,76 +53,47 @@ typedef enum _GtkSourceFileLoaderError
        GTK_SOURCE_FILE_LOADER_ERROR_CONVERSION_FALLBACK
 } GtkSourceFileLoaderError;
 
-struct _GtkSourceFileLoader
-{
-       GObject parent;
-
-       GtkSourceFileLoaderPrivate *priv;
-};
-
-struct _GtkSourceFileLoaderClass
-{
-       GObjectClass parent_class;
-
-       gpointer padding[10];
-};
-
 GTK_SOURCE_AVAILABLE_IN_3_14
-GType                   gtk_source_file_loader_get_type        (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (GtkSourceFileLoader, gtk_source_file_loader, GTK_SOURCE, FILE_LOADER, GObject)
 
 GTK_SOURCE_AVAILABLE_IN_3_14
-GQuark                  gtk_source_file_loader_error_quark     (void);
-
+GQuark                    gtk_source_file_loader_error_quark             (void);
 GTK_SOURCE_AVAILABLE_IN_3_14
-GtkSourceFileLoader    *gtk_source_file_loader_new             (GtkSourceBuffer         *buffer,
-                                                                GtkSourceFile           *file);
-
+GtkSourceFileLoader      *gtk_source_file_loader_new                     (GtkSourceBuffer        *buffer,
+                                                                          GtkSourceFile          *file);
 GTK_SOURCE_AVAILABLE_IN_3_14
-GtkSourceFileLoader    *gtk_source_file_loader_new_from_stream (GtkSourceBuffer         *buffer,
-                                                                GtkSourceFile           *file,
-                                                                GInputStream            *stream);
-
+GtkSourceFileLoader      *gtk_source_file_loader_new_from_stream         (GtkSourceBuffer        *buffer,
+                                                                          GtkSourceFile          *file,
+                                                                          GInputStream           *stream);
 GTK_SOURCE_AVAILABLE_IN_3_14
-void                    gtk_source_file_loader_set_candidate_encodings
-                                                               (GtkSourceFileLoader     *loader,
-                                                                GSList                  
*candidate_encodings);
-
+void                      gtk_source_file_loader_set_candidate_encodings (GtkSourceFileLoader    *loader,
+                                                                          GSList                 
*candidate_encodings);
 GTK_SOURCE_AVAILABLE_IN_3_14
-GtkSourceBuffer                *gtk_source_file_loader_get_buffer      (GtkSourceFileLoader     *loader);
-
+GtkSourceBuffer          *gtk_source_file_loader_get_buffer              (GtkSourceFileLoader    *loader);
 GTK_SOURCE_AVAILABLE_IN_3_14
-GtkSourceFile          *gtk_source_file_loader_get_file        (GtkSourceFileLoader     *loader);
-
+GtkSourceFile            *gtk_source_file_loader_get_file                (GtkSourceFileLoader    *loader);
 GTK_SOURCE_AVAILABLE_IN_3_14
-GFile                  *gtk_source_file_loader_get_location    (GtkSourceFileLoader     *loader);
-
+GFile                    *gtk_source_file_loader_get_location            (GtkSourceFileLoader    *loader);
 GTK_SOURCE_AVAILABLE_IN_3_14
-GInputStream           *gtk_source_file_loader_get_input_stream
-                                                               (GtkSourceFileLoader     *loader);
-
+GInputStream             *gtk_source_file_loader_get_input_stream        (GtkSourceFileLoader    *loader);
 GTK_SOURCE_AVAILABLE_IN_3_14
-void                    gtk_source_file_loader_load_async      (GtkSourceFileLoader     *loader,
-                                                                gint                     io_priority,
-                                                                GCancellable            *cancellable,
-                                                                GFileProgressCallback    progress_callback,
-                                                                gpointer                 
progress_callback_data,
-                                                                GDestroyNotify           
progress_callback_notify,
-                                                                GAsyncReadyCallback      callback,
-                                                                gpointer                 user_data);
-
+void                      gtk_source_file_loader_load_async              (GtkSourceFileLoader    *loader,
+                                                                          gint                    
io_priority,
+                                                                          GCancellable           
*cancellable,
+                                                                          GFileProgressCallback   
progress_callback,
+                                                                          gpointer                
progress_callback_data,
+                                                                          GDestroyNotify          
progress_callback_notify,
+                                                                          GAsyncReadyCallback     callback,
+                                                                          gpointer                user_data);
 GTK_SOURCE_AVAILABLE_IN_3_14
-gboolean                gtk_source_file_loader_load_finish     (GtkSourceFileLoader     *loader,
-                                                                GAsyncResult            *result,
-                                                                GError                 **error);
-
+gboolean                  gtk_source_file_loader_load_finish             (GtkSourceFileLoader    *loader,
+                                                                          GAsyncResult           *result,
+                                                                          GError                **error);
 GTK_SOURCE_AVAILABLE_IN_3_14
-const GtkSourceEncoding        *gtk_source_file_loader_get_encoding    (GtkSourceFileLoader     *loader);
-
+const GtkSourceEncoding  *gtk_source_file_loader_get_encoding            (GtkSourceFileLoader    *loader);
 GTK_SOURCE_AVAILABLE_IN_3_14
-GtkSourceNewlineType    gtk_source_file_loader_get_newline_type (GtkSourceFileLoader    *loader);
-
+GtkSourceNewlineType      gtk_source_file_loader_get_newline_type        (GtkSourceFileLoader    *loader);
 GTK_SOURCE_AVAILABLE_IN_3_14
-GtkSourceCompressionType gtk_source_file_loader_get_compression_type
-                                                               (GtkSourceFileLoader     *loader);
+GtkSourceCompressionType  gtk_source_file_loader_get_compression_type    (GtkSourceFileLoader    *loader);
 
 G_END_DECLS


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