[gtk+] notebook: Compute tab width in a simpler way



commit edd2f24b6ed362221661009c73245d9d4d616f66
Author: Benjamin Otte <otte redhat com>
Date:   Wed Jun 1 21:56:13 2011 +0200

    notebook: Compute tab width in a simpler way
    
    This code should be more obvious: The check only needs to check for
    scrollable widgets, and only needs to compare to tab_width.
    
    As a side note, for vis_pages == 1, tab_width will be smaller than
    tab_max + stuff, so this code will not behave differently.

 gtk/gtknotebook.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 1aabc6a..bab4e07 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2136,9 +2136,9 @@ gtk_notebook_size_request (GtkWidget      *widget,
                       page->requisition.height = tab_height;
                     }
 
-                  if (priv->scrollable && vis_pages > 1 &&
-                      requisition->width < tab_width)
-                    tab_width = tab_max + 2 * (scroll_arrow_hlength + arrow_spacing);
+                  if (priv->scrollable)
+                    tab_width = MIN (tab_width,
+                                     tab_max + 2 * (scroll_arrow_hlength + arrow_spacing));
 
                   action_width += action_widget_requisition[ACTION_WIDGET_START].width;
                   action_width += action_widget_requisition[ACTION_WIDGET_END].width;
@@ -2184,9 +2184,9 @@ gtk_notebook_size_request (GtkWidget      *widget,
                       tab_height += page->requisition.height;
                     }
 
-                  if (priv->scrollable && vis_pages > 1 &&
-                      requisition->height < tab_height)
-                    tab_height = tab_max + (2 * scroll_arrow_vlength + arrow_spacing);
+                  if (priv->scrollable)
+                    tab_height = MIN (tab_height,
+                                      tab_max + (2 * scroll_arrow_vlength + arrow_spacing));
                   action_height += action_widget_requisition[ACTION_WIDGET_START].height;
                   action_height += action_widget_requisition[ACTION_WIDGET_END].height;
 



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