ocarina: Pack tag labels into a scrolled window
I don't like the main window resizing, so we allow the users to scroll if the tags take up too much space.
This commit is contained in:
parent
30246df924
commit
3fe03734a1
|
@ -37,8 +37,8 @@ static void make_controls()
|
|||
controls = gtk_vbox_new(FALSE, 0);
|
||||
gtk_widget_show(controls);
|
||||
|
||||
box_pack_start(controls, make_top_row(), FALSE, FALSE, 0);
|
||||
box_pack_start(controls, make_bottom_row(), FALSE, FALSE, 0);
|
||||
box_pack_start(controls, make_top_row(), TRUE, FALSE, 0);
|
||||
box_pack_start(controls, make_bottom_row(), TRUE, FALSE, 0);
|
||||
}
|
||||
|
||||
GtkWidget *get_controls()
|
||||
|
|
|
@ -37,10 +37,24 @@ static GtkWidget *align(GtkWidget *label)
|
|||
return alignment;
|
||||
}
|
||||
|
||||
static void make_nowplaying()
|
||||
static GtkWidget *setup_window()
|
||||
{
|
||||
GtkWidget *viewport = gtk_viewport_new(NULL, NULL);
|
||||
now_playing = gtk_scrolled_window_new(NULL, NULL);
|
||||
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(now_playing),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_NEVER);
|
||||
gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
|
||||
container_add(now_playing, viewport);
|
||||
|
||||
return viewport;
|
||||
}
|
||||
|
||||
static void make_now_playing()
|
||||
{
|
||||
GtkWidget *tag_box = gtk_vbox_new(FALSE, 0);
|
||||
now_playing = gtk_hbox_new(FALSE, 0);
|
||||
GtkWidget *container = setup_window();
|
||||
|
||||
title = gtk_label_new("");
|
||||
artist = gtk_label_new("");
|
||||
|
@ -50,18 +64,18 @@ static void make_nowplaying()
|
|||
set_artist(" ");
|
||||
set_album(" ");
|
||||
|
||||
box_pack_start(tag_box, align(title), FALSE, FALSE, 0);
|
||||
box_pack_start(tag_box, align(artist), FALSE, FALSE, 0);
|
||||
box_pack_start(tag_box, align(album), FALSE, FALSE, 0);
|
||||
box_pack_start(tag_box, align(title), TRUE, FALSE, 0);
|
||||
box_pack_start(tag_box, align(artist), TRUE, FALSE, 0);
|
||||
box_pack_start(tag_box, align(album), TRUE, FALSE, 0);
|
||||
|
||||
box_pack_start(now_playing, tag_box, FALSE, FALSE, 0);
|
||||
container_add(container, tag_box);
|
||||
gtk_widget_show_all(now_playing);
|
||||
}
|
||||
|
||||
GtkWidget *get_nowplaying()
|
||||
{
|
||||
if (now_playing == NULL)
|
||||
make_nowplaying();
|
||||
make_now_playing();
|
||||
return now_playing;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue