Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/delete-files/delete-files.cc b/src/delete-files/delete-files.cc
- index dd16f4e..a5c09fd 100644
- --- a/src/delete-files/delete-files.cc
- +++ b/src/delete-files/delete-files.cc
- @@ -28,6 +28,7 @@
- #include <libaudcore/audstrings.h>
- #include <libaudcore/i18n.h>
- +#include <libaudcore/hook.h>
- #include <libaudcore/interface.h>
- #include <libaudcore/playlist.h>
- #include <libaudcore/plugin.h>
- @@ -92,6 +93,10 @@ static void confirm_delete (void)
- }
- }
- +static void delete_file_hook (void *hook_data, void *user_data) {
- + confirm_delete();
- +}
- +
- static void start_delete (void)
- {
- if (dialog)
- @@ -134,12 +139,14 @@ static bool_t delete_files_init (void)
- for (int i = 0; i < ARRAY_LEN (menus); i ++)
- aud_plugin_menu_add (menus[i], start_delete, _("Delete Selected Files"), "edit-delete");
- -
- + hook_associate("delete file", (HookFunction) delete_file_hook, NULL);
- return TRUE;
- }
- static void delete_files_cleanup (void)
- {
- + hook_dissociate("delete file", (HookFunction) delete_file_hook);
- +
- if (dialog)
- gtk_widget_destroy (dialog);
- diff --git a/src/hotkey/gui.cc b/src/hotkey/gui.cc
- index b10b5cf..b12f240 100644
- --- a/src/hotkey/gui.cc
- +++ b/src/hotkey/gui.cc
- @@ -83,7 +83,8 @@ static const char * event_desc[EVENT_MAX] = {
- [EVENT_TOGGLE_REPEAT] = N_("Toggle repeat"),
- [EVENT_TOGGLE_SHUFFLE] = N_("Toggle shuffle"),
- [EVENT_TOGGLE_STOP] = N_("Toggle stop after current"),
- - [EVENT_RAISE] = N_("Raise player window(s)")
- + [EVENT_RAISE] = N_("Raise player window(s)"),
- + [EVENT_DELETE] = N_("Delete current file")
- };
- diff --git a/src/hotkey/plugin.cc b/src/hotkey/plugin.cc
- index 1f4bedd..a754b8e 100644
- --- a/src/hotkey/plugin.cc
- +++ b/src/hotkey/plugin.cc
- @@ -287,6 +287,12 @@ gboolean handle_keyevent (EVENT event)
- return TRUE;
- }
- + if (event == EVENT_DELETE)
- + {
- + hook_call("delete file", NULL);
- + return TRUE;
- + }
- +
- return FALSE;
- }
- diff --git a/src/hotkey/plugin.h b/src/hotkey/plugin.h
- index 7215d6b..d66d175 100644
- --- a/src/hotkey/plugin.h
- +++ b/src/hotkey/plugin.h
- @@ -27,7 +27,7 @@ typedef enum {
- EVENT_TOGGLE_STOP,
- EVENT_RAISE,
- -
- + EVENT_DELETE,
- EVENT_MAX
- } EVENT;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement