diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-05-13 16:29:38 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-05-13 16:45:09 +0200 |
commit | 2527a4d5a7cb1a7086129019a29dc063a3a28f63 (patch) | |
tree | c1203a84aecb59467b71c68eb659f0fef34159ae /shell | |
parent | ccfab82ebd35771163d782da6b3737127a8ad589 (diff) |
Implement some more XModify methods
Change-Id: I1345d6a3d62f1e5c3353c5412024f6b47f824f7a
Diffstat (limited to 'shell')
-rw-r--r-- | shell/source/sessioninstall/SyncDbusSessionHelper.cxx | 121 | ||||
-rw-r--r-- | shell/source/sessioninstall/SyncDbusSessionHelper.hxx | 36 |
2 files changed, 116 insertions, 41 deletions
diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx index ae4235842da1..a45c343a248f 100644 --- a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx +++ b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx @@ -53,6 +53,32 @@ namespace throw RuntimeException("couldnt get a proxy!"); return proxy; } + +void request( + char const * method, sal_uInt32 xid, + css::uno::Sequence<OUString> const & resources, + OUString const & interaction) +{ + std::vector<OString> resUtf8; + std::shared_ptr<GVariantBuilder> builder( + g_variant_builder_new(G_VARIANT_TYPE ("as")), GVariantBuilderDeleter()); + for (auto & i: resources) { + auto s(OUStringToOString(i, RTL_TEXTENCODING_UTF8)); + resUtf8.push_back(s); + g_variant_builder_add(builder.get(), "s", s.getStr()); + } + auto iactUtf8(OUStringToOString(interaction, RTL_TEXTENCODING_UTF8)); + std::shared_ptr<GDBusProxy> proxy( + lcl_GetPackageKitProxy("Modify"), GObjectDeleter<GDBusProxy>()); + GErrorWrapper error(nullptr); + g_dbus_proxy_call_sync( + proxy.get(), method, + g_variant_new( + "(uass)", static_cast<guint32>(xid), builder.get(), + iactUtf8.getStr()), + G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &error.getRef()); +} + } namespace shell { namespace sessioninstall @@ -63,31 +89,78 @@ namespace shell { namespace sessioninstall g_type_init (); #endif } - void SAL_CALL SyncDbusSessionHelper::InstallPackageNames( const ::sal_uInt32 nXid, const Sequence< OUString >& vPackages, const OUString& sInteraction ) throw (RuntimeException, std::exception) - { - vector< OString > vPackagesOString; - vPackagesOString.reserve(vPackages.getLength()); - boost::shared_ptr<GVariantBuilder> pBuilder(g_variant_builder_new(G_VARIANT_TYPE ("as")), GVariantBuilderDeleter()); - for( const OUString* pPackage = vPackages.begin(); pPackage != vPackages.end(); ++pPackage) - { - vPackagesOString.push_back(OUStringToOString(*pPackage, RTL_TEXTENCODING_ASCII_US)); - g_variant_builder_add(pBuilder.get(), "s", vPackagesOString.back().getStr()); - } - const OString sInteractionAscii = OUStringToOString(sInteraction, RTL_TEXTENCODING_ASCII_US); - boost::shared_ptr<GDBusProxy> proxy(lcl_GetPackageKitProxy("Modify"), GObjectDeleter<GDBusProxy>()); - GErrorWrapper error(NULL); - g_dbus_proxy_call_sync (proxy.get(), - "InstallPackageNames", - g_variant_new ("(uass)", - sal::static_int_cast<guint32>(nXid), - pBuilder.get(), - sInteractionAscii.getStr()), - G_DBUS_CALL_FLAGS_NONE, - -1, /* timeout */ - NULL, /* cancellable */ - &error.getRef()); - } +void SyncDbusSessionHelper::InstallPackageFiles( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallPackageFiles", xid, files, interaction); +} + +void SyncDbusSessionHelper::InstallProvideFiles( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallProvideFiles", xid, files, interaction); +} + +void SyncDbusSessionHelper::InstallCatalogs( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallCatalogs", xid, files, interaction); +} + +void SyncDbusSessionHelper::InstallPackageNames( + sal_uInt32 xid, css::uno::Sequence<OUString> const & packages, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallPackageNames", xid, packages, interaction); +} + +void SyncDbusSessionHelper::InstallMimeTypes( + sal_uInt32 xid, css::uno::Sequence<OUString> const & mimeTypes, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallMimeTypes", xid, mimeTypes, interaction); +} + +void SyncDbusSessionHelper::InstallFontconfigResources( + sal_uInt32 xid, css::uno::Sequence<OUString> const & resources, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallFontconfigResources", xid, resources, interaction); +} + +void SyncDbusSessionHelper::InstallGStreamerResources( + sal_uInt32 xid, css::uno::Sequence<OUString> const & resources, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallGStreamerResources", xid, resources, interaction); +} + +void SyncDbusSessionHelper::RemovePackageByFiles( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("RemovePackageByFiles", xid, files, interaction); +} + +void SyncDbusSessionHelper::InstallPrinterDrivers( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallPrinteDrivers", xid, files, interaction); +} void SAL_CALL SyncDbusSessionHelper::IsInstalled( const OUString& sPackagename, const OUString& sInteraction, sal_Bool& o_isInstalled ) throw (RuntimeException, std::exception) { diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx index 20116522a056..47c72a8585b2 100644 --- a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx +++ b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx @@ -22,27 +22,29 @@ namespace shell { namespace sessioninstall public: SyncDbusSessionHelper(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); virtual ~SyncDbusSessionHelper() {} + // XModify Methods - virtual void SAL_CALL InstallPackageNames( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* packages */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL InstallPackageFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallProvideFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallCatalogs( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallPackageNames( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& packages, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallMimeTypes( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& mimeTypes, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallFontconfigResources( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& resources, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallGStreamerResources( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& resources, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void SAL_CALL InstallPackageFiles( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallProvideFiles( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallCatalogs( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallMimeTypes( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* mime_types */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallFontconfigResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallGStreamerResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented virtual void SAL_CALL InstallResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* types */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL RemovePackageByFiles( SAL_UNUSED_PARAMETER ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallPrinterDrivers( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented + + virtual void SAL_CALL RemovePackageByFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallPrinterDrivers( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // XQuery Methods virtual void SAL_CALL IsInstalled( const OUString& /* package_name */, const OUString& /* interaction */, sal_Bool& /* installed */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; |