Kaydet (Commit) b7166054 authored tarafından Caolán McNamara's avatar Caolán McNamara

[API CHANGE] migrate PackageKit usage to Modify2

xid dropped in favour of application_id

Change-Id: Id1eb43aa9c8dfb4eac82f99eff0f84c5320e0da0
Reviewed-on: https://gerrit.libreoffice.org/47661Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 74b3924a
......@@ -98,19 +98,6 @@ struct SystemEnvData
}
};
inline sal_uInt32 GetDbusId(const SystemEnvData& rData)
{
#if defined(_WIN32) || defined( MACOSX ) || defined( ANDROID ) || defined( IOS )
(void)rData;
return 0;
#elif defined( UNX )
return rData.aWindow;
#else
(void)rData;
return 0;
#endif
}
struct SystemParentData
{
sal_uInt32 nSize; // size in bytes of this structure
......
......@@ -22,7 +22,7 @@ module PackageKit
* The interface used for modifying the package database.
*
* @sa
* https://git.gnome.org/browse/gnome-software/tree/src/org.freedesktop.PackageKit.xml
* https://git.gnome.org/browse/gnome-software/tree/src/org.freedesktop.PackageKit.Modify2.xml
* for documentation of the corresponding D-Bus interface
*/
interface XModify : com::sun::star::uno::XInterface
......@@ -32,70 +32,70 @@ interface XModify : com::sun::star::uno::XInterface
* @since LibreOffice 4.0
*/
void InstallPackageFiles( [in] unsigned long xid, [in] sequence< string > files, [in] string interaction);
void InstallPackageFiles([in] sequence< string > files, [in] string interaction);
/**
* Installs sequence< string > packages to provide sequence< string > files.
* @since LibreOffice 4.0
*/
void InstallProvideFiles( [in] unsigned long xid, [in] sequence< string > files, [in] string interaction);
void InstallProvideFiles([in] sequence< string > files, [in] string interaction);
/**
* Installs sequence< string > packages to provide sequence< string > files.
* @since LibreOffice 4.0
*/
void InstallCatalogs( [in] unsigned long xid, [in] sequence< string > files, [in] string interaction);
void InstallCatalogs([in] sequence< string > files, [in] string interaction);
/**
* Installs sequence< string > packages from a configured software source.
* @since LibreOffice 4.0
*/
void InstallPackageNames( [in] unsigned long xid, [in] sequence< string > packages, [in] string interaction);
void InstallPackageNames([in] sequence< string > packages, [in] string interaction);
/**
* Installs mimetype handlers from a configured software source.
* @since LibreOffice 4.0
*/
void InstallMimeTypes( [in] unsigned long xid, [in] sequence< string > mimeTypes, [in] string interaction);
void InstallMimeTypes([in] sequence< string > mimeTypes, [in] string interaction);
/**
* Installs fontconfig resources ( [in] usually fonts) from a configured software source.
* @since LibreOffice 4.0
*/
void InstallFontconfigResources( [in] unsigned long xid, [in] sequence< string > resources, [in] string interaction);
void InstallFontconfigResources([in] sequence< string > resources, [in] string interaction);
/**
* Installs GStreamer resources ( [in] usually codecs) from a configured software source.
* @since LibreOffice 4.0
*/
void InstallGStreamerResources( [in] unsigned long xid, [in] sequence< string > resources, [in] string interaction);
void InstallGStreamerResources([in] sequence< string > resources, [in] string interaction);
/**
* Installs resources of a given type from a configured software source.
* @since LibreOffice 4.0
*/
void InstallResources( [in] unsigned long xid, [in] sequence< string > types, [in] sequence< string > resources, [in] string interaction);
void InstallResources([in] sequence< string > types, [in] sequence< string > resources, [in] string interaction);
/**
* Removes sequence< string > packages that provide the given local sequence< string > files.
* @since LibreOffice 4.0
*/
void RemovePackageByFiles( [in] unsigned long xid, [in] sequence< string > files, [in] string interaction);
void RemovePackageByFiles([in] sequence< string > files, [in] string interaction);
/**
* Installs printer drivers from a configured software source.
* @since LibreOffice 4.0
*/
void InstallPrinterDrivers( [in] unsigned long xid, [in] sequence< string > files, [in] string interaction);
void InstallPrinterDrivers([in] sequence< string > files, [in] string interaction);
};
} ; // PackageKit
......
......@@ -186,7 +186,7 @@ namespace
return false;
}
}
void lcl_tryLoadBibliography(const vcl::Window* pTopWindow)
void lcl_tryLoadBibliography()
{
// lp#527938, debian#602953, fdo#33266, i#105408
// make sure we actually can instantiate services from base first
......@@ -198,11 +198,7 @@ namespace
using namespace svtools;
Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
Sequence< OUString > vPackages { "libreoffice-base" };
const SystemEnvData* pEnvData = pTopWindow ? pTopWindow->GetSystemData() : nullptr;
sal_uInt32 nDbusId = pEnvData ? GetDbusId(*pEnvData) : 0;
xSyncDbusSessionHelper->InstallPackageNames(nDbusId, vPackages, OUString());
xSyncDbusSessionHelper->InstallPackageNames(vPackages, OUString());
// Ill be back (hopefully)!
SolarMutexGuard aGuard;
executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, RESTART_REASON_BIBLIOGRAPHY_INSTALL);
......@@ -1667,7 +1663,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
break;
case SID_COMP_BIBLIOGRAPHY:
lcl_tryLoadBibliography(GetTopWindow());
lcl_tryLoadBibliography();
break;
}
}
......
......@@ -55,8 +55,15 @@ namespace
return proxy;
}
GVariant* pk_make_platform_data()
{
GVariantBuilder builder;
g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}"));
return g_variant_builder_end(&builder);
}
void request(
char const * method, sal_uInt32 xid,
char const * method,
css::uno::Sequence<OUString> const & resources,
OUString const & interaction)
{
......@@ -70,13 +77,13 @@ void request(
}
auto iactUtf8(OUStringToOString(interaction, RTL_TEXTENCODING_UTF8));
std::shared_ptr<GDBusProxy> proxy(
lcl_GetPackageKitProxy("Modify"), GObjectDeleter<GDBusProxy>());
lcl_GetPackageKitProxy("Modify2"), GObjectDeleter<GDBusProxy>());
GErrorWrapper error;
std::shared_ptr<GVariant> result(g_dbus_proxy_call_sync(
proxy.get(), method,
g_variant_new(
"(uass)", static_cast<guint32>(xid), builder.get(),
iactUtf8.getStr()),
"(asss@a{sv})", builder.get(), iactUtf8.getStr(),
"libreoffice-startcenter.desktop", pk_make_platform_data()),
G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &error.getRef()), GVariantDeleter());
}
......@@ -92,66 +99,66 @@ namespace shell { namespace sessioninstall
}
void SyncDbusSessionHelper::InstallPackageFiles(
sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
css::uno::Sequence<OUString> const & files,
OUString const & interaction)
{
request("InstallPackageFiles", xid, files, interaction);
request("InstallPackageFiles", files, interaction);
}
void SyncDbusSessionHelper::InstallProvideFiles(
sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
css::uno::Sequence<OUString> const & files,
OUString const & interaction)
{
request("InstallProvideFiles", xid, files, interaction);
request("InstallProvideFiles", files, interaction);
}
void SyncDbusSessionHelper::InstallCatalogs(
sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
css::uno::Sequence<OUString> const & files,
OUString const & interaction)
{
request("InstallCatalogs", xid, files, interaction);
request("InstallCatalogs", files, interaction);
}
void SyncDbusSessionHelper::InstallPackageNames(
sal_uInt32 xid, css::uno::Sequence<OUString> const & packages,
css::uno::Sequence<OUString> const & packages,
OUString const & interaction)
{
request("InstallPackageNames", xid, packages, interaction);
request("InstallPackageNames", packages, interaction);
}
void SyncDbusSessionHelper::InstallMimeTypes(
sal_uInt32 xid, css::uno::Sequence<OUString> const & mimeTypes,
css::uno::Sequence<OUString> const & mimeTypes,
OUString const & interaction)
{
request("InstallMimeTypes", xid, mimeTypes, interaction);
request("InstallMimeTypes", mimeTypes, interaction);
}
void SyncDbusSessionHelper::InstallFontconfigResources(
sal_uInt32 xid, css::uno::Sequence<OUString> const & resources,
css::uno::Sequence<OUString> const & resources,
OUString const & interaction)
{
request("InstallFontconfigResources", xid, resources, interaction);
request("InstallFontconfigResources", resources, interaction);
}
void SyncDbusSessionHelper::InstallGStreamerResources(
sal_uInt32 xid, css::uno::Sequence<OUString> const & resources,
css::uno::Sequence<OUString> const & resources,
OUString const & interaction)
{
request("InstallGStreamerResources", xid, resources, interaction);
request("InstallGStreamerResources", resources, interaction);
}
void SyncDbusSessionHelper::RemovePackageByFiles(
sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
css::uno::Sequence<OUString> const & files,
OUString const & interaction)
{
request("RemovePackageByFiles", xid, files, interaction);
request("RemovePackageByFiles", files, interaction);
}
void SyncDbusSessionHelper::InstallPrinterDrivers(
sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
css::uno::Sequence<OUString> const & files,
OUString const & interaction)
{
request("InstallPrinteDrivers", xid, files, interaction);
request("InstallPrinteDrivers", files, interaction);
}
void SAL_CALL SyncDbusSessionHelper::IsInstalled( const OUString& sPackagename, const OUString& sInteraction, sal_Bool& o_isInstalled )
......
......@@ -23,26 +23,26 @@ namespace shell { namespace sessioninstall
SyncDbusSessionHelper(css::uno::Reference< css::uno::XComponentContext> const&);
// XModify Methods
virtual void SAL_CALL InstallPackageFiles( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL InstallPackageFiles( const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL InstallProvideFiles( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL InstallProvideFiles( const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL InstallCatalogs( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL InstallCatalogs( const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL InstallPackageNames( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& packages, const OUString& interaction ) override;
virtual void SAL_CALL InstallPackageNames( const css::uno::Sequence< OUString >& packages, const OUString& interaction ) override;
virtual void SAL_CALL InstallMimeTypes( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& mimeTypes, const OUString& interaction ) override;
virtual void SAL_CALL InstallMimeTypes( const css::uno::Sequence< OUString >& mimeTypes, const OUString& interaction ) override;
virtual void SAL_CALL InstallFontconfigResources( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& resources, const OUString& interaction ) override;
virtual void SAL_CALL InstallFontconfigResources( const css::uno::Sequence< OUString >& resources, const OUString& interaction ) override;
virtual void SAL_CALL InstallGStreamerResources( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& resources, const OUString& interaction ) override;
virtual void SAL_CALL InstallGStreamerResources( const css::uno::Sequence< OUString >& resources, const OUString& interaction ) override;
virtual void SAL_CALL InstallResources( ::sal_uInt32 /* xid */, const css::uno::Sequence< OUString >& /* types */, const css::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) override
virtual void SAL_CALL InstallResources( const css::uno::Sequence< OUString >& /* types */, const css::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) override
{ throw css::uno::RuntimeException(); } // not implemented
virtual void SAL_CALL RemovePackageByFiles( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL RemovePackageByFiles( const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL InstallPrinterDrivers( ::sal_uInt32 xid, const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
virtual void SAL_CALL InstallPrinterDrivers( const css::uno::Sequence< OUString >& files, const OUString& interaction ) override;
// XQuery Methods
virtual void SAL_CALL IsInstalled( const OUString& /* package_name */, const OUString& /* interaction */, sal_Bool& /* installed */ ) override;
......
......@@ -90,9 +90,7 @@ public:
{
using namespace org::freedesktop::PackageKit;
css::uno::Reference<XSyncDbusSessionHelper> xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
const SystemEnvData* pEnvData = pTopWindow->GetSystemData();
sal_uInt32 nDbusId = pEnvData ? GetDbusId(*pEnvData) : 0;
xSyncDbusSessionHelper->InstallPackageNames(nDbusId, comphelper::containerToSequence(m_aPackages), OUString());
xSyncDbusSessionHelper->InstallPackageNames(comphelper::containerToSequence(m_aPackages), OUString());
}
catch (const css::uno::Exception& e)
{
......
......@@ -421,14 +421,7 @@ void SwMailMergeWizardExecutor::ExecuteMailMergeWizard( const SfxItemSet * pArgs
using namespace svtools;
css::uno::Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
const css::uno::Sequence< OUString > vPackages{ "libreoffice-base" };
vcl::Window* pTopWindow = Application::GetActiveTopWindow();
if (!pTopWindow)
pTopWindow = Application::GetFirstTopLevelWindow();
const SystemEnvData* pEnvData = pTopWindow ? pTopWindow->GetSystemData() : nullptr;
sal_uInt32 nDbusId = pEnvData ? GetDbusId(*pEnvData) : 0;
xSyncDbusSessionHelper->InstallPackageNames(nDbusId, vPackages, OUString());
xSyncDbusSessionHelper->InstallPackageNames(vPackages, OUString());
SolarMutexGuard aGuard;
executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, RESTART_REASON_MAILMERGE_INSTALL);
}
......
......@@ -859,15 +859,6 @@ namespace
aBuf.append('-').append(pScriptCode);
return OStringToOUString(aBuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
}
sal_uInt32 get_xid_for_dbus()
{
const vcl::Window *pTopWindow = Application::GetActiveTopWindow();
if (!pTopWindow)
pTopWindow = Application::GetFirstTopLevelWindow();
const SystemEnvData* pEnvData = pTopWindow ? pTopWindow->GetSystemData() : nullptr;
return pEnvData ? GetDbusId(*pEnvData) : 0;
}
}
IMPL_LINK_NOARG(PrintFontManager, autoInstallFontLangSupport, Timer *, void)
......@@ -876,7 +867,7 @@ IMPL_LINK_NOARG(PrintFontManager, autoInstallFontLangSupport, Timer *, void)
{
using namespace org::freedesktop::PackageKit;
css::uno::Reference<XSyncDbusSessionHelper> xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
xSyncDbusSessionHelper->InstallFontconfigResources(get_xid_for_dbus(), comphelper::containerToSequence(m_aCurrentRequests), "hide-finished");
xSyncDbusSessionHelper->InstallFontconfigResources(comphelper::containerToSequence(m_aCurrentRequests), "hide-finished");
}
catch (const css::uno::Exception& e)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment