summaryrefslogtreecommitdiff
path: root/libreofficekit/source/gtk/lokdocview.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libreofficekit/source/gtk/lokdocview.cxx')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index b2708a3ad5bd..dc16af5b87d9 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -18,6 +18,7 @@
#include <com/sun/star/awt/Key.hpp>
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKit.h>
+#include <LibreOfficeKit/LibreOfficeKitInit.h>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <LibreOfficeKit/LibreOfficeKitGtk.h>
#include <rsc/rsc-vcl-shared-types.hxx>
@@ -297,7 +298,10 @@ LOKDocView_Impl::~LOKDocView_Impl()
{
if (m_pDocument)
m_pDocument->pClass->destroy(m_pDocument);
+ if (m_pOffice)
+ m_pOffice->pClass->destroy(m_pOffice);
m_pDocument = 0;
+ m_pOffice = 0;
}
void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/)
@@ -1210,14 +1214,16 @@ static void lok_doc_view_init (LOKDocView* pDocView)
/**
* lok_doc_view_new:
- * @pOffice: The LibreOfficeKit context.
+ * @pPath: LibreOffice install path.
*
* Returns: The #LOKDocView widget instance.
*/
-SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new( LibreOfficeKit* pOffice )
+SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new(const char* pPath)
{
- LOKDocView* pDocView = LOK_DOC_VIEW(gtk_type_new(lok_doc_view_get_type()));
- pDocView->m_pImpl->m_pOffice = pOffice;
+ LOKDocView* pDocView = LOK_DOC_VIEW(g_object_new(LOK_TYPE_DOC_VIEW, NULL));
+ pDocView->m_pImpl->m_pOffice = lok_init (pPath);
+ if (pDocView->m_pImpl->m_pOffice == NULL)
+ return NULL;
return GTK_WIDGET( pDocView );
}