[file-roller: 56/123] started work to support tar archives using libarchive



commit 1d2ab7f031984e3e09ce2f20d3050dcaf1f8a0d6
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jul 22 20:16:23 2012 +0200

    started work to support tar archives using libarchive

 configure.ac                |   66 +++++--
 src/Makefile.am             |   12 +-
 src/file-data.c             |    1 -
 src/fr-archive-libarchive.c |  432 +++++++++++++++++++++++++++++++++++++++++++
 src/fr-archive-libarchive.h |   50 +++++
 src/fr-init.c               |    7 +-
 6 files changed, 542 insertions(+), 26 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 82ed252..783aa46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,24 +19,13 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
 AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
 
-dnl ==========================================================================
-dnl
-dnl If you add a version number here, you *must* add an AC_SUBST line for
-dnl it too, or it will never make it into the spec file!
-dnl
-dnl ==========================================================================
-
 GLIB_REQUIRED=2.29.14
 GIO_REQUIRED=2.25.5
 GTK_REQUIRED=3.4.0
 NAUTILUS_REQUIRED=2.22.2
 JSON_GLIB_REQUIRED=0.14.0
 LIBNOTIFY_REQUIRED=0.4.3
-
-AC_SUBST(GLIB_REQUIRED)
-AC_SUBST(GIO_REQUIRED)
-AC_SUBST(GTK_REQUIRED)
-AC_SUBST(NAUTILUS_REQUIRED)
+LIBARCHIVE_REQUIRED=3.0.0
 
 dnl ===========================================================================
 
@@ -84,7 +73,9 @@ unset option
 CFLAGS="$CFLAGS $WARNINGS"
 
 dnl ===========================================================================
