ocarina: Added a "Pause after current track" menu item
Unlike my old version, this menu item is a check box that shows the user the current 'pause after' state. This should be more useful and less frustrating / confusing now.
This commit is contained in:
parent
5c6d7903a8
commit
64aff6a849
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include <ocarina/songlist.h>
|
||||
#include <libsaria/controls.h>
|
||||
#include <libsaria/print.h>
|
||||
#include "songlist.h"
|
||||
|
||||
|
@ -20,11 +21,27 @@ GtkWidget *MenuItem::get_widget()
|
|||
return widget;
|
||||
}
|
||||
|
||||
static void toggle_pause_after(GtkMenuItem *menu, gpointer data)
|
||||
{
|
||||
libsaria::set_pause_after(!libsaria::get_pause_after());
|
||||
}
|
||||
|
||||
static GtkWidget *make_pause_after_item()
|
||||
{
|
||||
GtkWidget *widget = gtk_check_menu_item_new_with_label("Pause After Current Song");
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget),
|
||||
libsaria::get_pause_after());
|
||||
GTK_CONNECT(widget, "activate", toggle_pause_after, NULL);
|
||||
return widget;
|
||||
}
|
||||
|
||||
gint SongList::right_click(guint button, guint64 time)
|
||||
{
|
||||
list<MenuItem>::iterator it;
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
|
||||
gtk_menu_append(GTK_MENU(menu), make_pause_after_item());
|
||||
|
||||
for (it = menu_items->begin(); it != menu_items->end(); it++)
|
||||
gtk_menu_append(GTK_MENU(menu), it->get_widget());
|
||||
|
||||
|
@ -39,6 +56,5 @@ void songlist_button_click(GtkWidget *widget, GdkEvent *event, gpointer data)
|
|||
|
||||
if (event->button.button != BUTTON_RIGHT)
|
||||
return;
|
||||
println("right click!");
|
||||
list->right_click(event->button.button, event->button.time);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue