Iterate children in notebook_alloc_timeout

This commit is contained in:
Christian Dywan 2011-12-10 19:30:48 +01:00
parent 1845d0bcbc
commit 9ba0c2806e

View file

@ -1487,13 +1487,13 @@ midori_browser_tab_destroy_cb (GtkWidget* widget,
static gboolean static gboolean
midori_browser_notebook_alloc_timeout (MidoriBrowser* browser) midori_browser_notebook_alloc_timeout (MidoriBrowser* browser)
{ {
guint i;
gint new_size = 0; gint new_size = 0;
gint n = gtk_notebook_get_n_pages (GTK_NOTEBOOK(browser->notebook)); gint n = 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;
gtk_widget_get_allocation (browser->notebook, &notebook_size); gtk_widget_get_allocation (browser->notebook, &notebook_size);
if (n > 0) new_size = notebook_size.width / n - 7; if (n > 0) new_size = notebook_size.width / n - 7;
@ -1506,11 +1506,11 @@ midori_browser_notebook_alloc_timeout (MidoriBrowser* browser)
if (new_size < min_size) new_size = min_size; if (new_size < min_size) new_size = min_size;
if (new_size > max_size) new_size = max_size; if (new_size > max_size) new_size = max_size;
for (i = 0; i < n; i++) children = gtk_container_get_children (GTK_CONTAINER (browser->notebook));
for (; children; children = g_list_next (children))
{ {
GtkWidget* view; GtkWidget* view = children->data;
GtkWidget* label; GtkWidget* label;
view = gtk_notebook_get_nth_page (GTK_NOTEBOOK(browser->notebook), i);
label = gtk_notebook_get_tab_label (GTK_NOTEBOOK(browser->notebook), view); label = gtk_notebook_get_tab_label (GTK_NOTEBOOK(browser->notebook), view);
/* Don't resize empty bin, which is used for thumbnail tabs */ /* Don't resize empty bin, which is used for thumbnail tabs */
if (GTK_IS_BIN (label) && gtk_bin_get_child (GTK_BIN (label)) if (GTK_IS_BIN (label) && gtk_bin_get_child (GTK_BIN (label))