2
* @file script.h scripting support interface
4
* Copyright (C) 2006-2007 Lars Lindner <lars.lindner@gmail.com>
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public License
17
* along with this library; see the file COPYING.LIB. If not, write to
18
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
27
/** scripting support plugin interface */
28
typedef struct scriptSupportImpl {
29
guint api_version; /**< API version of scripting support plugin */
30
const gchar *name; /**< descriptive name of the plugin */
31
void (*init) (void); /**< called on startup */
32
void (*deinit) (void); /**< called on shutdown */
33
void (*run_cmd) (const gchar *cmd); /**< runs the given command */
34
void (*run_script) (const gchar *file, const gchar *for_hook); /**< runs the given script */
35
} *scriptSupportImplPtr;
37
#define SCRIPT_SUPPORT_API_VERSION 1
39
#define DECLARE_SCRIPT_SUPPORT_IMPL(impl) \
40
G_MODULE_EXPORT scriptSupportImplPtr script_support_impl_get_info() { \
44
/* script support interface */
47
SCRIPT_HOOK_INVALID = 0,
51
SCRIPT_HOOK_FEED_UPDATED,
54
SCRIPT_HOOK_ITEM_SELECTED,
55
SCRIPT_HOOK_FEED_SELECTED,
56
SCRIPT_HOOK_ITEM_UNSELECT,
57
SCRIPT_HOOK_FEED_UNSELECT,
61
SCRIPT_HOOK_NEW_SUBSCRIPTION
65
* Checks wether scripting support is available and enabled or not.
67
* @returns TRUE if scripting support is available
69
gboolean script_support_enabled(void);
72
* Sets up the scripting engine.
74
void script_init(void);
77
* Runs a single command line.
79
* @param cmd the command string
81
void script_run_cmd(const gchar *cmd);
84
* Run a single script from the script repository.
86
* @param name the script name
87
* @param hook type of the calling hook
89
void script_run(const gchar *name, hookType hook);
92
* Run all scripts defined for the given hook id.
94
* @param type scripting hook type
96
void script_run_for_hook(hookType type);
99
* Adds a script to the script list of the given hook type.
101
* @param type scripting hook type
102
* @param scriptname the script
104
void script_hook_add(hookType type, const gchar *scriptname);
107
* Removes a script from the script list of the given hook type.
108
* Frees the passed script name.
110
* @param type scripting hook type
111
* @param scriptname the script
113
void script_hook_remove(hookType type, gchar *scriptname);
116
* Returns the script name list for the given hook type.
118
* @returns script list
120
GSList *script_hook_get_list(hookType type);
123
* Close down scripting.
125
void script_deinit(void);