In various Edit context menus, only display editors that match the file types in...
[geeqie.git] / src / editors.h
1 /*
2  * Geeqie
3  * (C) 2004 John Ellis
4  * Copyright (C) 2008 - 2009 The Geeqie Team
5  *
6  * Author: John Ellis
7  *
8  * This software is released under the GNU General Public License (GNU GPL).
9  * Please read the included file COPYING for more information.
10  * This software comes with no warranty of any kind, use at your own risk!
11  */
12
13
14 #ifndef EDITORS_H
15 #define EDITORS_H
16
17
18 #define EDITOR_KEEP_FS            0x00000001
19 #define EDITOR_VERBOSE            0x00000002
20 #define EDITOR_VERBOSE_MULTI      0x00000004
21 #define EDITOR_TERMINAL           0x00000008
22
23 #define EDITOR_DEST               0x00000100
24 #define EDITOR_FOR_EACH           0x00000200
25 #define EDITOR_SINGLE_COMMAND     0x00000400
26
27 #define EDITOR_ERROR_EMPTY        0x00020000
28 #define EDITOR_ERROR_SYNTAX       0x00040000
29 #define EDITOR_ERROR_INCOMPATIBLE 0x00080000
30 #define EDITOR_ERROR_NO_FILE      0x00100000
31 #define EDITOR_ERROR_CANT_EXEC    0x00200000
32 #define EDITOR_ERROR_STATUS       0x00400000
33 #define EDITOR_ERROR_SKIPPED      0x00800000
34
35 #define EDITOR_ERROR_MASK         0xffff0000
36
37
38 /* return values from callback function */
39 enum {
40         EDITOR_CB_CONTINUE = 0, /* continue multiple editor execution on remaining files*/
41         EDITOR_CB_SKIP,         /* skip the remaining files */
42         EDITOR_CB_SUSPEND       /* suspend execution, one of editor_resume or editor_skip
43                                    must be called later */
44 };
45
46 extern GHashTable *editors;
47
48 void editor_load_descriptions(void);
49 GList *editor_list_get(void);
50
51
52 /*
53 Callback is called even on skipped files, with the EDITOR_ERROR_SKIPPED flag set.
54 It is a good place to call file_data_change_info_free().
55
56 ed - pointer that can be used for editor_resume/editor_skip or NULL if all files were already processed
57 flags - flags above
58 list - list of procesed FileData structures, typically single file or whole list passed to start_editor_*
59 data - generic pointer
60 */
61 typedef gint (*EditorCallback) (gpointer ed, gint flags, GList *list, gpointer data);
62
63
64 void editor_resume(gpointer ed);
65 void editor_skip(gpointer ed);
66
67
68
69 gint start_editor_from_file(const gchar *key, FileData *fd);
70 gint start_editor_from_filelist(const gchar *key, GList *list);
71 gint start_editor_from_file_full(const gchar *key, FileData *fd, EditorCallback cb, gpointer data);
72 gint start_editor_from_filelist_full(const gchar *key, GList *list, EditorCallback cb, gpointer data);
73 gint editor_window_flag_set(const gchar *key);
74 gint editor_is_filter(const gchar *key);
75 const gchar *editor_get_error_str(gint flags);
76
77 const gchar *editor_get_name(const gchar *key);
78
79 gboolean is_valid_editor_command(const gchar *key);
80 gint editor_command_parse(const EditorDescription *editor, GList *list, gchar **output);
81
82 #endif
83 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */