summaryrefslogtreecommitdiff
path: root/src/typedefs.h
blob: 82ce933cce6e8384531ddfcdbfb98f0744b5c79c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */

/*
 *  Engrampa
 *
 *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef TYPEDEFS_H
#define TYPEDEFS_H

#include <glib.h>
#include <glib-object.h>

#define MEGABYTE (1024.0 * 1024.0)

#define ADD_FOLDER_OPTIONS_DIR  "engrampa/options"

typedef enum { /*< skip >*/
	FR_WINDOW_SORT_BY_NAME = 0,
	FR_WINDOW_SORT_BY_SIZE = 1,
	FR_WINDOW_SORT_BY_TYPE = 2,
	FR_WINDOW_SORT_BY_TIME = 3,
	FR_WINDOW_SORT_BY_PATH = 4
} FrWindowSortMethod;

typedef enum { /*< skip >*/
	FR_WINDOW_LIST_MODE_FLAT,
	FR_WINDOW_LIST_MODE_AS_DIR
} FrWindowListMode;

typedef enum {
	FR_COMPRESSION_VERY_FAST,
	FR_COMPRESSION_FAST,
	FR_COMPRESSION_NORMAL,
	FR_COMPRESSION_MAXIMUM
} FrCompression;

typedef enum {
	FR_OVERWRITE_YES,
	FR_OVERWRITE_NO,
	FR_OVERWRITE_ASK
} FrOverwrite;

typedef enum { /*< skip >*/
	FR_PROC_ERROR_NONE,
	FR_PROC_ERROR_GENERIC,
	FR_PROC_ERROR_COMMAND_ERROR,
	FR_PROC_ERROR_COMMAND_NOT_FOUND,
	FR_PROC_ERROR_EXITED_ABNORMALLY,
	FR_PROC_ERROR_SPAWN,
	FR_PROC_ERROR_STOPPED,
	FR_PROC_ERROR_ASK_PASSWORD,
	FR_PROC_ERROR_MISSING_VOLUME,
	FR_PROC_ERROR_IO_CHANNEL,
	FR_PROC_ERROR_BAD_CHARSET,
	FR_PROC_ERROR_UNSUPPORTED_FORMAT
} FrProcErrorType;

typedef struct {
	FrProcErrorType  type;
	int              status;
	GError          *gerror;
} FrProcError;

typedef enum { /*< skip >*/
	FR_COMMAND_CAN_DO_NOTHING = 0,
	FR_COMMAND_CAN_READ = 1 << 0,
	FR_COMMAND_CAN_WRITE = 1 << 1,
	FR_COMMAND_CAN_ARCHIVE_MANY_FILES = 1 << 2,
	FR_COMMAND_CAN_ENCRYPT = 1 << 3,
	FR_COMMAND_CAN_ENCRYPT_HEADER = 1 << 4,
	FR_COMMAND_CAN_CREATE_VOLUMES = 1 << 5
} FrCommandCap;

#define FR_COMMAND_CAN_READ_WRITE (FR_COMMAND_CAN_READ | FR_COMMAND_CAN_WRITE)

typedef guint8 FrCommandCaps;

typedef struct {
	const char    *mime_type;
	FrCommandCaps  current_capabilities;
	FrCommandCaps  potential_capabilities;
} FrMimeTypeCap;

typedef struct {
	const char *mime_type;
	const char *packages;
} FrMimeTypePackages;

typedef struct {
	int        ref;
	GType      type;
	GPtrArray *caps;  /* array of FrMimeTypeCap */
	GPtrArray *packages;  /* array of FrMimeTypePackages */
} FrRegisteredCommand;

typedef struct {
	const char    *mime_type;
	const char    *default_ext;
	const char    *name;
	FrCommandCaps  capabilities;
} FrMimeTypeDescription;

typedef struct {
	const char *ext;
	const char *mime_type;
} FrExtensionType;

#endif /* TYPEDEFS_H */