summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-01-04 22:02:43 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-01-04 22:02:43 +0100
commit27b464b6d307a63c92940dd7fe2fac4cb353ba34 (patch)
tree11dacf9ecf7e1715bfd47282a6c3537a73106a48
parent70b138eff4b3d6fa18e338248acc847b205a3f99 (diff)
gtkui: fix bug #1006: columns autoresize issues
-rw-r--r--plugins/gtkui/ddblistview.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c
index 70fec5b9..eb6070b0 100644
--- a/plugins/gtkui/ddblistview.c
+++ b/plugins/gtkui/ddblistview.c
@@ -2393,32 +2393,18 @@ ddb_listview_header_configure_event (GtkWidget *widget,
gtk_widget_get_allocation (GTK_WIDGET (ps), &lva);
int totalwidth = lva.width;
+ // col_autoresize flag indicates whether fwidth is valid
if (!ps->lock_columns) {
DdbListviewColumn *c;
- if (ps->header_width != totalwidth && deadbeef->conf_get_int ("gtkui.autoresize_columns", 0)) {
- if (!ps->col_autoresize) {
- for (c = ps->columns; c; c = c->next) {
- c->fwidth = (float)c->width / (float)totalwidth;
+ if (deadbeef->conf_get_int ("gtkui.autoresize_columns", 0)) {
+ if (ps->header_width != totalwidth) {
+ if (!ps->col_autoresize) {
+ for (c = ps->columns; c; c = c->next) {
+ c->fwidth = (float)c->width / (float)totalwidth;
+ }
+ ps->col_autoresize = 1;
}
- ps->col_autoresize = 1;
- }
- // use the fwidth
- int changed = 0;
- int i = 0;
- for (c = ps->columns; c; c = c->next, i++) {
- int newwidth = totalwidth * c->fwidth;
- if (newwidth != c->width) {
- c->width = newwidth;
- changed = 1;
- ps->binding->column_size_changed (ps, i);
- }
- }
- if (changed) {
- ps->binding->columns_changed (ps);
- }
- }
- else {
- if (ps->col_autoresize) {
+ // use the fwidth
int changed = 0;
int i = 0;
for (c = ps->columns; c; c = c->next, i++) {
@@ -2429,12 +2415,17 @@ ddb_listview_header_configure_event (GtkWidget *widget,
ps->binding->column_size_changed (ps, i);
}
}
- ps->col_autoresize = 0;
if (changed) {
ps->binding->columns_changed (ps);
}
}
}
+ else {
+ for (c = ps->columns; c; c = c->next) {
+ c->fwidth = (float)c->width / (float)totalwidth;
+ }
+ ps->col_autoresize = 1;
+ }
ps->header_width = totalwidth;
}