зеркало из https://github.com/mozilla/gecko-dev.git
Bug 526717 - remove non-working "Set as desktop background" from the UI for unsupported desktops. r=gavin
This commit is contained in:
Родитель
f6c2a9431d
Коммит
b93bb1bc3e
|
@ -267,7 +267,7 @@ nsContextMenu.prototype = {
|
|||
// Only enable Set as Desktop Background if we can get the shell service.
|
||||
var shell = getShellService();
|
||||
if (shell)
|
||||
haveSetDesktopBackground = true;
|
||||
haveSetDesktopBackground = shell.canSetDesktopBackground;
|
||||
#endif
|
||||
this.showItem("context-setDesktopBackground",
|
||||
haveSetDesktopBackground && this.onLoadedImage);
|
||||
|
|
|
@ -74,6 +74,15 @@ interface nsIShellService : nsISupports
|
|||
*/
|
||||
attribute boolean shouldCheckDefaultBrowser;
|
||||
|
||||
/**
|
||||
* Used to determine whether or not to offer "Set as desktop background"
|
||||
* functionality. Even if shell service is available it is not
|
||||
* guaranteed that it is able to set the background for every desktop
|
||||
* which is especially true for Linux with its many different desktop
|
||||
* environments.
|
||||
*/
|
||||
readonly attribute boolean canSetDesktopBackground;
|
||||
|
||||
/**
|
||||
* Flags for positioning/sizing of the Desktop Background image.
|
||||
*/
|
||||
|
|
|
@ -382,6 +382,21 @@ nsGNOMEShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGNOMEShellService::GetCanSetDesktopBackground(bool* aResult)
|
||||
{
|
||||
// setting desktop background is currently only supported
|
||||
// for Gnome or desktops using the same GSettings and GConf keys
|
||||
const char* gnomeSession = getenv("GNOME_DESKTOP_SESSION_ID");
|
||||
if (gnomeSession) {
|
||||
*aResult = true;
|
||||
} else {
|
||||
*aResult = false;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
WriteImage(const nsCString& aPath, imgIContainer* aImage)
|
||||
{
|
||||
|
|
|
@ -156,6 +156,13 @@ nsMacShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacShellService::GetCanSetDesktopBackground(bool* aResult)
|
||||
{
|
||||
*aResult = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
PRInt32 aPosition)
|
||||
|
|
|
@ -561,6 +561,13 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindowsShellService::GetCanSetDesktopBackground(bool* aResult)
|
||||
{
|
||||
*aResult = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче