diff -r ecd5bb5744dc -r f6b055dd94bc firefox-cross-desktop.patch --- a/firefox-cross-desktop.patch Sat Mar 31 09:26:42 2012 +0200 +++ b/firefox-cross-desktop.patch Sat Mar 31 22:19:28 2012 +0200 @@ -1,14 +1,12 @@ -From: Wolfgang Rosenauer -NonGnome/KDE integration - -References: -https://bugzilla.novell.com/show_bug.cgi?id=170055 +# HG changeset patch +# Parent fd2da289a3c15b8c96c248df2710d879793f22c9 +# User Wolfgang Rosenauer +Bug 526717 - remove non-working "Set as desktop background" from the UI for unsupported desktops diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js -@@ -237,17 +237,19 @@ nsContextMenu.prototype = { - this.showItem("context-sep-viewsource", shouldShow); +@@ -262,17 +262,17 @@ nsContextMenu.prototype = { // Set as Desktop background depends on whether an image was clicked on, // and only works if we have a shell service. @@ -16,11 +14,9 @@ #ifdef HAVE_SHELL_SERVICE // Only enable Set as Desktop Background if we can get the shell service. var shell = getShellService(); -- if (shell) -+ var env = Components.classes["@mozilla.org/process/environment;1"] -+ .getService(Components.interfaces.nsIEnvironment); -+ if (shell && env.get('DESKTOP_SESSION') == "gnome") - haveSetDesktopBackground = true; + if (shell) +- haveSetDesktopBackground = true; ++ haveSetDesktopBackground = shell.canSetDesktopBackground; #endif this.showItem("context-setDesktopBackground", haveSetDesktopBackground && this.onLoadedImage); @@ -28,3 +24,68 @@ if (haveSetDesktopBackground && this.onLoadedImage) { document.getElementById("context-setDesktopBackground") .disabled = this.disableSetDesktopBackground(); + } +diff --git a/browser/components/shell/public/nsIShellService.idl b/browser/components/shell/public/nsIShellService.idl +--- a/browser/components/shell/public/nsIShellService.idl ++++ b/browser/components/shell/public/nsIShellService.idl +@@ -69,16 +69,25 @@ interface nsIShellService : nsISupports + /** + * Used to determine whether or not to show a "Set Default Browser" + * query dialog. This attribute is true if the application is starting + * up and "browser.shell.checkDefaultBrowser" is true, otherwise it + * is false. + */ + attribute boolean shouldCheckDefaultBrowser; + ++ /** ++ * Used to determine whether or not to offer "Set as desktop background" ++ * context menu item. 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. + */ + const long BACKGROUND_TILE = 1; + const long BACKGROUND_STRETCH = 2; + const long BACKGROUND_CENTER = 3; + const long BACKGROUND_FILL = 4; + const long BACKGROUND_FIT = 5; +diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/src/nsGNOMEShellService.cpp +--- a/browser/components/shell/src/nsGNOMEShellService.cpp ++++ b/browser/components/shell/src/nsGNOMEShellService.cpp +@@ -377,16 +377,31 @@ nsGNOMEShellService::SetShouldCheckDefau + pserve->GetBranch("", getter_AddRefs(prefs)); + + if (prefs) + prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, 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) + { + #ifndef MOZ_WIDGET_GTK2 + return NS_ERROR_NOT_AVAILABLE; + #else + nsCOMPtr imgToPixbuf = + do_GetService("@mozilla.org/widget/image-to-gdk-pixbuf;1");