mirror of
https://abf.rosa.ru/djam/firefox-esr91.git
synced 2025-02-25 01:52:57 +00:00
drop tmp directory
This commit is contained in:
parent
23f74fadd0
commit
76384cd59b
5 changed files with 0 additions and 6056 deletions
|
@ -1,3 +0,0 @@
|
|||
sources:
|
||||
firefox-searchengines-bing.xml: ccdb7c0cc2d288714f70f8a92f0adfc2766f2b36
|
||||
firefox-31.0.source.tar.bz2: a6c3e25ee3aeb7da42db2aaeb50a385d63532beb
|
File diff suppressed because it is too large
Load diff
402
1/firefox.spec
402
1/firefox.spec
|
@ -1,402 +0,0 @@
|
|||
#
|
||||
# WARNING, READ FIRST:
|
||||
#
|
||||
# This is a special package that needs special treatment. Due to the amount of
|
||||
# security updates it needs, it's common to ship new upstream versions instead of patching.
|
||||
# That means this package MUST be BUILDABLE for stable official releases.
|
||||
# This also means only STABLE upstream releases, NO betas.
|
||||
# This is a discussed topic. Please, do not flame it again.
|
||||
|
||||
%define major 31.0
|
||||
%define ff_epoch 0
|
||||
# (tpg) set version HERE !!!
|
||||
%define realver %{major}
|
||||
%define firefox_appid \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\}
|
||||
|
||||
# (tpg) MOZILLA_FIVE_HOME
|
||||
%define mozillalibdir %{_libdir}/%{name}-%{major}
|
||||
%define pluginsdir %{_libdir}/mozilla/plugins
|
||||
|
||||
# this seems fragile, so require the exact version or later (#58754)
|
||||
%define sqlite3_version %(pkg-config --modversion sqlite3 &>/dev/null && pkg-config --modversion sqlite3 2>/dev/null || echo 0)
|
||||
%define nss_version %(pkg-config --modversion nss &>/dev/null && pkg-config --modversion nss 2>/dev/null || echo 0)
|
||||
%define nspr_version %(pkg-config --modversion nspr &>/dev/null && pkg-config --modversion nspr 2>/dev/null |sed -e 's!\.0!!' || echo 0)
|
||||
|
||||
%define _use_syshunspell 0
|
||||
|
||||
%define update_channel release
|
||||
|
||||
Summary: Next generation web browser
|
||||
Name: firefox
|
||||
Version: %{major}
|
||||
Epoch: %{ff_epoch}
|
||||
Release: 1
|
||||
License: MPLv1+
|
||||
Group: Networking/WWW
|
||||
Url: http://www.mozilla.com/firefox/
|
||||
%if 0%{?prel}
|
||||
Source0: ftp://ftp.mozilla.org/pub/mozilla.org/%{name}/releases/%{realver}/source/%{name}-%{realver}%prel.source.tar.bz2
|
||||
%else
|
||||
Source0: ftp://ftp.mozilla.org/pub/mozilla.org/%{name}/releases/%{realver}/source/%{name}-%{realver}.source.tar.bz2
|
||||
%endif
|
||||
Source4: %{name}.desktop
|
||||
Source5: firefox-searchengines-jamendo.xml
|
||||
Source6: firefox-searchengines-exalead.xml
|
||||
Source8: firefox-searchengines-askcom.xml
|
||||
Source9: kde.js
|
||||
Source10: firefox-searchengines-yandex.xml
|
||||
Source11: firefox-searchengines-google.xml
|
||||
Source12: firefox-searchengines-bing.xml
|
||||
Patch1: firefox-6.0-lang.patch
|
||||
Patch2: firefox-vendor.patch
|
||||
Patch8: firefox-25.0-disable-check-default-browser.patch
|
||||
Patch10: firefox-3.5.3-default-mail-handler.patch
|
||||
# Patches for kde integration of FF
|
||||
Patch11: firefox-31-kde.patch
|
||||
Patch12: mozilla-31-kde.patch
|
||||
Patch13: mozilla-kde-background.patch
|
||||
Patch34: xulrunner_nojit.patch
|
||||
|
||||
# Upstream patches
|
||||
|
||||
# ROSA
|
||||
Patch90: firefox-15.0-enable-addons.patch
|
||||
|
||||
|
||||
BuildRequires: gtk+2-devel
|
||||
BuildRequires: unzip
|
||||
BuildRequires: zip
|
||||
BuildRequires: pkgconfig(xinerama)
|
||||
BuildRequires: pkgconfig(xscrnsaver)
|
||||
BuildRequires: jpeg-devel
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: pkgconfig(libIDL-2.0)
|
||||
BuildRequires: makedepend
|
||||
BuildRequires: nss-devel >= 2:3.16.2
|
||||
BuildRequires: nss-static-devel
|
||||
BuildRequires: nspr-devel >= 2:4.10.6
|
||||
BuildRequires: startup-notification-devel
|
||||
BuildRequires: dbus-glib-devel
|
||||
BuildRequires: python
|
||||
BuildRequires: sqlite3-devel >= 3.8.4.1
|
||||
%ifnarch %arm %mips
|
||||
BuildRequires: valgrind
|
||||
BuildRequires: java-rpmbuild
|
||||
BuildRequires: yasm >= 1.0.1
|
||||
%endif
|
||||
%ifarch %arm
|
||||
BuildRequires: libffi-devel
|
||||
%endif
|
||||
BuildRequires: rootcerts >= 1:20110830.00
|
||||
BuildRequires: pkgconfig(xt)
|
||||
%if %_use_syshunspell
|
||||
BuildRequires: hunspell-devel
|
||||
%endif
|
||||
BuildRequires: doxygen
|
||||
# BuildRequires: xulrunner-devel >= %xulrunner_version%{?prel:-0.%prel}
|
||||
BuildRequires: pkgconfig(libproxy-1.0)
|
||||
BuildRequires: pkgconfig(alsa)
|
||||
BuildRequires: wget
|
||||
BuildRequires: pkgconfig(libnotify)
|
||||
BuildRequires: cairo-devel >= 1.10
|
||||
BuildRequires: pkgconfig(gl)
|
||||
BuildRequires: pkgconfig(vpx)
|
||||
BuildRequires: autoconf2.1
|
||||
BuildRequires: libiw-devel
|
||||
BuildRequires: python-virtualenv
|
||||
BuildRequires: pkgconfig(gstreamer-1.0)
|
||||
BuildRequires: pkgconfig(gstreamer-plugins-base-1.0)
|
||||
BuildRequires: pkgconfig(opus)
|
||||
BuildRequires: pkgconfig(libpulse)
|
||||
BuildRequires: bzip2-devel
|
||||
|
||||
%if 0%{?prel}
|
||||
Provides: %{name} = %{epoch}:%{realver}-0.%{prel}
|
||||
%else
|
||||
Provides: %{name} = %{epoch}:%{realver}
|
||||
%endif
|
||||
Provides: mozilla-firefox = %{epoch}:%{version}-%{release}
|
||||
Provides: webclient
|
||||
|
||||
Requires: %{mklibname sqlite3_ 0} >= %{sqlite3_version}
|
||||
Requires: %{mklibname nss 3} >= 2:%{nss_version}
|
||||
Requires: %{mklibname nspr 4} >= 2:%{nspr_version}
|
||||
Requires: indexhtml
|
||||
Requires: xdg-utils
|
||||
# fixes bug #42096
|
||||
Requires: mailcap
|
||||
%if %_use_syshunspell
|
||||
Suggests: hunspell-en
|
||||
%endif
|
||||
Suggests: %{_lib}canberra0
|
||||
Suggests: %{_lib}cups2
|
||||
Obsoletes: firefox-ext-weave-sync
|
||||
Obsoletes: firefox-beta < 11
|
||||
|
||||
%description
|
||||
The award-winning Web browser is now faster, more secure, and fully
|
||||
customizable to your online life. With Firefox(R), we've added powerful new
|
||||
features that make your online experience even better. It is an 'open source'
|
||||
product which is freely available, and is acquiring a growing proportion of
|
||||
international web browser usage.
|
||||
|
||||
Firefox claims to offer a more secure web browsing experience than other
|
||||
products, with better protection against spyware and other Internet-based
|
||||
security threats. It includes all the standard features of a modern web
|
||||
browser, like Internet searching, tracking recently visited sites, setting up
|
||||
shortcuts to favourite sites, customising the software behaviour and so on.
|
||||
Firefox also includes features like 'tabbed browsing' (opening several web
|
||||
sites as sections within the same window) and methods for controlling pop-up
|
||||
windows, cookies and downloaded files.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Group: Development/Other
|
||||
Obsoletes: firefox-beta-devel < 11
|
||||
|
||||
%description devel
|
||||
Files and macros mainly for building Firefox extensions.
|
||||
|
||||
%prep
|
||||
%setup -qn mozilla-%update_channel
|
||||
%patch1 -p1 -b .lang
|
||||
%patch2 -p1 -b .vendor
|
||||
%patch8 -p1 -b .disable-check
|
||||
%patch10 -p1 -b .default-mail-handler
|
||||
|
||||
## KDE INTEGRATION
|
||||
# Disable kde integration , need refactoring
|
||||
%patch11 -p1 -b .kdepatch
|
||||
%patch12 -p1 -b .kdemoz
|
||||
%patch13 -p1 -b .kdebackground
|
||||
|
||||
%ifarch %arm
|
||||
%if "%{_target_cpu}" != "armv7l"
|
||||
%patch34 -p1
|
||||
%endif
|
||||
%endif
|
||||
|
||||
#patch90 -p2 -b .addons
|
||||
|
||||
pushd js/src
|
||||
autoconf-2.13
|
||||
popd
|
||||
autoconf-2.13
|
||||
|
||||
# needed to regenerate certdata.c
|
||||
pushd security/nss/lib/ckfw/builtins
|
||||
perl ./certdata.perl < /etc/pki/tls/mozilla/certdata.txt
|
||||
popd
|
||||
|
||||
%build
|
||||
export MOZCONFIG=`pwd`/mozconfig
|
||||
cat << EOF > $MOZCONFIG
|
||||
mk_add_options MOZILLA_OFFICIAL=1
|
||||
mk_add_options BUILD_OFFICIAL=1
|
||||
mk_add_options MOZ_MAKE_FLAGS="%{_smp_mflags}"
|
||||
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj
|
||||
ac_add_options --host=%{_host}
|
||||
ac_add_options --target=%{_target_platform}
|
||||
ac_add_options --enable-optimize
|
||||
ac_add_options --prefix="%{_prefix}"
|
||||
ac_add_options --libdir="%{_libdir}"
|
||||
ac_add_options --sysconfdir="%{_sysconfdir}"
|
||||
ac_add_options --mandir="%{_mandir}"
|
||||
ac_add_options --includedir="%{_includedir}"
|
||||
ac_add_options --datadir="%{_datadir}"
|
||||
ac_add_options --with-system-nspr
|
||||
ac_add_options --with-system-nss
|
||||
ac_add_options --with-system-zlib
|
||||
ac_add_options --with-system-libvpx
|
||||
ac_add_options --with-system-bz2
|
||||
ac_add_options --enable-libnotify
|
||||
ac_add_options --enable-svg
|
||||
ac_add_options --enable-canvas
|
||||
ac_add_options --enable-webm
|
||||
ac_add_options --enable-gio
|
||||
ac_add_options --disable-gnomevfs
|
||||
ac_add_options --disable-updater
|
||||
ac_add_options --disable-tests
|
||||
ac_add_options --disable-debug
|
||||
#ac_add_options --enable-chrome-format=jar
|
||||
#ac_add_options --enable-update-channel=beta
|
||||
ac_add_options --enable-official-branding
|
||||
ac_add_options --enable-libproxy
|
||||
ac_add_options --with-system-jpeg
|
||||
ac_add_options --enable-system-cairo
|
||||
ac_add_options --enable-system-sqlite
|
||||
ac_add_options --enable-startup-notification
|
||||
ac_add_options --enable-xinerama
|
||||
ac_add_options --with-distribution-id=org.rosa
|
||||
ac_add_options --disable-crashreporter
|
||||
ac_add_options --enable-update-channel=%{update_channel}
|
||||
ac_add_options --enable-gstreamer
|
||||
%ifarch %arm
|
||||
%if "%{_target_cpu}" != "armv7l"
|
||||
ac_add_options --disable-methodjit
|
||||
ac_add_options --disable-tracejit
|
||||
%endif
|
||||
ac_add_options --enable-system-ffi
|
||||
%endif
|
||||
%ifnarch %arm %mips
|
||||
ac_add_options --with-valgrind
|
||||
ac_add_options --with-java-include-path=%{java_home}/include
|
||||
ac_add_options --with-java-bin-path=%{java_home}/bin
|
||||
ac_add_options --enable-opus
|
||||
%endif
|
||||
|
||||
EOF
|
||||
|
||||
%__perl -p -i -e 's|\-0|\-9|g' config/make-jars.pl
|
||||
|
||||
export LDFLAGS="%ldflags"
|
||||
make -f client.mk build
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
|
||||
make -C %{_builddir}/obj/browser/installer STRIP=/bin/true MOZ_PKG_FATAL_WARNINGS=0
|
||||
|
||||
# Copy files to buildroot
|
||||
%{__mkdir_p} %{buildroot}%{mozillalibdir}
|
||||
cp -rf %{_builddir}/obj/dist/firefox/* %{buildroot}%{mozillalibdir}
|
||||
|
||||
%{__mkdir_p} %{buildroot}%{_bindir}
|
||||
ln -sf %{mozillalibdir}/firefox %{buildroot}%{_bindir}/firefox
|
||||
pushd %{buildroot}%{_bindir}
|
||||
ln -sf firefox mozilla-firefox
|
||||
popd
|
||||
mkdir -p %{buildroot}%{mozillalibdir}/defaults/preferences/
|
||||
install -m 644 %{SOURCE9} %{buildroot}%{mozillalibdir}/defaults/preferences/kde.js
|
||||
|
||||
# Create and own %_libdir/mozilla/plugins & firefox extensions directories
|
||||
%{__mkdir_p} %{buildroot}%{pluginsdir}
|
||||
%{__mkdir_p} %{buildroot}%{_libdir}/mozilla/extensions/%{firefox_appid}
|
||||
%{__mkdir_p} %{buildroot}%{_datadir}/mozilla/extensions/%{firefox_appid}
|
||||
|
||||
# (tpg) desktop entry
|
||||
%{__mkdir_p} %{buildroot}%{_datadir}/applications
|
||||
install -m 644 %{SOURCE4} %{buildroot}%{_datadir}/applications/%{name}.desktop
|
||||
|
||||
# (tpg) icons
|
||||
%{__cp} %{buildroot}%{mozillalibdir}/browser/chrome/icons/default/default16.png %{buildroot}/%{mozillalibdir}/browser/icons/
|
||||
for i in 16 22 24 32 48 256; do
|
||||
# (cg) Not all icon sizes are installed with make install, so just redo it here.
|
||||
%{__install} -m 644 browser/branding/official/default$i.png %{buildroot}%{mozillalibdir}/browser/chrome/icons/default/default$i.png
|
||||
%{__mkdir_p} %{buildroot}%{_iconsdir}/hicolor/"$i"x"$i"/apps
|
||||
ln -sf %{mozillalibdir}/browser/chrome/icons/default/default$i.png %{buildroot}%{_iconsdir}/hicolor/"$i"x"$i"/apps/%{name}.png ;
|
||||
done
|
||||
%{__mkdir_p} %{buildroot}{%{_liconsdir},%{_iconsdir},%{_miconsdir}}
|
||||
ln -sf %{mozillalibdir}/browser/chrome/icons/default/default48.png %{buildroot}%{_liconsdir}/%{name}.png
|
||||
ln -sf %{mozillalibdir}/browser/chrome/icons/default/default32.png %{buildroot}%{_iconsdir}/%{name}.png
|
||||
ln -sf %{mozillalibdir}/browser/chrome/icons/default/default16.png %{buildroot}%{_miconsdir}/%{name}.png
|
||||
|
||||
# exclusions
|
||||
rm -f %{buildroot}%{mozillalibdir}/README.txt
|
||||
rm -f %{buildroot}%{mozillalibdir}/removed-files
|
||||
rm -f %{buildroot}%{mozillalibdir}/precomplete
|
||||
|
||||
cat << EOF >> %{buildroot}%{mozillalibdir}/firefox.cfg
|
||||
#code
|
||||
pref("browser.rights.3.shown", false);
|
||||
defaultPref("browser.startup.homepage", "data:text/html,browser.startup.homepage=file:///usr/share/doc/HTML/index.html");
|
||||
pref("browser.shell.checkDefaultBrowser", false);
|
||||
pref("browser.startup.homepage_override.mstone", "ignore");
|
||||
pref("browser.ctrlTab.previews", true);
|
||||
pref("browser.tabs.insertRelatedAfterCurrent", false);
|
||||
pref("browser.backspace_action", 2);
|
||||
pref("browser.display.use_system_colors", true);
|
||||
pref("browser.download.folderList", 1);
|
||||
pref("browser.link.open_external", 3);
|
||||
pref("app.update.auto", false);
|
||||
pref("app.update.enabled", false);
|
||||
pref("app.update.autoInstallEnabled", false);
|
||||
pref("security.ssl.require_safe_negotiation", false);
|
||||
pref("dom.ipc.plugins.enabled.nswrapper*", false);
|
||||
pref("extensions.autoDisableScopes", 0);
|
||||
pref("extensions.shownSelectionUI", true);
|
||||
pref("network.manage-offline-status", true);
|
||||
EOF
|
||||
cat << EOF >> %{buildroot}%{mozillalibdir}/defaults/pref/config-prefs.js
|
||||
pref("general.config.filename", "firefox.cfg");
|
||||
pref("general.config.obscure_value", 0); // use this to disable the byte-shift
|
||||
EOF
|
||||
|
||||
# display icon for Firefox button
|
||||
%{__mkdir_p} %{buildroot}%{mozillalibdir}/defaults/profile/chrome
|
||||
cat << EOF > %{buildroot}%{mozillalibdir}/defaults/profile/chrome/userChrome.css
|
||||
#appmenu-toolbar-button {
|
||||
list-style-image: url("chrome://branding/content/icon16.png");
|
||||
}
|
||||
EOF
|
||||
|
||||
# use the system myspell dictionaries
|
||||
rm -fr %{buildroot}%{mozillalibdir}/dictionaries
|
||||
#ln -s %{_datadir}/hunspell %{buildroot}%{mozillalibdir}/dictionaries
|
||||
ln -s %{_datadir}/dict/mozilla/ %{buildroot}%{mozillalibdir}/dictionaries
|
||||
|
||||
# (lm) touch and %ghost bookmarks.html to a proper uninstall
|
||||
touch %{buildroot}%{mozillalibdir}/defaults/profile/bookmarks.html
|
||||
|
||||
# search engines
|
||||
rm -f %{buildroot}%{mozillalibdir}/browser/searchplugins/*
|
||||
cp -f %{SOURCE5} %{buildroot}%{mozillalibdir}/browser/searchplugins/jamendo.xml
|
||||
cp -f %{SOURCE6} %{buildroot}%{mozillalibdir}/browser/searchplugins/exalead.xml
|
||||
cp -f %{SOURCE8} %{buildroot}%{mozillalibdir}/browser/searchplugins/askcom.xml
|
||||
cp -f %{SOURCE10} %{buildroot}%{mozillalibdir}/browser/searchplugins/yandex.xml
|
||||
cp -f %{SOURCE11} %{buildroot}%{mozillalibdir}/browser/searchplugins/google.xml
|
||||
cp -f %{SOURCE12} %{buildroot}%{mozillalibdir}/browser/searchplugins/bing.xml
|
||||
|
||||
# Correct distro values on search engines
|
||||
sed -i 's/@DISTRO_VALUE@/ffx/' %{buildroot}%{mozillalibdir}/browser/searchplugins/askcom.xml
|
||||
sed -i 's/@DISTRO_VALUE@//' %{buildroot}%{mozillalibdir}/browser/searchplugins/exalead.xml
|
||||
|
||||
mkdir -p %{buildroot}%{_sys_macros_dir}
|
||||
cat <<FIN >%{buildroot}%{_sys_macros_dir}/%{name}.macros
|
||||
# Macros from %{name} package
|
||||
%%firefox_major %{major}
|
||||
%%firefox_epoch %{ff_epoch}
|
||||
%%firefox_version %{major}%{?prel:-0.%prel}
|
||||
%%firefox_mozillapath %{mozillalibdir}
|
||||
%%firefox_pluginsdir %{pluginsdir}
|
||||
%%firefox_appid \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\}
|
||||
%%firefox_extdir %%(if [ "%%_target_cpu" = "noarch" ]; then echo %%{_datadir}/mozilla/extensions/%%{firefox_appid}; else echo %%{_libdir}/mozilla/extensions/%%{firefox_appid}; fi)
|
||||
FIN
|
||||
|
||||
# Fix libxpcom.so rights
|
||||
#chmod 755 $RPM_BUILD_ROOT/%{mozillalibdir}/libxpcom.so
|
||||
|
||||
%pre
|
||||
if [ -d %{mozillalibdir}/browser/dictionaries ]; then
|
||||
rm -fr %{mozillalibdir}/browser/dictionaries
|
||||
fi
|
||||
|
||||
%post
|
||||
if [ ! -r /etc/sysconfig/oem ]; then
|
||||
case `grep META_CLASS /etc/sysconfig/system` in
|
||||
*powerpack) bookmark="mozilla-powerpack.html" ;;
|
||||
*desktop) bookmark="mozilla-one.html";;
|
||||
*) bookmark="mozilla-download.html";;
|
||||
esac
|
||||
ln -s -f ../../../../share/mdk/bookmarks/mozilla/$bookmark %{mozillalibdir}/defaults/profile/bookmarks.html
|
||||
fi
|
||||
|
||||
%files
|
||||
%{_bindir}/%{name}
|
||||
%{_bindir}/mozilla-firefox
|
||||
%{_iconsdir}/hicolor/*/apps/*.png
|
||||
%{_miconsdir}/%{name}.png
|
||||
%{_iconsdir}/%{name}.png
|
||||
%{_liconsdir}/%{name}.png
|
||||
%{_datadir}/applications/*.desktop
|
||||
%{_libdir}/%{name}-%{major}*
|
||||
#% ghost %{mozillalibdir}/defaults/profile/bookmarks.html
|
||||
%dir %{_libdir}/mozilla
|
||||
%dir %{_libdir}/mozilla/extensions
|
||||
%dir %{pluginsdir}
|
||||
%dir %{_libdir}/mozilla/extensions/%{firefox_appid}
|
||||
%dir %{_datadir}/mozilla/extensions/%{firefox_appid}
|
||||
|
||||
%files devel
|
||||
%{_sys_macros_dir}/%{name}.macros
|
File diff suppressed because it is too large
Load diff
|
@ -1,142 +0,0 @@
|
|||
diff -urN mozilla-release.orig/browser/components/shell/src/nsKDEShellService.cpp mozilla-release/browser/components/shell/src/nsKDEShellService.cpp
|
||||
--- mozilla-release.orig/browser/components/shell/src/nsKDEShellService.cpp 2014-08-04 17:37:32.064081427 +0400
|
||||
+++ mozilla-release/browser/components/shell/src/nsKDEShellService.cpp 2014-08-04 17:42:22.108041230 +0400
|
||||
@@ -17,6 +17,21 @@
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsArrayUtils.h"
|
||||
+#include "nsIImageLoadingContent.h"
|
||||
+#include "imgIRequest.h"
|
||||
+#include "nsIStringBundle.h"
|
||||
+#include "nsIDOMHTMLImageElement.h"
|
||||
+#include "prenv.h"
|
||||
+
|
||||
+#include <glib.h>
|
||||
+#include <glib-object.h>
|
||||
+#include <gtk/gtk.h>
|
||||
+#include <gdk/gdk.h>
|
||||
+#if defined(MOZ_WIDGET_GTK)
|
||||
+#include "nsIImageToPixbuf.h"
|
||||
+#endif
|
||||
+#include <limits.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@@ -28,6 +43,29 @@
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
+static nsresult
|
||||
+WriteImage(const nsCString& aPath, imgIContainer* aImage)
|
||||
+{
|
||||
+#if !defined(MOZ_WIDGET_GTK)
|
||||
+ return NS_ERROR_NOT_AVAILABLE;
|
||||
+#else
|
||||
+ nsCOMPtr<nsIImageToPixbuf> imgToPixbuf =
|
||||
+ do_GetService("@mozilla.org/widget/image-to-gdk-pixbuf;1");
|
||||
+ if (!imgToPixbuf)
|
||||
+ return NS_ERROR_NOT_AVAILABLE;
|
||||
+
|
||||
+ GdkPixbuf* pixbuf = imgToPixbuf->ConvertImageToPixbuf(aImage);
|
||||
+ if (!pixbuf)
|
||||
+ return NS_ERROR_NOT_AVAILABLE;
|
||||
+
|
||||
+ gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", nullptr, nullptr);
|
||||
+
|
||||
+ g_object_unref(pixbuf);
|
||||
+ return res ? NS_OK : NS_ERROR_FAILURE;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+
|
||||
NS_IMPL_ISUPPORTS(nsKDEShellService, nsIShellService)
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -123,19 +161,83 @@
|
||||
nsKDEShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
PRInt32 aPosition)
|
||||
{
|
||||
- return NS_ERROR_NOT_IMPLEMENTED;
|
||||
+ nsresult rv;
|
||||
+ nsCOMPtr<nsIImageLoadingContent> imageContent = do_QueryInterface(aElement, &rv);
|
||||
+ if (!imageContent) return rv;
|
||||
+
|
||||
+ // get the image container
|
||||
+ nsCOMPtr<imgIRequest> request;
|
||||
+ rv = imageContent->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
|
||||
+ getter_AddRefs(request));
|
||||
+ if (!request) return rv;
|
||||
+ nsCOMPtr<imgIContainer> container;
|
||||
+ rv = request->GetImage(getter_AddRefs(container));
|
||||
+ if (!container) return rv;
|
||||
+
|
||||
+ // Set desktop wallpaper filling style
|
||||
+ nsAutoCString options;
|
||||
+ if (aPosition == BACKGROUND_TILE)
|
||||
+ options.Assign("TiledResize");
|
||||
+ else if (aPosition == BACKGROUND_STRETCH)
|
||||
+ options.Assign("ScaledResize");
|
||||
+ else if (aPosition == BACKGROUND_FILL)
|
||||
+ options.Assign("ScaledAndCroppedResize");
|
||||
+ else if (aPosition == BACKGROUND_FIT)
|
||||
+ options.Assign("MaxpectResize");
|
||||
+ else
|
||||
+ options.Assign("CenteredResize");
|
||||
+
|
||||
+ // Write the background file to the home directory.
|
||||
+ nsAutoCString filePath(PR_GetEnv("HOME"));
|
||||
+
|
||||
+ // get the product brand name from localized strings
|
||||
+ nsString brandName;
|
||||
+ nsCID bundleCID = NS_STRINGBUNDLESERVICE_CID;
|
||||
+ nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(bundleCID));
|
||||
+ if (bundleService) {
|
||||
+ nsCOMPtr<nsIStringBundle> brandBundle;
|
||||
+ rv = bundleService->CreateBundle(BRAND_PROPERTIES,
|
||||
+ getter_AddRefs(brandBundle));
|
||||
+ if (NS_SUCCEEDED(rv) && brandBundle) {
|
||||
+ rv = brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
+ getter_Copies(brandName));
|
||||
+ NS_ENSURE_SUCCESS(rv, rv);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // build the file name
|
||||
+ filePath.Append('/');
|
||||
+ filePath.Append(NS_ConvertUTF16toUTF8(brandName));
|
||||
+ filePath.Append("_wallpaper.png");
|
||||
+
|
||||
+ // write the image to a file in the home dir
|
||||
+ rv = WriteImage(filePath, container);
|
||||
+ NS_ENSURE_SUCCESS(rv, rv);
|
||||
+
|
||||
+ nsCOMPtr<nsIMutableArray> command = do_CreateInstance( NS_ARRAY_CONTRACTID );
|
||||
+ nsCOMPtr<nsISupportsCString> cmdstr = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
|
||||
+ nsCOMPtr<nsISupportsCString> imgstr = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
|
||||
+ nsCOMPtr<nsISupportsCString> modestr = do_CreateInstance( NS_SUPPORTS_CSTRING_CONTRACTID );
|
||||
+ cmdstr->SetData( NS_LITERAL_CSTRING( "SETWALLPAPER" ));
|
||||
+ command->AppendElement( cmdstr, false );
|
||||
+ imgstr->SetData( filePath );
|
||||
+ command->AppendElement( imgstr, false );
|
||||
+ modestr->SetData( options );
|
||||
+ command->AppendElement( modestr, false );
|
||||
+ return nsKDEUtils::command( command ) ? rv : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsKDEShellService::GetDesktopBackgroundColor(PRUint32 *aColor)
|
||||
{
|
||||
- return NS_ERROR_NOT_IMPLEMENTED;
|
||||
+ aColor = 0;
|
||||
+ return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsKDEShellService::SetDesktopBackgroundColor(PRUint32 aColor)
|
||||
{
|
||||
- return NS_ERROR_NOT_IMPLEMENTED;
|
||||
+ return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
Loading…
Add table
Reference in a new issue