summaryrefslogtreecommitdiff
path: root/plugins/shellexecui
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-04-25 22:25:46 +0200
committerGravatar waker <wakeroid@gmail.com>2012-04-25 22:25:46 +0200
commit6974e0672bcd9cdab22cabc6b2aa64a533fa871a (patch)
treed8840a6dc8e547897b3145622c5fa505e4d6dbb2 /plugins/shellexecui
parentce7f7611615bbe32c859a94a13f343097a120f19 (diff)
shellexec: fixed adding first and removing last shell command
Diffstat (limited to 'plugins/shellexecui')
-rw-r--r--plugins/shellexecui/shellexecui.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/plugins/shellexecui/shellexecui.c b/plugins/shellexecui/shellexecui.c
index 04661bdd..0f979653 100644
--- a/plugins/shellexecui/shellexecui.c
+++ b/plugins/shellexecui/shellexecui.c
@@ -149,20 +149,8 @@ on_remove_button_clicked (GtkButton *button,
gtk_tree_model_get(treemodel, &iter, COL_META, &action, -1);
//remove action from list
- if(actions == action) {
- actions = (Shx_action_t*)action->parent.next;
- }
- else {
- Shx_action_t *prev = actions;
- while(((Shx_action_t*)prev->parent.next) != action) {
- prev = (Shx_action_t*)prev->parent.next;
- }
- prev->parent.next = action->parent.next;
- }
- free((void *)action->shcommand);
- free((void *)action->parent.name);
- free((void *)action->parent.title);
- free(action);
+ shellexec_plugin->action_remove (action);
+ actions = (Shx_action_t *)shellexec_plugin->misc.plugin.get_actions(NULL);
GtkTreeIter next_iter = iter;
if(gtk_tree_model_iter_next(treemodel, &next_iter)) {
@@ -177,7 +165,7 @@ on_remove_button_clicked (GtkButton *button,
}
gtk_list_store_remove(GTK_LIST_STORE(treemodel), &iter);
- shellexec_plugin->save_actions(actions);
+ shellexec_plugin->save_actions();
deadbeef->sendmessage (DB_EV_ACTIONSCHANGED, 0, 0, 0);
}
}
@@ -281,17 +269,8 @@ on_edit_ok_button_clicked (GtkButton *button, gpointer user_data) {
GtkTreeIter iter;
if(current_action == NULL) {
- current_action = calloc(sizeof(Shx_action_t), 1);
- if(!actions) {
- actions = current_action;
- }
- else {
- Shx_action_t *last = actions;
- while(last->parent.next) {
- last = (Shx_action_t *)last->parent.next;
- }
- last->parent.next = (DB_plugin_action_t*)current_action;
- }
+ current_action = shellexec_plugin->action_add ();
+ actions = (Shx_action_t *)shellexec_plugin->misc.plugin.get_actions(NULL);
gtk_list_store_append(GTK_LIST_STORE(treemodel), &iter);
gtk_list_store_set(GTK_LIST_STORE(treemodel), &iter, COL_META, current_action, -1);
gtk_tree_selection_select_iter(selection, &iter);
@@ -335,7 +314,7 @@ on_edit_ok_button_clicked (GtkButton *button, gpointer user_data) {
edit_dlg = NULL;
current_action = NULL;
- shellexec_plugin->save_actions(actions);
+ shellexec_plugin->save_actions();
deadbeef->sendmessage (DB_EV_ACTIONSCHANGED, 0, 0, 0);
}