diff --git a/src/widgets/gnm-notebook.c b/src/widgets/gnm-notebook.c
index b4f1e36..a4000f1 100644
--- a/src/widgets/gnm-notebook.c
+++ b/src/widgets/gnm-notebook.c
@@ -1,3 +1,4 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /**
  * gnm-notebook.c: Implements a button-only notebook.
  *
@@ -70,6 +71,50 @@ gnm_notebook_size_allocate (GtkWidget     *widget,
 }
 
 static void
+gnm_notebook_adjust_this_tab_appearance (GnmNotebook *nb, GtkWidget *page, gboolean active)
+{
+	GtkEntry *tab;
+	GtkBorder *border;
+
+	if (page == NULL)
+		return;
+
+	tab = GTK_ENTRY (gtk_notebook_get_tab_label 
+			 (GTK_NOTEBOOK (nb), page));
+	border = gtk_border_new ();
+	if (!active) {
+		border->left = 2;
+		border->right = 2;
+		border->top = 2;
+		border->bottom = 2;
+	}
+	gtk_entry_set_inner_border (tab, border);
+	gtk_entry_set_has_frame (tab, active);
+	gtk_border_free (border);
+}
+
+static void
+gnm_notebook_adjust_tab_appearance (GnmNotebook *nb, GtkWidget *old, GtkWidget *new)
+{
+	gnm_notebook_adjust_this_tab_appearance (nb, old, FALSE);
+	gnm_notebook_adjust_this_tab_appearance (nb, new, TRUE);
+}
+
+static void
+gnm_notebook_switch_page_cb (GtkNotebook *notebook,
+			     GtkWidget   *page,
+			     G_GNUC_UNUSED guint page_num,
+			     GnmNotebook *nb)
+{
+	GtkWidget *current_page = NULL;
+	gint current = gtk_notebook_get_current_page (notebook);
+
+	if (current != -1)
+		current_page = gtk_notebook_get_nth_page (notebook, current);
+	gnm_notebook_adjust_tab_appearance (nb, current_page, page);
+}
+
+static void
 gnm_notebook_class_init (GtkWidgetClass *klass)
 {
 	gnm_notebook_parent_class = g_type_class_peek (GTK_TYPE_NOTEBOOK);
@@ -97,6 +142,11 @@ gnm_notebook_init (GnmNotebook *notebook)
 	gtk_style_context_add_provider (context,
 					GTK_STYLE_PROVIDER (css),
 					GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+	g_signal_connect (G_OBJECT (notebook), "switch-page", 
+			  (GCallback) gnm_notebook_switch_page_cb, 
+			  notebook);
+
 	g_object_unref (css);
 }
 
@@ -152,6 +202,9 @@ void
 gnm_notebook_insert_tab (GnmNotebook *nb, GtkWidget *label, int pos)
 {
 	GtkWidget *dummy_page = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+	GtkBorder *border;
+	GtkEntry * tab = GTK_ENTRY (label);
+
 	gtk_widget_set_size_request (dummy_page, 1, 1);
 
 	g_object_set_data (G_OBJECT (label), DUMMY_KEY, dummy_page);
@@ -165,6 +218,14 @@ gnm_notebook_insert_tab (GnmNotebook *nb, GtkWidget *label, int pos)
 				 G_CALLBACK (cb_label_visibility), dummy_page,
 				 0);
 
+	border = gtk_border_new ();
+	border->left = 2;
+	border->right = 2;
+	border->top = 2;
+	border->bottom = 2;
+	gtk_entry_set_inner_border (tab, border);
+	gtk_entry_set_has_frame (tab, FALSE);
+	gtk_border_free (border);
 	gtk_notebook_insert_page (GTK_NOTEBOOK (nb), dummy_page, label, pos);
 }
 
