[gtk+/gtk-2-16] Improve GtkNotbook behaviour with too little space



commit 277b4ea327a37b8e6192cf0c8e2e0e27f0728b9a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 17 23:43:26 2009 -0400

    Improve GtkNotbook behaviour with too little space
    
    This fixes bug 582488. The patch was provided by Morten Welinder.
---
 gtk/gtknotebook.c |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 9b1c0c3..2e0e8dd 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -4981,12 +4981,15 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
 				  remaining_space, STEP_NEXT);
 	}
 
-      if (*remaining_space <= 0)
+      if (tab_space <= 0 || *remaining_space < 0)
 	{
 	  /* show 1 tab */
 	  notebook->first_tab = notebook->focus_tab;
 	  *last_child = gtk_notebook_search_page (notebook, notebook->focus_tab,
 						  STEP_NEXT, TRUE);
+          page = notebook->first_tab->data;
+          *remaining_space = tab_space - page->requisition.width;
+          *n = 1;
 	}
       else
 	{
@@ -5073,22 +5076,22 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
 								   TRUE);
 		}
 	    }
-	}
 
-      if (*remaining_space < 0) 
-	{
-	  /* calculate number of tabs */
-	  *remaining_space = - (*remaining_space);
-	  *n = 0;
-
-	  for (children = notebook->first_tab;
-	       children && children != *last_child;
-	       children = gtk_notebook_search_page (notebook, children,
-						    STEP_NEXT, TRUE))
-	    (*n)++;
-	}
-      else 
-	*remaining_space = 0;
+          if (*remaining_space < 0)
+            {
+              /* calculate number of tabs */
+              *remaining_space = - (*remaining_space);
+              *n = 0;
+
+              for (children = notebook->first_tab;
+                   children && children != *last_child;
+                   children = gtk_notebook_search_page (notebook, children,
+                                                        STEP_NEXT, TRUE))
+                (*n)++;
+	    }
+          else
+	    *remaining_space = 0;
+        }
 
       /* unmap all non-visible tabs */
       for (children = gtk_notebook_search_page (notebook, NULL,



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