summaryrefslogtreecommitdiff
path: root/plugins/shellexec
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-04-24 19:40:56 +0200
committerGravatar waker <wakeroid@gmail.com>2012-04-24 19:40:56 +0200
commit6498b5187f44a48571aac268c9c377b7c3e6af7b (patch)
treef37b114e098b4bf63de93f5664860762f99d9680 /plugins/shellexec
parent15bd1af9f7c6bdad62b9610b1303b281f252b367 (diff)
shellexec[ui]: cleaned up api, fixed memleaks, add/remove/edit works without restarting player, Disabled flag is not user-editable and is not saved to config
Diffstat (limited to 'plugins/shellexec')
-rw-r--r--plugins/shellexec/shellexec.c44
-rw-r--r--plugins/shellexec/shellexec.h4
2 files changed, 27 insertions, 21 deletions
diff --git a/plugins/shellexec/shellexec.c b/plugins/shellexec/shellexec.c
index d442672a..fcc61aa8 100644
--- a/plugins/shellexec/shellexec.c
+++ b/plugins/shellexec/shellexec.c
@@ -39,7 +39,6 @@
local - command allowed for local files
remote - command allowed for non-local files
playlist - command allowed for playlist tabs
- disabled - ignore command
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -160,9 +159,6 @@ shx_save_actions(Shx_action_t *action_list)
if(action->parent.flags & DB_ACTION_ALLOW_MULTIPLE_TRACKS) {
strcat(conf_line, "multiple,");
}
- if(action->parent.flags & DB_ACTION_DISABLED) {
- strcat(conf_line, "disabled,");
- }
deadbeef->conf_set_str(conf_key, conf_line);
action = (Shx_action_t*)action->parent.next;
i++;
@@ -171,7 +167,7 @@ shx_save_actions(Shx_action_t *action_list)
}
Shx_action_t*
-shx_get_actions (DB_plugin_action_callback_t callback, int omit_disabled)
+shx_get_actions (DB_plugin_action_callback_t callback)
{
Shx_action_t *action_list = NULL;
Shx_action_t *prev = NULL;
@@ -214,11 +210,6 @@ shx_get_actions (DB_plugin_action_callback_t callback, int omit_disabled)
flags = "local,single";
}
- if (strstr (flags, "disabled") && omit_disabled) {
- item = deadbeef->conf_find ("shellexec.", item);
- continue;
- }
-
Shx_action_t *action = calloc (sizeof (Shx_action_t), 1);
action->parent.title = strdup (title);
@@ -244,10 +235,6 @@ shx_get_actions (DB_plugin_action_callback_t callback, int omit_disabled)
if (strstr (flags, "playlist"))
action->parent.flags |= DB_ACTION_PLAYLIST;
- if (strstr (flags, "disabled")) {
- action->parent.flags |= DB_ACTION_DISABLED;
- }
-
if (prev)
prev->parent.next = (DB_plugin_action_t *)action;
prev = action;
@@ -263,7 +250,29 @@ shx_get_actions (DB_plugin_action_callback_t callback, int omit_disabled)
static int
shx_start ()
{
- actions = shx_get_actions((DB_plugin_action_callback_t)shx_callback, 1);
+ actions = shx_get_actions((DB_plugin_action_callback_t)shx_callback);
+ return 0;
+}
+
+static int
+shx_stop ()
+{
+ Shx_action_t *a = actions;
+ while (a) {
+ Shx_action_t *next = (Shx_action_t *)a->parent.next;
+ if (a->shcommand) {
+ free ((char *)a->shcommand);
+ }
+ if (a->parent.title) {
+ free ((char *)a->parent.title);
+ }
+ if (a->parent.name) {
+ free ((char *)a->parent.name);
+ }
+ free (a);
+ a = next;
+ }
+ actions = NULL;
return 0;
}
@@ -288,7 +297,6 @@ static Shx_plugin_t plugin = {
" single - command allowed only for single track\n"
" local - command allowed only for local files\n"
" remote - command allowed only for non-local files\n"
- " disabled - ignore command\n\n"
"EXAMPLE: shellexec.00 notify-send \"%a - %t\":Show selected track:notify:single\n"
"this would show the name of selected track in notification popup"
,
@@ -314,8 +322,8 @@ static Shx_plugin_t plugin = {
,
.misc.plugin.website = "http://deadbeef.sf.net",
.misc.plugin.start = shx_start,
+ .misc.plugin.stop = shx_stop,
.misc.plugin.get_actions = shx_get_plugin_actions,
- .shx_get_actions = shx_get_actions,
- .shx_save_actions = shx_save_actions
+ .save_actions = shx_save_actions
};
diff --git a/plugins/shellexec/shellexec.h b/plugins/shellexec/shellexec.h
index 748340bd..b76dfd85 100644
--- a/plugins/shellexec/shellexec.h
+++ b/plugins/shellexec/shellexec.h
@@ -40,10 +40,8 @@ typedef struct Shx_action_s
typedef struct Shx_plugin_s
{
DB_misc_t misc;
- Shx_action_t *
- (*shx_get_actions)(DB_plugin_action_callback_t callback, int omit_disabled);
void
- (*shx_save_actions)(Shx_action_t *action_list);
+ (*save_actions)(Shx_action_t *action_list);
} Shx_plugin_t;
#endif