midori_browser_notebook_resize must consider n = 7

This commit is contained in:
Christian Dywan 2012-03-05 22:21:33 +01:00
parent ba51341786
commit bf07220bc3

View file

@ -1521,20 +1521,18 @@ midori_browser_notebook_resize (MidoriBrowser* browser,
GdkRectangle* allocation) GdkRectangle* allocation)
{ {
gint new_size = 0; gint new_size = 0;
gint n = gtk_notebook_get_n_pages (GTK_NOTEBOOK(browser->notebook)); gint n = MAX (1, gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook)));
const gint max_size = 150; const gint max_size = 150;
gint min_size; gint min_size;
gint icon_size = 16; gint icon_size = 16;
GtkAllocation notebook_size; GtkAllocation notebook_size;
GList* children; GList* children;
g_return_if_fail (n > 0);
if (allocation != NULL) if (allocation != NULL)
notebook_size.width = allocation->width; notebook_size.width = allocation->width;
else else
gtk_widget_get_allocation (browser->notebook, &notebook_size); gtk_widget_get_allocation (browser->notebook, &notebook_size);
new_size = notebook_size.width / n - 7; new_size = notebook_size.width / n;
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (browser->notebook), gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (browser->notebook),
GTK_ICON_SIZE_MENU, &icon_size, NULL); GTK_ICON_SIZE_MENU, &icon_size, NULL);