From: Christian Dywan Date: Sat, 10 Dec 2011 18:30:48 +0000 (+0100) Subject: Iterate children in notebook_alloc_timeout X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ba0c2806ed9a7d33fe5c29be95b6023ada3828c;p=midori Iterate children in notebook_alloc_timeout --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 76283b4f..a5538507 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1487,13 +1487,13 @@ midori_browser_tab_destroy_cb (GtkWidget* widget, static gboolean midori_browser_notebook_alloc_timeout (MidoriBrowser* browser) { - guint i; gint new_size = 0; gint n = gtk_notebook_get_n_pages (GTK_NOTEBOOK(browser->notebook)); const gint max_size = 150; gint min_size; gint icon_size = 16; GtkAllocation notebook_size; + GList* children; gtk_widget_get_allocation (browser->notebook, ¬ebook_size); 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 > 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; - view = gtk_notebook_get_nth_page (GTK_NOTEBOOK(browser->notebook), i); label = gtk_notebook_get_tab_label (GTK_NOTEBOOK(browser->notebook), view); /* Don't resize empty bin, which is used for thumbnail tabs */ if (GTK_IS_BIN (label) && gtk_bin_get_child (GTK_BIN (label))