diff options
author | Viktor Semykin <thesame.ml@gmail.com> | 2010-07-04 19:11:26 +0300 |
---|---|---|
committer | Viktor Semykin <thesame.ml@gmail.com> | 2010-07-04 19:15:28 +0300 |
commit | c6ef716dbefff585d97c9f24844186c2cd010d18 (patch) | |
tree | 5dae796860ae51efdc392d038cca0dbf513a5410 | |
parent | 5e64ac2297992c8cfe35233fc93585f7066a6faa (diff) |
added some comments
-rw-r--r-- | deadbeef.h | 7 | ||||
-rw-r--r-- | plugins/shellexec/shellexec.c | 33 |
2 files changed, 29 insertions, 11 deletions
@@ -536,14 +536,13 @@ typedef struct DB_plugin_action_s { uint32_t flags; /** * Function called when user activates menu item - * @it - pointer to selected playitem for single-track action, + * @action pointer to action struct itself + * @it pointer to selected playitem for single-track action, * to first playitem for multiple-track action, * or NULL for common action - * @data - opaque pointer + * @returns unused */ -// int (*callback) (DB_playItem_t *it, void *data); int (*callback) (struct DB_plugin_action_s *action, DB_playItem_t *it); -// void *data; //we have linked list here struct DB_plugin_action_s *next; diff --git a/plugins/shellexec/shellexec.c b/plugins/shellexec/shellexec.c index 94cbffe5..8adbb246 100644 --- a/plugins/shellexec/shellexec.c +++ b/plugins/shellexec/shellexec.c @@ -15,6 +15,28 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* + Configuration scheme: + + shellexec.NN shcmd:title:name:flags + + @shcmd is the command executed by the shell + formating directives are allowed, see + format_shell_command function + + @title is the title of command displayed in UI + + @name used for referencing command, for example in hotkeys + configuration + + @flags comma-separated of command flags, allowed flags are: + single - command allowed only for single track + local - command allowed only for local files + remote - command allowed only for non-local files + disabled - ignore command +*/ + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -27,6 +49,7 @@ static DB_misc_t plugin; static DB_functions_t *deadbeef; +//Probably it's reasonable to move these flags to parent struct enum { SHX_ACTION_LOCAL_ONLY = 1 << 0, SHX_ACTION_REMOTE_ONLY = 1 << 1 @@ -163,7 +186,6 @@ format_shell_command (DB_playItem_t *it, const char *format) } static int -//shx_callback (DB_playItem_t *it, void *data) shx_callback (Shx_action_t *action, DB_playItem_t *it) { char *cmd = format_shell_command (it, action->shcommand); @@ -241,13 +263,10 @@ shx_start () fprintf (stderr, "Shellexec: too many parameters in configuration line (%s)\n", item->value); continue; } - Shx_action_t *action = calloc (sizeof (Shx_action_t), 1); + if (strstr (flags, "disabled")) + continue; - trace ("Shellexec: title <%s>, name <%s>, command <%s>, flags <%s>\n", - title, - name, - command, - flags); + Shx_action_t *action = calloc (sizeof (Shx_action_t), 1); action->parent.title = strdup (title); action->parent.name = strdup (name); |