Index: configure.ac
===================================================================
--- configure.ac	(revision 5713)
+++ configure.ac	(working copy)
@@ -147,7 +147,7 @@
 
 PKG_CHECK_MODULES(GEDIT, [
 	glib-2.0 >= 2.12.0
-	gtk+-2.0 >= 2.10.0
+	gtk+-2.0 >= 2.11.0
 	gtksourceview-2.0 >= 1.90.2
 	libgnomeui-2.0 >= 2.16.0
 	libglade-2.0 >= 2.5.1
Index: gedit/gedit-documents-panel.c
===================================================================
--- gedit/gedit-documents-panel.c	(revision 5713)
+++ gedit/gedit-documents-panel.c	(working copy)
@@ -649,10 +649,10 @@
 	if (new_position > old_position)
 		new_position = MAX (0, new_position - 1);
 		
-	gedit_notebook_reorder_tab (GEDIT_NOTEBOOK (nb),
-				    tab,
+	gtk_notebook_reorder_child (GTK_NOTEBOOK (nb),
+				    GTK_WIDGET(tab),
 				    new_position);
-
+	
 	panel->priv->is_reodering = FALSE;				    
 }
 
Index: gedit/gedit-notebook.c
===================================================================
--- gedit/gedit-notebook.c	(revision 5713)
+++ gedit/gedit-notebook.c	(working copy)
@@ -65,15 +65,8 @@
 
 struct _GeditNotebookPrivate
 {
-	GList         *focused_pages;
-	GeditTooltips *title_tips;
-	gulong         motion_notify_handler_id;
-	gint           x_start;
-	gint           y_start;
-	gint           drag_in_progress : 1;
-	gint	       always_show_tabs : 1;
-	gint           close_buttons_sensitive : 1;
-	gint           tab_drag_and_drop_enabled : 1;
+    GList         *focused_pages;
+    gint           close_buttons_sensitive : 1;
 };
 
 G_DEFINE_TYPE(GeditNotebook, gedit_notebook, GTK_TYPE_NOTEBOOK)
@@ -80,23 +73,11 @@
 
 static void gedit_notebook_finalize (GObject *object);
 
-static void move_current_tab_to_another_notebook  (GeditNotebook  *src,
-						   GeditNotebook  *dest,
-						   GdkEventMotion *event,
-						   gint            dest_position);
-
-/* Local variables */
-static GdkCursor *cursor = NULL;
-
 /* Signals */
 enum
 {
-	TAB_ADDED,
-	TAB_REMOVED,
-	TABS_REORDERED,
-	TAB_DETACHED,
-	TAB_CLOSE_REQUEST,
-	LAST_SIGNAL
+    TAB_CLOSE_REQUEST,
+    LAST_SIGNAL
 };
 
 static guint signals[LAST_SIGNAL] = { 0 };
@@ -104,198 +85,24 @@
 static void
 gedit_notebook_class_init (GeditNotebookClass *klass)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-	object_class->finalize = gedit_notebook_finalize;
-
-	signals[TAB_ADDED] =
-		g_signal_new ("tab_added",
-			      G_OBJECT_CLASS_TYPE (object_class),
-			      G_SIGNAL_RUN_FIRST,
-			      G_STRUCT_OFFSET (GeditNotebookClass, tab_added),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__OBJECT,
-			      G_TYPE_NONE,
-			      1,
-			      GEDIT_TYPE_TAB);
-	signals[TAB_REMOVED] =
-		g_signal_new ("tab_removed",
-			      G_OBJECT_CLASS_TYPE (object_class),
-			      G_SIGNAL_RUN_FIRST,
-			      G_STRUCT_OFFSET (GeditNotebookClass, tab_removed),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__OBJECT,
-			      G_TYPE_NONE,
-			      1,
-			      GEDIT_TYPE_TAB);
-	signals[TAB_DETACHED] =
-		g_signal_new ("tab_detached",
-			      G_OBJECT_CLASS_TYPE (object_class),
-			      G_SIGNAL_RUN_FIRST,
-			      G_STRUCT_OFFSET (GeditNotebookClass, tab_detached),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__OBJECT,
-			      G_TYPE_NONE,
-			      1,
-			      GEDIT_TYPE_TAB);
-	signals[TABS_REORDERED] =
-		g_signal_new ("tabs_reordered",
-			      G_OBJECT_CLASS_TYPE (object_class),
-			      G_SIGNAL_RUN_FIRST,
-			      G_STRUCT_OFFSET (GeditNotebookClass, tabs_reordered),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__VOID,
-			      G_TYPE_NONE,
-			      0);
-	signals[TAB_CLOSE_REQUEST] =
-		g_signal_new ("tab-close-request",
-			      G_OBJECT_CLASS_TYPE (object_class),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (GeditNotebookClass, tab_close_request),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__OBJECT,
-			      G_TYPE_NONE,
-			      1,
-			      GEDIT_TYPE_TAB);
-
-	g_type_class_add_private (object_class, sizeof(GeditNotebookPrivate));
-}
-
-static GeditNotebook *
-find_notebook_at_pointer (gint abs_x, gint abs_y)
-{
-	GdkWindow *win_at_pointer;
-	GdkWindow *toplevel_win;
-	gpointer toplevel = NULL;
-	gint x, y;
-
-	/* FIXME multi-head */
-	win_at_pointer = gdk_window_at_pointer (&x, &y);
-	if (win_at_pointer == NULL)
-	{
-		/* We are outside all windows of the same application */
-		return NULL;
-	}
-
-	toplevel_win = gdk_window_get_toplevel (win_at_pointer);
-
-	/* get the GtkWidget which owns the toplevel GdkWindow */
-	gdk_window_get_user_data (toplevel_win, &toplevel);
-
-	/* toplevel should be an GeditWindow */
-	if ((toplevel != NULL) && 
-	    GEDIT_IS_WINDOW (toplevel))
-	{
-		return GEDIT_NOTEBOOK (_gedit_window_get_notebook
-						(GEDIT_WINDOW (toplevel)));
-	}
-
-	/* We are outside all windows containing a notebook */
-	return NULL;
-}
-
-static gboolean
-is_in_notebook_window (GeditNotebook *notebook,
-		       gint           abs_x, 
-		       gint           abs_y)
-{
-	GeditNotebook *nb_at_pointer;
-
-	g_return_val_if_fail (notebook != NULL, FALSE);
-
-	nb_at_pointer = find_notebook_at_pointer (abs_x, abs_y);
-
-	return (nb_at_pointer == notebook);
-}
-
-static gint
-find_tab_num_at_pos (GeditNotebook *notebook, 
-		     gint           abs_x, 
-		     gint           abs_y)
-{
-	GtkPositionType tab_pos;
-	int page_num = 0;
-	GtkNotebook *nb = GTK_NOTEBOOK (notebook);
-	GtkWidget *page;
-
-	tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook));
-
-	if (GTK_NOTEBOOK (notebook)->first_tab == NULL)
-	{
-		return AFTER_ALL_TABS;
-	}
-
-	/* For some reason unfullscreen + quick click can
-	   cause a wrong click event to be reported to the tab */
-	if (!is_in_notebook_window (notebook, abs_x, abs_y))
-	{
-		return NOT_IN_APP_WINDOWS;
-	}
-
-	while ((page = gtk_notebook_get_nth_page (nb, page_num)) != NULL)
-	{
-		GtkWidget *tab;
-		gint max_x, max_y;
-		gint x_root, y_root;
-
-		tab = gtk_notebook_get_tab_label (nb, page);
-		g_return_val_if_fail (tab != NULL, AFTER_ALL_TABS);
-
-		if (!GTK_WIDGET_MAPPED (GTK_WIDGET (tab)))
-		{
-			++page_num;
-			continue;
-		}
-
-		gdk_window_get_origin (GDK_WINDOW (tab->window),
-				       &x_root, &y_root);
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-		max_x = x_root + tab->allocation.x + tab->allocation.width;
-		max_y = y_root + tab->allocation.y + tab->allocation.height;
+    object_class->finalize = gedit_notebook_finalize;
 
-		if (((tab_pos == GTK_POS_TOP) || 
-		     (tab_pos == GTK_POS_BOTTOM)) &&
-		    (abs_x <= max_x))
-		{
-			return page_num;
-		}
-		else if (((tab_pos == GTK_POS_LEFT) || 
-		          (tab_pos == GTK_POS_RIGHT)) && 
-		         (abs_y <= max_y))
-		{
-			return page_num;
-		}
+    signals[TAB_CLOSE_REQUEST] =
+        g_signal_new ("tab-close-request",
+                  G_OBJECT_CLASS_TYPE (object_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GeditNotebookClass, tab_close_request),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__OBJECT,
+                  G_TYPE_NONE,
+                  1,
+                  GEDIT_TYPE_TAB);
 
-		++page_num;
-	}
-	
-	return AFTER_ALL_TABS;
+    g_type_class_add_private (object_class, sizeof(GeditNotebookPrivate));
 }
 
-static gint 
-find_notebook_and_tab_at_pos (gint            abs_x, 
-			      gint            abs_y,
-			      GeditNotebook **notebook,
-			      gint           *page_num)
-{
-	*notebook = find_notebook_at_pointer (abs_x, abs_y);
-	if (*notebook == NULL)
-	{
-		return NOT_IN_APP_WINDOWS;
-	}
-	
-	*page_num = find_tab_num_at_pos (*notebook, abs_x, abs_y);
-
-	if (*page_num < 0)
-	{
-		return *page_num;
-	}
-	else
-	{
-		return 0;
-	}
-}
-
 /* If dest_position is greater than or equal to the number of tabs 
    of the destination nootebook or negative, tab will be moved to the 
    end of the tabs. */
@@ -301,302 +108,20 @@
    end of the tabs. */
 void
 gedit_notebook_move_tab (GeditNotebook *src,
-			 GeditNotebook *dest,
-			 GeditTab      *tab,
-			 gint           dest_position)
-{
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (src));	
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (dest));
-	g_return_if_fail (src != dest);
-	g_return_if_fail (GEDIT_IS_TAB (tab));
-
-	/* make sure the tab isn't destroyed while we move it */
-	g_object_ref (tab);
-	gedit_notebook_remove_tab (src, tab);
-	gedit_notebook_add_tab (dest, tab, dest_position, TRUE);
-	g_object_unref (tab);
-}
-
-/* If dest_position is greater than or equal to the number of tabs 
-   of the destination nootebook or negative, tab will be moved to the 
-   end of the tabs. */
-void
-gedit_notebook_reorder_tab (GeditNotebook *src,
-			    GeditTab      *tab,
-			    gint           dest_position)
-{
-	gint old_position;
-	
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (src));	
-	g_return_if_fail (GEDIT_IS_TAB (tab));
-
-	old_position = gtk_notebook_page_num (GTK_NOTEBOOK (src), 
-				    	      GTK_WIDGET (tab));
-				    	      
-	if (old_position == dest_position)
-		return;
-
-	gtk_notebook_reorder_child (GTK_NOTEBOOK (src), 
-				    GTK_WIDGET (tab),
-				    dest_position);
-		
-	if (!src->priv->drag_in_progress)
-	{
-		g_signal_emit (G_OBJECT (src), 
-			       signals[TABS_REORDERED], 
-			       0);
-	}
-}
-
-static void
-drag_start (GeditNotebook *notebook,
-	    guint32        time)
-{
-	notebook->priv->drag_in_progress = TRUE;
-
-	/* get a new cursor, if necessary */
-	/* FIXME multi-head */
-	if (cursor == NULL)
-		cursor = gdk_cursor_new (GDK_FLEUR);
-
-	/* grab the pointer */
-	gtk_grab_add (GTK_WIDGET (notebook));
-
-	/* FIXME multi-head */
-	if (!gdk_pointer_is_grabbed ())
-	{
-		gdk_pointer_grab (GTK_WIDGET (notebook)->window,
-				  FALSE,
-				  GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
-				  NULL, 
-				  cursor, 
-				  time);
-	}
-}
-
-static void
-drag_stop (GeditNotebook *notebook)
-{
-	if (notebook->priv->drag_in_progress)
-	{
-		g_signal_emit (G_OBJECT (notebook), 
-			       signals[TABS_REORDERED], 
-			       0);
-	}
-
-	notebook->priv->drag_in_progress = FALSE;
-	if (notebook->priv->motion_notify_handler_id != 0)
-	{
-		g_signal_handler_disconnect (G_OBJECT (notebook),
-					     notebook->priv->motion_notify_handler_id);
-		notebook->priv->motion_notify_handler_id = 0;
-	}
-}
-
-/* This function is only called during dnd, we don't need to emit TABS_REORDERED
- * here, instead we do it on drag_stop
- */
-static void
-move_current_tab (GeditNotebook *notebook,
-	          gint           dest_position)
-{
-	gint cur_page_num;
-
-	cur_page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
-
-	if (dest_position != cur_page_num)
-	{
-		GtkWidget *cur_tab;
-		
-		cur_tab = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook),
-						     cur_page_num);
-						     
-		gedit_notebook_reorder_tab (GEDIT_NOTEBOOK (notebook),
-					    GEDIT_TAB (cur_tab),
-					    dest_position);
-	}
-}
-
-static gboolean
-motion_notify_cb (GeditNotebook  *notebook,
-		  GdkEventMotion *event,
-		  gpointer        data)
-{
-	GeditNotebook *dest;
-	gint page_num;
-	gint result;
-
-	if (notebook->priv->drag_in_progress == FALSE)
-	{
-		if (notebook->priv->tab_drag_and_drop_enabled == FALSE)
-			return FALSE;
-			
-		if (gtk_drag_check_threshold (GTK_WIDGET (notebook),
-					      notebook->priv->x_start,
-					      notebook->priv->y_start,
-					      event->x_root, 
-					      event->y_root))
-		{
-			drag_start (notebook, event->time);
-			return TRUE;
-		}
-
-		return FALSE;
-	}
-
-	result = find_notebook_and_tab_at_pos ((gint)event->x_root,
-					       (gint)event->y_root,
-					       &dest, 
-					       &page_num);
-
-	if (result != NOT_IN_APP_WINDOWS)
-	{
-		if (dest != notebook)
-		{
-			move_current_tab_to_another_notebook (notebook, 
-							      dest,
-						      	      event, 
-						      	      page_num);
-		}
-		else
-		{
-			g_return_val_if_fail (page_num >= -1, FALSE);
-			move_current_tab (notebook, page_num);
-		}
-	}
-
-	return FALSE;
-}
-
-static void
-move_current_tab_to_another_notebook (GeditNotebook  *src,
-				      GeditNotebook  *dest,
-				      GdkEventMotion *event,
-				      gint            dest_position)
-{
-	GeditTab *tab;
-	gint cur_page;
-
-	/* This is getting tricky, the tab was dragged in a notebook
-	 * in another window of the same app, we move the tab
-	 * to that new notebook, and let this notebook handle the
-	 * drag
-	 */
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (dest));
-	g_return_if_fail (dest != src);
-
-	cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (src));
-	tab = GEDIT_TAB (gtk_notebook_get_nth_page (GTK_NOTEBOOK (src), 
-						    cur_page));
-
-	/* stop drag in origin window */
-	/* ungrab the pointer if it's grabbed */
-	drag_stop (src);
-	if (gdk_pointer_is_grabbed ())
-	{
-		gdk_pointer_ungrab (event->time);
-	}
-	gtk_grab_remove (GTK_WIDGET (src));
-
-	gedit_notebook_move_tab (src, dest, tab, dest_position);
-
-	/* start drag handling in dest notebook */
-	dest->priv->motion_notify_handler_id =
-		g_signal_connect (G_OBJECT (dest),
-				  "motion-notify-event",
-				  G_CALLBACK (motion_notify_cb),
-				  NULL);
-
-	drag_start (dest, event->time);
-}
-
-static gboolean
-button_release_cb (GeditNotebook  *notebook,
-		   GdkEventButton *event,
-		   gpointer        data)
-{
-	if (notebook->priv->drag_in_progress)
-	{
-		gint cur_page_num;
-		GtkWidget *cur_page;
-
-		cur_page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
-		cur_page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook),
-						      cur_page_num);
-
-		/* CHECK: I don't follow the code here -- Paolo  */
-		if (!is_in_notebook_window (notebook, event->x_root, event->y_root) &&
-		    (gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) > 1))
-		{
-			/* Tab was detached */
-			g_signal_emit (G_OBJECT (notebook),
-				       signals[TAB_DETACHED], 
-				       0, 
-				       cur_page);
-		}
-
-		/* ungrab the pointer if it's grabbed */
-		if (gdk_pointer_is_grabbed ())
-		{
-			gdk_pointer_ungrab (event->time);
-		}
-		gtk_grab_remove (GTK_WIDGET (notebook));
-	}
-
-	/* This must be called even if a drag isn't happening */
-	drag_stop (notebook);
-
-	return FALSE;
-}
-
-static gboolean
-button_press_cb (GeditNotebook  *notebook,
-		 GdkEventButton *event,
-		 gpointer        data)
+             GeditNotebook *dest,
+             GeditTab      *tab,
+             gint           dest_position)
 {
-	gint tab_clicked;
-
-	if (notebook->priv->drag_in_progress)
-		return TRUE;
-
-	tab_clicked = find_tab_num_at_pos (notebook,
-					   event->x_root,
-					   event->y_root);
-					   
-	if ((event->button == 1) && 
-	    (event->type == GDK_BUTTON_PRESS) && 
-	    (tab_clicked >= 0))
-	{
-		notebook->priv->x_start = event->x_root;
-		notebook->priv->y_start = event->y_root;
-		
-		notebook->priv->motion_notify_handler_id =
-			g_signal_connect (G_OBJECT (notebook),
-					  "motion-notify-event",
-					  G_CALLBACK (motion_notify_cb), 
-					  NULL);
-	}
-	else if ((event->type == GDK_BUTTON_PRESS) && 
-		 (event->button == 3))
-	{
-		if (tab_clicked == -1)
-		{
-			// CHECK: do we really need it?
-			
-			/* consume event, so that we don't pop up the context menu when
-			 * the mouse if not over a tab label
-			 */
-			return TRUE;
-		}
-		else
-		{
-			/* Switch to the page the mouse is over, but don't consume the event */
-			gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 
-						       tab_clicked);
-		}
-	}
+    g_return_if_fail (GEDIT_IS_NOTEBOOK (src)); 
+    g_return_if_fail (GEDIT_IS_NOTEBOOK (dest));
+    g_return_if_fail (src != dest);
+    g_return_if_fail (GEDIT_IS_TAB (tab));
 
