annotate src/editors.h @ 1802:956aab097ea7

added 2010 to copyright text
author nadvornik
date Tue, 16 Feb 2010 21:18:03 +0000
parents eb64f542341b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 140
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
1802
956aab097ea7 added 2010 to copyright text
nadvornik
parents: 1742
diff changeset
4 * Copyright (C) 2008 - 2010 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #ifndef EDITORS_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 #define EDITORS_H
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 234
diff changeset
17
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
18 typedef enum {
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
19 EDITOR_KEEP_FS = 0x00000001,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
20 EDITOR_VERBOSE = 0x00000002,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
21 EDITOR_VERBOSE_MULTI = 0x00000004,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
22 EDITOR_TERMINAL = 0x00000008,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 234
diff changeset
23
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
24 EDITOR_DEST = 0x00000100,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
25 EDITOR_FOR_EACH = 0x00000200,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
26 EDITOR_SINGLE_COMMAND = 0x00000400,
1581
c9c1a16ff8ae allow external editors without parameters, as long as they are in
nadvornik
parents: 1479
diff changeset
27 EDITOR_NO_PARAM = 0x00000800,
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
28 /* below are errors */
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
29 EDITOR_ERROR_EMPTY = 0x00020000,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
30 EDITOR_ERROR_SYNTAX = 0x00040000,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
31 EDITOR_ERROR_INCOMPATIBLE = 0x00080000,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
32 EDITOR_ERROR_NO_FILE = 0x00100000,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
33 EDITOR_ERROR_CANT_EXEC = 0x00200000,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
34 EDITOR_ERROR_STATUS = 0x00400000,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
35 EDITOR_ERROR_SKIPPED = 0x00800000,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
36 /* mask to match errors only */
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
37 EDITOR_ERROR_MASK = 0xffff0000,
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
38 } EditorFlags;
140
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
39
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
40 struct _EditorDescription {
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
41 gchar *key; /* desktop file name, not including path, including extension */
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
42 gchar *name; /* Name, localized name presented to user */
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
43 gchar *icon; /* Icon */
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
44 gchar *exec; /* Exec */
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
45 gchar *menu_path;
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
46 gchar *hotkey;
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
47 GList *ext_list;
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
48 gchar *file;
1468
e9f9d3da3f43 added tooltips to external editors on toolbar
nadvornik
parents: 1405
diff changeset
49 gchar *comment; /* .desktop Comment key, used to show a tooltip */
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
50 EditorFlags flags;
1479
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
51 gboolean hidden; /* explicitly hidden, shown in configuration dialog */
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
52 gboolean ignored; /* not interesting, do not show at all */
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
53 };
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 234
diff changeset
54
1400
67573155210c Add helper macros EDITOR_ERRORS() and EDITOR_ERRORS_BUT_SKIPPED() to clean up the code a bit. Minor tidy up.
zas_
parents: 1397
diff changeset
55 #define EDITOR_ERRORS(flags) ((flags) & EDITOR_ERROR_MASK)
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
56 #define EDITOR_ERRORS_BUT_SKIPPED(flags) (!!(((flags) & EDITOR_ERROR_MASK) && !((flags) & EDITOR_ERROR_SKIPPED)))
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
57
140
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
58
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
59 /* return values from callback function */
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
60 enum {
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
61 EDITOR_CB_CONTINUE = 0, /* continue multiple editor execution on remaining files*/
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
62 EDITOR_CB_SKIP, /* skip the remaining files */
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
63 EDITOR_CB_SUSPEND /* suspend execution, one of editor_resume or editor_skip
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 234
diff changeset
64 must be called later */
140
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
65 };
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
66
1479
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
67 enum {
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
68 DESKTOP_FILE_COLUMN_KEY,
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
69 DESKTOP_FILE_COLUMN_NAME,
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
70 DESKTOP_FILE_COLUMN_HIDDEN,
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
71 DESKTOP_FILE_COLUMN_WRITABLE,
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
72 DESKTOP_FILE_COLUMN_PATH,
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
73 DESKTOP_FILE_COLUMN_COUNT
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
74 };
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
75
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
76 extern GtkListStore *desktop_file_list;
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
77
d062522699dc added simple desktop file editor
nadvornik
parents: 1468
diff changeset
78
1272
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
79 extern GHashTable *editors;
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
80
1736
8e64965c1d92 load desktop files in idle time
nadvornik
parents: 1652
diff changeset
81 void editor_table_finish(void);
8e64965c1d92 load desktop files in idle time
nadvornik
parents: 1652
diff changeset
82 void editor_table_clear(void);
8e64965c1d92 load desktop files in idle time
nadvornik
parents: 1652
diff changeset
83 GList *editor_get_desktop_files(void);
8e64965c1d92 load desktop files in idle time
nadvornik
parents: 1652
diff changeset
84 gboolean editor_read_desktop_file(const gchar *path);
8e64965c1d92 load desktop files in idle time
nadvornik
parents: 1652
diff changeset
85
1272
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
86 GList *editor_list_get(void);
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
87
140
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
88
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
89 /*
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 234
diff changeset
90 Callback is called even on skipped files, with the EDITOR_ERROR_SKIPPED flag set.
140
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
91 It is a good place to call file_data_change_info_free().
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
92
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
93 ed - pointer that can be used for editor_resume/editor_skip or NULL if all files were already processed
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
94 flags - flags above
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
95 list - list of procesed FileData structures, typically single file or whole list passed to start_editor_*
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
96 data - generic pointer
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
97 */
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
98 typedef gint (*EditorCallback) (gpointer ed, EditorFlags flags, GList *list, gpointer data);
140
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
99
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
100
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
101 void editor_resume(gpointer ed);
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
102 void editor_skip(gpointer ed);
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
103
e57b0207e180 editors.c was almost completely rewritten:
nadvornik
parents: 138
diff changeset
104
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105
1652
58a5d1e01e33 run external commands from current directory even with no files
nadvornik
parents: 1618
diff changeset
106 EditorFlags start_editor(const gchar *key, const gchar *working_directory);
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
107 EditorFlags start_editor_from_file(const gchar *key, FileData *fd);
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
108 EditorFlags start_editor_from_filelist(const gchar *key, GList *list);
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
109 EditorFlags start_editor_from_file_full(const gchar *key, FileData *fd, EditorCallback cb, gpointer data);
1652
58a5d1e01e33 run external commands from current directory even with no files
nadvornik
parents: 1618
diff changeset
110 EditorFlags start_editor_from_filelist_full(const gchar *key, GList *list, const gchar *working_directory, EditorCallback cb, gpointer data);
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
111 gboolean editor_window_flag_set(const gchar *key);
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
112 gboolean editor_is_filter(const gchar *key);
1581
c9c1a16ff8ae allow external editors without parameters, as long as they are in
nadvornik
parents: 1479
diff changeset
113 gboolean editor_no_param(const gchar *key);
1405
03384485676d Introduce EditorFlags type, cleanup.
zas_
parents: 1400
diff changeset
114 const gchar *editor_get_error_str(EditorFlags flags);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115
1272
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
116 const gchar *editor_get_name(const gchar *key);
731
fa8f7d7396cf Introduce an helper function that returns the name of an editor.
zas_
parents: 475
diff changeset
117
1272
e0e12512cde2 read external editors from .desktop files
nadvornik
parents: 1055
diff changeset
118 gboolean is_valid_editor_command(const gchar *key);
1618
552648eff4f2 do not block the files sent to external editors like gimp
nadvornik
parents: 1581
diff changeset
119 gboolean editor_blocks_file(const gchar *key);
552648eff4f2 do not block the files sent to external editors like gimp
nadvornik
parents: 1581
diff changeset
120
1742
eb64f542341b fixed list of possible editors in popup menu
nadvornik
parents: 1736
diff changeset
121 EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, gboolean consider_sidecars, gchar **output);
766
7148e125bf23 Check for existing editor command using is_valid_editor_command().
zas_
parents: 753
diff changeset
122
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 #endif
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 976
diff changeset
124 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */