From 6c70e1ee8c4a180dc0056524f5a3d637ebec190c Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Thu, 11 Mar 2010 22:36:03 +0100 Subject: fixed scrolling of short playlists --- plugins/gtkui/ddblistview.c | 14 ++++++++------ plugins/gtkui/gtkui.c | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c index 3181b154..ffd5c66e 100644 --- a/plugins/gtkui/ddblistview.c +++ b/plugins/gtkui/ddblistview.c @@ -991,21 +991,23 @@ void ddb_listview_list_setup_vscroll (DdbListview *ps) { GtkWidget *list = ps->list; GtkWidget *scroll = ps->scrollbar; + int vheight = ps->fullheight;; if (ps->fullheight <= ps->list->allocation.height) { gtk_widget_hide (scroll); ps->scrollpos = 0; + ddb_listview_list_render (ps, 0, 0, list->allocation.width, list->allocation.height); + ddb_listview_list_expose (ps, 0, 0, list->allocation.width, list->allocation.height); } else { - int h = list->allocation.height; - int vheight = ps->fullheight;; - GtkAdjustment *adj = (GtkAdjustment*)gtk_adjustment_new (gtk_range_get_value (GTK_RANGE (scroll)), 0, vheight, SCROLL_STEP, h/2, h); + gtk_widget_show (scroll); if (ps->scrollpos >= vheight) { ps->scrollpos = vheight-1; } - gtk_range_set_adjustment (GTK_RANGE (scroll), adj); - gtk_range_set_value (GTK_RANGE (scroll), ps->scrollpos); - gtk_widget_show (scroll); } + int h = list->allocation.height; + GtkAdjustment *adj = (GtkAdjustment*)gtk_adjustment_new (gtk_range_get_value (GTK_RANGE (scroll)), 0, vheight, SCROLL_STEP, h/2, h); + gtk_range_set_adjustment (GTK_RANGE (scroll), adj); + gtk_range_set_value (GTK_RANGE (scroll), ps->scrollpos); } void diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index dda269fa..a8ba8642 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -440,7 +440,6 @@ playlistswitch_cb (gpointer none) { char conf[100]; snprintf (conf, sizeof (conf), "playlist.scroll.%d", curr); int scroll = deadbeef->conf_get_int (conf, 0); - printf ("scroll=%d\n", scroll); gdk_window_invalidate_rect (tabstrip->window, NULL, FALSE); DdbListview *listview = DDB_LISTVIEW (lookup_widget (mainwin, "playlist")); playlist_refresh (); -- cgit v1.2.3