-	return FALSE;
+    /* make sure the tab isn't destroyed while we move it */
+    g_object_ref (tab);
+    gedit_notebook_remove_tab (src, tab);
+    gedit_notebook_add_tab (dest, tab, dest_position, TRUE);
+    g_object_unref (tab);
 }
 
 GtkWidget *
@@ -602,9 +127,11 @@
 GtkWidget *
 gedit_notebook_new (void)
 {
-	return GTK_WIDGET (g_object_new (GEDIT_TYPE_NOTEBOOK, NULL));
+    return GTK_WIDGET (g_object_new (GEDIT_TYPE_NOTEBOOK, NULL));
 }
 
+/* CHECK : called twice for each switch
+ */
 static void
 gedit_notebook_switch_page_cb (GtkNotebook     *notebook,
                                GtkNotebookPage *page,
@@ -611,46 +138,26 @@
                                guint            page_num,
                                gpointer         data)
 {
-	GeditNotebook *nb = GEDIT_NOTEBOOK (notebook);
-	GtkWidget *child;
-	GeditView *view;
+    GeditNotebook *nb = GEDIT_NOTEBOOK (notebook);
+    GtkWidget *child;
+    GeditView *view;
 
-	child = gtk_notebook_get_nth_page (notebook, page_num);
+    child = gtk_notebook_get_nth_page (notebook, page_num);
 
-	/* Remove the old page, we dont want to grow unnecessarily
-	 * the list */
-	if (nb->priv->focused_pages)
-	{
-		nb->priv->focused_pages =
-			g_list_remove (nb->priv->focused_pages, child);
-	}
+    /* Remove the old page, we dont want to grow unnecessarily
+     * the list */
+    if (nb->priv->focused_pages)
+    {
+        nb->priv->focused_pages =
+            g_list_remove (nb->priv->focused_pages, child);
+    }
 
-	nb->priv->focused_pages = g_list_append (nb->priv->focused_pages,
-						 child);
+    nb->priv->focused_pages = g_list_append (nb->priv->focused_pages,
+                         child);
 
-	/* give focus to the view */
-	view = gedit_tab_get_view (GEDIT_TAB (child));
-	gtk_widget_grab_focus (GTK_WIDGET (view));
-}
-
-/*
- * update_tabs_visibility: Hide tabs if there is only one tab
- * and the pref is not set.
- */
-static void
-update_tabs_visibility (GeditNotebook *nb, 
-			gboolean       before_inserting)
-{
-	gboolean show_tabs;
-	guint num;
-
-	num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
-
-	if (before_inserting) num++;
-
-	show_tabs = (nb->priv->always_show_tabs || num > 1);
-
-	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), show_tabs);
+    /* give focus to the view */
+    view = gedit_tab_get_view (GEDIT_TAB (child));
+    gtk_widget_grab_focus (GTK_WIDGET (view));
 }
 
 static void
@@ -656,35 +163,18 @@
 static void
 gedit_notebook_init (GeditNotebook *notebook)
 {
-	notebook->priv = GEDIT_NOTEBOOK_GET_PRIVATE (notebook);
-
-	notebook->priv->close_buttons_sensitive = TRUE;
-	notebook->priv->tab_drag_and_drop_enabled = TRUE;
-	
-	gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
-	gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
-	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
-
-	notebook->priv->title_tips = gedit_tooltips_new ();
-	g_object_ref_sink (notebook->priv->title_tips);
-
-	notebook->priv->always_show_tabs = TRUE;
+    notebook->priv = GEDIT_NOTEBOOK_GET_PRIVATE (notebook);
 
-	g_signal_connect (notebook, 
-			  "button-press-event",
-			  (GCallback)button_press_cb, 
-			  NULL);
-	g_signal_connect (notebook, 
-			  "button-release-event",
-			  (GCallback)button_release_cb,
-			  NULL);
-	gtk_widget_add_events (GTK_WIDGET (notebook), 
-			       GDK_BUTTON1_MOTION_MASK);
+    notebook->priv->close_buttons_sensitive = TRUE;
+    
+    gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
+    gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
+    gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
 
-	g_signal_connect_after (G_OBJECT (notebook), 
-				"switch_page",
-                                G_CALLBACK (gedit_notebook_switch_page_cb),
-                                NULL);
+    g_signal_connect_after (G_OBJECT (notebook), 
+                "switch-page",
+                G_CALLBACK (gedit_notebook_switch_page_cb),
+                NULL);
 }
 
 static void
