Blob Blame History Raw
From d439c2271500a145d4c6e37e3a8d504cc2027b5f Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 15 Sep 2015 15:41:46 +0200
Subject: [PATCH 137/398] lokdocview: set up the widget in all windows

With this finally the number of GTK+ windows always match the number
returned by SfxLokHelper::getViews().

Change-Id: Ia45bef7dea86b80cfac00e2ad7c1a16d7f5b507b
(cherry picked from commit b3498e9fcdc895853564d13173075bebc7407ef2)
---
 libreofficekit/source/gtk/lokdocview.cxx | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 0b0b5e9d9659..92095f2d9707 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1850,8 +1850,15 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error)
 SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pLOKDocView)
 {
     LOKDocViewPrivate* priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private(pLOKDocView));
-    return GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0,
-                                     "lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL));
+    GtkWidget* pDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/0, /*error=*/0,
+                                                    "lopath", priv->m_aLOPath, "lopointer", priv->m_pOffice, "docpointer", priv->m_pDocument, NULL));
+
+    // No documentLoad(), just a createView().
+    LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(pDocView));
+    pDocument->pClass->createView(pDocument);
+
+    postDocumentLoad(pDocView);
+    return pDocView;
 }
 
 /**
-- 
2.12.0