return FALSE;
}
+static void
+_midori_browser_update_notebook (MidoriBrowser* browser)
+{
+ guint i;
+ gint new_size = 0;
+ gint n = gtk_notebook_get_n_pages (GTK_NOTEBOOK(browser->notebook));
+ const gint max_size = 150;
+ const gint min_size = 32;
+ GtkAllocation notebook_size;
+
+ gtk_widget_get_allocation (browser->notebook, ¬ebook_size);
+ if (n > 0) new_size = notebook_size.width / n - 7;
+ if (new_size < min_size) new_size = min_size;
+ if (new_size > max_size) new_size = max_size;
+
+ for (i = 0; i < n; i++)
+ {
+ GtkWidget* view;
+ GtkWidget* label;
+ view = gtk_notebook_get_nth_page (GTK_NOTEBOOK(browser->notebook), i);
+ label = gtk_notebook_get_tab_label (GTK_NOTEBOOK(browser->notebook), view);
+ gtk_widget_set_size_request (label, new_size, -1);
+ }
+}
+
static void
_midori_browser_add_tab (MidoriBrowser* browser,
GtkWidget* view)
G_CALLBACK (midori_browser_tab_destroy_cb), browser);
_midori_browser_update_actions (browser);
+ _midori_browser_update_notebook (browser);
}
static void
GtkWidget* view)
{
gtk_widget_destroy (view);
+ _midori_browser_update_notebook (browser);
}
/**
}
}
+static void
+gtk_notebook_size_allocated_cb (GtkWidget* widget,
+ GdkRectangle* allocation,
+ MidoriBrowser* browser)
+{
+ _midori_browser_update_notebook (browser);
+}
+
static void
midori_browser_destroy_cb (MidoriBrowser* browser)
{
g_signal_handlers_disconnect_by_func (browser->notebook,
midori_browser_notebook_reorder_tab_cb,
NULL);
+ g_signal_handlers_disconnect_by_func (browser->notebook,
+ gtk_notebook_size_allocated_cb,
+ NULL);
gtk_container_foreach (GTK_CONTAINER (browser->notebook),
(GtkCallback) gtk_widget_destroy, NULL);
}
g_signal_connect (browser->notebook, "page-reordered",
G_CALLBACK (midori_browser_notebook_page_reordered_cb),
browser);
+ g_signal_connect (browser->notebook, "size-allocate",
+ G_CALLBACK (gtk_notebook_size_allocated_cb),
+ browser);
g_signal_connect_after (browser->notebook, "button-press-event",
G_CALLBACK (midori_browser_notebook_button_press_event_after_cb),
browser);
gint size,
gdouble angle)
{
- gint width;
-
- sokoke_widget_get_text_size (label, "M", &width, NULL);
if (angle == 0.0 || angle == 360.0)
{
- gtk_widget_set_size_request (label, width * size, -1);
if (gtk_label_get_ellipsize (GTK_LABEL (label)) != PANGO_ELLIPSIZE_START)
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
}
else
{
- gtk_widget_set_size_request (label, -1, width * size);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_NONE);
}
gtk_label_set_angle (GTK_LABEL (label), angle);
if (katze_object_get_boolean (view->settings, "close-buttons-left"))
{
gtk_box_pack_end (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), view->tab_title, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), align, FALSE, FALSE, 0);
}
else
{
gtk_box_pack_start (GTK_BOX (hbox), view->tab_icon, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), view->tab_title, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), view->tab_title, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (hbox), align, FALSE, FALSE, 0);
}
gtk_widget_show_all (GTK_WIDGET (event_box));