mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1411589 - Notify flatpak print portal that print to file has finished, r=stransky
The GTK print portal is notified by the observer service with 'print-to-file-finished' topic. The print filename is used as an identifier of the target in case multiple printing jobs are in progress. MozReview-Commit-ID: 1BZKDcK5De3 --HG-- extra : rebase_source : 5234aea32097cff4fc9f74f1b522cd04b2be8db1
This commit is contained in:
parent
7628529d74
commit
360d03d095
@ -33,6 +33,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
// To check if we need to use flatpak portal for printing
|
||||
#include "nsIGIOService.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
using mozilla::gfx::IntSize;
|
||||
@ -355,6 +358,20 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument()
|
||||
// If you're not familiar with umasks, they contain the bits of what NOT to set in the permissions
|
||||
// (thats because files and directories have different numbers of bits for their permissions)
|
||||
destFile->SetPermissions(0666 & ~(mask));
|
||||
|
||||
// Notify flatpak printing portal that file is completely written
|
||||
nsCOMPtr<nsIGIOService> giovfs =
|
||||
do_GetService(NS_GIOSERVICE_CONTRACTID);
|
||||
bool shouldUsePortal;
|
||||
if (giovfs) {
|
||||
giovfs->ShouldUseFlatpakPortal(&shouldUsePortal);
|
||||
if (shouldUsePortal) {
|
||||
// Use the name of the file for printing to match with nsFlatpakPrintPortal
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
// Pass filename to be sure that observer process the right data
|
||||
os->NotifyObservers(nullptr, "print-to-file-finished", targetPath.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user