mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
clapper-app: Add "Clear Queue" menu option
An option to clear playback queue from UI. This is quckier and easier than manually dragging every item to bin. Closes #434
This commit is contained in:
@@ -333,6 +333,23 @@ add_uri (GSimpleAction *action, GVariant *param, gpointer user_data)
|
|||||||
clapper_app_uri_dialog_open_uri (gtk_app);
|
clapper_app_uri_dialog_open_uri (gtk_app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clear_queue (GSimpleAction *action, GVariant *param, gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkApplication *gtk_app = GTK_APPLICATION (user_data);
|
||||||
|
GtkWindow *window = gtk_application_get_active_window (gtk_app);
|
||||||
|
ClapperPlayer *player;
|
||||||
|
ClapperQueue *queue;
|
||||||
|
|
||||||
|
while (window && !CLAPPER_APP_IS_WINDOW (window))
|
||||||
|
window = gtk_window_get_transient_for (window);
|
||||||
|
|
||||||
|
player = clapper_app_window_get_player (CLAPPER_APP_WINDOW (window));
|
||||||
|
queue = clapper_player_get_queue (player);
|
||||||
|
|
||||||
|
clapper_queue_clear (queue);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_window (GSimpleAction *action, GVariant *param, gpointer user_data)
|
new_window (GSimpleAction *action, GVariant *param, gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -692,6 +709,7 @@ clapper_app_application_constructed (GObject *object)
|
|||||||
static const GActionEntry app_actions[] = {
|
static const GActionEntry app_actions[] = {
|
||||||
{ "add-files", add_files, NULL, NULL, NULL },
|
{ "add-files", add_files, NULL, NULL, NULL },
|
||||||
{ "add-uri", add_uri, NULL, NULL, NULL },
|
{ "add-uri", add_uri, NULL, NULL, NULL },
|
||||||
|
{ "clear-queue", clear_queue, NULL, NULL, NULL },
|
||||||
{ "new-window", new_window, NULL, NULL, NULL },
|
{ "new-window", new_window, NULL, NULL, NULL },
|
||||||
{ "info", show_info, NULL, NULL, NULL },
|
{ "info", show_info, NULL, NULL, NULL },
|
||||||
{ "preferences", show_preferences, NULL, NULL, NULL },
|
{ "preferences", show_preferences, NULL, NULL, NULL },
|
||||||
|
@@ -183,5 +183,11 @@
|
|||||||
<attribute name="action">app.add-uri</attribute>
|
<attribute name="action">app.add-uri</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">Clear Queue</attribute>
|
||||||
|
<attribute name="action">app.clear-queue</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
</interface>
|
</interface>
|
||||||
|
Reference in New Issue
Block a user