summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-11-23 20:46:06 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-11-23 20:46:06 +0100
commit8baad4fe4f4a95022d5f902089680605627d289b (patch)
tree45d550b5d263fa0bda0c90a509e68227db50dda0
parent027eb7dcffb53d6f5965958484c0ac34f4d27e5d (diff)
gtkui: yet another fix to column autoresize
-rw-r--r--plugins/gtkui/ddblistview.c18
1 files changed, 16 insertions, 2 deletions
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;
+ }
}