[Libreoffice-commits] core.git: include/vcl offapi/org sfx2/source shell/source svtools/source sw/source vcl/unx

Caolán McNamara caolanm at redhat.com
Thu Jan 11 13:30:00 UTC 2018


 include/vcl/sysdata.hxx                               |   13 ----
 offapi/org/freedesktop/PackageKit/XModify.idl         |   22 +++----
 sfx2/source/appl/appserv.cxx                          |   10 +--
 shell/source/sessioninstall/SyncDbusSessionHelper.cxx |   51 ++++++++++--------
 shell/source/sessioninstall/SyncDbusSessionHelper.hxx |   20 +++----
 svtools/source/misc/langhelp.cxx                      |    4 -
 sw/source/uibase/app/apphdl.cxx                       |    9 ---
 vcl/unx/generic/fontmanager/fontconfig.cxx            |   11 ---
 8 files changed, 56 insertions(+), 84 deletions(-)

New commits:
commit b71660540e326db3b15899a9db0aa3bf4aed2cee
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 9 12:07:50 2018 +0000

    [API CHANGE] migrate PackageKit usage to Modify2
    
    xid dropped in favour of application_id
    
    Change-Id: Id1eb43aa9c8dfb4eac82f99eff0f84c5320e0da0
    Reviewed-on: https://gerrit.libreoffice.org/47661
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index d05ceb44438a..794f424b4448 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -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
diff --git a/offapi/org/freedesktop/PackageKit/XModify.idl b/offapi/org/freedesktop/PackageKit/XModify.idl
index a712bb527f19..69544e94c7b3 100644
--- a/offapi/org/freedesktop/PackageKit/XModify.idl
+++ b/offapi/org/freedesktop/PackageKit/XModify.idl
@@ -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
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 31de5352644b..2b902d2ad529 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -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;
     }
 }
diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
index 4092d146f7c2..9fd928f7e982 100644
--- a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
+++ b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx
@@ -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 at 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 )
diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
index 731b649d723a..72b17ba468cc 100644
--- a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
+++ b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx
@@ -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;
diff --git a/svtools/source/misc/langhelp.cxx b/svtools/source/misc/langhelp.cxx
index 5bbc01172964..55643af50621 100644
--- a/svtools/source/misc/langhelp.cxx
+++ b/svtools/source/misc/langhelp.cxx
@@ -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)
         {
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index aafd754ca14a..d7d005c92778 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -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);
         }
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 94c80cc6cf8f..59acfa5841b0 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -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)
     {


More information about the Libreoffice-commits mailing list