@@ -690,14 +180,12 @@
 static void
 gedit_notebook_finalize (GObject *object)
 {
-	GeditNotebook *notebook = GEDIT_NOTEBOOK (object);
-
-	if (notebook->priv->focused_pages)
-		g_list_free (notebook->priv->focused_pages);
-		
-	g_object_unref (notebook->priv->title_tips);
+    GeditNotebook *notebook = GEDIT_NOTEBOOK (object);
 
-	G_OBJECT_CLASS (gedit_notebook_parent_class)->finalize (object);
+    if (notebook->priv->focused_pages)
+        g_list_free (notebook->priv->focused_pages);
+        
+    G_OBJECT_CLASS (gedit_notebook_parent_class)->finalize (object);
 }
 
 static void
@@ -703,78 +191,75 @@
 static void
 sync_name (GeditTab *tab, GParamSpec *pspec, GtkWidget *hbox)
 {
-	GeditNotebook *nb;
-	GtkWidget *label;
-	GtkWidget *ebox;
-	GtkWidget *button;
-	GtkWidget *spinner;
-	GeditTooltips *tips;	
-	gchar *str;
-	GtkImage *icon;
-	GeditTabState  state;
-	
-	tips = GEDIT_TOOLTIPS (g_object_get_data (G_OBJECT (hbox), "tooltips"));
-	label = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label"));
-	ebox = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label-ebox"));
-	icon = GTK_IMAGE (g_object_get_data (G_OBJECT (hbox), "icon"));
-	button = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "close-button"));
-	spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "spinner"));
+    GeditNotebook *nb;
+    GtkWidget *label;
+    GtkWidget *ebox;
+    GtkWidget *button;
+    GtkWidget *spinner;
+    gchar *str;
+    GtkImage *icon;
+    GeditTabState  state;
+    
+    label = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label"));
+    ebox = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label-ebox"));
+    icon = GTK_IMAGE (g_object_get_data (G_OBJECT (hbox), "icon"));
+    button = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "close-button"));
+    spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "spinner"));
 
-	nb = GEDIT_NOTEBOOK (gtk_widget_get_parent (GTK_WIDGET (tab)));
+    nb = GEDIT_NOTEBOOK (gtk_widget_get_parent (GTK_WIDGET (tab)));
 
-	g_return_if_fail ((tips    != NULL) && 
-			  (label   != NULL) && 
-			  (ebox    != NULL) && 
-			  (button  != NULL) &&
-			  (icon    != NULL) &&
-			  (spinner != NULL) &&
-			  (nb      != NULL));
+    g_return_if_fail ((label   != NULL) && 
+              (ebox    != NULL) && 
+              (button  != NULL) &&
+              (icon    != NULL) &&
+              (spinner != NULL) &&
+              (nb      != NULL));
 
-	str = _gedit_tab_get_name (tab);
-	g_return_if_fail (str != NULL);
-	
-	gtk_label_set_text (GTK_LABEL (label), str);
-	g_free (str);
-	
-	str = _gedit_tab_get_tooltips (tab);
-	g_return_if_fail (str != NULL);
-	
-	gedit_tooltips_set_tip (tips, ebox, str, NULL);
-	g_free (str);
-		
-	state = gedit_tab_get_state (tab);
-	
-	gtk_widget_set_sensitive (button,
-				  nb->priv->close_buttons_sensitive &&  
-				  (state != GEDIT_TAB_STATE_CLOSING) &&
-				  (state != GEDIT_TAB_STATE_SAVING)  &&
-				  (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
-				  (state != GEDIT_TAB_STATE_SAVING_ERROR));
-				  
-	if ((state == GEDIT_TAB_STATE_LOADING)   ||
-	    (state == GEDIT_TAB_STATE_SAVING)    ||
-	    (state == GEDIT_TAB_STATE_REVERTING))
-	{
-		gtk_widget_hide (GTK_WIDGET (icon));
-		
-		gtk_widget_show (spinner);
-		gedit_spinner_start (GEDIT_SPINNER (spinner));
-	}
-	else
-	{
-		GdkPixbuf *pixbuf;
-		
-		pixbuf = _gedit_tab_get_icon (tab);
-		gtk_image_set_from_pixbuf (icon, pixbuf);
+    str = _gedit_tab_get_name (tab);
+    g_return_if_fail (str != NULL);
+    
+    gtk_label_set_text (GTK_LABEL (label), str);
+    g_free (str);
+    
+    str = _gedit_tab_get_tooltips (tab);
+    g_return_if_fail (str != NULL);
+    
+    gtk_widget_set_tooltip_markup (ebox, str);
+    g_free (str);
+        
+    state = gedit_tab_get_state (tab);
+    
+    gtk_widget_set_sensitive (button,
+                  nb->priv->close_buttons_sensitive &&  
+                  (state != GEDIT_TAB_STATE_CLOSING) &&
+                  (state != GEDIT_TAB_STATE_SAVING)  &&
+                  (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
+                  (state != GEDIT_TAB_STATE_SAVING_ERROR));
+                  
+    if ((state == GEDIT_TAB_STATE_LOADING)   ||
+        (state == GEDIT_TAB_STATE_SAVING)    ||
+        (state == GEDIT_TAB_STATE_REVERTING))
+    {
+        gtk_widget_hide (GTK_WIDGET (icon));
+        
+        gtk_widget_show (spinner);
+        gedit_spinner_start (GEDIT_SPINNER (spinner));
+    }
+    else
+    {
+        GdkPixbuf *pixbuf;
+        
+        pixbuf = _gedit_tab_get_icon (tab);
+        gtk_image_set_from_pixbuf (icon, pixbuf);
 
-		if (pixbuf != NULL)
-			g_object_unref (pixbuf);
+        if (pixbuf != NULL)
+            g_object_unref (pixbuf);
 
-		gtk_widget_show (GTK_WIDGET (icon));
-		
-		gtk_widget_hide (spinner);
-		gedit_spinner_stop (GEDIT_SPINNER (spinner));
-	}
+        gtk_widget_show (GTK_WIDGET (icon));
+        
+        gtk_widget_hide (spinner);
+        gedit_spinner_stop (GEDIT_SPINNER (spinner));
+    }
 }
 
 static void
@@ -779,12 +264,12 @@
 
 static void
 close_button_clicked_cb (GtkWidget *widget, 
-			 GtkWidget *tab)
+             GtkWidget *tab)
 {
-	GeditNotebook *notebook;
+    GeditNotebook *notebook;
 
-	notebook = GEDIT_NOTEBOOK (gtk_widget_get_parent (tab));
-	g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, tab);
+    notebook = GEDIT_NOTEBOOK (gtk_widget_get_parent (tab));
+    g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, tab);
 }
 
 static void
@@ -789,17 +274,17 @@
 
 static void
 tab_label_style_set_cb (GtkWidget *hbox,
-			GtkStyle *previous_style,
-			gpointer user_data)
+            GtkStyle *previous_style,
+            gpointer user_data)
 {
-	GtkWidget *button;
-	gint h, w;
+    GtkWidget *button;
+    gint h, w;
 
-	gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (hbox),
-					   GTK_ICON_SIZE_MENU, &w, &h);
+    gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (hbox),
+                       GTK_ICON_SIZE_MENU, &w, &h);
 
-	button = g_object_get_data (G_OBJECT (hbox), "close-button");
-	gtk_widget_set_size_request (button, w + 2, h + 2);
+    button = g_object_get_data (G_OBJECT (hbox), "close-button");
+    gtk_widget_set_size_request (button, w + 2, h + 2);
 }
 
 static GtkWidget *
