[gdl] Avoid a crash when the pane width is smaller than a button



commit 31886f0912951e162922a94297f53dd3b4fda38e
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Mon Aug 8 22:18:37 2011 +0200

    Avoid a crash when the pane width is smaller than a button

 gdl/gdl-switcher.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gdl/gdl-switcher.c b/gdl/gdl-switcher.c
index 266fe62..cad2efe 100644
--- a/gdl/gdl-switcher.c
+++ b/gdl/gdl-switcher.c
@@ -303,6 +303,8 @@ layout_buttons (GdlSwitcher *switcher, GtkAllocation* allocation)
 
     /* Figure out how many rows and columns we'll use. */
     btns_per_row = allocation->width / (max_btn_width + H_PADDING);
+    /* Use at least one column */
+    if (btns_per_row == 0) btns_per_row = 1;
     
     /* If all the buttons could fit in the single row, have it so */
     if (allocation->width >= optimal_layout_width)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]