From 8baad4fe4f4a95022d5f902089680605627d289b Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sat, 23 Nov 2013 20:46:06 +0100 Subject: gtkui: yet another fix to column autoresize --- plugins/gtkui/ddblistview.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'plugins/gtkui') diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c index 7b893f7c..51f6d951 100644 --- a/plugins/gtkui/ddblistview.c +++ b/plugins/gtkui/ddblistview.c @@ -314,7 +314,7 @@ ddb_listview_init(DdbListview *listview) listview->last_header_motion_ev = -1; //is it subject to remove? listview->prev_header_x = -1; listview->header_prepare = 0; - listview->header_width = 0; + listview->header_width = -1; listview->columns = NULL; listview->lock_columns = 1; @@ -2435,8 +2435,8 @@ ddb_listview_header_configure_event (GtkWidget *widget, } } } + ps->header_width = totalwidth; } - ps->header_width = totalwidth; return FALSE; } @@ -2444,6 +2444,20 @@ ddb_listview_header_configure_event (GtkWidget *widget, void ddb_listview_lock_columns (DdbListview *lv, gboolean lock) { lv->lock_columns = lock; + if (lock == 0) { + GtkAllocation a; + gtk_widget_get_allocation (GTK_WIDGET (lv), &a); + if (deadbeef->conf_get_int ("gtkui.autoresize_columns", 0)) { + DdbListviewColumn *c; + if (!lv->col_autoresize) { + for (c = lv->columns; c; c = c->next) { + c->fwidth = (float)c->width / (float)a.width; + } + lv->col_autoresize = 1; + } + } + lv->header_width = a.width; + } } -- cgit v1.2.3