-
+dnl
+dnl run_in_place
+dnl
 AC_ARG_ENABLE([run_in_place],
 	      AS_HELP_STRING([--enable-run-in-place],
 			     [load ui data and extensions from source tree]),,
@@ -103,7 +94,9 @@ AC_SUBST(FR_CFLAGS)
 AC_SUBST(FR_LIBS)
 
 dnl ******************************
-
+dnl
+dnl nautilus actions
+dnl
 AC_ARG_ENABLE([nautilus_actions],
 	      [AS_HELP_STRING([--disable-nautilus-actions],
 			      [do not build the nautilus context menu actions])],,
@@ -125,7 +118,9 @@ NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extensio
 AC_SUBST(NAUTILUS_EXTENSION_DIR)
 
 dnl ******************************
-
+dnl
+dnl json-glib-1.0
+dnl
 PKG_CHECK_MODULES(JSON_GLIB,
 		  [json-glib-1.0 >= $JSON_GLIB_REQUIRED
 		   glib-2.0],
@@ -142,9 +137,9 @@ AC_SUBST(JSON_GLIB_LIBS)
 AM_CONDITIONAL(ENABLE_JSON_GLIB, test x"$enable_json_glib" != x"no")
 
 dnl ******************************
-
+dnl
 dnl Checks for mkdtemp function
-
+dnl
 mkdtemp_missing=false
 AC_CHECK_FUNC(mkdtemp,
     [AC_DEFINE([HAVE_MKDTEMP], 1, [Have GlibC function to make temp dirs])],
@@ -154,7 +149,9 @@ AM_CONDITIONAL(MKDTEMP_MISSING, test x$mkdtemp_missing = xtrue)
 AC_CHECK_LIB(m, floor)
 
 dnl ==========================================================================
-
+dnl
+dnl packagekit
+dnl
 AC_ARG_ENABLE(packagekit,
 	      [AS_HELP_STRING([--disable-packagekit],[build without PackageKit support])],,
 	      [enable_packagekit=yes])
@@ -187,7 +184,9 @@ AC_SUBST(LIBNOTIFY_LIBS)
 AC_SUBST(LIBNOTIFY_CFLAGS)
 
 dnl ******************************
-
+dnl
+dnl magic
+dnl
 AC_ARG_ENABLE([magic],
               AS_HELP_STRING([--enable-magic], [use libmagic to detect file type]),,
               [enable_magic=yes])
@@ -216,6 +215,30 @@ fi
 
 AM_CONDITIONAL(ENABLE_MAGIC, test x"$enable_magic" != x"no")
 
+dnl ===========================================================================
+dnl
+dnl libarchive
+dnl
+AC_ARG_ENABLE(libarchive,[AC_HELP_STRING([--enable-libarchive],[enable code that requires libarchive [default=yes]])],, [enable_libarchive="yes"])
+AM_CONDITIONAL(ENABLE_LIBARCHIVE, test "x$enable_libarchive" = xyes)
+
+LIBARCHIVE_LIBS=""
+LIBARCHIVE_CFLAGS=""
+if test x"$enable_libarchive" = xyes; then
+   AC_MSG_CHECKING(for libarchive support)
+
+   if pkg-config --atleast-version=$LIBARCHIVE_REQUIRED libarchive; then
+      LIBARCHIVE_LIBS=`pkg-config --libs libarchive`
+      LIBARCHIVE_CFLAGS=`pkg-config --cflags libarchive`
+      AC_DEFINE(ENABLE_LIBARCHIVE, 1, [Have libarchive])
+   else
+      enable_libarchive=no
+   fi
+fi
+AC_MSG_RESULT($enable_libarchive)
+AC_SUBST(LIBARCHIVE_LIBS)
+AC_SUBST(LIBARCHIVE_CFLAGS)
+
 dnl ******************************
 
 IT_PROG_INTLTOOL([0.40.0])
@@ -287,9 +310,10 @@ Configuration:
 	Disable deprecated code : ${disable_deprecated}
 	Run in place            : ${enable_run_in_place}
 	Internal mkdtemp        : ${mkdtemp_missing}
-	Nautilus support        : ${enable_nautilus_actions}
+	Nautilus module         : ${enable_nautilus_actions}
 	PackageKit support      : ${enable_packagekit}
 	Use libmagic            : ${enable_magic}
 	JSON support            : ${enable_json_glib}
-	Enable notification     : ${enable_notification}
+	Notifications support   : ${enable_notification}
+	Use libarchive          : ${enable_libarchive}
 "
diff --git a/src/Makefile.am b/src/Makefile.am
index d7dd438..7abe4a4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -42,7 +42,8 @@ INCLUDES =						\
 	$(DISABLE_DEPRECATED)				\
 	$(FR_CFLAGS)					\
 	$(JSON_GLIB_CFLAGS)				\
-	$(LIBNOTIFY_CFLAGS)
+	$(LIBNOTIFY_CFLAGS)				\
+	$(LIBARCHIVE_CFLAGS)
 
 BUILT_SOURCES =			\
 	fr-marshal.c		\
@@ -166,6 +167,12 @@ COMMON_SOURCES +=			\
 	fr-command-unarchiver.c
 endif
 
+if ENABLE_LIBARCHIVE
+COMMON_SOURCES +=			\
+	fr-archive-libarchive.h		\
+	fr-archive-libarchive.c
+endif
+
 fr-marshal.h: fr-marshal.list $(GLIB_GENMARSHAL)
 	$(AM_V_GEN)( $(GLIB_GENMARSHAL) $< --header --prefix=fr_marshal > $@ )
 
@@ -208,7 +215,8 @@ file_roller_LDADD =					\
 	$(top_builddir)/copy-n-paste/libeggsmclient.la	\
 	$(FR_LIBS)					\
 	$(JSON_GLIB_LIBS)				\
-	$(LIBNOTIFY_LIBS)
+	$(LIBNOTIFY_LIBS)				\
+	$(LIBARCHIVE_LIBS)
 
 if ENABLE_MAGIC
 file_roller_LDADD += $(MAGIC_LIBS)
diff --git a/src/file-data.c b/src/file-data.c
index 57e82c5..9e92897 100644
--- a/src/file-data.c
+++ b/src/file-data.c
@@ -93,7 +93,6 @@ file_data_copy (FileData *src)
 void
 file_data_update_content_type (FileData *fdata)
 {
-
 	if (fdata->dir)
 		fdata->content_type = MIME_TYPE_DIRECTORY;
 	else
diff --git a/src/fr-archive-libarchive.c b/src/fr-archive-libarchive.c
new file mode 100644
index 0000000..5e83004
--- /dev/null
+++ b/src/fr-archive-libarchive.c
@@ -0,0 +1,432 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  File-Roller
+ *
+ *  Copyright (C) 2012 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <archive.h>
+#include <archive_entry.h>
+#include "file-data.h"
+#include "fr-archive-libarchive.h"
+#include "glib-utils.h"
+
+
+G_DEFINE_TYPE (FrArchiveLibarchive, fr_archive_libarchive, FR_TYPE_ARCHIVE)
+
+
+struct _FrArchiveLibarchivePrivate {
+	int dummy;
+};
+
+
+static void
+fr_archive_libarchive_finalize (GObject *object)
+{
+	/*FrArchiveLibarchive *self;*/
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (FR_IS_ARCHIVE_LIBARCHIVE (object));
+
+	/*self = FR_ARCHIVE_LIBARCHIVE (object);*/
+
+	if (G_OBJECT_CLASS (fr_archive_libarchive_parent_class)->finalize)
+		G_OBJECT_CLASS (fr_archive_libarchive_parent_class)->finalize (object);
+}
+
+
+const char *libarchiver_mime_types[] = {
+		"application/x-compressed-tar",
+		"application/x-bzip-compressed-tar",
+		"application/x-tar",
+		"application/x-7z-compressed-tar",
+		"application/x-lrzip-compressed-tar",
+		"application/x-lzip-compressed-tar",
+		"application/x-lzma-compressed-tar",
+		"application/x-tarz",
+		"application/x-xz-compressed-tar",
+		NULL };
+
+
+static const char **
+fr_archive_libarchive_get_mime_types (FrArchive *archive)
+{
+	return libarchiver_mime_types;
+}
+
+
+static FrArchiveCap
+fr_archive_libarchive_get_capabilities (FrArchive  *archive,
+					const char *mime_type,
+					gboolean    check_command)
+{
+	return FR_ARCHIVE_CAN_STORE_MANY_FILES | FR_ARCHIVE_CAN_READ;
+}
+
+
+static const char *
+fr_archive_libarchive_get_packages (FrArchive  *archive,
+				    const char *mime_type)
+{
+	return NULL;
+}
+
+
+/* -- load -- */
+
+
+#define BUFFER_SIZE_FOR_READING (10 * 1024)
+
+
+typedef struct {
+	FrArchive          *archive;
+	GCancellable       *cancellable;
+	GSimpleAsyncResult *result;
+	GInputStream       *istream;
+	void               *buffer;
+	gssize              buffer_size;
+	GError             *error;
+} LoadData;
+
+
+static void
+load_data_free (LoadData *add_data)
+{
+	_g_object_unref (add_data->archive);
+	_g_object_unref (add_data->cancellable);
+	_g_object_unref (add_data->result);
+	_g_object_unref (add_data->istream);
+	g_free (add_data->buffer);
+	g_free (add_data);
+}
+
+
+static int
+load_data_open (struct archive *a,
+		void           *client_data)
+{
+	LoadData *load_data = client_data;
+
+	load_data->istream = (GInputStream *) g_file_read (fr_archive_get_file (load_data->archive),
+							   load_data->cancellable,
+							   &load_data->error);
+	return (load_data->error == NULL) ? ARCHIVE_OK : ARCHIVE_FATAL;
+}
+
+
+static ssize_t
+load_data_read (struct archive  *a,
+		void            *client_data,
+		const void     **buff)
+{
+	LoadData *load_data = client_data;
+
+	*buff = load_data->buffer;
+	return g_input_stream_read (load_data->istream,
+				    load_data->buffer,
+				    load_data->buffer_size,
+				    load_data->cancellable,
+				    &load_data->error);
+}
+
+
+static int
+load_data_close (struct archive *a,
+		 void           *client_data)
+{
+	LoadData *load_data = client_data;
+
+	if (load_data->istream != NULL) {
+		_g_object_unref (load_data->istream);
+		load_data->istream = NULL;
+	}
+
+	return ARCHIVE_OK;
+}
+
+
+static void
+load_archive_thread (GSimpleAsyncResult *result,
+		     GObject            *object,
+		     GCancellable       *cancellable)
+{
+	LoadData             *load_data;
+	struct archive       *a;
+	struct archive_entry *entry;
+
+	load_data = g_simple_async_result_get_op_res_gpointer (result);
+
+	a = archive_read_new ();
+	archive_read_support_filter_all (a);
+	archive_read_support_format_all (a);
+	archive_read_open (a, load_data, load_data_open, load_data_read, load_data_close);
+	while (archive_read_next_header (a, &entry) == ARCHIVE_OK) {
+		FileData   *file_data;
+		const char *pathname;
+
+		if (g_cancellable_is_cancelled (cancellable))
+			break;
+
+		file_data = file_data_new ();
+
+		if (archive_entry_size_is_set (entry))
+			file_data->size =  archive_entry_size (entry);
+
+		if (archive_entry_mtime_is_set (entry))
+			file_data->modified =  archive_entry_mtime (entry);
+
+		if (archive_entry_filetype (entry) == AE_IFLNK)
+			file_data->link = g_strdup (archive_entry_symlink (entry));
+
+		pathname = archive_entry_pathname (entry);
+		if (*pathname == '/') {
+			file_data->full_path = g_strdup (pathname);
+			file_data->original_path = file_data->full_path;
+		}
+		else {
+			file_data->full_path = g_strconcat ("/", pathname, NULL);
+			file_data->original_path = file_data->full_path + 1;
+		}
+
+		file_data->dir = (archive_entry_filetype (entry) == AE_IFDIR);
+		if (file_data->dir)
+			file_data->name = _g_path_get_dir_name (file_data->full_path);
+		else
+			file_data->name = g_strdup (_g_path_get_file_name (file_data->full_path));
+		file_data->path = _g_path_remove_level (file_data->full_path);
+
+		/*
+		g_print ("%s\n", archive_entry_pathname (entry));
+		g_print ("\tfull_path: %s\n", file_data->full_path);
+		g_print ("\toriginal_path: %s\n", file_data->original_path);
+		g_print ("\tname: %s\n", file_data->name);
+		g_print ("\tpath: %s\n", file_data->path);
+		*/
+
+		fr_archive_add_file (load_data->archive, file_data);
+
+		archive_read_data_skip (a);
+	}
+	archive_read_free (a);
+
+	if (load_data->error == NULL)
+		g_cancellable_set_error_if_cancelled (cancellable, &load_data->error);
+
+	if (load_data->error != NULL)
+		g_simple_async_result_set_from_error (result, load_data->error);
+	g_simple_async_result_complete_in_idle (result);
+
+	load_data_free (load_data);
+}
+
+
+static void
+fr_archive_libarchive_load (FrArchive           *archive,
+			    const char          *password,
+			    GCancellable        *cancellable,
+			    GAsyncReadyCallback  callback,
+			    gpointer             user_data)
+{
+	LoadData *load_data;
+
+	load_data = g_new0 (LoadData, 1);
+	load_data->archive = g_object_ref (archive);
+	load_data->cancellable = _g_object_ref (cancellable);
+	load_data->result = g_simple_async_result_new (G_OBJECT (archive),
+						       callback,
+						       user_data,
+						       fr_archive_load);
+	load_data->buffer_size = BUFFER_SIZE_FOR_READING;
+	load_data->buffer = g_new (char, load_data->buffer_size);
+
+	g_simple_async_result_set_op_res_gpointer (load_data->result, load_data, NULL);
+	g_simple_async_result_run_in_thread (load_data->result,
+					     load_archive_thread,
+					     G_PRIORITY_DEFAULT,
+					     cancellable);
+}
+
+
+/* -- add -- */
+
+
+static void
+fr_archive_libarchive_add_files (FrArchive           *base,
+				 GList               *file_list,
+				 const char          *base_dir,
+				 const char          *dest_dir,
+				 gboolean             update,
+				 gboolean             recursive,
+				 const char          *password,
+				 gboolean             encrypt_header,
+				 FrCompression        compression,
+				 guint                volume_size,
+				 GCancellable        *cancellable,
+				 GAsyncReadyCallback  callback,
+				 gpointer             user_data)
+{
+}
+
+
+/* -- remove -- */
+
+
+static void
+fr_archive_libarchive_remove_files (FrArchive           *archive,
+				    GList               *file_list,
+				    FrCompression        compression,
+				    GCancellable        *cancellable,
+				    GAsyncReadyCallback  callback,
+				    gpointer             user_data)
+{
+}
+
+
+/* -- extract -- */
+
+
+static void
+fr_archive_libarchive_extract_files (FrArchive           *base,
+				     GList               *file_list,
+				     const char          *destination,
+				     const char          *base_dir,
+				     gboolean             skip_older,
+				     gboolean             overwrite,
+				     gboolean             junk_paths,
+				     const char          *password,
+				     GCancellable        *cancellable,
+				     GAsyncReadyCallback  callback,
+				     gpointer             user_data)
+{
+}
+
+
+/* -- fr_archive_libarchive_rename -- */
+
+
+static void
+fr_archive_libarchive_rename (FrArchive           *archive,
+			      GList               *file_list,
+			      const char          *old_name,
+			      const char          *new_name,
+			      const char          *current_dir,
+			      gboolean             is_dir,
+			      gboolean             dir_in_archive,
+			      const char          *original_path,
+			      GCancellable        *cancellable,
+			      GAsyncReadyCallback  callback,
+			      gpointer             user_data)
+{
+}
+
+
+/* -- fr_archive_libarchive_paste_clipboard -- */
+
+
+static void
+fr_archive_libarchive_paste_clipboard (FrArchive           *archive,
+				       char                *archive_uri,
+				       char                *password,
+				       gboolean             encrypt_header,
+				       FrCompression        compression,
+				       guint                volume_size,
+				       FrClipboardOp        op,
+				       char                *base_dir,
+				       GList               *files,
+				       char                *tmp_dir,
+				       char                *current_dir,
+				       GCancellable        *cancellable,
+				       GAsyncReadyCallback  callback,
+				       gpointer             user_data)
+{
+}
+
+
+/* -- fr_archive_libarchive_add_dropped_items -- */
+
+
+static void
+fr_archive_libarchive_add_dropped_items (FrArchive           *archive,
+					 GList               *item_list,
+					 const char          *base_dir,
+					 const char          *dest_dir,
+					 gboolean             update,
+					 const char          *password,
+					 gboolean             encrypt_header,
+					 FrCompression        compression,
+					 guint                volume_size,
+					 GCancellable        *cancellable,
+					 GAsyncReadyCallback  callback,
+					 gpointer             user_data)
+{
+}
+
+
+/* -- fr_archive_libarchive_update_open_files -- */
+
+
+static void
+fr_archive_libarchive_update_open_files (FrArchive           *archive,
+					 GList               *file_list,
+					 GList               *dir_list,
+					 const char          *password,
+					 gboolean             encrypt_header,
+					 FrCompression        compression,
+					 guint                volume_size,
+					 GCancellable        *cancellable,
+					 GAsyncReadyCallback  callback,
+					 gpointer             user_data)
+{
+}
+
+
+static void
+fr_archive_libarchive_class_init (FrArchiveLibarchiveClass *klass)
+{
+	GObjectClass   *gobject_class;
+	FrArchiveClass *archive_class;
+
+	fr_archive_libarchive_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (klass, sizeof (FrArchiveLibarchivePrivate));
+
+	gobject_class = G_OBJECT_CLASS (klass);
+	gobject_class->finalize = fr_archive_libarchive_finalize;
+
+	archive_class = FR_ARCHIVE_CLASS (klass);
+	archive_class->get_mime_types = fr_archive_libarchive_get_mime_types;
+	archive_class->get_capabilities = fr_archive_libarchive_get_capabilities;
+	archive_class->get_packages = fr_archive_libarchive_get_packages;
+	archive_class->load = fr_archive_libarchive_load;
+	archive_class->add_files = fr_archive_libarchive_add_files;
+	archive_class->remove_files = fr_archive_libarchive_remove_files;
+	archive_class->extract_files = fr_archive_libarchive_extract_files;
+	archive_class->rename = fr_archive_libarchive_rename;
+	archive_class->paste_clipboard = fr_archive_libarchive_paste_clipboard;
+	archive_class->add_dropped_items = fr_archive_libarchive_add_dropped_items;
+	archive_class->update_open_files = fr_archive_libarchive_update_open_files;
+}
+
+
+static void
+fr_archive_libarchive_init (FrArchiveLibarchive *self)
+{
+	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, FR_TYPE_ARCHIVE_LIBARCHIVE, FrArchiveLibarchivePrivate);
+}
diff --git a/src/fr-archive-libarchive.h b/src/fr-archive-libarchive.h
new file mode 100644
index 0000000..e90e384
--- /dev/null
+++ b/src/fr-archive-libarchive.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  File-Roller
+ *
+ *  Copyright (C) 2012 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FR_ARCHIVE_LIBARCHIVE_H
+#define FR_ARCHIVE_LIBARCHIVE_H
+
+#include <glib.h>
+#include "fr-archive.h"
+
+#define FR_TYPE_ARCHIVE_LIBARCHIVE            (fr_archive_libarchive_get_type ())
+#define FR_ARCHIVE_LIBARCHIVE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_ARCHIVE_LIBARCHIVE, FrArchiveLibarchive))
+#define FR_ARCHIVE_LIBARCHIVE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_ARCHIVE_LIBARCHIVE, FrArchiveLibarchiveClass))
+#define FR_IS_ARCHIVE_LIBARCHIVE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_ARCHIVE_LIBARCHIVE))
+#define FR_IS_ARCHIVE_LIBARCHIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_ARCHIVE_LIBARCHIVE))
+#define FR_ARCHIVE_LIBARCHIVE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_ARCHIVE_LIBARCHIVE, FrArchiveLibarchiveClass))
+
+typedef struct _FrArchiveLibarchive        FrArchiveLibarchive;
+typedef struct _FrArchiveLibarchiveClass   FrArchiveLibarchiveClass;
+typedef struct _FrArchiveLibarchivePrivate FrArchiveLibarchivePrivate;
+
+struct _FrArchiveLibarchive {
+	FrArchive  __parent;
+	FrArchiveLibarchivePrivate *priv;
+};
+
+struct _FrArchiveLibarchiveClass {
+	FrArchiveClass __parent_class;
+};
+
+GType  fr_archive_libarchive_get_type  (void);
+
+#endif /* FR_ARCHIVE_LIBARCHIVE_H */
diff --git a/src/fr-init.c b/src/fr-init.c
index 1435012..e20fafd 100644
--- a/src/fr-init.c
+++ b/src/fr-init.c
@@ -25,6 +25,9 @@
 #include "file-data.h"
 #include "file-utils.h"
 #include "glib-utils.h"
+#if ENABLE_LIBARCHIVE
+# include "fr-archive-libarchive.h"
+#endif
 #include "fr-command.h"
 #include "fr-command-ace.h"
 #include "fr-command-alz.h"
@@ -339,8 +342,8 @@ register_archives (void)
 	 * have higher priority over commands that can only read the same
 	 * format, regardless of the registration order. */
 
-#if HAVE_LIBARCHIVE
-	register_archive (FR_TYPE_LIBARCHIVE);
+#if ENABLE_LIBARCHIVE
+	register_archive (FR_TYPE_ARCHIVE_LIBARCHIVE);
 #endif
 
 	register_archive (FR_TYPE_COMMAND_TAR);



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