@@ -804,102 +289,90 @@
 
 static GtkWidget *
 build_tab_label (GeditNotebook *nb, 
-		 GeditTab      *tab)
+         GeditTab      *tab)
 {
-	GtkWidget *hbox, *label_hbox, *label_ebox;
-	GtkWidget *label, *dummy_label;
-	GtkWidget *close_button;
-	GtkRcStyle *rcstyle;
-	GtkWidget *image;
-	GtkWidget *spinner;
-	GtkWidget *icon;
-
-	hbox = gtk_hbox_new (FALSE, 4);
+    GtkWidget *hbox, *label_hbox, *label_ebox;
+    GtkWidget *label, *dummy_label;
+    GtkWidget *close_button;
+    GtkRcStyle *rcstyle;
+    GtkWidget *image;
+    GtkWidget *spinner;
+    GtkWidget *icon;
 
-	label_ebox = gtk_event_box_new ();
-	gtk_event_box_set_visible_window (GTK_EVENT_BOX (label_ebox), FALSE);
-	gtk_box_pack_start (GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0);
+    hbox = gtk_hbox_new (FALSE, 4);
 
-	label_hbox = gtk_hbox_new (FALSE, 4);
-	gtk_container_add (GTK_CONTAINER (label_ebox), label_hbox);
+    label_ebox = gtk_event_box_new ();
+    gtk_event_box_set_visible_window (GTK_EVENT_BOX (label_ebox), FALSE);
+    gtk_box_pack_start (GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0);
 
-	/* setup close button */
-	close_button = gtk_button_new ();
-	gtk_button_set_relief (GTK_BUTTON (close_button),
-			       GTK_RELIEF_NONE);
-	/* don't allow focus on the close button */
-	gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
+    label_hbox = gtk_hbox_new (FALSE, 4);
+    gtk_container_add (GTK_CONTAINER (label_ebox), label_hbox);
 
-	/* make it as small as possible */
-	rcstyle = gtk_rc_style_new ();
-	rcstyle->xthickness = rcstyle->ythickness = 0;
-	gtk_widget_modify_style (close_button, rcstyle);
-	gtk_rc_style_unref (rcstyle),
+    /* setup close button */
+    close_button = gtk_button_new ();
+    gtk_button_set_relief (GTK_BUTTON (close_button),
+                   GTK_RELIEF_NONE);
+    /* don't allow focus on the close button */
+    gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
 
-	image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
-					  GTK_ICON_SIZE_MENU);
-	gtk_container_add (GTK_CONTAINER (close_button), image);
-	gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
+    /* make it as small as possible */
+    rcstyle = gtk_rc_style_new ();
+    rcstyle->xthickness = rcstyle->ythickness = 0;
+    gtk_widget_modify_style (close_button, rcstyle);
+    gtk_rc_style_unref (rcstyle),
 
-	gedit_tooltips_set_tip (nb->priv->title_tips, close_button,
-			      _("Close document"), NULL);
+    image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
+                      GTK_ICON_SIZE_MENU);
+    gtk_container_add (GTK_CONTAINER (close_button), image);
+    gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
 
-	g_signal_connect (close_button,
-			  "clicked",
-			  G_CALLBACK (close_button_clicked_cb),
-			  tab);
+    gtk_widget_set_tooltip_text (close_button,
+                  _("Close document"));
+    
+    g_signal_connect (close_button,
+              "clicked",
+              G_CALLBACK (close_button_clicked_cb),
+              tab);
 
-	/* setup spinner */
-	spinner = gedit_spinner_new ();
-	gedit_spinner_set_size (GEDIT_SPINNER (spinner), GTK_ICON_SIZE_MENU);
-	gtk_box_pack_start (GTK_BOX (label_hbox), spinner, FALSE, FALSE, 0);
+    /* setup spinner */
+    spinner = gedit_spinner_new ();
+    gedit_spinner_set_size (GEDIT_SPINNER (spinner), GTK_ICON_SIZE_MENU);
+    gtk_box_pack_start (GTK_BOX (label_hbox), spinner, FALSE, FALSE, 0);
 
-	/* setup site icon, empty by default */
-	icon = gtk_image_new ();
-	gtk_box_pack_start (GTK_BOX (label_hbox), icon, FALSE, FALSE, 0);
-	
-	/* setup label */
-	label = gtk_label_new ("");
-	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-	gtk_misc_set_padding (GTK_MISC (label), 0, 0);
-	gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, FALSE, 0);
+    /* setup site icon, empty by default */
+    icon = gtk_image_new ();
+    gtk_box_pack_start (GTK_BOX (label_hbox), icon, FALSE, FALSE, 0);
+    
+    /* setup label */
+    label = gtk_label_new ("");
+    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    gtk_misc_set_padding (GTK_MISC (label), 0, 0);
+    gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, FALSE, 0);
 
-	dummy_label = gtk_label_new ("");
-	gtk_box_pack_start (GTK_BOX (label_hbox), dummy_label, TRUE, TRUE, 0);
-	
-	/* Set minimal size */
-	g_signal_connect (hbox, "style-set",
-			  G_CALLBACK (tab_label_style_set_cb), NULL);
-	
-	gtk_widget_show (hbox);
-	gtk_widget_show (label_ebox);
-	gtk_widget_show (label_hbox);
-	gtk_widget_show (label);
-	gtk_widget_show (dummy_label);	
-	gtk_widget_show (image);
-	gtk_widget_show (close_button);
-	gtk_widget_show (icon);
-	
-	g_object_set_data (G_OBJECT (hbox), "label", label);
-	g_object_set_data (G_OBJECT (hbox), "label-ebox", label_ebox);
-	g_object_set_data (G_OBJECT (hbox), "spinner", spinner);
-	g_object_set_data (G_OBJECT (hbox), "icon", icon);
-	g_object_set_data (G_OBJECT (hbox), "close-button", close_button);
-	g_object_set_data (G_OBJECT (tab), "close-button", close_button);
-	g_object_set_data (G_OBJECT (hbox), "tooltips", nb->priv->title_tips);
+    dummy_label = gtk_label_new ("");
+    gtk_box_pack_start (GTK_BOX (label_hbox), dummy_label, TRUE, TRUE, 0);
+    
+    /* Set minimal size */
+    g_signal_connect (hbox, "style-set",
+              G_CALLBACK (tab_label_style_set_cb), NULL);
+    
+    gtk_widget_show (hbox);
+    gtk_widget_show (label_ebox);
+    gtk_widget_show (label_hbox);
+    gtk_widget_show (label);
+    gtk_widget_show (dummy_label);  
+    gtk_widget_show (image);
+    gtk_widget_show (close_button);
+    gtk_widget_show (icon);
+    
+    g_object_set_data (G_OBJECT (hbox), "label", label);
+    g_object_set_data (G_OBJECT (hbox), "label-ebox", label_ebox);
+    g_object_set_data (G_OBJECT (hbox), "spinner", spinner);
+    g_object_set_data (G_OBJECT (hbox), "icon", icon);
+    g_object_set_data (G_OBJECT (hbox), "close-button", close_button);
+    g_object_set_data (G_OBJECT (tab), "close-button", close_button);
 
-	return hbox;
-}
-
-void
-gedit_notebook_set_always_show_tabs (GeditNotebook *nb, 
-				     gboolean       show_tabs)
-{
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
-
-	nb->priv->always_show_tabs = (show_tabs != FALSE);
-
-	update_tabs_visibility (nb, FALSE);
+    return hbox;
 }
 
 void
@@ -904,55 +377,59 @@
 
 void
 gedit_notebook_add_tab (GeditNotebook *nb,
-		        GeditTab      *tab,
-		        gint           position,
-		        gboolean       jump_to)
+                GeditTab      *tab,
+                gint           position,
+                gboolean       jump_to)
 {
-	GtkWidget *label;
-
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
-	g_return_if_fail (GEDIT_IS_TAB (tab));
+    GtkWidget *label;
 
-	label = build_tab_label (nb, tab);
+    g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
+    g_return_if_fail (GEDIT_IS_TAB (tab));
 
-	update_tabs_visibility (nb, TRUE);
+    label = build_tab_label (nb, tab);
 
-	gtk_notebook_insert_page (GTK_NOTEBOOK (nb), 
-				  GTK_WIDGET (tab),
-				  label, 
-				  position);
+    gtk_notebook_insert_page (GTK_NOTEBOOK (nb), 
+                  GTK_WIDGET (tab),
+                  label, 
+                  position);
 
-	sync_name (tab, NULL, label);
-		         
-	g_signal_connect_object (tab, 
-				 "notify::name",
-			         G_CALLBACK (sync_name), 
-			         label, 
-			         0);
-	g_signal_connect_object (tab, 
-				 "notify::state",
-			         G_CALLBACK (sync_name), 
-			         label, 
-			         0);			         
+    /* Set the tab detachable and reorderable */
+    gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (nb),
+                    GTK_WIDGET (tab),
+                    TRUE);
+    gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (nb),
+                    GTK_WIDGET (tab),
+                    TRUE);
 
