diff options
author | Perberos <[email protected]> | 2011-11-09 22:53:33 -0300 |
---|---|---|
committer | Perberos <[email protected]> | 2011-11-09 22:53:33 -0300 |
commit | 70438138096a47b2505ac55634cd94947ce378b6 (patch) | |
tree | e45e49dda10a71616466500a4ab65d1c54b5f6c1 /src/fr-command.h | |
download | engrampa-70438138096a47b2505ac55634cd94947ce378b6.tar.bz2 engrampa-70438138096a47b2505ac55634cd94947ce378b6.tar.xz |
initial
Diffstat (limited to 'src/fr-command.h')
-rw-r--r-- | src/fr-command.h | 228 |
1 files changed, 228 insertions, 0 deletions
diff --git a/src/fr-command.h b/src/fr-command.h new file mode 100644 index 0000000..39b18de --- /dev/null +++ b/src/fr-command.h @@ -0,0 +1,228 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * File-Roller + * + * Copyright (C) 2001 The 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, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + */ + +#ifndef FR_COMMAND_H +#define FR_COMMAND_H + +#include <glib.h> +#include "file-data.h" +#include "fr-process.h" + +#define PACKAGES(x) (x) + +#define FR_TYPE_COMMAND (fr_command_get_type ()) +#define FR_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_COMMAND, FrCommand)) +#define FR_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FR_TYPE_COMMAND, FrCommandClass)) +#define FR_IS_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_COMMAND)) +#define FR_IS_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_COMMAND)) +#define FR_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_COMMAND, FrCommandClass)) + +typedef struct _FrCommand FrCommand; +typedef struct _FrCommandClass FrCommandClass; + +typedef enum { + FR_ACTION_NONE, + FR_ACTION_CREATING_NEW_ARCHIVE, + FR_ACTION_LOADING_ARCHIVE, /* loading the archive from a remote location */ + FR_ACTION_LISTING_CONTENT, /* listing the content of the archive */ + FR_ACTION_DELETING_FILES, /* deleting files from the archive */ + FR_ACTION_TESTING_ARCHIVE, /* testing the archive integrity */ + FR_ACTION_GETTING_FILE_LIST, /* getting the file list (when fr_archive_add_with_wildcard or + fr_archive_add_directory are used, we need to scan a directory + and collect the files to add to the archive, this + may require some time to complete, so the operation + is asynchronous) */ + FR_ACTION_COPYING_FILES_FROM_REMOTE, /* copying files to be added to the archive from a remote location */ + FR_ACTION_ADDING_FILES, /* adding files to an archive */ + FR_ACTION_EXTRACTING_FILES, /* extracting files */ + FR_ACTION_COPYING_FILES_TO_REMOTE, /* copying extracted files to a remote location */ + FR_ACTION_CREATING_ARCHIVE, /* creating a local archive */ + FR_ACTION_SAVING_REMOTE_ARCHIVE /* copying the archive to a remote location */ +} FrAction; + +#ifdef DEBUG +extern char *action_names[]; +#endif + +struct _FrCommand +{ + GObject __parent; + + /*<public, read only>*/ + + GPtrArray *files; /* Array of FileData* */ + int n_regular_files; + FrProcess *process; /* the process object used to execute + * commands. */ + char *filename; /* archive file path. */ + char *e_filename; /* escaped archive filename. */ + const char *mime_type; + gboolean multi_volume; + + /*<protected>*/ + + /* options */ + + char *password; + gboolean encrypt_header : 1; + FrCompression compression; + guint volume_size; + gboolean creating_archive; + + /* features. */ + + guint propAddCanUpdate : 1; + guint propAddCanReplace : 1; + guint propAddCanStoreFolders : 1; + guint propExtractCanAvoidOverwrite : 1; + guint propExtractCanSkipOlder : 1; + guint propExtractCanJunkPaths : 1; + guint propPassword : 1; + guint propTest : 1; + guint propCanExtractAll : 1; + guint propCanDeleteNonEmptyFolders : 1; + guint propCanExtractNonEmptyFolders : 1; + guint propListFromFile : 1; + + /*<private>*/ + + FrCommandCaps capabilities; + FrAction action; /* current action. */ + gboolean fake_load; /* if TRUE does nothing when the list + * operation is invoked. */ + + /* progress data */ + + int n_file; + int n_files; +}; + +struct _FrCommandClass +{ + GObjectClass __parent_class; + + /*<virtual functions>*/ + + void (*list) (FrCommand *comm); + void (*add) (FrCommand *comm, + const char *from_file, + GList *file_list, + const char *base_dir, + gboolean update, + gboolean recursive); + void (*delete) (FrCommand *comm, + const char *from_file, + GList *file_list); + void (*extract) (FrCommand *comm, + const char *from_file, + GList *file_list, + const char *dest_dir, + gboolean overwrite, + gboolean skip_older, + gboolean junk_paths); + void (*test) (FrCommand *comm); + void (*uncompress) (FrCommand *comm); + void (*recompress) (FrCommand *comm); + void (*handle_error) (FrCommand *comm, + FrProcError *error); + const char ** (*get_mime_types) (FrCommand *comm); + FrCommandCap (*get_capabilities) (FrCommand *comm, + const char *mime_type, + gboolean check_command); + void (*set_mime_type) (FrCommand *comm, + const char *mime_type); + const char * (*get_packages) (FrCommand *comm, + const char *mime_type); + + /*<signals>*/ + + void (*start) (FrCommand *comm, + FrAction action); + void (*done) (FrCommand *comm, + FrAction action, + FrProcError *error); + void (*progress) (FrCommand *comm, + double fraction); + void (*message) (FrCommand *comm, + const char *msg); + void (*working_archive) (FrCommand *comm, + const char *filename); +}; + +GType fr_command_get_type (void); +void fr_command_set_filename (FrCommand *comm, + const char *filename); +void fr_command_set_multi_volume (FrCommand *comm, + const char *filename); +void fr_command_list (FrCommand *comm); +void fr_command_add (FrCommand *comm, + const char *from_file, + GList *file_list, + const char *base_dir, + gboolean update, + gboolean recursive); +void fr_command_delete (FrCommand *comm, + const char *from_file, + GList *file_list); +void fr_command_extract (FrCommand *comm, + const char *from_file, + GList *file_list, + const char *dest_dir, + gboolean overwrite, + gboolean skip_older, + gboolean junk_paths); +void fr_command_test (FrCommand *comm); +void fr_command_uncompress (FrCommand *comm); +void fr_command_recompress (FrCommand *comm); +gboolean fr_command_is_capable_of (FrCommand *comm, + FrCommandCaps capabilities); +const char ** fr_command_get_mime_types (FrCommand *comm); +void fr_command_update_capabilities (FrCommand *comm); +FrCommandCap fr_command_get_capabilities (FrCommand *comm, + const char *mime_type, + gboolean check_command); +void fr_command_set_mime_type (FrCommand *comm, + const char *mime_type); +gboolean fr_command_is_capable_of (FrCommand *comm, + FrCommandCaps capabilities); +const char * fr_command_get_packages (FrCommand *comm, + const char *mime_type); + +/* protected functions */ + +void fr_command_progress (FrCommand *comm, + double fraction); +void fr_command_message (FrCommand *comm, + const char *msg); +void fr_command_working_archive (FrCommand *comm, + const char *archive_name); +void fr_command_set_n_files (FrCommand *comm, + int n_files); +void fr_command_add_file (FrCommand *comm, + FileData *fdata); + +/* private functions */ + +void fr_command_handle_error (FrCommand *comm, + FrProcError *error); + +#endif /* FR_COMMAND_H */ |