diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-09-12 11:53:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-09-12 11:53:56 +0100 |
commit | a1ece2d00d5c484a4aba6d7281895005e70126a9 (patch) | |
tree | aeb7e4f14551eeae38aaee23a1e9aeb8736add82 /vcl | |
parent | 8a70142223049f98a9c6f91130ecdc87a2a9becf (diff) |
stub things to build without dbus or gio
Change-Id: Ibdcf33a6f0a688b322aedd531e8dfbf107e9e755
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/cpdmgr.hxx | 12 | ||||
-rw-r--r-- | vcl/unx/generic/printer/cpdmgr.cxx | 52 |
2 files changed, 55 insertions, 9 deletions
diff --git a/vcl/inc/unx/cpdmgr.hxx b/vcl/inc/unx/cpdmgr.hxx index 48fb02ab3a2a..de8aab4547ce 100644 --- a/vcl/inc/unx/cpdmgr.hxx +++ b/vcl/inc/unx/cpdmgr.hxx @@ -34,6 +34,9 @@ #define FRONTEND_INTERFACE "/usr/share/dbus-1/interfaces/org.openprinting.Frontend.xml" #define BACKEND_INTERFACE "/usr/share/dbus-1/interfaces/org.openprinting.Backend.xml" +typedef struct _GDBusProxy GDBusProxy; +typedef struct _GDBusConnection GDBusConnection; + namespace psp { @@ -75,6 +78,9 @@ class CPDManager : public PrinterInfoManager // Function called when CPDManager is destroyed virtual ~CPDManager() override; + virtual void initialize() override; + +#if ENABLE_DBUS && ENABLE_GIO static void onNameAcquired(GDBusConnection *connection, const char* name, void* user_data); static void onNameLost (GDBusConnection *, const char *name, void*); static void printerAdded (GDBusConnection *connection, @@ -92,18 +98,18 @@ class CPDManager : public PrinterInfoManager GVariant *parameters, gpointer user_data); - virtual void initialize() override; - static void getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, const OString& rJobName, int& rNumOptions, GVariant **arr ); - +#endif public: +#if ENABLE_DBUS && ENABLE_GIO // Functions involved in initialization GDBusProxy * getProxy( std::string target ); void addBackend( std::pair< std::string, GDBusProxy * > pair ); void addTempBackend( std::pair< std::string, gchar* > pair ); std::vector<std::pair<std::string, gchar*>> getTempBackends(); void addNewPrinter( const OUString&, const OUString&, CPDPrinter * ); +#endif // Create CPDManager static CPDManager* tryLoadCPD(); diff --git a/vcl/unx/generic/printer/cpdmgr.cxx b/vcl/unx/generic/printer/cpdmgr.cxx index 9ba7456c1a9a..60a050bd7471 100644 --- a/vcl/unx/generic/printer/cpdmgr.cxx +++ b/vcl/unx/generic/printer/cpdmgr.cxx @@ -34,6 +34,7 @@ using namespace psp; using namespace osl; +#if ENABLE_DBUS && ENABLE_GIO // Function to execute when name is acquired on the bus void CPDManager::onNameAcquired (GDBusConnection *connection, const gchar *, @@ -233,6 +234,7 @@ void CPDManager::addNewPrinter(const OUString& aPrinterName, const OUString& aUn aPrinter.m_bModified = false; m_aPrinters[ aUniqueName ] = aPrinter; } +#endif /* * CPDManager class @@ -271,14 +273,17 @@ CPDManager* CPDManager::tryLoadCPD() CPDManager::CPDManager() : PrinterInfoManager( PrinterInfoManager::Type::CPD ) { +#if ENABLE_DBUS && ENABLE_GIO // Get Destinations number and pointers GError *error = nullptr; m_pConnection = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, &error); g_assert_no_error (error); +#endif } CPDManager::~CPDManager() { +#if ENABLE_DBUS && ENABLE_GIO g_dbus_connection_emit_signal (m_pConnection, nullptr, "/org/libreoffice/PrintDialog", @@ -303,12 +308,14 @@ CPDManager::~CPDManager() { free(dest_it->second); } +#endif } const PPDParser* CPDManager::createCPDParser( const OUString& rPrinter ) { const PPDParser* pNewParser = nullptr; +#if ENABLE_DBUS && ENABLE_GIO OUString aPrinter; if( rPrinter.startsWith("CPD:") ) @@ -464,7 +471,9 @@ const PPDParser* CPDManager::createCPDParser( const OUString& rPrinter ) rInfo.m_pParser = pNewParser; rInfo.m_aContext.setParser( pNewParser ); } - +#else + (void)rPrinter; +#endif return pNewParser; } @@ -473,6 +482,7 @@ void CPDManager::initialize() { // get normal printers, clear printer list PrinterInfoManager::initialize(); +#if ENABLE_DBUS && ENABLE_GIO g_bus_own_name_on_connection (m_pConnection, "org.libreoffice.print-dialog", G_BUS_NAME_OWNER_FLAGS_NONE, @@ -520,10 +530,12 @@ void CPDManager::initialize() m_aPrinters.erase( aRemovePrinters.front() ); aRemovePrinters.pop_front(); } +#endif } void CPDManager::setupJobContextData( JobData& rData ) { +#if ENABLE_DBUS && ENABLE_GIO std::unordered_map<OUString, CPDPrinter *, OUStringHash>::iterator dest_it = m_aCPDDestMap.find( rData.m_aPrinterName ); @@ -558,10 +570,14 @@ void CPDManager::setupJobContextData( JobData& rData ) rData.m_pParser = p_it->second.m_aInfo.m_pParser; rData.m_aContext = p_it->second.m_aInfo.m_aContext; +#else + (void)rData; +#endif } FILE* CPDManager::startSpool( const OUString& rPrintername, bool bQuickCommand ) { +#if ENABLE_DBUS && ENABLE_GIO SAL_INFO( "vcl.unx.print", "startSpool: " << rPrintername << " " << (bQuickCommand ? "true" : "false") ); if( m_aCPDDestMap.find( rPrintername ) == m_aCPDDestMap.end() ) { @@ -577,8 +593,14 @@ FILE* CPDManager::startSpool( const OUString& rPrintername, bool bQuickCommand ) m_aSpoolFiles[fp] = aSysFile; return fp; +#else + (void)rPrintername; + (void)bQuickCommand; + return nullptr; +#endif } +#if ENABLE_DBUS && ENABLE_GIO void CPDManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, const OString& rJobName, int& rNumOptions, GVariant **arr ) { GVariantBuilder *builder; @@ -649,10 +671,12 @@ void CPDManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, (*arr) = g_variant_new("a(ss)", builder); g_variant_builder_unref(builder); } +#endif bool CPDManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString& rFaxNumber ) { bool success = false; +#if ENABLE_DBUS && ENABLE_GIO SAL_INFO( "vcl.unx.print", "endSpool: " << rPrintername << "," << rJobTitle << " copy count = " << rDocumentJobData.m_nCopies ); std::unordered_map< OUString, CPDPrinter *, OUStringHash >::iterator dest_it = m_aCPDDestMap.find( rPrintername ); @@ -697,12 +721,20 @@ bool CPDManager::endSpool( const OUString& rPrintername, const OUString& rJobTit unlink( it->second.getStr() ); m_aSpoolFiles.erase( pFile ); } - +#else + (void)rPrintername; + (void)rJobTitle; + (void)pFile; + (void)rDocumentJobData; + (void)bBanner; + (void)rFaxNumber; +#endif return success; } bool CPDManager::checkPrintersChanged( bool ) { +#if ENABLE_DBUS && ENABLE_GIO bool bChanged = m_aPrintersChanged; m_aPrintersChanged = false; g_dbus_connection_emit_signal (m_pConnection, @@ -713,29 +745,35 @@ bool CPDManager::checkPrintersChanged( bool ) nullptr, nullptr); return bChanged; +#else + return false; +#endif } bool CPDManager::addPrinter( const OUString& rName, const OUString& rDriver ) { +#if ENABLE_DBUS && ENABLE_GIO // don't touch the CPD printers - if( m_aCPDDestMap.find( rName ) != m_aCPDDestMap.end() || - rDriver.startsWith("CPD:") - ) + if (m_aCPDDestMap.find( rName ) != m_aCPDDestMap.end() || rDriver.startsWith("CPD:")) return false; +#endif return PrinterInfoManager::addPrinter( rName, rDriver ); } bool CPDManager::removePrinter( const OUString& rName, bool bCheck ) { +#if ENABLE_DBUS && ENABLE_GIO // don't touch the CPD printers if( m_aCPDDestMap.find( rName ) != m_aCPDDestMap.end() ) return false; +#endif return PrinterInfoManager::removePrinter( rName, bCheck ); } bool CPDManager::setDefaultPrinter( const OUString& rName ) { bool bSuccess = false; +#if ENABLE_DBUS && ENABLE_GIO std::unordered_map< OUString, CPDPrinter *, OUStringHash >::iterator nit = m_aCPDDestMap.find( rName ); if( nit != m_aCPDDestMap.end()) @@ -745,7 +783,9 @@ bool CPDManager::setDefaultPrinter( const OUString& rName ) } else bSuccess = PrinterInfoManager::setDefaultPrinter( rName ); - +#else + (void)rName; +#endif return bSuccess; } |