Skip to content

Commit eafa829

Browse files
gtkui: Support more shortcuts to switch playlist tabs. Closes: #1730
1 parent efcf359 commit eafa829

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/gtkui/ui_gtk.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,9 +607,14 @@ static gboolean window_keypress_cb (GtkWidget *, GdkEventKey * event)
607607
{
608608
case GDK_KEY_ISO_Left_Tab:
609609
case GDK_KEY_Tab:
610+
case GDK_KEY_Page_Down:
610611
pl_next ();
611612
break;
612613

614+
case GDK_KEY_Page_Up:
615+
pl_prev ();
616+
break;
617+
613618
default:
614619
return false;
615620
}
@@ -632,10 +637,24 @@ static gboolean window_keypress_cb (GtkWidget *, GdkEventKey * event)
632637
if (aud_drct_get_playing ())
633638
do_seek (aud_drct_get_time () - aud_get_int ("step_size") * 1000);
634639
break;
640+
635641
case GDK_KEY_Right:
636642
if (aud_drct_get_playing ())
637643
do_seek (aud_drct_get_time () + aud_get_int ("step_size") * 1000);
638644
break;
645+
646+
case GDK_KEY_1:
647+
case GDK_KEY_2:
648+
case GDK_KEY_3:
649+
case GDK_KEY_4:
650+
case GDK_KEY_5:
651+
case GDK_KEY_6:
652+
case GDK_KEY_7:
653+
case GDK_KEY_8:
654+
case GDK_KEY_9:
655+
pl_notebook_switch_to_page (event->keyval - GDK_KEY_1);
656+
break;
657+
639658
default:
640659
return false;
641660
}

src/gtkui/ui_playlist_notebook.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,15 @@ static void create_tab (int list_idx, Playlist list)
384384
}
385385
}
386386

387+
void pl_notebook_switch_to_page (int page_num)
388+
{
389+
gtk_notebook_set_current_page ((GtkNotebook *) pl_notebook, page_num);
390+
}
391+
387392
static void switch_to_active ()
388393
{
389394
int active_idx = Playlist::active_playlist ().index ();
390-
gtk_notebook_set_current_page ((GtkNotebook *) pl_notebook, active_idx);
395+
pl_notebook_switch_to_page (active_idx);
391396
}
392397

393398
void pl_notebook_populate ()

src/gtkui/ui_playlist_notebook.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ GtkWidget * pl_notebook_new ();
3737
void pl_notebook_grab_focus ();
3838
void pl_notebook_populate ();
3939
void pl_notebook_purge ();
40+
void pl_notebook_switch_to_page (int page_num);
4041

4142
void pl_notebook_update (void * data, void * user);
4243
void pl_notebook_activate (void * data, void * user);

0 commit comments

Comments
 (0)