Mercurial > geeqie.yaz
annotate src/editors.h @ 1468:e9f9d3da3f43
added tooltips to external editors on toolbar
- patch by Colin Clark
author | nadvornik |
---|---|
date | Fri, 20 Mar 2009 17:02:00 +0000 |
parents | 03384485676d |
children | d062522699dc |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
9 | 3 * (C) 2004 John Ellis |
1284 | 4 * Copyright (C) 2008 - 2009 The Geeqie Team |
9 | 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 | |
442 | 17 |
1405 | 18 typedef enum { |
19 EDITOR_KEEP_FS = 0x00000001, | |
20 EDITOR_VERBOSE = 0x00000002, | |
21 EDITOR_VERBOSE_MULTI = 0x00000004, | |
22 EDITOR_TERMINAL = 0x00000008, | |
442 | 23 |
1405 | 24 EDITOR_DEST = 0x00000100, |
25 EDITOR_FOR_EACH = 0x00000200, | |
26 EDITOR_SINGLE_COMMAND = 0x00000400, | |
27 /* below are errors */ | |
28 EDITOR_ERROR_EMPTY = 0x00020000, | |
29 EDITOR_ERROR_SYNTAX = 0x00040000, | |
30 EDITOR_ERROR_INCOMPATIBLE = 0x00080000, | |
31 EDITOR_ERROR_NO_FILE = 0x00100000, | |
32 EDITOR_ERROR_CANT_EXEC = 0x00200000, | |
33 EDITOR_ERROR_STATUS = 0x00400000, | |
34 EDITOR_ERROR_SKIPPED = 0x00800000, | |
35 /* mask to match errors only */ | |
36 EDITOR_ERROR_MASK = 0xffff0000, | |
37 } EditorFlags; | |
140 | 38 |
1405 | 39 struct _EditorDescription { |
40 gchar *key; /* desktop file name, not including path, including extension */ | |
41 gchar *name; /* Name, localized name presented to user */ | |
42 gchar *icon; /* Icon */ | |
43 gchar *exec; /* Exec */ | |
44 gchar *menu_path; | |
45 gchar *hotkey; | |
46 GList *ext_list; | |
47 gchar *file; | |
1468 | 48 gchar *comment; /* .desktop Comment key, used to show a tooltip */ |
1405 | 49 EditorFlags flags; |
50 gboolean hidden; | |
51 }; | |
442 | 52 |
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
|
53 #define EDITOR_ERRORS(flags) ((flags) & EDITOR_ERROR_MASK) |
1405 | 54 #define EDITOR_ERRORS_BUT_SKIPPED(flags) (!!(((flags) & EDITOR_ERROR_MASK) && !((flags) & EDITOR_ERROR_SKIPPED))) |
55 | |
140 | 56 |
57 /* return values from callback function */ | |
58 enum { | |
59 EDITOR_CB_CONTINUE = 0, /* continue multiple editor execution on remaining files*/ | |
60 EDITOR_CB_SKIP, /* skip the remaining files */ | |
61 EDITOR_CB_SUSPEND /* suspend execution, one of editor_resume or editor_skip | |
442 | 62 must be called later */ |
140 | 63 }; |
64 | |
1272 | 65 extern GHashTable *editors; |
66 | |
67 void editor_load_descriptions(void); | |
68 GList *editor_list_get(void); | |
69 | |
140 | 70 |
71 /* | |
442 | 72 Callback is called even on skipped files, with the EDITOR_ERROR_SKIPPED flag set. |
140 | 73 It is a good place to call file_data_change_info_free(). |
74 | |
75 ed - pointer that can be used for editor_resume/editor_skip or NULL if all files were already processed | |
76 flags - flags above | |
77 list - list of procesed FileData structures, typically single file or whole list passed to start_editor_* | |
78 data - generic pointer | |
79 */ | |
1405 | 80 typedef gint (*EditorCallback) (gpointer ed, EditorFlags flags, GList *list, gpointer data); |
140 | 81 |
82 | |
83 void editor_resume(gpointer ed); | |
84 void editor_skip(gpointer ed); | |
85 | |
86 | |
9 | 87 |
1405 | 88 EditorFlags start_editor_from_file(const gchar *key, FileData *fd); |
89 EditorFlags start_editor_from_filelist(const gchar *key, GList *list); | |
90 EditorFlags start_editor_from_file_full(const gchar *key, FileData *fd, EditorCallback cb, gpointer data); | |
91 EditorFlags start_editor_from_filelist_full(const gchar *key, GList *list, EditorCallback cb, gpointer data); | |
92 gboolean editor_window_flag_set(const gchar *key); | |
93 gboolean editor_is_filter(const gchar *key); | |
94 const gchar *editor_get_error_str(EditorFlags flags); | |
9 | 95 |
1272 | 96 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
|
97 |
1272 | 98 gboolean is_valid_editor_command(const gchar *key); |
1405 | 99 EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, gchar **output); |
766
7148e125bf23
Check for existing editor command using is_valid_editor_command().
zas_
parents:
753
diff
changeset
|
100 |
9 | 101 #endif |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
976
diff
changeset
|
102 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |