[gnome-autoar] AutoarCreate: make the type final



commit ec1ab075c1ab15d467bf9cdcb5e4a9297cfbc2e4
Author: Razvan Chitu <razvan ch95 gmail com>
Date:   Tue Aug 16 20:24:38 2016 +0300

    AutoarCreate: make the type final
    
    Since it is not expected to derive AutoarCreate now, make it a final type.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768645

 gnome-autoar/autoar-create.c |  551 ++++++++++++++++++++----------------------
 gnome-autoar/autoar-create.h |   23 +--
 2 files changed, 258 insertions(+), 316 deletions(-)
---
diff --git a/gnome-autoar/autoar-create.c b/gnome-autoar/autoar-create.c
index 75c48fe..76012ea 100644
--- a/gnome-autoar/autoar-create.c
+++ b/gnome-autoar/autoar-create.c
@@ -60,8 +60,6 @@
  * An #AutoarCreate object can only be used once and create one archive.
  **/
 
-G_DEFINE_TYPE (AutoarCreate, autoar_create, G_TYPE_OBJECT)
-
 /**
  * autoar_create_quark:
  *
@@ -71,17 +69,16 @@ G_DEFINE_TYPE (AutoarCreate, autoar_create, G_TYPE_OBJECT)
  **/
 G_DEFINE_QUARK (autoar-create, autoar_create)
 
-#define AUTOAR_CREATE_GET_PRIVATE(o) \
-  (G_TYPE_INSTANCE_GET_PRIVATE ((o), AUTOAR_TYPE_CREATE, AutoarCreatePrivate))
-
 #define BUFFER_SIZE (64 * 1024)
 #define ARCHIVE_WRITE_RETRY_TIMES 5
 
 #define INVALID_FORMAT 1
 #define INVALID_FILTER 2
 
-struct _AutoarCreatePrivate
+struct _AutoarCreate
 {
+  GObject parent_instance;
+
   GList *source_files;
   GFile *output_file;
   AutoarFormat format;
@@ -117,6 +114,8 @@ struct _AutoarCreatePrivate
   gboolean create_top_level_directory;
 };
 
+G_DEFINE_TYPE (AutoarCreate, autoar_create, G_TYPE_OBJECT)
+
 enum
 {
   DECIDE_DEST,
@@ -152,44 +151,42 @@ autoar_create_get_property (GObject    *object,
                             GParamSpec *pspec)
 {
   AutoarCreate *arcreate;
-  AutoarCreatePrivate *priv;
 
   arcreate = AUTOAR_CREATE (object);
-  priv = arcreate->priv;
 
   switch (property_id) {
     case PROP_SOURCE_FILES:
-      g_value_set_pointer (value, priv->source_files);
+      g_value_set_pointer (value, arcreate->source_files);
       break;
     case PROP_OUTPUT_FILE:
-      g_value_set_object (value, priv->output_file);
+      g_value_set_object (value, arcreate->output_file);
       break;
     case PROP_FORMAT:
-      g_value_set_enum (value, priv->format);
+      g_value_set_enum (value, arcreate->format);
       break;
     case PROP_FILTER:
-      g_value_set_enum (value, priv->format);
+      g_value_set_enum (value, arcreate->format);
       break;
     case PROP_CREATE_TOP_LEVEL_DIRECTORY:
-      g_value_set_boolean (value, priv->create_top_level_directory);
+      g_value_set_boolean (value, arcreate->create_top_level_directory);
       break;
     case PROP_SIZE:
-      g_value_set_uint64 (value, priv->size);
+      g_value_set_uint64 (value, arcreate->size);
       break;
     case PROP_COMPLETED_SIZE:
-      g_value_set_uint64 (value, priv->completed_size);
+      g_value_set_uint64 (value, arcreate->completed_size);
       break;
     case PROP_FILES:
-      g_value_set_uint (value, priv->files);
+      g_value_set_uint (value, arcreate->files);
       break;
     case PROP_COMPLETED_FILES:
-      g_value_set_uint (value, priv->completed_files);
+      g_value_set_uint (value, arcreate->completed_files);
       break;
     case PROP_OUTPUT_IS_DEST:
-      g_value_set_boolean (value, priv->output_is_dest);
+      g_value_set_boolean (value, arcreate->output_is_dest);
       break;
     case PROP_NOTIFY_INTERVAL:
-      g_value_set_int64 (value, priv->notify_interval);
+      g_value_set_int64 (value, arcreate->notify_interval);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -204,37 +201,35 @@ autoar_create_set_property (GObject      *object,
                             GParamSpec   *pspec)
 {
   AutoarCreate *arcreate;
-  AutoarCreatePrivate *priv;
 
   arcreate = AUTOAR_CREATE (object);
-  priv = arcreate->priv;
 
   switch (property_id) {
     case PROP_SOURCE_FILES:
-      if (priv->source_files != NULL)
-        g_list_free_full (priv->source_files, g_object_unref);
-      priv->source_files = g_list_copy_deep (g_value_get_pointer (value),
+      if (arcreate->source_files != NULL)
+        g_list_free_full (arcreate->source_files, g_object_unref);
+      arcreate->source_files = g_list_copy_deep (g_value_get_pointer (value),
                                              (GCopyFunc)g_object_ref,
                                              NULL);
       break;
     case PROP_OUTPUT_FILE:
-      autoar_common_g_object_unref (priv->output_file);
-      priv->output_file = g_object_ref (g_value_get_object (value));
+      autoar_common_g_object_unref (arcreate->output_file);
+      arcreate->output_file = g_object_ref (g_value_get_object (value));
       break;
     case PROP_FORMAT:
-      priv->format = g_value_get_enum (value);
+      arcreate->format = g_value_get_enum (value);
       break;
     case PROP_FILTER:
-      priv->filter = g_value_get_enum (value);
+      arcreate->filter = g_value_get_enum (value);
       break;
     case PROP_CREATE_TOP_LEVEL_DIRECTORY:
-      priv->create_top_level_directory = g_value_get_boolean (value);
+      arcreate->create_top_level_directory = g_value_get_boolean (value);
       break;
     case PROP_OUTPUT_IS_DEST:
-      priv->output_is_dest = g_value_get_boolean (value);
+      arcreate->output_is_dest = g_value_get_boolean (value);
       break;
     case PROP_NOTIFY_INTERVAL:
-      priv->notify_interval = g_value_get_int64 (value);
+      arcreate->notify_interval = g_value_get_int64 (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -254,7 +249,7 @@ GList*
 autoar_create_get_source_files (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), NULL);
-  return arcreate->priv->source_files;
+  return arcreate->source_files;
 }
 
 /**
@@ -271,7 +266,7 @@ GFile*
 autoar_create_get_output_file (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), NULL);
-  return arcreate->priv->output_file;
+  return arcreate->output_file;
 }
 
 /**
@@ -286,7 +281,7 @@ AutoarFormat
 autoar_create_get_format (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), AUTOAR_FORMAT_0);
-  return arcreate->priv->format;
+  return arcreate->format;
 }
 
 /**
@@ -301,7 +296,7 @@ AutoarFilter
 autoar_create_get_filter (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), AUTOAR_FILTER_0);
-  return arcreate->priv->filter;
+  return arcreate->filter;
 }
 
 /**
@@ -316,7 +311,7 @@ gboolean
 autoar_create_get_create_top_level_directory (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), FALSE);
-  return arcreate->priv->create_top_level_directory;
+  return arcreate->create_top_level_directory;
 }
 
 /**
@@ -332,7 +327,7 @@ guint64
 autoar_create_get_size (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), 0);
-  return arcreate->priv->size;
+  return arcreate->size;
 }
 
 /**
@@ -347,7 +342,7 @@ guint64
 autoar_create_get_completed_size (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), 0);
-  return arcreate->priv->completed_size;
+  return arcreate->completed_size;
 }
 
 /**
@@ -363,7 +358,7 @@ guint
 autoar_create_get_files (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), 0);
-  return arcreate->priv->files;
+  return arcreate->files;
 }
 
 /**
@@ -378,7 +373,7 @@ guint
 autoar_create_get_completed_files (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), 0);
-  return arcreate->priv->completed_files;
+  return arcreate->completed_files;
 }
 
 /**
@@ -393,7 +388,7 @@ gboolean
 autoar_create_get_output_is_dest (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), 0);
-  return arcreate->priv->output_is_dest;
+  return arcreate->output_is_dest;
 }
 
 /**
@@ -409,7 +404,7 @@ gint64
 autoar_create_get_notify_interval (AutoarCreate *arcreate)
 {
   g_return_val_if_fail (AUTOAR_IS_CREATE (arcreate), 0);
-  return arcreate->priv->notify_interval;
+  return arcreate->notify_interval;
 }
 
 /**
@@ -435,7 +430,7 @@ autoar_create_set_output_is_dest (AutoarCreate *arcreate,
                                   gboolean output_is_dest)
 {
   g_return_if_fail (AUTOAR_IS_CREATE (arcreate));
-  arcreate->priv->output_is_dest = output_is_dest;
+  arcreate->output_is_dest = output_is_dest;
 }
 
 /**
@@ -454,40 +449,38 @@ autoar_create_set_notify_interval (AutoarCreate *arcreate,
 {
   g_return_if_fail (AUTOAR_IS_CREATE (arcreate));
   g_return_if_fail (notify_interval >= 0);
-  arcreate->priv->notify_interval = notify_interval;
+  arcreate->notify_interval = notify_interval;
 }
 
 static void
 autoar_create_dispose (GObject *object)
 {
   AutoarCreate *arcreate;
-  AutoarCreatePrivate *priv;
 
   arcreate = AUTOAR_CREATE (object);
-  priv = arcreate->priv;
 
   g_debug ("AutoarCreate: dispose");
 
-  if (priv->ostream != NULL) {
-    if (!g_output_stream_is_closed (priv->ostream)) {
-      g_output_stream_close (priv->ostream, priv->cancellable, NULL);
+  if (arcreate->ostream != NULL) {
+    if (!g_output_stream_is_closed (arcreate->ostream)) {
+      g_output_stream_close (arcreate->ostream, arcreate->cancellable, NULL);
     }
-    g_object_unref (priv->ostream);
-    priv->ostream = NULL;
+    g_object_unref (arcreate->ostream);
+    arcreate->ostream = NULL;
   }
 
-  g_clear_object (&(priv->dest));
-  g_clear_object (&(priv->cancellable));
-  g_clear_object (&(priv->output_file));
+  g_clear_object (&(arcreate->dest));
+  g_clear_object (&(arcreate->cancellable));
+  g_clear_object (&(arcreate->output_file));
 
-  if (priv->pathname_to_g_file != NULL) {
-    g_hash_table_unref (priv->pathname_to_g_file);
-    priv->pathname_to_g_file = NULL;
+  if (arcreate->pathname_to_g_file != NULL) {
+    g_hash_table_unref (arcreate->pathname_to_g_file);
+    arcreate->pathname_to_g_file = NULL;
   }
 
-  if (priv->source_files != NULL) {
-    g_list_free_full (priv->source_files, g_object_unref);
-    priv->source_files = NULL;
+  if (arcreate->source_files != NULL) {
+    g_list_free_full (arcreate->source_files, g_object_unref);
+    arcreate->source_files = NULL;
   }
 
   G_OBJECT_CLASS (autoar_create_parent_class)->dispose (object);
@@ -497,47 +490,45 @@ static void
 autoar_create_finalize (GObject *object)
 {
   AutoarCreate *arcreate;
-  AutoarCreatePrivate *priv;
 
   arcreate = AUTOAR_CREATE (object);
-  priv = arcreate->priv;
 
   g_debug ("AutoarCreate: finalize");
 
-  g_free (priv->buffer);
-  priv->buffer = NULL;
+  g_free (arcreate->buffer);
+  arcreate->buffer = NULL;
 
-  /* If priv->error == NULL, no errors occurs. Therefore, we can safely free
+  /* If arcreate->error == NULL, no errors occurs. Therefore, we can safely free
    * libarchive objects because it will not call the callbacks during the
    * the process of freeing.
-   * If priv->error != NULL, we must free libarchive objects beforce freeing
-   * priv->error in order to prevent libarchive callbacks from accessing
+   * If arcreate->error != NULL, we must free libarchive objects beforce freeing
+   * arcreate->error in order to prevent libarchive callbacks from accessing
    * freed private objects and buffers. */
-  if (priv->a != NULL) {
-    archive_write_free (priv->a);
-    priv->a = NULL;
+  if (arcreate->a != NULL) {
+    archive_write_free (arcreate->a);
+    arcreate->a = NULL;
   }
 
-  if (priv->entry != NULL) {
-    archive_entry_free (priv->entry);
-    priv->entry = NULL;
+  if (arcreate->entry != NULL) {
+    archive_entry_free (arcreate->entry);
+    arcreate->entry = NULL;
   }
 
-  if (priv->resolver != NULL) {
-    archive_entry_linkresolver_free (priv->resolver);
-    priv->resolver = NULL;
+  if (arcreate->resolver != NULL) {
+    archive_entry_linkresolver_free (arcreate->resolver);
+    arcreate->resolver = NULL;
   }
 
-  if (priv->error != NULL) {
-    g_error_free (priv->error);
-    priv->error = NULL;
+  if (arcreate->error != NULL) {
+    g_error_free (arcreate->error);
+    arcreate->error = NULL;
   }
 
-  g_free (priv->source_basename_noext);
-  priv->source_basename_noext = NULL;
+  g_free (arcreate->source_basename_noext);
+  arcreate->source_basename_noext = NULL;
 
-  g_free (priv->extension);
-  priv->extension = NULL;
+  g_free (arcreate->extension);
+  arcreate->extension = NULL;
 
   G_OBJECT_CLASS (autoar_create_parent_class)->finalize (object);
 }
@@ -551,15 +542,15 @@ libarchive_write_open_cb (struct archive *ar_write,
   g_debug ("libarchive_write_open_cb: called");
 
   arcreate = (AutoarCreate*)client_data;
-  if (arcreate->priv->error != NULL) {
+  if (arcreate->error != NULL) {
     return ARCHIVE_FATAL;
   }
 
-  arcreate->priv->ostream = (GOutputStream*)g_file_create (arcreate->priv->dest,
+  arcreate->ostream = (GOutputStream*)g_file_create (arcreate->dest,
                                                            G_FILE_CREATE_NONE,
-                                                           arcreate->priv->cancellable,
-                                                           &(arcreate->priv->error));
-  if (arcreate->priv->error != NULL) {
+                                                           arcreate->cancellable,
+                                                           &(arcreate->error));
+  if (arcreate->error != NULL) {
     g_debug ("libarchive_write_open_cb: ARCHIVE_FATAL");
     return ARCHIVE_FATAL;
   }
@@ -577,17 +568,17 @@ libarchive_write_close_cb (struct archive *ar_write,
   g_debug ("libarchive_write_close_cb: called");
 
   arcreate = (AutoarCreate*)client_data;
-  if (arcreate->priv->error != NULL) {
+  if (arcreate->error != NULL) {
     return ARCHIVE_FATAL;
   }
 
-  if (arcreate->priv->ostream != NULL) {
-    g_output_stream_close (arcreate->priv->ostream, arcreate->priv->cancellable, &(arcreate->priv->error));
-    g_object_unref (arcreate->priv->ostream);
-    arcreate->priv->ostream = NULL;
+  if (arcreate->ostream != NULL) {
+    g_output_stream_close (arcreate->ostream, arcreate->cancellable, &(arcreate->error));
+    g_object_unref (arcreate->ostream);
+    arcreate->ostream = NULL;
   }
 
-  if (arcreate->priv->error != NULL) {
+  if (arcreate->error != NULL) {
     g_debug ("libarchive_write_close_cb: ARCHIVE_FATAL");
     return ARCHIVE_FATAL;
   }
@@ -608,16 +599,16 @@ libarchive_write_write_cb (struct archive *ar_write,
   g_debug ("libarchive_write_write_cb: called");
 
   arcreate = (AutoarCreate*)client_data;
-  if (arcreate->priv->error != NULL || arcreate->priv->ostream == NULL) {
+  if (arcreate->error != NULL || arcreate->ostream == NULL) {
     return -1;
   }
 
-  write_size = g_output_stream_write (arcreate->priv->ostream,
+  write_size = g_output_stream_write (arcreate->ostream,
                                       buffer,
                                       length,
-                                      arcreate->priv->cancellable,
-                                      &(arcreate->priv->error));
-  if (arcreate->priv->error != NULL)
+                                      arcreate->cancellable,
+                                      &(arcreate->error));
+  if (arcreate->error != NULL)
     return -1;
 
   g_debug ("libarchive_write_write_cb: %" G_GSSIZE_FORMAT, write_size);
@@ -627,9 +618,9 @@ libarchive_write_write_cb (struct archive *ar_write,
 static inline void
 autoar_create_signal_decide_dest (AutoarCreate *arcreate)
 {
-  autoar_common_g_signal_emit (arcreate, arcreate->priv->in_thread,
+  autoar_common_g_signal_emit (arcreate, arcreate->in_thread,
                                autoar_create_signals[DECIDE_DEST], 0,
-                               arcreate->priv->dest);
+                               arcreate->dest);
 }
 
 static inline void
@@ -637,19 +628,19 @@ autoar_create_signal_progress (AutoarCreate *arcreate)
 {
   gint64 mtime;
   mtime = g_get_monotonic_time ();
-  if (mtime - arcreate->priv->notify_last >= arcreate->priv->notify_interval) {
-    autoar_common_g_signal_emit (arcreate, arcreate->priv->in_thread,
+  if (mtime - arcreate->notify_last >= arcreate->notify_interval) {
+    autoar_common_g_signal_emit (arcreate, arcreate->in_thread,
                                  autoar_create_signals[PROGRESS], 0,
-                                 arcreate->priv->completed_size,
-                                 arcreate->priv->completed_files);
-    arcreate->priv->notify_last = mtime;
+                                 arcreate->completed_size,
+                                 arcreate->completed_files);
+    arcreate->notify_last = mtime;
   }
 }
 
 static inline void
 autoar_create_signal_cancelled (AutoarCreate *arcreate)
 {
-  autoar_common_g_signal_emit (arcreate, arcreate->priv->in_thread,
+  autoar_common_g_signal_emit (arcreate, arcreate->in_thread,
                                autoar_create_signals[CANCELLED], 0);
 
 }
@@ -657,7 +648,7 @@ autoar_create_signal_cancelled (AutoarCreate *arcreate)
 static inline void
 autoar_create_signal_completed (AutoarCreate *arcreate)
 {
-  autoar_common_g_signal_emit (arcreate, arcreate->priv->in_thread,
+  autoar_common_g_signal_emit (arcreate, arcreate->in_thread,
                                autoar_create_signals[COMPLETED], 0);
 
 }
@@ -665,16 +656,16 @@ autoar_create_signal_completed (AutoarCreate *arcreate)
 static inline void
 autoar_create_signal_error (AutoarCreate *arcreate)
 {
-  if (arcreate->priv->error != NULL) {
-    if (arcreate->priv->error->domain == G_IO_ERROR &&
-        arcreate->priv->error->code == G_IO_ERROR_CANCELLED) {
-      g_error_free (arcreate->priv->error);
-      arcreate->priv->error = NULL;
+  if (arcreate->error != NULL) {
+    if (arcreate->error->domain == G_IO_ERROR &&
+        arcreate->error->code == G_IO_ERROR_CANCELLED) {
+      g_error_free (arcreate->error);
+      arcreate->error = NULL;
       autoar_create_signal_cancelled (arcreate);
     } else {
-      autoar_common_g_signal_emit (arcreate, arcreate->priv->in_thread,
+      autoar_common_g_signal_emit (arcreate, arcreate->in_thread,
                                    autoar_create_signals[AR_ERROR], 0,
-                                   arcreate->priv->error);
+                                   arcreate->error);
     }
   }
 }
@@ -685,22 +676,19 @@ autoar_create_do_write_data (AutoarCreate *arcreate,
                              GFile *file)
 {
   int r;
-  AutoarCreatePrivate *priv;
 
   g_debug ("autoar_create_do_write_data: called");
 
-  if (arcreate->priv->error != NULL)
+  if (arcreate->error != NULL)
     return;
 
-  if (g_cancellable_is_cancelled (arcreate->priv->cancellable))
+  if (g_cancellable_is_cancelled (arcreate->cancellable))
     return;
 
-  priv = arcreate->priv;
-
-  while ((r = archive_write_header (priv->a, entry)) == ARCHIVE_RETRY);
+  while ((r = archive_write_header (arcreate->a, entry)) == ARCHIVE_RETRY);
   if (r == ARCHIVE_FATAL) {
-    if (priv->error == NULL)
-      priv->error = autoar_common_g_error_new_a_entry (priv->a, entry);
+    if (arcreate->error == NULL)
+      arcreate->error = autoar_common_g_error_new_a_entry (arcreate->a, entry);
     return;
   }
 
@@ -718,25 +706,25 @@ autoar_create_do_write_data (AutoarCreate *arcreate,
     written_actual = 0;
     written_try = 0;
 
-    istream = (GInputStream*)g_file_read (file, priv->cancellable, &(priv->error));
+    istream = (GInputStream*)g_file_read (file, arcreate->cancellable, &(arcreate->error));
     if (istream == NULL)
       return;
 
-    priv->completed_files++;
+    arcreate->completed_files++;
 
     do {
       read_actual = g_input_stream_read (istream,
-                                         priv->buffer,
-                                         priv->buffer_size,
-                                         priv->cancellable,
-                                         &(priv->error));
-      priv->completed_size += read_actual > 0 ? read_actual : 0;
+                                         arcreate->buffer,
+                                         arcreate->buffer_size,
+                                         arcreate->cancellable,
+                                         &(arcreate->error));
+      arcreate->completed_size += read_actual > 0 ? read_actual : 0;
       autoar_create_signal_progress (arcreate);
       if (read_actual > 0) {
         written_acc = 0;
         written_try = 0;
         do {
-          written_actual = archive_write_data (priv->a, (const char*)(priv->buffer) + written_acc, 
read_actual);
+          written_actual = archive_write_data (arcreate->a, (const char*)(arcreate->buffer) + written_acc, 
read_actual);
           written_acc += written_actual > 0 ? written_actual : 0;
           written_try = written_actual ? 0 : written_try + 1;
           /* archive_write_data may return zero, so we have to limit the
@@ -746,21 +734,21 @@ autoar_create_do_write_data (AutoarCreate *arcreate,
     } while (read_actual > 0 && written_actual >= 0);
 
 
-    g_input_stream_close (istream, priv->cancellable, NULL);
+    g_input_stream_close (istream, arcreate->cancellable, NULL);
     g_object_unref (istream);
 
     if (read_actual < 0)
       return;
 
     if (written_actual < 0 || written_try >= ARCHIVE_WRITE_RETRY_TIMES) {
-      if (priv->error == NULL)
-        priv->error = autoar_common_g_error_new_a_entry (priv->a, entry);
+      if (arcreate->error == NULL)
+        arcreate->error = autoar_common_g_error_new_a_entry (arcreate->a, entry);
       return;
     }
     g_debug ("autoar_create_do_write_data: write data OK");
   } else {
     g_debug ("autoar_create_do_write_data: no data, return now!");
-    priv->completed_files++;
+    arcreate->completed_files++;
     autoar_create_signal_progress (arcreate);
   }
 }
@@ -770,26 +758,23 @@ autoar_create_do_add_to_archive (AutoarCreate *arcreate,
                                  GFile *root,
                                  GFile *file)
 {
-  AutoarCreatePrivate *priv;
   GFileInfo *info;
   GFileType  filetype;
 
-  priv = arcreate->priv;
-
-  if (priv->error != NULL)
+  if (arcreate->error != NULL)
     return;
 
-  if (g_cancellable_is_cancelled (priv->cancellable))
+  if (g_cancellable_is_cancelled (arcreate->cancellable))
     return;
 
-  archive_entry_clear (priv->entry);
+  archive_entry_clear (arcreate->entry);
   info = g_file_query_info (file, "*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
-                            priv->cancellable, &(priv->error));
+                            arcreate->cancellable, &(arcreate->error));
   if (info == NULL)
     return;
 
   filetype = g_file_info_get_file_type (info);
-  switch (archive_format (priv->a)) {
+  switch (archive_format (arcreate->a)) {
     case ARCHIVE_FORMAT_AR:
     case ARCHIVE_FORMAT_AR_GNU:
     case ARCHIVE_FORMAT_AR_BSD:
@@ -818,33 +803,33 @@ autoar_create_do_add_to_archive (AutoarCreate *arcreate,
     char *pathname_relative;
     char *pathname;
 
-    switch (archive_format (priv->a)) {
+    switch (archive_format (arcreate->a)) {
       /* ar format does not support directories */
       case ARCHIVE_FORMAT_AR:
       case ARCHIVE_FORMAT_AR_GNU:
       case ARCHIVE_FORMAT_AR_BSD:
         pathname = g_file_get_basename (file);
-        archive_entry_set_pathname (priv->entry, pathname);
+        archive_entry_set_pathname (arcreate->entry, pathname);
         g_free (pathname);
         break;
 
       default:
         root_basename = g_file_get_basename (root);
         pathname_relative = g_file_get_relative_path (root, file);
-        pathname = g_strconcat (priv->create_top_level_directory ? priv->source_basename_noext : "",
-                                priv->create_top_level_directory ? "/" : "",
+        pathname = g_strconcat (arcreate->create_top_level_directory ? arcreate->source_basename_noext : "",
+                                arcreate->create_top_level_directory ? "/" : "",
                                 root_basename,
                                 pathname_relative != NULL ? "/" : "",
                                 pathname_relative != NULL ? pathname_relative : "",
                                 NULL);
-        archive_entry_set_pathname (priv->entry, pathname);
+        archive_entry_set_pathname (arcreate->entry, pathname);
         g_free (root_basename);
         g_free (pathname_relative);
         g_free (pathname);
     }
   }
 
-  g_debug ("autoar_create_do_add_to_archive: %s", archive_entry_pathname (priv->entry));
+  g_debug ("autoar_create_do_add_to_archive: %s", archive_entry_pathname (arcreate->entry));
 
   {
     time_t atime, btime, ctime, mtime;
@@ -860,34 +845,34 @@ autoar_create_do_add_to_archive (AutoarCreate *arcreate,
     ctimeu = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_CHANGED_USEC);
     mtimeu = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC);
 
-    archive_entry_set_atime (priv->entry, atime, atimeu * 1000);
-    archive_entry_set_birthtime (priv->entry, btime, btimeu * 1000);
-    archive_entry_set_ctime (priv->entry, ctime, ctimeu * 1000);
-    archive_entry_set_mtime (priv->entry, mtime, mtimeu * 1000);
+    archive_entry_set_atime (arcreate->entry, atime, atimeu * 1000);
+    archive_entry_set_birthtime (arcreate->entry, btime, btimeu * 1000);
+    archive_entry_set_ctime (arcreate->entry, ctime, ctimeu * 1000);
+    archive_entry_set_mtime (arcreate->entry, mtime, mtimeu * 1000);
 
-    archive_entry_set_uid (priv->entry, g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_UID));
-    archive_entry_set_gid (priv->entry, g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_GID));
-    archive_entry_set_uname (priv->entry, g_file_info_get_attribute_string (info, 
G_FILE_ATTRIBUTE_OWNER_USER));
-    archive_entry_set_gname (priv->entry, g_file_info_get_attribute_string (info, 
G_FILE_ATTRIBUTE_OWNER_GROUP));
-    archive_entry_set_mode (priv->entry, g_file_info_get_attribute_uint32 (info, 
G_FILE_ATTRIBUTE_UNIX_MODE));
+    archive_entry_set_uid (arcreate->entry, g_file_info_get_attribute_uint32 (info, 
G_FILE_ATTRIBUTE_UNIX_UID));
+    archive_entry_set_gid (arcreate->entry, g_file_info_get_attribute_uint32 (info, 
G_FILE_ATTRIBUTE_UNIX_GID));
+    archive_entry_set_uname (arcreate->entry, g_file_info_get_attribute_string (info, 
G_FILE_ATTRIBUTE_OWNER_USER));
+    archive_entry_set_gname (arcreate->entry, g_file_info_get_attribute_string (info, 
G_FILE_ATTRIBUTE_OWNER_GROUP));
+    archive_entry_set_mode (arcreate->entry, g_file_info_get_attribute_uint32 (info, 
G_FILE_ATTRIBUTE_UNIX_MODE));
   }
 
-  archive_entry_set_size (priv->entry, g_file_info_get_attribute_uint64 (info, 
G_FILE_ATTRIBUTE_STANDARD_SIZE));
-  archive_entry_set_dev (priv->entry, g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_DEVICE));
-  archive_entry_set_ino64 (priv->entry, g_file_info_get_attribute_uint64 (info, 
G_FILE_ATTRIBUTE_UNIX_INODE));
-  archive_entry_set_nlink (priv->entry, g_file_info_get_attribute_uint32 (info, 
G_FILE_ATTRIBUTE_UNIX_NLINK));
-  archive_entry_set_rdev (priv->entry, g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_RDEV));
+  archive_entry_set_size (arcreate->entry, g_file_info_get_attribute_uint64 (info, 
G_FILE_ATTRIBUTE_STANDARD_SIZE));
+  archive_entry_set_dev (arcreate->entry, g_file_info_get_attribute_uint32 (info, 
G_FILE_ATTRIBUTE_UNIX_DEVICE));
+  archive_entry_set_ino64 (arcreate->entry, g_file_info_get_attribute_uint64 (info, 
G_FILE_ATTRIBUTE_UNIX_INODE));
+  archive_entry_set_nlink (arcreate->entry, g_file_info_get_attribute_uint32 (info, 
G_FILE_ATTRIBUTE_UNIX_NLINK));
+  archive_entry_set_rdev (arcreate->entry, g_file_info_get_attribute_uint32 (info, 
G_FILE_ATTRIBUTE_UNIX_RDEV));
 
   switch (filetype) {
     case G_FILE_TYPE_DIRECTORY:
       g_debug ("autoar_create_do_add_to_archive: file type set to DIR");
-      archive_entry_set_filetype (priv->entry, AE_IFDIR);
+      archive_entry_set_filetype (arcreate->entry, AE_IFDIR);
       break;
 
     case G_FILE_TYPE_SYMBOLIC_LINK:
       g_debug ("autoar_create_do_add_to_archive: file type set to SYMLINK");
-      archive_entry_set_filetype (priv->entry, AE_IFLNK);
-      archive_entry_set_symlink (priv->entry, g_file_info_get_attribute_byte_string (info, 
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET));
+      archive_entry_set_filetype (arcreate->entry, AE_IFLNK);
+      archive_entry_set_symlink (arcreate->entry, g_file_info_get_attribute_byte_string (info, 
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET));
       break;
 
     case G_FILE_TYPE_SPECIAL:
@@ -902,24 +887,24 @@ autoar_create_do_add_to_archive (AutoarCreate *arcreate,
         if (local_pathname != NULL && stat (local_pathname, &filestat) >= 0) {
           if (S_ISBLK (filestat.st_mode)) {
             g_debug ("autoar_create_do_add_to_archive: file type set to BLOCK");
-            archive_entry_set_filetype (priv->entry, AE_IFBLK);
+            archive_entry_set_filetype (arcreate->entry, AE_IFBLK);
           } else if (S_ISSOCK (filestat.st_mode)) {
             g_debug ("autoar_create_do_add_to_archive: file type set to SOCKET");
-            archive_entry_set_filetype (priv->entry, AE_IFSOCK);
+            archive_entry_set_filetype (arcreate->entry, AE_IFSOCK);
           } else if (S_ISCHR (filestat.st_mode)) {
             g_debug ("autoar_create_do_add_to_archive: file type set to CHAR");
-            archive_entry_set_filetype (priv->entry, AE_IFCHR);
+            archive_entry_set_filetype (arcreate->entry, AE_IFCHR);
           } else if (S_ISFIFO (filestat.st_mode)) {
             g_debug ("autoar_create_do_add_to_archive: file type set to FIFO");
-            archive_entry_set_filetype (priv->entry, AE_IFIFO);
+            archive_entry_set_filetype (arcreate->entry, AE_IFIFO);
           } else {
             g_debug ("autoar_create_do_add_to_archive: file type set to REGULAR");
-            archive_entry_set_filetype (priv->entry, AE_IFREG);
+            archive_entry_set_filetype (arcreate->entry, AE_IFREG);
           }
           g_free (local_pathname);
         } else {
           g_debug ("autoar_create_do_add_to_archive: file type set to REGULAR");
-          archive_entry_set_filetype (priv->entry, AE_IFREG);
+          archive_entry_set_filetype (arcreate->entry, AE_IFREG);
         }
       }
       break;
@@ -931,36 +916,36 @@ autoar_create_do_add_to_archive (AutoarCreate *arcreate,
     case G_FILE_TYPE_REGULAR:
     default:
       g_debug ("autoar_create_do_add_to_archive: file type set to REGULAR");
-      archive_entry_set_filetype (priv->entry, AE_IFREG);
+      archive_entry_set_filetype (arcreate->entry, AE_IFREG);
       break;
   }
 
-  g_hash_table_insert (priv->pathname_to_g_file,
-                       g_strdup (archive_entry_pathname (priv->entry)),
+  g_hash_table_insert (arcreate->pathname_to_g_file,
+                       g_strdup (archive_entry_pathname (arcreate->entry)),
                        g_object_ref (file));
 
   {
     struct archive_entry *entry, *sparse;
 
-    entry = priv->entry;
-    archive_entry_linkify (priv->resolver, &entry, &sparse);
+    entry = arcreate->entry;
+    archive_entry_linkify (arcreate->resolver, &entry, &sparse);
 
     if (entry != NULL) {
       GFile *file_to_read;
       const char *pathname_in_entry;
       pathname_in_entry = archive_entry_pathname (entry);
-      file_to_read = g_hash_table_lookup (priv->pathname_to_g_file, pathname_in_entry);
+      file_to_read = g_hash_table_lookup (arcreate->pathname_to_g_file, pathname_in_entry);
       autoar_create_do_write_data (arcreate, entry, file_to_read);
       /* Entries for non-regular files might have their size attribute
        * different to their actual size on the disk
        */
       if (archive_entry_filetype (entry) != AE_IFREG &&
           archive_entry_size (entry) != g_file_info_get_size (info)) {
-        priv->completed_size += g_file_info_get_size (info);
+        arcreate->completed_size += g_file_info_get_size (info);
         autoar_create_signal_progress (arcreate);
       }
 
-      g_hash_table_remove (priv->pathname_to_g_file, pathname_in_entry);
+      g_hash_table_remove (arcreate->pathname_to_g_file, pathname_in_entry);
       /* We have registered g_object_unref function to free the GFile object,
        * so we do not have to unref it here. */
     }
@@ -969,9 +954,9 @@ autoar_create_do_add_to_archive (AutoarCreate *arcreate,
       GFile *file_to_read;
       const char *pathname_in_entry;
       pathname_in_entry = archive_entry_pathname (entry);
-      file_to_read = g_hash_table_lookup (priv->pathname_to_g_file, pathname_in_entry);
+      file_to_read = g_hash_table_lookup (arcreate->pathname_to_g_file, pathname_in_entry);
       autoar_create_do_write_data (arcreate, sparse, file_to_read);
-      g_hash_table_remove (priv->pathname_to_g_file, pathname_in_entry);
+      g_hash_table_remove (arcreate->pathname_to_g_file, pathname_in_entry);
     }
   }
 
@@ -988,22 +973,19 @@ autoar_create_do_recursive_read (AutoarCreate *arcreate,
   GFile *thisfile;
   const char *thisname;
 
-  AutoarCreatePrivate *priv;
-
-  priv = arcreate->priv;
   enumerator = g_file_enumerate_children (file,
                                           "standard::*",
                                           G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
-                                          priv->cancellable,
-                                          &(priv->error));
+                                          arcreate->cancellable,
+                                          &(arcreate->error));
   if (enumerator == NULL)
     return;
 
-  while ((info = g_file_enumerator_next_file (enumerator, priv->cancellable, &(priv->error))) != NULL) {
+  while ((info = g_file_enumerator_next_file (enumerator, arcreate->cancellable, &(arcreate->error))) != 
NULL) {
     thisname = g_file_info_get_name (info);
     thisfile = g_file_get_child (file, thisname);
     autoar_create_do_add_to_archive (arcreate, root, thisfile);
-    if (priv->error != NULL) {
+    if (arcreate->error != NULL) {
       g_object_unref (thisfile);
       g_object_unref (info);
       break;
@@ -1014,9 +996,9 @@ autoar_create_do_recursive_read (AutoarCreate *arcreate,
     g_object_unref (thisfile);
     g_object_unref (info);
 
-    if (priv->error != NULL)
+    if (arcreate->error != NULL)
       break;
-    if (g_cancellable_is_cancelled (priv->cancellable))
+    if (g_cancellable_is_cancelled (arcreate->cancellable))
       break;
   }
 
@@ -1032,8 +1014,6 @@ autoar_create_class_init (AutoarCreateClass *klass)
   object_class = G_OBJECT_CLASS (klass);
   type = G_TYPE_FROM_CLASS (klass);
 
-  g_type_class_add_private (klass, sizeof (AutoarCreatePrivate));
-
   object_class->get_property = autoar_create_get_property;
   object_class->set_property = autoar_create_set_property;
   object_class->dispose = autoar_create_dispose;
@@ -1232,33 +1212,28 @@ autoar_create_class_init (AutoarCreateClass *klass)
 static void
 autoar_create_init (AutoarCreate *arcreate)
 {
-  AutoarCreatePrivate *priv;
-
-  priv = AUTOAR_CREATE_GET_PRIVATE (arcreate);
-  arcreate->priv = priv;
-
-  priv->size = 0;
-  priv->completed_size = 0;
-  priv->files = 0;
-  priv->completed_files = 0;
+  arcreate->size = 0;
+  arcreate->completed_size = 0;
+  arcreate->files = 0;
+  arcreate->completed_files = 0;
 
-  priv->notify_last = 0;
+  arcreate->notify_last = 0;
 
-  priv->ostream = NULL;
-  priv->buffer_size = BUFFER_SIZE;
-  priv->buffer = g_new (char, priv->buffer_size);
-  priv->error = NULL;
+  arcreate->ostream = NULL;
+  arcreate->buffer_size = BUFFER_SIZE;
+  arcreate->buffer = g_new (char, arcreate->buffer_size);
+  arcreate->error = NULL;
 
-  priv->cancellable = NULL;
+  arcreate->cancellable = NULL;
 
-  priv->a = archive_write_new ();
-  priv->entry = archive_entry_new ();
-  priv->resolver = archive_entry_linkresolver_new ();;
-  priv->pathname_to_g_file = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
-  priv->source_basename_noext = NULL;
-  priv->extension = NULL;
+  arcreate->a = archive_write_new ();
+  arcreate->entry = archive_entry_new ();
+  arcreate->resolver = archive_entry_linkresolver_new ();;
+  arcreate->pathname_to_g_file = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+  arcreate->source_basename_noext = NULL;
+  arcreate->extension = NULL;
 
-  priv->in_thread = FALSE;
+  arcreate->in_thread = FALSE;
 }
 
 /**
@@ -1307,43 +1282,40 @@ autoar_create_step_initialize_object (AutoarCreate *arcreate)
   AutoarFormatFunc format_func;
   AutoarFilterFunc filter_func;
 
-  AutoarCreatePrivate *priv;
   int r;
 
-  priv = arcreate->priv;
-
-  if (!autoar_format_is_valid (priv->format)) {
-    priv->error = g_error_new (AUTOAR_CREATE_ERROR, INVALID_FORMAT,
-                               "Format %d is invalid", priv->format);
+  if (!autoar_format_is_valid (arcreate->format)) {
+    arcreate->error = g_error_new (AUTOAR_CREATE_ERROR, INVALID_FORMAT,
+                               "Format %d is invalid", arcreate->format);
     return;
   }
 
-  if (!autoar_filter_is_valid (priv->filter)) {
-    priv->error = g_error_new (AUTOAR_CREATE_ERROR, INVALID_FILTER,
-                               "Filter %d is invalid", priv->filter);
+  if (!autoar_filter_is_valid (arcreate->filter)) {
+    arcreate->error = g_error_new (AUTOAR_CREATE_ERROR, INVALID_FILTER,
+                               "Filter %d is invalid", arcreate->filter);
     return;
   }
 
-  priv->extension = autoar_format_filter_get_extension (priv->format,
-                                                        priv->filter);
+  arcreate->extension = autoar_format_filter_get_extension (arcreate->format,
+                                                        arcreate->filter);
 
-  r = archive_write_set_bytes_in_last_block (priv->a, 1);
+  r = archive_write_set_bytes_in_last_block (arcreate->a, 1);
   if (r != ARCHIVE_OK) {
-    priv->error = autoar_common_g_error_new_a (priv->a, NULL);
+    arcreate->error = autoar_common_g_error_new_a (arcreate->a, NULL);
     return;
   }
 
-  format_func = autoar_format_get_libarchive_write (priv->format);
-  r = (*format_func)(priv->a);
+  format_func = autoar_format_get_libarchive_write (arcreate->format);
+  r = (*format_func)(arcreate->a);
   if (r != ARCHIVE_OK) {
-    priv->error = autoar_common_g_error_new_a (priv->a, NULL);
+    arcreate->error = autoar_common_g_error_new_a (arcreate->a, NULL);
     return;
   }
 
-  filter_func = autoar_filter_get_libarchive_write (priv->filter);
-  r = (*filter_func)(priv->a);
+  filter_func = autoar_filter_get_libarchive_write (arcreate->filter);
+  r = (*filter_func)(arcreate->a);
   if (r != ARCHIVE_OK) {
-    priv->error = autoar_common_g_error_new_a (priv->a, NULL);
+    arcreate->error = autoar_common_g_error_new_a (arcreate->a, NULL);
     return;
   }
 }
@@ -1354,31 +1326,27 @@ autoar_create_step_decide_dest (AutoarCreate *arcreate)
   /* Step 1: Set the destination file name
    * Use the first source file name */
 
-  AutoarCreatePrivate *priv;
-
   g_debug ("autoar_create_step_decide_dest: called");
 
-  priv = arcreate->priv;
-
   {
     GFile *file_source; /* Do not unref */
     GFileInfo *source_info;
     char *source_basename;
 
-    file_source = priv->source_files->data;
+    file_source = arcreate->source_files->data;
     source_info = g_file_query_info (file_source,
                                      G_FILE_ATTRIBUTE_STANDARD_TYPE,
                                      G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
-                                     priv->cancellable,
-                                     &(priv->error));
+                                     arcreate->cancellable,
+                                     &(arcreate->error));
     if (source_info == NULL)
       return;
 
     source_basename = g_file_get_basename (file_source);
     if (g_file_info_get_file_type (source_info) == G_FILE_TYPE_REGULAR)
-      priv->source_basename_noext = autoar_common_get_basename_remove_extension (source_basename);
+      arcreate->source_basename_noext = autoar_common_get_basename_remove_extension (source_basename);
     else
-      priv->source_basename_noext = g_strdup (source_basename);
+      arcreate->source_basename_noext = g_strdup (source_basename);
 
     g_object_unref (source_info);
     g_free (source_basename);
@@ -1388,31 +1356,31 @@ autoar_create_step_decide_dest (AutoarCreate *arcreate)
     char *dest_basename;
     int i;
 
-    dest_basename = g_strconcat (priv->source_basename_noext,
-                                 priv->extension, NULL);
-    priv->dest = g_file_get_child (priv->output_file, dest_basename);
+    dest_basename = g_strconcat (arcreate->source_basename_noext,
+                                 arcreate->extension, NULL);
+    arcreate->dest = g_file_get_child (arcreate->output_file, dest_basename);
 
-    for (i = 1; g_file_query_exists (priv->dest, priv->cancellable); i++) {
+    for (i = 1; g_file_query_exists (arcreate->dest, arcreate->cancellable); i++) {
       g_free (dest_basename);
-      g_object_unref (priv->dest);
+      g_object_unref (arcreate->dest);
 
-      if (g_cancellable_is_cancelled (priv->cancellable))
+      if (g_cancellable_is_cancelled (arcreate->cancellable))
         return;
 
       dest_basename = g_strdup_printf ("%s(%d)%s",
-                                       priv->source_basename_noext,
-                                       i, priv->extension);
-      priv->dest = g_file_get_child (priv->output_file, dest_basename);
+                                       arcreate->source_basename_noext,
+                                       i, arcreate->extension);
+      arcreate->dest = g_file_get_child (arcreate->output_file, dest_basename);
     }
 
     g_free (dest_basename);
   }
 
-  if (!g_file_query_exists (priv->output_file, priv->cancellable)) {
-    g_file_make_directory_with_parents (priv->output_file,
-                                        priv->cancellable,
-                                        &(priv->error));
-    if (priv->error != NULL)
+  if (!g_file_query_exists (arcreate->output_file, arcreate->cancellable)) {
+    g_file_make_directory_with_parents (arcreate->output_file,
+                                        arcreate->cancellable,
+                                        &(arcreate->error));
+    if (arcreate->error != NULL)
       return;
   }
 
@@ -1425,9 +1393,9 @@ autoar_create_step_decide_dest_already (AutoarCreate *arcreate)
   /* Alternative step 1: Output is destination */
 
   char *output_basename;
-  arcreate->priv->dest = g_object_ref (arcreate->priv->output_file);
-  output_basename = g_file_get_basename (arcreate->priv->output_file);
-  arcreate->priv->source_basename_noext =
+  arcreate->dest = g_object_ref (arcreate->output_file);
+  output_basename = g_file_get_basename (arcreate->output_file);
+  arcreate->source_basename_noext =
     autoar_common_get_basename_remove_extension (output_basename);
   g_free (output_basename);
 
@@ -1438,27 +1406,24 @@ static void
 autoar_create_step_create (AutoarCreate *arcreate)
 {
   /* Step 2: Create and open the new archive file */
-  AutoarCreatePrivate *priv;
   GList *l;
   int r;
 
   g_debug ("autoar_create_step_create: called");
 
-  priv = arcreate->priv;
-
-  r = archive_write_open (priv->a, arcreate,
+  r = archive_write_open (arcreate->a, arcreate,
                           libarchive_write_open_cb,
                           libarchive_write_write_cb,
                           libarchive_write_close_cb);
   if (r != ARCHIVE_OK) {
-    if (priv->error == NULL)
-      priv->error = autoar_common_g_error_new_a (priv->a, NULL);
+    if (arcreate->error == NULL)
+      arcreate->error = autoar_common_g_error_new_a (arcreate->a, NULL);
     return;
   }
 
-  archive_entry_linkresolver_set_strategy (priv->resolver, archive_format (priv->a));
+  archive_entry_linkresolver_set_strategy (arcreate->resolver, archive_format (arcreate->a));
 
-  for (l = priv->source_files; l != NULL; l = l->next) {
+  for (l = arcreate->source_files; l != NULL; l = l->next) {
     GFile *file; /* Do not unref */
     GFileType filetype;
     GFileInfo *fileinfo;
@@ -1472,9 +1437,9 @@ autoar_create_step_create (AutoarCreate *arcreate)
     fileinfo = g_file_query_info (file,
                                   G_FILE_ATTRIBUTE_STANDARD_TYPE,
                                   G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
-                                  priv->cancellable,
-                                  &(priv->error));
-    if (priv->error != NULL)
+                                  arcreate->cancellable,
+                                  &(arcreate->error));
+    if (arcreate->error != NULL)
       return;
 
     filetype = g_file_info_get_file_type (fileinfo);
@@ -1485,10 +1450,10 @@ autoar_create_step_create (AutoarCreate *arcreate)
     if (filetype == G_FILE_TYPE_DIRECTORY)
       autoar_create_do_recursive_read (arcreate, file, file);
 
-    if (priv->error != NULL)
+    if (arcreate->error != NULL)
       return;
 
-    if (g_cancellable_is_cancelled (priv->cancellable))
+    if (g_cancellable_is_cancelled (arcreate->cancellable))
       return;
   }
 
@@ -1496,12 +1461,12 @@ autoar_create_step_create (AutoarCreate *arcreate)
   {
     struct archive_entry *entry, *sparse;
     entry = NULL;
-    archive_entry_linkify (priv->resolver, &entry, &sparse);
+    archive_entry_linkify (arcreate->resolver, &entry, &sparse);
     if (entry != NULL) {
       GFile *file_to_read;
       const char *pathname_in_entry;
       pathname_in_entry = archive_entry_pathname (entry);
-      file_to_read = g_hash_table_lookup (priv->pathname_to_g_file, pathname_in_entry);
+      file_to_read = g_hash_table_lookup (arcreate->pathname_to_g_file, pathname_in_entry);
       autoar_create_do_write_data (arcreate, entry, file_to_read);
       /* I think we do not have to remove the entry in the hash table now
        * because we are going to free the entire hash table. */
@@ -1515,17 +1480,15 @@ autoar_create_step_cleanup (AutoarCreate *arcreate)
   /* Step 3: Close the libarchive object and force progress to be updated.
    * We do not have to do other cleanup because they are handled in dispose
    * and finalize functions. */
-  AutoarCreatePrivate *priv;
-  priv = arcreate->priv;
-  priv->notify_last = 0;
+  arcreate->notify_last = 0;
   autoar_create_signal_progress (arcreate);
-  if (archive_write_close (priv->a) != ARCHIVE_OK) {
+  if (archive_write_close (arcreate->a) != ARCHIVE_OK) {
     g_autofree gchar *output_name;
 
-    output_name = autoar_common_g_file_get_name (priv->output_file);
+    output_name = autoar_common_g_file_get_name (arcreate->output_file);
 
-    if (priv->error == NULL)
-      priv->error = autoar_common_g_error_new_a (priv->a, output_name);
+    if (arcreate->error == NULL)
+      arcreate->error = autoar_common_g_error_new_a (arcreate->a, output_name);
     return;
   }
 }
@@ -1537,26 +1500,24 @@ autoar_create_run (AutoarCreate *arcreate)
    * The array size must be modified if more steps are added. */
   void (*steps[5])(AutoarCreate*);
 
-  AutoarCreatePrivate *priv;
   int i;
 
   g_return_if_fail (AUTOAR_IS_CREATE (arcreate));
-  priv = arcreate->priv;
 
-  g_return_if_fail (priv->source_files != NULL);
-  g_return_if_fail (priv->output_file != NULL);
+  g_return_if_fail (arcreate->source_files != NULL);
+  g_return_if_fail (arcreate->output_file != NULL);
 
   /* A GFile* list without a GFile* is not allowed */
-  g_return_if_fail (priv->source_files->data != NULL);
+  g_return_if_fail (arcreate->source_files->data != NULL);
 
-  if (g_cancellable_is_cancelled (priv->cancellable)) {
+  if (g_cancellable_is_cancelled (arcreate->cancellable)) {
     autoar_create_signal_cancelled (arcreate);
     return;
   }
 
   i = 0;
   steps[i++] = autoar_create_step_initialize_object;
-  steps[i++] = priv->output_is_dest ?
+  steps[i++] = arcreate->output_is_dest ?
                autoar_create_step_decide_dest_already :
                autoar_create_step_decide_dest;
   steps[i++] = autoar_create_step_create;
@@ -1567,11 +1528,11 @@ autoar_create_run (AutoarCreate *arcreate)
     g_debug ("autoar_create_run: Step %d Begin", i);
     (*steps[i])(arcreate);
     g_debug ("autoar_create_run: Step %d End", i);
-    if (priv->error != NULL) {
+    if (arcreate->error != NULL) {
       autoar_create_signal_error (arcreate);
       return;
     }
-    if (g_cancellable_is_cancelled (priv->cancellable)) {
+    if (g_cancellable_is_cancelled (arcreate->cancellable)) {
       autoar_create_signal_cancelled (arcreate);
       return;
     }
@@ -1594,8 +1555,8 @@ autoar_create_start (AutoarCreate *arcreate,
 {
   if (cancellable != NULL)
     g_object_ref (cancellable);
-  arcreate->priv->cancellable = cancellable;
-  arcreate->priv->in_thread = FALSE;
+  arcreate->cancellable = cancellable;
+  arcreate->in_thread = FALSE;
   autoar_create_run (arcreate);
 }
 
@@ -1632,8 +1593,8 @@ autoar_create_start_async (AutoarCreate *arcreate,
   g_object_ref (arcreate);
   if (cancellable != NULL)
     g_object_ref (cancellable);
-  arcreate->priv->cancellable = cancellable;
-  arcreate->priv->in_thread = TRUE;
+  arcreate->cancellable = cancellable;
+  arcreate->in_thread = TRUE;
 
   task = g_task_new (arcreate, NULL, NULL, NULL);
   g_task_set_task_data (task, NULL, NULL);
diff --git a/gnome-autoar/autoar-create.h b/gnome-autoar/autoar-create.h
index e5247d1..ee59339 100644
--- a/gnome-autoar/autoar-create.h
+++ b/gnome-autoar/autoar-create.h
@@ -33,28 +33,9 @@
 
 G_BEGIN_DECLS
 
-#define AUTOAR_TYPE_CREATE              autoar_create_get_type ()
-#define AUTOAR_CREATE(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUTOAR_TYPE_CREATE, 
AutoarCreate))
-#define AUTOAR_CREATE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), AUTOAR_TYPE_CREATE, 
AutoarCreateClass))
-#define AUTOAR_IS_CREATE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUTOAR_TYPE_CREATE))
-#define AUTOAR_IS_CREATE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), AUTOAR_TYPE_CREATE))
-#define AUTOAR_CREATE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), AUTOAR_TYPE_CREATE, 
AutoarCreateClass))
+#define AUTOAR_TYPE_CREATE autoar_create_get_type ()
 
-typedef struct _AutoarCreate AutoarCreate;
-typedef struct _AutoarCreateClass AutoarCreateClass;
-typedef struct _AutoarCreatePrivate AutoarCreatePrivate;
-
-struct _AutoarCreate
-{
-  GObject parent;
-
-  AutoarCreatePrivate *priv;
-};
-
-struct _AutoarCreateClass
-{
-  GObjectClass parent_class;
-};
+G_DECLARE_FINAL_TYPE (AutoarCreate, autoar_create, AUTOAR, CREATE, GObject)
 
 /**
  * AUTOAR_CREATE_ERROR:


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