Skip to content

Commit 2c571ba

Browse files
gtkui: Add medialib refresh action
1 parent 415e7c9 commit 2c571ba

5 files changed

Lines changed: 29 additions & 1 deletion

File tree

plugins/gtkui/actionhandlers.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "trkproperties.h"
4747
#include "wingeom.h"
4848
#include "undostack.h"
49+
#include "medialib/medialibmanager.h"
4950

5051
// disable custom title function, until we have new title formatting (0.7)
5152
#define DISABLE_CUSTOM_TITLE
@@ -882,3 +883,9 @@ action_redo(DB_plugin_action_t *act, ddb_action_context_t ctx) {
882883
gtkui_undostack_perform_redo();
883884
return 0;
884885
}
886+
887+
int
888+
action_ml_refresh_handler (DB_plugin_action_t *act, ddb_action_context_t ctx) {
889+
gtkui_medialib_refresh ();
890+
return 0;
891+
}

plugins/gtkui/actionhandlers.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,7 @@ action_undo(DB_plugin_action_t *act, ddb_action_context_t ctx);
230230
int
231231
action_redo(DB_plugin_action_t *act, ddb_action_context_t ctx);
232232

233+
int
234+
action_ml_refresh_handler (DB_plugin_action_t *act, ddb_action_context_t ctx);
235+
233236
#endif

plugins/gtkui/gtkui.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1936,12 +1936,20 @@ gtkui_get_mainwin (void) {
19361936
return mainwin;
19371937
}
19381938

1939+
static DB_plugin_action_t action_ml_refresh = {
1940+
.title = "Refresh Media Library",
1941+
.name = "medialib_refresh",
1942+
.flags = DB_ACTION_COMMON,
1943+
.callback2 = action_ml_refresh_handler,
1944+
.next = NULL
1945+
};
1946+
19391947
static DB_plugin_action_t action_rg_remove_info = { .title = "ReplayGain/Remove ReplayGain Information",
19401948
.name = "rg_remove_info",
19411949
.flags = DB_ACTION_SINGLE_TRACK | DB_ACTION_MULTIPLE_TRACKS |
19421950
DB_ACTION_ADD_MENU,
19431951
.callback2 = action_rg_remove_info_handler,
1944-
.next = NULL };
1952+
.next = &action_ml_refresh };
19451953

19461954
static DB_plugin_action_t action_rg_scan_selection_as_albums = {
19471955
.title = "ReplayGain/Scan Selection As Albums (By Tags)",

plugins/gtkui/medialib/medialibmanager.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,10 @@ scriptableModel_t *
5353
gtkui_medialib_get_model (void) {
5454
return _model;
5555
}
56+
57+
void
58+
gtkui_medialib_refresh (void) {
59+
if (_source != NULL && _plugin != NULL) {
60+
_plugin->refresh (_source);
61+
}
62+
}

plugins/gtkui/medialib/medialibmanager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ gtkui_medialib_free (void);
2121
scriptableModel_t *
2222
gtkui_medialib_get_model (void);
2323

24+
void
25+
gtkui_medialib_refresh (void);
26+
2427
#endif /* medialibmanager_h */

0 commit comments

Comments
 (0)