summaryrefslogtreecommitdiff
path: root/src/fr-window.h
blob: dcbd01898b42a97393112522c3aadd59ad90c9b4 (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */

/*
 *  Engrampa
 *
 *  Copyright (C) 2007 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 FR_WINDOW_H
#define FR_WINDOW_H

#include <gio/gio.h>
#include <gtk/gtk.h>
#include "typedefs.h"
#include "fr-archive.h"

enum {
	COLUMN_FILE_DATA,
	COLUMN_ICON,
	COLUMN_NAME,
	COLUMN_EMBLEM,
	COLUMN_SIZE,
	COLUMN_TYPE,
	COLUMN_TIME,
	COLUMN_PATH,
	NUMBER_OF_COLUMNS
};

enum {
	TREE_COLUMN_PATH,
	TREE_COLUMN_ICON,
	TREE_COLUMN_NAME,
	TREE_COLUMN_WEIGHT,
	TREE_NUMBER_OF_COLUMNS
};

typedef enum {
	FR_BATCH_ACTION_NONE,
	FR_BATCH_ACTION_LOAD,
	FR_BATCH_ACTION_OPEN,
	FR_BATCH_ACTION_ADD,
	FR_BATCH_ACTION_DELETE,
	FR_BATCH_ACTION_EXTRACT,
	FR_BATCH_ACTION_EXTRACT_HERE,
	FR_BATCH_ACTION_EXTRACT_INTERACT,
	FR_BATCH_ACTION_RENAME,
	FR_BATCH_ACTION_PASTE,
	FR_BATCH_ACTION_OPEN_FILES,
	FR_BATCH_ACTION_SAVE_AS,
	FR_BATCH_ACTION_TEST,
	FR_BATCH_ACTION_CLOSE,
	FR_BATCH_ACTION_QUIT,
	FR_BATCH_ACTIONS
} FrBatchActionType;

/* -- FrWindow -- */

#define FR_TYPE_WINDOW              (fr_window_get_type ())
#define FR_WINDOW(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), FR_TYPE_WINDOW, FrWindow))
#define FR_WINDOW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), FR_WINDOW_TYPE, FrWindowClass))
#define FR_IS_WINDOW(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FR_TYPE_WINDOW))
#define FR_IS_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), FR_TYPE_WINDOW))
#define FR_WINDOW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), FR_TYPE_WINDOW, FrWindowClass))

typedef struct _FrWindow            FrWindow;
typedef struct _FrWindowClass       FrWindowClass;
typedef struct _FrWindowPrivateData FrWindowPrivateData;

struct _FrWindow
{
	GtkApplicationWindow __parent;
	FrArchive *archive;
	FrWindowPrivateData *priv;
};

struct _FrWindowClass
{
	GtkApplicationWindowClass __parent_class;

	/*<signals>*/

	void (*archive_loaded) (FrWindow   *window,
				gboolean    success);
	void (*progress)       (FrWindow   *window,
			        double      fraction,
			        const char *msg);
	void (*ready)          (FrWindow   *window,
				GError     *error);
};

GType       fr_window_get_type                  (void);
GtkWidget * fr_window_new                       (void);
void        fr_window_close                     (FrWindow      *window);

/* archive operations */

gboolean    fr_window_archive_new               (FrWindow      *window,
						 const char    *uri);
FrWindow *  fr_window_archive_open              (FrWindow      *window,
						 const char    *uri,
						 GtkWindow     *parent);
void        fr_window_archive_close             (FrWindow      *window);
const char *fr_window_get_archive_uri           (FrWindow      *window);
const char *fr_window_get_paste_archive_uri     (FrWindow      *window);
gboolean    fr_window_archive_is_present        (FrWindow      *window);
void        fr_window_archive_save_as           (FrWindow      *window,
						 const char    *filename,
						 const char    *password,
						 gboolean       encrypt_header,
						 guint          volume_size);
void        fr_window_archive_reload            (FrWindow      *window);
void        fr_window_archive_add_files         (FrWindow      *window,
						 GList         *file_list, /* GFile list */
						 gboolean       update);
void        fr_window_archive_add_with_wildcard (FrWindow      *window,
						 const char    *include_files,
						 const char    *exclude_files,
						 const char    *exclude_folders,
						 const char    *base_dir,
						 const char    *dest_dir,
						 gboolean       update,
						 gboolean       follow_links);
void        fr_window_archive_add_directory     (FrWindow      *window,
						 const char    *directory,
						 const char    *base_dir,
						 const char    *dest_dir,
						 gboolean       update);
void        fr_window_archive_add_items         (FrWindow      *window,
						 GList         *dir_list,
						 const char    *base_dir,
						 const char    *dest_dir,
						 gboolean       update);
void        fr_window_archive_add_dropped_items (FrWindow      *window,
						 GList         *item_list,
						 gboolean       update);
void        fr_window_archive_remove            (FrWindow      *window,
						 GList         *file_list);
void        fr_window_archive_extract           (FrWindow      *window,
						 GList         *file_list,
						 const char    *extract_to_dir,
						 const char    *sub_dir,
						 const char    *base_dir,
						 gboolean       skip_older,
						 FrOverwrite    overwrite,
						 gboolean       junk_paths,
						 gboolean       ask_to_open_destination);
void        fr_window_archive_extract_here      (FrWindow      *window,
						 gboolean       skip_older,
						 FrOverwrite    overwrite,
						 gboolean       junk_paths);
void        fr_window_archive_test	        (FrWindow      *window);

/**/

void        fr_window_set_password              (FrWindow      *window,
						 const char    *password);
void        fr_window_set_password_for_paste    (FrWindow      *window,
					         const char    *password);
const char *fr_window_get_password              (FrWindow      *window);
void        fr_window_set_encrypt_header        (FrWindow      *window,
						 gboolean       encrypt_header);
gboolean    fr_window_get_encrypt_header        (FrWindow      *window);
void        fr_window_set_compression 	        (FrWindow      *window,
						 FrCompression  compression);
FrCompression fr_window_get_compression 	(FrWindow      *window);
void        fr_window_set_volume_size 	        (FrWindow      *window,
						 guint          volume_size);
guint       fr_window_get_volume_size 	        (FrWindow      *window);

/**/

void       fr_window_go_to_location             (FrWindow       *window,
					 	 const char     *path,
					 	 gboolean        force_update);
const char*fr_window_get_current_location       (FrWindow       *window);
void       fr_window_go_up_one_level            (FrWindow       *window);
void       fr_window_go_back                    (FrWindow       *window);
void       fr_window_go_forward                 (FrWindow       *window);
void       fr_window_current_folder_activated   (FrWindow       *window,
						 gboolean        from_sidebar);
void       fr_window_set_list_mode              (FrWindow       *window,
						 FrWindowListMode  list_mode);

/**/

void       fr_window_update_list_order            (FrWindow    *window);
GList *    fr_window_get_file_list_selection      (FrWindow    *window,
						   gboolean     recursive,
						   gboolean    *has_dirs);
GList *    fr_window_get_file_list_from_path_list (FrWindow    *window,
						   GList       *path_list,
						   gboolean    *has_dirs);
GList *    fr_window_get_file_list_pattern        (FrWindow    *window,
						   const char  *pattern);
int        fr_window_get_n_selected_files         (FrWindow    *window);
GList *    fr_window_get_folder_tree_selection    (FrWindow    *window,
				     		   gboolean     recursive,
				     		   gboolean    *has_dirs);
GList *    fr_window_get_selection                (FrWindow    *window,
		  	 			   gboolean     from_sidebar,
		  	 			   char       **return_base_dir);
GtkTreeModel *
	   fr_window_get_list_store               (FrWindow    *window);
void       fr_window_find                         (FrWindow    *window);
void       fr_window_select_all                   (FrWindow    *window);
void       fr_window_unselect_all                 (FrWindow    *window);
/**/

void       fr_window_rename_selection             (FrWindow    *window,
						   gboolean     from_sidebar);
void       fr_window_cut_selection                (FrWindow    *window,
						   gboolean     from_sidebar);
void       fr_window_copy_selection               (FrWindow    *window,
						   gboolean     from_sidebar);
void       fr_window_paste_selection              (FrWindow    *window,
						   gboolean     from_sidebar);

/**/

void       fr_window_stop                         (FrWindow    *window);
void       fr_window_start_activity_mode          (FrWindow    *window);
void       fr_window_stop_activity_mode           (FrWindow    *window);

/**/

void        fr_window_view_last_output            (FrWindow   *window,
						   const char *title);

void        fr_window_open_files                  (FrWindow   *window,
						   GList      *file_list,
						   gboolean    ask_application);
void        fr_window_open_files_with_command     (FrWindow   *window,
						   GList      *file_list,
						   char       *command);
void        fr_window_open_files_with_application (FrWindow   *window,
						   GList      *file_list,
						   GAppInfo   *app);
gboolean    fr_window_update_files                (FrWindow   *window,
						   GList      *file_list);
void        fr_window_update_columns_visibility   (FrWindow   *window);
void        fr_window_update_history_list         (FrWindow   *window);
void        fr_window_set_default_dir             (FrWindow   *window,
						   const char *default_dir,
						   gboolean    freeze);
void        fr_window_set_open_default_dir        (FrWindow   *window,
						   const char *default_dir);
const char *fr_window_get_open_default_dir        (FrWindow   *window);
void        fr_window_set_add_default_dir         (FrWindow   *window,
						   const char *default_dir);
const char *fr_window_get_add_default_dir         (FrWindow   *window);
void        fr_window_set_extract_default_dir     (FrWindow   *window,
						   const char *default_dir,
						   gboolean    freeze);
const char *fr_window_get_extract_default_dir     (FrWindow   *window);
void        fr_window_push_message                (FrWindow   *window,
						   const char *msg);
void        fr_window_pop_message                 (FrWindow   *window);
void        fr_window_set_toolbar_visibility      (FrWindow   *window,
						   gboolean    value);
void        fr_window_set_statusbar_visibility    (FrWindow   *window,
						   gboolean    value);
void        fr_window_set_folders_visibility      (FrWindow   *window,
						   gboolean    value);
void        fr_window_use_progress_dialog         (FrWindow   *window,
						   gboolean    value);

/* batch mode procedures. */

void       fr_window_new_batch                    (FrWindow      *window,
						   const char    *title);
void       fr_window_set_current_batch_action     (FrWindow      *window,
						   FrBatchActionType  action,
						   void          *data,
						   GFreeFunc      free_func);
void       fr_window_reset_current_batch_action   (FrWindow      *window);
void       fr_window_restart_current_batch_action (FrWindow      *window);
void       fr_window_append_batch_action          (FrWindow      *window,
						   FrBatchActionType  action,
						   void          *data,
						   GFreeFunc      free_func);
void       fr_window_start_batch                  (FrWindow      *window);
void       fr_window_stop_batch                   (FrWindow      *window);
void       fr_window_resume_batch                 (FrWindow      *window);
gboolean   fr_window_is_batch_mode                (FrWindow      *window);
void       fr_window_set_batch__extract           (FrWindow      *window,
						   const char    *filename,
						   const char    *dest_dir);
void       fr_window_set_batch__extract_here      (FrWindow      *window,
						   const char    *filename);
void       fr_window_set_batch__add               (FrWindow      *window,
						   const char    *archive,
						   GList         *file_list);
void       fr_window_destroy_with_error_dialog    (FrWindow      *window);

/**/

gboolean   fr_window_file_list_drag_data_get (FrWindow         *window,
					      GdkDragContext   *context,
					      GtkSelectionData *selection_data,
					      GList            *path_list);

void       fr_window_update_dialog_closed    (FrWindow *window);

void       fr_window_set_close_dialog        (FrWindow *window,
				               gboolean  state);
#endif /* FR_WINDOW_H */