gint last_window_width, last_window_height;
guint alloc_timeout;
- guint notebook_alloc_timeout;
+ gint last_tab_size;
guint panel_timeout;
gint clear_private_data;
return FALSE;
}
-static gboolean
-midori_browser_notebook_alloc_timeout (MidoriBrowser* browser)
+static void
+midori_browser_notebook_resize (MidoriBrowser* browser,
+ GdkRectangle* allocation)
{
gint new_size = 0;
gint n = gtk_notebook_get_n_pages (GTK_NOTEBOOK(browser->notebook));
GtkAllocation notebook_size;
GList* children;
- gtk_widget_get_allocation (browser->notebook, ¬ebook_size);
- if (n > 0) new_size = notebook_size.width / n - 7;
+ g_return_if_fail (n > 0);
+
+ if (allocation != NULL)
+ notebook_size.width = allocation->width;
+ else
+ gtk_widget_get_allocation (browser->notebook, ¬ebook_size);
+ new_size = notebook_size.width / n - 7;
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (browser->notebook),
GTK_ICON_SIZE_MENU, &icon_size, NULL);
if (new_size < min_size) new_size = min_size;
if (new_size > max_size) new_size = max_size;
+ if (new_size > browser->last_tab_size - 3
+ && new_size < browser->last_tab_size + 3)
+ return;
+ browser->last_tab_size = new_size;
+
children = gtk_container_get_children (GTK_CONTAINER (browser->notebook));
for (; children; children = g_list_next (children))
{
&& !katze_object_get_boolean (view, "minimized"))
gtk_widget_set_size_request (label, new_size, -1);
}
-
- browser->notebook_alloc_timeout = 0;
- return FALSE;
}
static void
if (!gtk_notebook_get_show_tabs (GTK_NOTEBOOK (browser->notebook)))
return;
- if (browser->notebook_alloc_timeout > 0)
- g_source_remove (browser->notebook_alloc_timeout);
-
- browser->notebook_alloc_timeout = g_timeout_add_full (G_PRIORITY_LOW, 250,
- (GSourceFunc)midori_browser_notebook_alloc_timeout, browser, NULL);
+ midori_browser_notebook_resize (browser, allocation);
}
static void
gtk_widget_set_can_focus (view, TRUE);
tab_label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
+ /* Don't resize empty bin, which is used for thumbnail tabs */
+ if (GTK_IS_BIN (tab_label) && gtk_bin_get_child (GTK_BIN (tab_label))
+ && !katze_object_get_boolean (view, "minimized"))
+ gtk_widget_set_size_request (tab_label, browser->last_tab_size, -1);
item = midori_view_get_proxy_item (MIDORI_VIEW (view));
katze_array_add_item (browser->proxy_array, item);