-	g_signal_emit (G_OBJECT (nb), signals[TAB_ADDED], 0, tab);
+    sync_name (tab, NULL, label);
+                 
+    g_signal_connect_object (tab, 
+                 "notify::name",
+                     G_CALLBACK (sync_name), 
+                     label, 
+                     0);
+    g_signal_connect_object (tab, 
+                 "notify::state",
+                     G_CALLBACK (sync_name), 
+                     label, 
+                     0);                     
 
-	/* The signal handler may have reordered the tabs */
-	position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), 
-					  GTK_WIDGET (tab));
+    /* The signal handler may have reordered the tabs */
+    position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), 
+                      GTK_WIDGET (tab));
 
-	if (jump_to)
-	{
-		GeditView *view;
-		
-		gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), position);
-		g_object_set_data (G_OBJECT (tab), 
-				   "jump_to",
-				   GINT_TO_POINTER (jump_to));
-		view = gedit_tab_get_view (tab);
-		
-		gtk_widget_grab_focus (GTK_WIDGET (view));
-	}
+    if (jump_to)
+    {
+        GeditView *view;
+        
+        gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), position);
+        g_object_set_data (G_OBJECT (tab), 
+                   "jump_to",
+                   GINT_TO_POINTER (jump_to));
+        view = gedit_tab_get_view (tab);
+        
+        gtk_widget_grab_focus (GTK_WIDGET (view));
+    }
 }
 
 static void
@@ -957,31 +434,31 @@
 
 static void
 smart_tab_switching_on_closure (GeditNotebook *nb,
-				GeditTab      *tab)
+                GeditTab      *tab)
 {
-	gboolean jump_to;
+    gboolean jump_to;
 
-	jump_to = GPOINTER_TO_INT (g_object_get_data
-				   (G_OBJECT (tab), "jump_to"));
+    jump_to = GPOINTER_TO_INT (g_object_get_data
+                   (G_OBJECT (tab), "jump_to"));
 
-	if (!jump_to || !nb->priv->focused_pages)
-	{
-		gtk_notebook_next_page (GTK_NOTEBOOK (nb));
-	}
-	else
-	{
-		GList *l;
-		GtkWidget *child;
-		int page_num;
+    if (!jump_to || !nb->priv->focused_pages)
+    {
+        gtk_notebook_next_page (GTK_NOTEBOOK (nb));
+    }
+    else
+    {
+        GList *l;
+        GtkWidget *child;
+        int page_num;
 
-		/* activate the last focused tab */
-		l = g_list_last (nb->priv->focused_pages);
-		child = GTK_WIDGET (l->data);
-		page_num = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
-						  child);
-		gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), 
-					       page_num);
-	}
+        /* activate the last focused tab */
+        l = g_list_last (nb->priv->focused_pages);
+        child = GTK_WIDGET (l->data);
+        page_num = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
+                          child);
+        gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), 
+                           page_num);
+    }
 }
 
 static void
@@ -986,36 +463,29 @@
 
 static void
 remove_tab (GeditTab      *tab,
-	    GeditNotebook *nb)
+        GeditNotebook *nb)
 {
-	GtkWidget *label, *ebox;
-	gint position;
-
-	position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
-
-	label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
-	ebox = GTK_WIDGET (g_object_get_data (G_OBJECT (label), "label-ebox"));
-	gedit_tooltips_set_tip (GEDIT_TOOLTIPS (nb->priv->title_tips), 
-			        ebox, 
-			        NULL, 
-			        NULL);
+    GtkWidget *label, *ebox;
+    gint position;
 
-	g_signal_handlers_disconnect_by_func (tab,
-					      G_CALLBACK (sync_name), 
-					      label);
+    position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
 
-	/* we ref the tab so that it's still alive while the tabs_removed
-	 * signal is processed.
-	 */
-	g_object_ref (tab);
+    label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
+    ebox = GTK_WIDGET (g_object_get_data (G_OBJECT (label), "label-ebox"));
+    gtk_widget_set_tooltip_text (ebox, NULL);
 
-	gtk_notebook_remove_page (GTK_NOTEBOOK (nb), position);
+    g_signal_handlers_disconnect_by_func (tab,
+                          G_CALLBACK (sync_name), 
+                          label);
 
-	update_tabs_visibility (nb, FALSE);
+    /* we ref the tab so that it's still alive while the tabs_removed
+     * signal is processed.
+     */
+    g_object_ref (tab);
 
-	g_signal_emit (G_OBJECT (nb), signals[TAB_REMOVED], 0, tab);
+    gtk_notebook_remove_page (GTK_NOTEBOOK (nb), position);
 
-	g_object_unref (tab);	
+    g_object_unref (tab);   
 }
 
 void
@@ -1020,26 +490,26 @@
 
 void
 gedit_notebook_remove_tab (GeditNotebook *nb,
-			   GeditTab      *tab)
+               GeditTab      *tab)
 {
-	gint position, curr;
+    gint position, curr;
 
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
-	g_return_if_fail (GEDIT_IS_TAB (tab));
+    g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
+    g_return_if_fail (GEDIT_IS_TAB (tab));
 
-	/* Remove the page from the focused pages list */
-	nb->priv->focused_pages =  g_list_remove (nb->priv->focused_pages,
-						  tab);
+    /* Remove the page from the focused pages list */
+    nb->priv->focused_pages =  g_list_remove (nb->priv->focused_pages,
+                          tab);
 
-	position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
-	curr = gtk_notebook_get_current_page (GTK_NOTEBOOK (nb));
+    position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
+    curr = gtk_notebook_get_current_page (GTK_NOTEBOOK (nb));
 
-	if (position == curr)
-	{
-		smart_tab_switching_on_closure (nb, tab);
-	}
+    if (position == curr)
+    {
+        smart_tab_switching_on_closure (nb, tab);
+    }
 
-	remove_tab (tab, nb);
+    remove_tab (tab, nb);
 }
 
 void
@@ -1044,15 +514,15 @@
 
 void
 gedit_notebook_remove_all_tabs (GeditNotebook *nb)
