@@ -333,6 +333,23 @@ add_uri (GSimpleAction *action, GVariant *param, gpointer user_data)
333333 clapper_app_uri_dialog_open_uri (gtk_app );
334334}
335335
336+ static void
337+ clear_queue (GSimpleAction * action , GVariant * param , gpointer user_data )
338+ {
339+ GtkApplication * gtk_app = GTK_APPLICATION (user_data );
340+ GtkWindow * window = gtk_application_get_active_window (gtk_app );
341+ ClapperPlayer * player ;
342+ ClapperQueue * queue ;
343+
344+ while (window && !CLAPPER_APP_IS_WINDOW (window ))
345+ window = gtk_window_get_transient_for (window );
346+
347+ player = clapper_app_window_get_player (CLAPPER_APP_WINDOW (window ));
348+ queue = clapper_player_get_queue (player );
349+
350+ clapper_queue_clear (queue );
351+ }
352+
336353static void
337354new_window (GSimpleAction * action , GVariant * param , gpointer user_data )
338355{
@@ -692,6 +709,7 @@ clapper_app_application_constructed (GObject *object)
692709 static const GActionEntry app_actions [] = {
693710 { "add-files" , add_files , NULL , NULL , NULL },
694711 { "add-uri" , add_uri , NULL , NULL , NULL },
712+ { "clear-queue" , clear_queue , NULL , NULL , NULL },
695713 { "new-window" , new_window , NULL , NULL , NULL },
696714 { "info" , show_info , NULL , NULL , NULL },
697715 { "preferences" , show_preferences , NULL , NULL , NULL },
0 commit comments