summaryrefslogtreecommitdiff
path: root/libreofficekit/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-04-19 09:09:19 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-04-19 08:10:35 +0000
commitdf784ec1bf3d1745a291056df28bec799d4fdee3 (patch)
treeb6cdb85786db0798da23e1970bb0866b2c98092b /libreofficekit/source
parenta7e23e7f7b5489da2441adf5b8afbee507709821 (diff)
tdf#99314 lokdocview: add new userprofileurl property
So that users of the widget can use a custom user profile, allowing running widgets users and LibreOffice in parallel. Change-Id: I1bd0a8e53aa3216adc721052cf30f0dd174327bd Reviewed-on: https://gerrit.libreoffice.org/24237 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'libreofficekit/source')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx37
1 files changed, 36 insertions, 1 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 81ccb378cb4a..fdb07fe861f8 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -48,6 +48,7 @@
struct LOKDocViewPrivateImpl
{
const gchar* m_aLOPath;
+ const gchar* m_pUserProfileURL;
const gchar* m_aDocPath;
std::string m_aRenderingArguments;
gdouble m_nLoadProgress;
@@ -139,6 +140,7 @@ struct LOKDocViewPrivateImpl
LOKDocViewPrivateImpl()
: m_aLOPath(nullptr),
+ m_pUserProfileURL(nullptr),
m_aDocPath(nullptr),
m_nLoadProgress(0),
m_bIsLoading(false),
@@ -221,6 +223,7 @@ enum
PROP_LO_PATH,
PROP_LO_POINTER,
+ PROP_USER_PROFILE_URL,
PROP_DOC_PATH,
PROP_DOC_POINTER,
PROP_EDITABLE,
@@ -2013,6 +2016,9 @@ static void lok_doc_view_set_property (GObject* object, guint propId, const GVal
case PROP_LO_POINTER:
priv->m_pOffice = static_cast<LibreOfficeKit*>(g_value_get_pointer(value));
break;
+ case PROP_USER_PROFILE_URL:
+ priv->m_pUserProfileURL = g_value_dup_string(value);
+ break;
case PROP_DOC_PATH:
priv->m_aDocPath = g_value_dup_string (value);
break;
@@ -2063,6 +2069,9 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
case PROP_LO_POINTER:
g_value_set_pointer(value, priv->m_pOffice);
break;
+ case PROP_USER_PROFILE_URL:
+ g_value_set_string(value, priv->m_pUserProfileURL);
+ break;
case PROP_DOC_PATH:
g_value_set_string (value, priv->m_aDocPath);
break;
@@ -2137,7 +2146,7 @@ static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* /
if (priv->m_pOffice != nullptr)
return TRUE;
- priv->m_pOffice = lok_init (priv->m_aLOPath);
+ priv->m_pOffice = lok_init_2(priv->m_aLOPath, priv->m_pUserProfileURL);
if (priv->m_pOffice == nullptr)
{
@@ -2201,6 +2210,20 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
G_PARAM_STATIC_STRINGS));
/**
+ * LOKDocView:userprofileurl:
+ *
+ * The absolute path of the LibreOffice user profile.
+ */
+ properties[PROP_USER_PROFILE_URL] =
+ g_param_spec_string("userprofileurl",
+ "User profile path",
+ "LibreOffice user profile path",
+ nullptr,
+ static_cast<GParamFlags>(G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
* LOKDocView:docpath:
*
* The path of the document that is currently being viewed.
@@ -2591,11 +2614,23 @@ lok_doc_view_new (const gchar* pPath, GCancellable *cancellable, GError **error)
nullptr));
}
+SAL_DLLPUBLIC_EXPORT GtkWidget*
+lok_doc_view_new_from_user_profile (const gchar* pPath, const gchar* pUserProfile, GCancellable *cancellable, GError **error)
+{
+ return GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, cancellable, error,
+ "lopath", pPath == nullptr ? LOK_PATH : pPath,
+ "userprofileurl", pUserProfile,
+ "halign", GTK_ALIGN_CENTER,
+ "valign", GTK_ALIGN_CENTER,
+ nullptr));
+}
+
SAL_DLLPUBLIC_EXPORT GtkWidget* lok_doc_view_new_from_widget(LOKDocView* pOldLOKDocView)
{
LOKDocViewPrivate& pOldPriv = getPrivate(pOldLOKDocView);
GtkWidget* pNewDocView = GTK_WIDGET(g_initable_new(LOK_TYPE_DOC_VIEW, /*cancellable=*/nullptr, /*error=*/nullptr,
"lopath", pOldPriv->m_aLOPath,
+ "userprofileurl", pOldPriv->m_pUserProfileURL,
"lopointer", pOldPriv->m_pOffice,
"docpointer", pOldPriv->m_pDocument,
"halign", GTK_ALIGN_CENTER,