[latexila/wip/use-tepl-tab] DocumentTab: do not reparent document_view



commit 0de64bcc288137c33ae7a0d2a06cf502477febb7
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Jun 23 18:31:23 2017 +0200

    DocumentTab: do not reparent document_view
    
    TeplTab doesn't reparent the view, so don't do that in DocumentTab, to
    reduce the delta between DocumentTab and TeplTab.
    
    The only place where it was used was for the DocumentsMoveToNewWindow
    GtkAction.

 src/document_tab.vala          |   10 +---------
 src/main_window_documents.vala |    4 ++++
 2 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/src/document_tab.vala b/src/document_tab.vala
index c76fe16..440eb2f 100644
--- a/src/document_tab.vala
+++ b/src/document_tab.vala
@@ -133,9 +133,6 @@ public class DocumentTab : Grid
 
     private void initialize ()
     {
-        // usefull when moving a tab to a new window
-        bool reparent = document.tab != null;
-
         document.tab = this;
 
         document.notify["location"].connect (() =>
@@ -158,12 +155,7 @@ public class DocumentTab : Grid
         // with a scrollbar
         ScrolledWindow sw = new ScrolledWindow (null, null);
         sw.overlay_scrolling = false;
-
-        if (reparent)
-            document_view.reparent (sw);
-        else
-            sw.add (document_view);
-
+        sw.add (document_view);
         sw.show_all ();
 
         // pack at the end so we can display message above
diff --git a/src/main_window_documents.vala b/src/main_window_documents.vala
index bbedd5e..5decf0a 100644
--- a/src/main_window_documents.vala
+++ b/src/main_window_documents.vala
@@ -286,6 +286,10 @@ public class MainWindowDocuments
         DocumentView view = tab.document_view;
         _documents_panel.remove_tab (tab);
 
+        Container? parent = (Container) view.get_parent ();
+        if (parent != null)
+            parent.remove (view);
+
         new_window.create_tab_with_view (view);
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]