summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-16 11:18:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-17 08:48:02 +0200
commitae777762c15258be6598f8b8a056b2924e1fe756 (patch)
tree2fa3e7899b256b0f98360955ca1997f589a2d072 /shell
parent2fc112e98ddcb46038eaff341734331a8558934f (diff)
shell/sessioninstall: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I1878cf052b3f250927d5bb72ddd523af28cf9337 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98917 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'shell')
-rw-r--r--shell/Library_losessioninstall.mk1
-rw-r--r--shell/source/sessioninstall/SyncDbusSessionHelper.cxx23
-rw-r--r--shell/source/sessioninstall/SyncDbusSessionHelper.hxx8
-rw-r--r--shell/source/sessioninstall/losessioninstall.component5
-rw-r--r--shell/source/sessioninstall/services.cxx36
5 files changed, 33 insertions, 40 deletions
diff --git a/shell/Library_losessioninstall.mk b/shell/Library_losessioninstall.mk
index b3334092cdb2..c83b8fa9c358 100644
--- a/shell/Library_losessioninstall.mk
+++ b/shell/Library_losessioninstall.mk
@@ -31,7 +31,6 @@ $(eval $(call gb_Library_use_externals,losessioninstall,\
$(eval $(call gb_Library_add_exception_objects,losessioninstall,\
shell/source/sessioninstall/SyncDbusSessionHelper \
- shell/source/sessioninstall/services \
))
# vim:set noet sw=4 ts=4:
diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
index 6e35a069f588..fc90c19a8fca 100644
--- a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
+++ b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
@@ -9,6 +9,7 @@
#include "SyncDbusSessionHelper.hxx"
+#include <cppuhelper/supportsservice.hxx>
#include <gio/gio.h>
#include <memory>
#include <vector>
@@ -99,6 +100,21 @@ namespace shell::sessioninstall
#endif
}
+Sequence< OUString > SAL_CALL SyncDbusSessionHelper::getSupportedServiceNames()
+{
+ return { "org.freedesktop.PackageKit.SyncDbusSessionHelper" };
+}
+
+OUString SAL_CALL SyncDbusSessionHelper::getImplementationName()
+{
+ return "org.libreoffice.comp.shell.sessioninstall.SyncDbusSessionHelper";
+}
+
+sal_Bool SAL_CALL SyncDbusSessionHelper::supportsService(const OUString& aServiceName)
+{
+ return cppu::supportsService(this, aServiceName);
+}
+
void SyncDbusSessionHelper::InstallPackageFiles(
css::uno::Sequence<OUString> const & files,
OUString const & interaction)
@@ -181,6 +197,13 @@ void SAL_CALL SyncDbusSessionHelper::IsInstalled( const OUString& sPackagename,
o_isInstalled = bool(g_variant_get_boolean(g_variant_get_child_value(result.get(),0)));
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+shell_sessioninstall_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new SyncDbusSessionHelper(context));
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
index 8a8dd3bf235f..7812604c9e01 100644
--- a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
+++ b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
@@ -11,16 +11,22 @@
#define INCLUDED_SHELL_SOURCE_SESSIONINSTALL_SYNCDBUSSESSIONHELPER_HXX
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
#include <cppuhelper/implbase.hxx>
namespace shell::sessioninstall
{
- class SyncDbusSessionHelper : public ::cppu::WeakImplHelper< ::org::freedesktop::PackageKit::XSyncDbusSessionHelper >
+ class SyncDbusSessionHelper : public ::cppu::WeakImplHelper< ::org::freedesktop::PackageKit::XSyncDbusSessionHelper, css::lang::XServiceInfo >
{
public:
SyncDbusSessionHelper(css::uno::Reference< css::uno::XComponentContext> const&);
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override;
+
// XModify Methods
virtual void SAL_CALL InstallPackageFiles( const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
diff --git a/shell/source/sessioninstall/losessioninstall.component b/shell/source/sessioninstall/losessioninstall.component
index 9d63cd5ecca7..4dbc3bf0f2a3 100644
--- a/shell/source/sessioninstall/losessioninstall.component
+++ b/shell/source/sessioninstall/losessioninstall.component
@@ -8,8 +8,9 @@
*
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="sessioninstall" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="org.libreoffice.comp.shell.sessioninstall.SyncDbusSessionHelper">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.libreoffice.comp.shell.sessioninstall.SyncDbusSessionHelper"
+ constructor="shell_sessioninstall_get_implementation">
<service name="org.freedesktop.PackageKit.SyncDbusSessionHelper"/>
</implementation>
</component>
diff --git a/shell/source/sessioninstall/services.cxx b/shell/source/sessioninstall/services.cxx
deleted file mode 100644
index 69a7b2e4924e..000000000000
--- a/shell/source/sessioninstall/services.cxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "SyncDbusSessionHelper.hxx"
-#include <comphelper/servicedecl.hxx>
-
-namespace sdecl = ::comphelper::service_decl;
-
-sdecl::class_< ::shell::sessioninstall::SyncDbusSessionHelper> const SyncDbusSessionHelperServiceImpl;
-
-const sdecl::ServiceDecl SyncDbusSessionHelperServiceDecl(
- SyncDbusSessionHelperServiceImpl,
- "org.libreoffice.comp.shell.sessioninstall.SyncDbusSessionHelper",
- "org.freedesktop.PackageKit.SyncDbusSessionHelper");
-
-extern "C"
-SAL_DLLPUBLIC_EXPORT void* losessioninstall_component_getFactory( char const* pImplName,
- void*, void* )
-{
- return sdecl::component_getFactoryHelper( pImplName, {&SyncDbusSessionHelperServiceDecl} );
-}
-
-extern "C"
-SAL_DLLPUBLIC_EXPORT void* sessioninstall_component_getFactory( char const* pImplName, void* pServiceManager, void* pRegistryKey )
-{
- return losessioninstall_component_getFactory(pImplName, pServiceManager, pRegistryKey);
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */