kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0369-lokdocview-Set-a-default-path-for-LOK-init.patch

135360
From 3943bc9014e426740ca5f756eae4cf4dd124bc23 Mon Sep 17 00:00:00 2001
135360
From: Pranav Kant <pranavk@libreoffice.org>
135360
Date: Tue, 8 Dec 2015 23:14:25 +0530
135360
Subject: [PATCH 369/398] lokdocview: Set a 'default' path for LOK init
135360
135360
When passed NULL to lok_doc_view_new, use the default path :
135360
$libdir/libreoffice/program as LOK install path
135360
135360
Change-Id: I1e033c407184b29b1509cfb8c416b514591d67ce
135360
Reviewed-on: https://gerrit.libreoffice.org/20476
135360
Tested-by: Jenkins <ci@libreoffice.org>
135360
Reviewed-by: David Tardon <dtardon@redhat.com>
135360
(cherry picked from commit 424c09b10d3d6ba6edfed2dcf560d5ce2c950b9d)
135360
(cherry picked from commit dabfa0ce06f605fd0e8de32774b6385fd6ffbd56)
135360
---
135360
 include/LibreOfficeKit/LibreOfficeKitGtk.h  | 3 ++-
135360
 libreofficekit/Library_libreofficekitgtk.mk | 4 ++++
135360
 libreofficekit/source/gtk/lokdocview.cxx    | 2 +-
135360
 3 files changed, 7 insertions(+), 2 deletions(-)
135360
135360
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
index b2f17f14b6cb..1b03e4633547 100644
135360
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
@@ -42,7 +42,8 @@ GType                          lok_doc_view_get_type               (void) G_GNUC
135360
 
135360
 /**
135360
  * lok_doc_view_new:
135360
- * @pPath: LibreOffice install path.
135360
+ * @pPath: (nullable): LibreOffice install path. Pass null to set it to default
135360
+ * path which in most cases would be $libdir/libreoffice/program
135360
  * @cancellable: The cancellable object that you can use to cancel this
135360
  * operation.
135360
  * @error: The error that will be set if the object fails to initialize.
135360
diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk
135360
index 3eba939ad56c..fc62e72ca723 100644
135360
--- a/libreofficekit/Library_libreofficekitgtk.mk
135360
+++ b/libreofficekit/Library_libreofficekitgtk.mk
135360
@@ -28,6 +28,10 @@ $(eval $(call gb_Library_add_libs,libreofficekitgtk,\
135360
     $(GTK3_LIBS) \
135360
 ))
135360
 
135360
+$(eval $(call gb_Library_add_defs,libreofficekitgtk,\
135360
+	-DLOK_PATH="\"$(LIBDIR)/libreoffice/$(LIBO_LIB_FOLDER)\"" \
135360
+))
135360
+
135360
 ifeq ($(OS),$(filter LINUX %BSD SOLARIS, $(OS)))
135360
 $(eval $(call gb_Library_add_libs,libreofficekitgtk,\
135360
     $(DLOPEN_LIBS) -lm \
135360
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
135360
index 424d80eabcf9..34823437e6ad 100644
135360
--- a/libreofficekit/source/gtk/lokdocview.cxx
135360
+++ b/libreofficekit/source/gtk/lokdocview.cxx
135360
@@ -2385,7 +2385,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
135360
 SAL_DLLPUBLIC_EXPORT GtkWidget*
135360
 lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error)
135360
 {
135360
-    return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath, NULL));
135360
+    return GTK_WIDGET (g_initable_new (LOK_TYPE_DOC_VIEW, cancellable, error, "lopath", pPath == NULL ? LOK_PATH : pPath, NULL));
135360
 }
135360
 
135360
 SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView)
135360
-- 
135360
2.12.0
135360