-{	
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
-	
-	g_list_free (nb->priv->focused_pages);
-	nb->priv->focused_pages = NULL;
+{   
+    g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
+    
+    g_list_free (nb->priv->focused_pages);
+    nb->priv->focused_pages = NULL;
 
-	gtk_container_foreach (GTK_CONTAINER (nb),
-			       (GtkCallback)remove_tab,
-			       nb);
+    gtk_container_foreach (GTK_CONTAINER (nb),
+                   (GtkCallback)remove_tab,
+                   nb);
 }
 
 static void
@@ -1059,21 +529,21 @@
 set_close_buttons_sensitivity (GeditTab      *tab,
                                GeditNotebook *nb)
 {
-	GtkWidget     *button;
-	GeditTabState  state;
-	
-	button = GTK_WIDGET (g_object_get_data (G_OBJECT (tab), 
-						"close-button"));	
-	g_return_if_fail (button != NULL);
-	
-	state = gedit_tab_get_state (tab);
-	
-	gtk_widget_set_sensitive (button, 
-				  nb->priv->close_buttons_sensitive &&
-				  (state != GEDIT_TAB_STATE_CLOSING) &&
-				  (state != GEDIT_TAB_STATE_SAVING)  &&
-				  (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
-				  (state != GEDIT_TAB_STATE_SAVING_ERROR));
+    GtkWidget     *button;
+    GeditTabState  state;
+    
+    button = GTK_WIDGET (g_object_get_data (G_OBJECT (tab), 
+                        "close-button"));   
+    g_return_if_fail (button != NULL);
+    
+    state = gedit_tab_get_state (tab);
+    
+    gtk_widget_set_sensitive (button, 
+                  nb->priv->close_buttons_sensitive &&
+                  (state != GEDIT_TAB_STATE_CLOSING) &&
+                  (state != GEDIT_TAB_STATE_SAVING)  &&
+                  (state != GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
+                  (state != GEDIT_TAB_STATE_SAVING_ERROR));
 }
 
 void
@@ -1078,20 +548,20 @@
 
 void
 gedit_notebook_set_close_buttons_sensitive (GeditNotebook *nb,
-					    gboolean       sensitive)
+                        gboolean       sensitive)
 {
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
-	
-	sensitive = (sensitive != FALSE);
-	
-	if (sensitive == nb->priv->close_buttons_sensitive)
-		return;
-	
-	nb->priv->close_buttons_sensitive = sensitive;
-	
-	gtk_container_foreach (GTK_CONTAINER (nb),
-			       (GtkCallback)set_close_buttons_sensitivity,
-			       nb);
+    g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
+    
+    sensitive = (sensitive != FALSE);
+    
+    if (sensitive == nb->priv->close_buttons_sensitive)
+        return;
+    
+    nb->priv->close_buttons_sensitive = sensitive;
+    
+    gtk_container_foreach (GTK_CONTAINER (nb),
+                   (GtkCallback)set_close_buttons_sensitivity,
+                   nb);
 }
 
 gboolean
@@ -1097,30 +567,7 @@
 gboolean
 gedit_notebook_get_close_buttons_sensitive (GeditNotebook *nb)
 {
-	g_return_val_if_fail (GEDIT_IS_NOTEBOOK (nb), TRUE);
-	
-	return nb->priv->close_buttons_sensitive;
+    g_return_val_if_fail (GEDIT_IS_NOTEBOOK (nb), TRUE);
+    
+    return nb->priv->close_buttons_sensitive;
 }
-
-void
-gedit_notebook_set_tab_drag_and_drop_enabled (GeditNotebook *nb,
-					      gboolean       enable)
-{
-	g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
-	
-	enable = (enable != FALSE);
-	
-	if (enable == nb->priv->tab_drag_and_drop_enabled)
-		return;
-		
-	nb->priv->tab_drag_and_drop_enabled = enable;		
-}
-
-gboolean	
-gedit_notebook_get_tab_drag_and_drop_enabled (GeditNotebook *nb)
-{
-	g_return_val_if_fail (GEDIT_IS_NOTEBOOK (nb), TRUE);
-	
-	return nb->priv->tab_drag_and_drop_enabled;
-}
-
Index: gedit/gedit-notebook.h
===================================================================
--- gedit/gedit-notebook.h	(revision 5713)
+++ gedit/gedit-notebook.h	(working copy)
@@ -48,15 +48,15 @@
 /*
  * Type checking and casting macros
  */
-#define GEDIT_TYPE_NOTEBOOK		(gedit_notebook_get_type ())
-#define GEDIT_NOTEBOOK(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GEDIT_TYPE_NOTEBOOK, GeditNotebook))
-#define GEDIT_NOTEBOOK_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GEDIT_TYPE_NOTEBOOK, GeditNotebookClass))
-#define GEDIT_IS_NOTEBOOK(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GEDIT_TYPE_NOTEBOOK))
-#define GEDIT_IS_NOTEBOOK_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GEDIT_TYPE_NOTEBOOK))
-#define GEDIT_NOTEBOOK_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GEDIT_TYPE_NOTEBOOK, GeditNotebookClass))
+#define GEDIT_TYPE_NOTEBOOK     (gedit_notebook_get_type ())
+#define GEDIT_NOTEBOOK(o)       (G_TYPE_CHECK_INSTANCE_CAST ((o), GEDIT_TYPE_NOTEBOOK, GeditNotebook))
+#define GEDIT_NOTEBOOK_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GEDIT_TYPE_NOTEBOOK, GeditNotebookClass))
+#define GEDIT_IS_NOTEBOOK(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GEDIT_TYPE_NOTEBOOK))
+#define GEDIT_IS_NOTEBOOK_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GEDIT_TYPE_NOTEBOOK))
+#define GEDIT_NOTEBOOK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GEDIT_TYPE_NOTEBOOK, GeditNotebookClass))
 
 /* Private structure type */
-typedef struct _GeditNotebookPrivate	GeditNotebookPrivate;
+typedef struct _GeditNotebookPrivate    GeditNotebookPrivate;
 
 /*
  * Main object structure
@@ -61,13 +61,13 @@
 /*
  * Main object structure
  */
-typedef struct _GeditNotebook		GeditNotebook;
+typedef struct _GeditNotebook       GeditNotebook;
  
 struct _GeditNotebook
 {
-	GtkNotebook notebook;
+    GtkNotebook notebook;
 
-	/*< private >*/
+    /*< private >*/
         GeditNotebookPrivate *priv;
 };
 
@@ -74,7 +74,7 @@
 /*
  * Class definition
  */
-typedef struct _GeditNotebookClass	GeditNotebookClass;
+typedef struct _GeditNotebookClass  GeditNotebookClass;
 
 struct _GeditNotebookClass
 {
@@ -80,17 +80,10 @@
 {
         GtkNotebookClass parent_class;
 
-	/* Signals */
-	void	 (* tab_added)      (GeditNotebook *notebook,
-				     GeditTab      *tab);
-	void	 (* tab_removed)    (GeditNotebook *notebook,
-				     GeditTab      *tab);
-	void	 (* tab_detached)   (GeditNotebook *notebook,
-				     GeditTab      *tab);
-	void	 (* tabs_reordered) (GeditNotebook *notebook);
-	void	 (* tab_close_request)
-				    (GeditNotebook *notebook,
-				     GeditTab      *tab);
+    /* Signals */
+    void     (* tab_close_request)
+                    (GeditNotebook *notebook,
+                     GeditTab      *tab);
 };
 
 /*
@@ -96,47 +89,31 @@
 /*
  * Public methods
  */
-GType		gedit_notebook_get_type		(void) G_GNUC_CONST;
-
-GtkWidget      *gedit_notebook_new		(void);
-
-void		gedit_notebook_add_tab		(GeditNotebook *nb,
-						 GeditTab      *tab,
-						 gint           position,
-						 gboolean       jump_to);
-
-void		gedit_notebook_remove_tab	(GeditNotebook *nb,
-						 GeditTab      *tab);
+GType       gedit_notebook_get_type     (void) G_GNUC_CONST;
 
-void		gedit_notebook_remove_all_tabs 	(GeditNotebook *nb);
+GtkWidget      *gedit_notebook_new      (void);
 
-void		gedit_notebook_reorder_tab	(GeditNotebook *src,
-			    			 GeditTab      *tab,
-			    			 gint           dest_position);
-			    			 
-void            gedit_notebook_move_tab		(GeditNotebook *src,
-						 GeditNotebook *dest,
-						 GeditTab      *tab,
-						 gint           dest_position);
+void        gedit_notebook_add_tab      (GeditNotebook *nb,
+                         GeditTab      *tab,
+                         gint           position,
+                         gboolean       jump_to);
 
-/* FIXME: do we really need this function ? */
-void		gedit_notebook_set_always_show_tabs	
-						(GeditNotebook *nb,
-						 gboolean       show_tabs);
+void        gedit_notebook_remove_tab   (GeditNotebook *nb,
+                         GeditTab      *tab);
 
-void		gedit_notebook_set_close_buttons_sensitive
-						(GeditNotebook *nb,
-						 gboolean       sensitive);
+void        gedit_notebook_remove_all_tabs  (GeditNotebook *nb);
+                             
+void        gedit_notebook_move_tab     (GeditNotebook *src,
+                         GeditNotebook *dest,
+                         GeditTab      *tab,
+                         gint           dest_position);
 
-gboolean	gedit_notebook_get_close_buttons_sensitive
-						(GeditNotebook *nb);
+void        gedit_notebook_set_close_buttons_sensitive
+                        (GeditNotebook *nb,
+                         gboolean       sensitive);
 
-void		gedit_notebook_set_tab_drag_and_drop_enabled
-						(GeditNotebook *nb,
-						 gboolean       enable);
-
-gboolean	gedit_notebook_get_tab_drag_and_drop_enabled
-						(GeditNotebook *nb);
+gboolean    gedit_notebook_get_close_buttons_sensitive
+                        (GeditNotebook *nb);
 
 G_END_DECLS
 
Index: gedit/gedit-window.c
===================================================================
--- gedit/gedit-window.c	(revision 5713)
+++ gedit/gedit-window.c	(working copy)
@@ -317,7 +317,7 @@
 gedit_window_tab_removed (GeditWindow *window,
 			  GeditTab    *tab) 
 {
-	gedit_plugins_engine_garbage_collect();
+	gedit_plugins_engine_garbage_collect ();
 }
 
 static void
@@ -2073,9 +2073,6 @@
 	gedit_notebook_set_close_buttons_sensitive (GEDIT_NOTEBOOK (window->priv->notebook),
 						    !(window->priv->state & GEDIT_WINDOW_STATE_SAVING_SESSION));
 						    
-	gedit_notebook_set_tab_drag_and_drop_enabled (GEDIT_NOTEBOOK (window->priv->notebook),
-						      !(window->priv->state & GEDIT_WINDOW_STATE_SAVING_SESSION));
-
 	if ((window->priv->state & GEDIT_WINDOW_STATE_SAVING_SESSION) != 0)
 	{
 		/* TODO: If we really care, Find could be active
@@ -2530,9 +2527,10 @@
 }
 
 static void
-notebook_tab_added (GeditNotebook *notebook,
-		    GeditTab      *tab,
-		    GeditWindow   *window)
+notebook_tab_added (GtkNotebook *notebook,
+		    GtkWidget      *tab,
+		    guint			page_num,
+		    GeditWindow	   *window)
 {
 	GeditView *view;
 	GeditDocument *doc;
@@ -2538,9 +2536,9 @@
 	GeditDocument *doc;
 	GtkTargetList *tl;
 	GtkAction *action;
-
+	
 	gedit_debug (DEBUG_WINDOW);
-
+	
 	g_return_if_fail ((window->priv->state & GEDIT_WINDOW_STATE_SAVING_SESSION) == 0);
 	
 	++window->priv->num_tabs;
@@ -2555,8 +2553,8 @@
 	gtk_action_set_sensitive (action,
 				  window->priv->num_tabs > 1);
 
-	view = gedit_tab_get_view (tab);
-	doc = gedit_tab_get_document (tab);
+	view = gedit_tab_get_view (GEDIT_TAB(tab));
+	doc = gedit_tab_get_document (GEDIT_TAB(tab));
 
 	/* IMPORTANT: remember to disconnect the signal in notebook_tab_removed
 	 * if a new signal is connected here */
@@ -2636,8 +2634,9 @@
 }
 
 static void
-notebook_tab_removed (GeditNotebook *notebook,
-		      GeditTab      *tab,
+notebook_tab_removed (GtkNotebook *notebook,
+		      GtkWidget      *tab,
+		      guint        page_num,
 		      GeditWindow   *window)
 {
 	GeditView     *view;
@@ -2643,7 +2642,7 @@
 	GeditView     *view;
 	GeditDocument *doc;
 	GtkAction     *action;
-
+	
 	gedit_debug (DEBUG_WINDOW);
 
 	g_return_if_fail ((window->priv->state & GEDIT_WINDOW_STATE_SAVING_SESSION) == 0);
@@ -2650,8 +2649,8 @@
 
 	--window->priv->num_tabs;
 
-	view = gedit_tab_get_view (tab);
-	doc = gedit_tab_get_document (tab);
+	view = gedit_tab_get_view (GEDIT_TAB(tab));
+	doc = gedit_tab_get_document (GEDIT_TAB(tab));
 
 	g_signal_handlers_disconnect_by_func (tab,
 					      G_CALLBACK (sync_name), 
@@ -2752,8 +2751,10 @@
 }
 
 static void
-notebook_tabs_reordered (GeditNotebook *notebook,
-			 GeditWindow   *window)
+notebook_tabs_reordered (GtkNotebook *notebook,
+			GtkWidget   *child,
+			guint        page_num,
+			GeditWindow   *window)
 {
 	update_documents_list_menu (window);
 	update_next_prev_doc_sensitivity_per_window (window);
@@ -2761,24 +2762,30 @@
 	g_signal_emit (G_OBJECT (window), signals[TABS_REORDERED], 0);
 }
 
-static void
-notebook_tab_detached (GeditNotebook *notebook,
-		       GeditTab      *tab,
-		       GeditWindow   *window)
+static GtkNotebook*
+notebook_tab_detached  (GtkNotebook *source,
+			GtkWidget *page,
+			gint x,
+			gint y,
+			GeditWindow *window)
 {
 	GeditWindow *new_window;
 	
+	/* If the tab s the only one in the source notebook, then
+	 * we forbid the drag operation
+	 */
+	if (gtk_notebook_get_n_pages (source) < 2)
+		return NULL;
+
 	new_window = clone_window (window);
-		
-	gedit_notebook_move_tab (notebook,
-				 GEDIT_NOTEBOOK (_gedit_window_get_notebook (new_window)),
-				 tab, 0);
-				 
+
 	gtk_window_set_position (GTK_WINDOW (new_window), 
 				 GTK_WIN_POS_MOUSE);
-					 
+
 	gtk_widget_show (GTK_WIDGET (new_window));
-}		      
+
+	return GTK_NOTEBOOK(new_window->priv->notebook);
+}
 
 static void 
 notebook_tab_close_request (GeditNotebook *notebook,
@@ -3187,7 +3194,12 @@
   	
 	gedit_debug_message (DEBUG_WINDOW, "Create gedit notebook");
 	window->priv->notebook = gedit_notebook_new ();
-  	gtk_paned_pack1 (GTK_PANED (window->priv->vpaned), 
+	/* Set the current app pointer as the notebook group,
+	 *  so we can move tabs between windows of the same app */
+	gtk_notebook_set_group (GTK_NOTEBOOK(window->priv->notebook),
+					gedit_app_get_default ());
+	
+	gtk_paned_pack1 (GTK_PANED (window->priv->vpaned), 
   			 window->priv->notebook,
   			 TRUE, 
   			 TRUE);
@@ -3230,23 +3242,23 @@
 
 	/* Connect signals */
 	g_signal_connect (window->priv->notebook,
-			  "switch_page",
+			  "switch-page",
 			  G_CALLBACK (notebook_switch_page),
 			  window);
 	g_signal_connect (window->priv->notebook,
-			  "tab_added",
+			  "page-added",
 			  G_CALLBACK (notebook_tab_added),
 			  window);
 	g_signal_connect (window->priv->notebook,
-			  "tab_removed",
+			  "page-removed",
 			  G_CALLBACK (notebook_tab_removed),
 			  window);
 	g_signal_connect (window->priv->notebook,
-			  "tabs_reordered",
+			  "page-reordered",
 			  G_CALLBACK (notebook_tabs_reordered),
-			  window);			  
+			  window);	
 	g_signal_connect (window->priv->notebook,
-			  "tab_detached",
+			  "create-window",
 			  G_CALLBACK (notebook_tab_detached),
 			  window);
 	g_signal_connect (window->priv->notebook,
