rpms/xulrunner/devel mozilla-libnotify.patch, NONE, 1.1 xulrunner-mozconfig, 1.27, 1.28 xulrunner.spec, 1.173, 1.174
Jan Horak
xhorak at fedoraproject.org
Fri Aug 21 13:40:35 UTC 2009
Author: xhorak
Update of /cvs/pkgs/rpms/xulrunner/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9532
Modified Files:
xulrunner-mozconfig xulrunner.spec
Added Files:
mozilla-libnotify.patch
Log Message:
Added libnotify support
mozilla-libnotify.patch:
config/autoconf.mk.in | 10
config/system-headers | 1
configure.in | 34 ++
js/src/config/system-headers | 1
toolkit/components/alerts/src/Makefile.in | 2
toolkit/components/alerts/src/nsAlertsService.cpp | 12
toolkit/components/build/nsToolkitCompsCID.h | 11
toolkit/system/gnome/Makefile.in | 18 +
toolkit/system/gnome/nsAlertsIconListener.cpp | 326 ++++++++++++++++++++++
toolkit/system/gnome/nsAlertsIconListener.h | 85 +++++
toolkit/system/gnome/nsAlertsService.cpp | 73 ++++
toolkit/system/gnome/nsAlertsService.h | 59 +++
toolkit/system/gnome/nsGnomeModule.cpp | 17 +
13 files changed, 644 insertions(+), 5 deletions(-)
--- NEW FILE mozilla-libnotify.patch ---
diff -up mozilla-1.9.1/config/autoconf.mk.in.libnotify mozilla-1.9.1/config/autoconf.mk.in
--- mozilla-1.9.1/config/autoconf.mk.in.libnotify 2009-07-30 17:30:11.000000000 +0200
+++ mozilla-1.9.1/config/autoconf.mk.in 2009-08-21 15:31:20.000000000 +0200
@@ -57,14 +57,14 @@ MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
-includedir = @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+includedir = @includedir@/$(MOZ_APP_NAME)-sdk-$(MOZ_APP_VERSION)
libdir = @libdir@
datadir = @datadir@
mandir = @mandir@
-idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+idldir = $(datadir)/idl/$(MOZ_APP_NAME)-sdk-$(MOZ_APP_VERSION)
installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
+sdkdir = $(libdir)/$(MOZ_APP_NAME)-sdk-$(MOZ_APP_VERSION)
DIST = $(DEPTH)/dist
LIBXUL_SDK = @LIBXUL_SDK@
@@ -528,6 +528,10 @@ MOZ_PANGO_LIBS = @MOZ_PANGO_LIB
MOZ_XIE_LIBS = @MOZ_XIE_LIBS@
XT_LIBS = @XT_LIBS@
+MOZ_LIBNOTIFY_CFLAGS = @MOZ_LIBNOTIFY_CFLAGS@
+MOZ_LIBNOTIFY_LIBS = @MOZ_LIBNOTIFY_LIBS@
+MOZ_ENABLE_LIBNOTIFY = @MOZ_ENABLE_LIBNOTIFY@
+
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GLIB_GMODULE_LIBS = @GLIB_GMODULE_LIBS@
diff -up mozilla-1.9.1/config/system-headers.libnotify mozilla-1.9.1/config/system-headers
--- mozilla-1.9.1/config/system-headers.libnotify 2009-07-30 17:30:11.000000000 +0200
+++ mozilla-1.9.1/config/system-headers 2009-08-21 15:31:20.000000000 +0200
@@ -432,6 +432,7 @@ libgnomevfs/gnome-vfs-ops.h
libgnomevfs/gnome-vfs-standard-callbacks.h
libIDL/IDL.h
lib$routines.h
+libnotify/notify.h
limits
limits.h
link.h
diff -up mozilla-1.9.1/configure.in.libnotify mozilla-1.9.1/configure.in
--- mozilla-1.9.1/configure.in.libnotify 2009-07-30 17:30:11.000000000 +0200
+++ mozilla-1.9.1/configure.in 2009-08-21 15:31:20.000000000 +0200
@@ -132,6 +132,7 @@ LIBGNOME_VERSION=2.0
STARTUP_NOTIFICATION_VERSION=0.8
DBUS_VERSION=0.60
SQLITE_VERSION=3.6.10
+LIBNOTIFY_VERSION=0.4
MSMANIFEST_TOOL=
@@ -5186,6 +5187,39 @@ AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
AC_SUBST(MOZ_DBUS_GLIB_LIBS)
dnl ========================================================
+dnl = libnotify support
+dnl ========================================================
+
+if test "$MOZ_ENABLE_GTK2"
+then
+ MOZ_ENABLE_LIBNOTIFY=1
+
+ MOZ_ARG_DISABLE_BOOL(libnotify,
+ [ --disable-libnotify Disable libnotify support ],
+ MOZ_ENABLE_LIBNOTIFY=,
+ MOZ_ENABLE_LIBNOTIFY=1)
+
+ if test "$MOZ_ENABLE_LIBNOTIFY"
+ then
+ AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
+ fi
+fi
+
+if test -z "$SKIP_LIBRARY_CHECKS"
+then
+ if test "$MOZ_ENABLE_GTK2"
+ then
+ if test "$MOZ_ENABLE_LIBNOTIFY"
+ then
+ PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
+ fi
+ fi
+fi
+AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
+AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
+AC_SUBST(MOZ_LIBNOTIFY_LIBS)
+
+dnl ========================================================
dnl = Build Personal Security Manager
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(crypto,
diff -up mozilla-1.9.1/js/src/config/system-headers.libnotify mozilla-1.9.1/js/src/config/system-headers
--- mozilla-1.9.1/js/src/config/system-headers.libnotify 2009-07-30 17:30:17.000000000 +0200
+++ mozilla-1.9.1/js/src/config/system-headers 2009-08-21 15:31:20.000000000 +0200
@@ -432,6 +432,7 @@ libgnomevfs/gnome-vfs-ops.h
libgnomevfs/gnome-vfs-standard-callbacks.h
libIDL/IDL.h
lib$routines.h
+libnotify/notify.h
limits
limits.h
link.h
diff -up mozilla-1.9.1/toolkit/components/alerts/src/Makefile.in.libnotify mozilla-1.9.1/toolkit/components/alerts/src/Makefile.in
--- mozilla-1.9.1/toolkit/components/alerts/src/Makefile.in.libnotify 2009-07-30 17:30:31.000000000 +0200
+++ mozilla-1.9.1/toolkit/components/alerts/src/Makefile.in 2009-08-21 15:31:20.000000000 +0200
@@ -60,6 +60,8 @@ CPPSRCS = \
nsAlertsService.cpp \
$(NULL)
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/components/build/
+
include $(topsrcdir)/config/rules.mk
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
diff -up mozilla-1.9.1/toolkit/components/alerts/src/nsAlertsService.cpp.libnotify mozilla-1.9.1/toolkit/components/alerts/src/nsAlertsService.cpp
--- mozilla-1.9.1/toolkit/components/alerts/src/nsAlertsService.cpp.libnotify 2009-07-30 17:30:31.000000000 +0200
+++ mozilla-1.9.1/toolkit/components/alerts/src/nsAlertsService.cpp 2009-08-21 15:31:20.000000000 +0200
@@ -47,6 +47,7 @@
#include "nsDependentString.h"
#include "nsWidgetsCID.h"
#include "nsILookAndFeel.h"
+#include "nsToolkitCompsCID.h"
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
@@ -73,9 +74,18 @@ NS_IMETHODIMP nsAlertsService::ShowAlert
nsIObserver * aAlertListener,
const nsAString & aAlertName)
{
+ // Check if there is an optional service that handles system-level notifications
+ nsCOMPtr<nsIAlertsService> sysAlerts(do_GetService(NS_SYSTEMALERTSERVICE_CONTRACTID));
+ nsresult rv;
+ if (sysAlerts) {
+ rv = sysAlerts->ShowAlertNotification(aImageUrl, aAlertTitle, aAlertText, aAlertTextClickable,
+ aAlertCookie, aAlertListener, aAlertName);
+ if (NS_SUCCEEDED(rv))
+ return rv;
+ }
+
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIDOMWindow> newWindow;
- nsresult rv;
nsCOMPtr<nsISupportsArray> argsArray;
rv = NS_NewISupportsArray(getter_AddRefs(argsArray));
diff -up mozilla-1.9.1/toolkit/components/build/nsToolkitCompsCID.h.libnotify mozilla-1.9.1/toolkit/components/build/nsToolkitCompsCID.h
--- mozilla-1.9.1/toolkit/components/build/nsToolkitCompsCID.h.libnotify 2009-07-30 17:30:31.000000000 +0200
+++ mozilla-1.9.1/toolkit/components/build/nsToolkitCompsCID.h 2009-08-21 15:31:20.000000000 +0200
@@ -38,6 +38,13 @@
#define NS_ALERTSERVICE_CONTRACTID \
"@mozilla.org/alerts-service;1"
+// This separate service uses the same nsIAlertsService interface,
+// but instead sends a notification to a platform alerts API
+// if available. Using a separate CID allows us to overwrite the XUL
+// alerts service at runtime.
+#define NS_SYSTEMALERTSERVICE_CONTRACTID \
+ "@mozilla.org/system-alerts-service;1"
+
#define NS_AUTOCOMPLETECONTROLLER_CONTRACTID \
"@mozilla.org/autocomplete/controller;1"
@@ -115,6 +122,10 @@
#define NS_ALERTSSERVICE_CID \
{ 0xa0ccaaf8, 0x9da, 0x44d8, { 0xb2, 0x50, 0x9a, 0xc3, 0xe9, 0x3c, 0x81, 0x17 } }
+// {84E11F80-CA55-11DD-AD8B-0800200C9A66}
+#define NS_SYSTEMALERTSSERVICE_CID \
+{ 0x84e11f80, 0xca55, 0x11dd, { 0xad, 0x8b, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
+
// {F6D5EBBD-34F4-487d-9D10-3D34123E3EB9}
#define NS_AUTOCOMPLETECONTROLLER_CID \
{ 0xf6d5ebbd, 0x34f4, 0x487d, { 0x9d, 0x10, 0x3d, 0x34, 0x12, 0x3e, 0x3e, 0xb9 } }
diff -up mozilla-1.9.1/toolkit/system/gnome/Makefile.in.libnotify mozilla-1.9.1/toolkit/system/gnome/Makefile.in
--- mozilla-1.9.1/toolkit/system/gnome/Makefile.in.libnotify 2009-07-30 17:30:33.000000000 +0200
+++ mozilla-1.9.1/toolkit/system/gnome/Makefile.in 2009-08-21 15:31:20.000000000 +0200
@@ -51,6 +51,13 @@ REQUIRES = \
xpcom \
string \
necko \
+ alerts \
+ gfx \
+ imglib2 \
+ intl \
+ widget \
+ thebes \
+ cairo \
$(NULL)
CPPSRCS = \
@@ -59,6 +66,13 @@ CPPSRCS = \
nsGnomeModule.cpp \
$(NULL)
+ifdef MOZ_ENABLE_LIBNOTIFY
+CPPSRCS += \
+ nsAlertsService.cpp \
+ nsAlertsIconListener.cpp \
+ $(NULL)
+endif
+
EXTRA_DSO_LDOPTS += \
$(XPCOM_GLUE_LDOPTS) \
$(XPCOM_FROZEN_LDOPTS) \
@@ -67,8 +81,11 @@ EXTRA_DSO_LDOPTS += \
$(MOZ_GNOMEVFS_LIBS) \
$(MOZ_LIBGNOME_LIBS) \
$(GLIB_LIBS) \
+ $(MOZ_LIBNOTIFY_LIBS) \
$(NULL)
+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/components/build/
+
include $(topsrcdir)/config/rules.mk
CXXFLAGS += \
@@ -76,4 +93,5 @@ CXXFLAGS += \
$(MOZ_GNOMEVFS_CFLAGS) \
$(MOZ_LIBGNOME_CFLAGS) \
$(GLIB_CFLAGS) \
+ $(MOZ_LIBNOTIFY_CFLAGS) \
$(NULL)
diff -up /dev/null mozilla-1.9.1/toolkit/system/gnome/nsAlertsIconListener.cpp
--- /dev/null 2009-08-21 10:27:01.489538501 +0200
+++ mozilla-1.9.1/toolkit/system/gnome/nsAlertsIconListener.cpp 2009-08-21 15:31:20.000000000 +0200
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsAlertsIconListener.h"
+#include "imgILoader.h"
+#include "imgIRequest.h"
+#include "gfxIImageFrame.h"
+#include "nsIImage.h"
+#include "nsNetUtil.h"
+#include "nsIImageToPixbuf.h"
+#include "nsIStringBundle.h"
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libnotify/notify.h>
+#include <gdk/gdk.h>
+
+static PRBool gHasActions = PR_FALSE;
+
+static void notify_action_cb(NotifyNotification *notification,
+ gchar *action, gpointer user_data)
+{
+ nsAlertsIconListener* alert = static_cast<nsAlertsIconListener*> (user_data);
+ alert->SendCallback();
+}
+
+static void notify_closed_cb(NotifyNotification *notification,
+ gpointer user_data)
+{
+ g_object_unref(notification);
+
+ nsAlertsIconListener* alert = static_cast<nsAlertsIconListener*> (user_data);
+ alert->SendClosed();
+ NS_RELEASE(alert);
+}
+
+NS_IMPL_ISUPPORTS2(nsAlertsIconListener, imgIContainerObserver, imgIDecoderObserver)
+
+nsAlertsIconListener::nsAlertsIconListener()
+: mLoadedFrame(PR_FALSE)
+{
+ MOZ_COUNT_CTOR(nsAlertsIconListener);
+}
+
+nsAlertsIconListener::~nsAlertsIconListener()
+{
+ MOZ_COUNT_DTOR(nsAlertsIconListener);
+
+ if (mIconRequest)
+ mIconRequest->CancelAndForgetObserver(NS_BINDING_ABORTED);
+}
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnStartRequest(imgIRequest* aRequest)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnStartDecode(imgIRequest* aRequest)
+{
+ return NS_OK;
+}
+
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnStartContainer(imgIRequest* aRequest,
+ imgIContainer* aContainer)
+{
+ return NS_OK;
+}
+
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnStartFrame(imgIRequest* aRequest,
+ gfxIImageFrame* aFrame)
+{
+ return NS_OK;
+}
+
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnDataAvailable(imgIRequest* aRequest,
+ gfxIImageFrame* aFrame,
+ const nsIntRect* aRect)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnStopContainer(imgIRequest* aRequest,
+ imgIContainer* aContainer)
+{
+ return NS_OK;
+}
+
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnStopDecode(imgIRequest* aRequest,
+ nsresult status,
+ const PRUnichar* statusArg)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAlertsIconListener::FrameChanged(imgIContainer* aContainer,
+ gfxIImageFrame* aFrame,
+ nsIntRect* aDirtyRect)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnStopRequest(imgIRequest* aRequest,
+ PRBool aIsLastPart)
+{
+ PRUint32 imgStatus = imgIRequest::STATUS_ERROR;
+ nsresult rv = aRequest->GetImageStatus(&imgStatus);
+ NS_ENSURE_SUCCESS(rv, rv);
+ if (imgStatus == imgIRequest::STATUS_ERROR && !mLoadedFrame) {
+ // We have an error getting the image. Display the notification with no icon.
+ ShowAlert(NULL);
+ }
+
+ if (mIconRequest) {
+ mIconRequest->Cancel(NS_BINDING_ABORTED);
+ mIconRequest = nsnull;
+ }
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAlertsIconListener::OnStopFrame(imgIRequest* aRequest,
+ gfxIImageFrame* aFrame)
+{
+ if (aRequest != mIconRequest)
+ return NS_ERROR_FAILURE;
+
+ if (mLoadedFrame)
+ return NS_OK; // only use one frame
+
+ nsCOMPtr<gfxIImageFrame> frame = aFrame;
+ nsCOMPtr<nsIImage> image = do_GetInterface(frame);
+ if (!image)
+ return NS_ERROR_FAILURE;
+
+ nsresult rv = image->LockImagePixels(PR_FALSE);
+ if (NS_FAILED(rv))
+ return rv;
+
+ nsCOMPtr<nsIImageToPixbuf> imgToPixbuf =
+ do_GetService("@mozilla.org/widget/image-to-gdk-pixbuf;1");
+
+ GdkPixbuf* imagePixbuf = imgToPixbuf->ConvertImageToPixbuf(image);
+ if (!imagePixbuf)
+ return NS_ERROR_FAILURE;
+
+ rv = image->UnlockImagePixels(PR_FALSE);
+ if (NS_FAILED(rv))
+ return rv;
+
+ ShowAlert(imagePixbuf);
+
+ g_object_unref(imagePixbuf);
+
+ mLoadedFrame = PR_TRUE;
+ return NS_OK;
+}
+
+nsresult
+nsAlertsIconListener::ShowAlert(GdkPixbuf* aPixbuf)
+{
+ NotifyNotification* notify = notify_notification_new(mAlertTitle.get(),
+ mAlertText.get(),
+ NULL, NULL);
+ if (!notify)
+ return NS_ERROR_OUT_OF_MEMORY;
+
+ if (aPixbuf)
+ notify_notification_set_icon_from_pixbuf(notify, aPixbuf);
+
+ NS_ADDREF(this);
+ if (mAlertHasAction) {
+ // What we put as the label doesn't matter here, if the action
+ // string is "default" then that makes the entire bubble clickable
+ // rather than creating a button.
+ notify_notification_add_action(notify, "default", "Activate",
+ notify_action_cb, this, NULL);
+ }
+
+ g_signal_connect(notify, "closed", G_CALLBACK(notify_closed_cb), this);
+ gboolean result = notify_notification_show(notify, NULL);
+
+ return result ? NS_OK : NS_ERROR_FAILURE;
+}
+
+nsresult
+nsAlertsIconListener::StartRequest(const nsAString & aImageUrl)
+{
+ if (mIconRequest) {
+ // Another icon request is already in flight. Kill it.
+ mIconRequest->Cancel(NS_BINDING_ABORTED);
+ mIconRequest = nsnull;
+ }
+
+ nsCOMPtr<nsIURI> imageUri;
+ NS_NewURI(getter_AddRefs(imageUri), aImageUrl);
+ if (!imageUri)
+ return ShowAlert(NULL);
+
+ nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1"));
+ if (!il)
+ return ShowAlert(NULL);
+
+ return il->LoadImage(imageUri, nsnull, nsnull, nsnull, this,
+ nsnull, nsIRequest::LOAD_NORMAL, nsnull, nsnull,
+ getter_AddRefs(mIconRequest));
+}
+
+void
+nsAlertsIconListener::SendCallback()
+{
+ mAlertListener->Observe(NULL, "alertclickcallback", mAlertCookie.get());
+}
+
+void
+nsAlertsIconListener::SendClosed()
+{
+ mAlertListener->Observe(NULL, "alertfinished", mAlertCookie.get());
+}
+
+nsresult
+nsAlertsIconListener::InitAlertAsync(const nsAString & aImageUrl,
+ const nsAString & aAlertTitle,
+ const nsAString & aAlertText,
+ PRBool aAlertTextClickable,
+ const nsAString & aAlertCookie,
+ nsIObserver * aAlertListener)
+{
+ if (!notify_is_initted()) {
+ // Give the name of this application to libnotify
+ nsCOMPtr<nsIStringBundleService> bundleService =
+ do_GetService(NS_STRINGBUNDLE_CONTRACTID);
+
+ nsCAutoString appShortName;
+ if (bundleService) {
+ nsCOMPtr<nsIStringBundle> bundle;
+ bundleService->CreateBundle("chrome://branding/locale/brand.properties",
+ getter_AddRefs(bundle));
+ nsAutoString appName;
+
+ if (bundle) {
+ bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
+ getter_Copies(appName));
+ appShortName = NS_ConvertUTF16toUTF8(appName);
+ } else {
+ NS_WARNING("brand.properties not present, using default application name");
+ appShortName.AssignLiteral("Mozilla");
+ }
+ } else {
+ appShortName.AssignLiteral("Mozilla");
+ }
+
+ if (!notify_init(appShortName.get()))
+ return NS_ERROR_FAILURE;
+
+ GList *server_caps = notify_get_server_caps();
+ if (server_caps) {
+ for (GList* cap = server_caps; cap != NULL; cap = cap->next) {
+ if (!strcmp((char*) cap->data, "actions")) {
+ gHasActions = PR_TRUE;
+ break;
+ }
+ }
+ g_list_foreach(server_caps, (GFunc)g_free, NULL);
+ g_list_free(server_caps);
+ }
+ }
+
+ if (!gHasActions && aAlertTextClickable)
+ return NS_ERROR_FAILURE; // No good, fallback to XUL
+
+ mAlertTitle = NS_ConvertUTF16toUTF8(aAlertTitle);
+ mAlertText = NS_ConvertUTF16toUTF8(aAlertText);
+
+ mAlertHasAction = aAlertTextClickable;
+
+ mAlertListener = aAlertListener;
+ mAlertCookie = aAlertCookie;
+
+ return StartRequest(aImageUrl);
+}
diff -up /dev/null mozilla-1.9.1/toolkit/system/gnome/nsAlertsIconListener.h
--- /dev/null 2009-08-21 10:27:01.489538501 +0200
+++ mozilla-1.9.1/toolkit/system/gnome/nsAlertsIconListener.h 2009-08-21 15:31:20.000000000 +0200
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nsAlertsIconListener_h__
+#define nsAlertsIconListener_h__
+
+#include "nsCOMPtr.h"
+#include "imgIDecoderObserver.h"
+#include "nsStringAPI.h"
+#include "nsIObserver.h"
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+class imgIRequest;
+
+class nsAlertsIconListener : public imgIDecoderObserver
+{
+public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_IMGICONTAINEROBSERVER
+ NS_DECL_IMGIDECODEROBSERVER
+
+ nsAlertsIconListener();
+ virtual ~nsAlertsIconListener();
+
+ nsresult InitAlertAsync(const nsAString & aImageUrl,
+ const nsAString & aAlertTitle,
+ const nsAString & aAlertText,
+ PRBool aAlertTextClickable,
+ const nsAString & aAlertCookie,
+ nsIObserver * aAlertListener);
+
+ void SendCallback();
+ void SendClosed();
+
+protected:
+ nsCOMPtr<imgIRequest> mIconRequest;
+ nsCString mAlertTitle;
+ nsCString mAlertText;
+
+ nsCOMPtr<nsIObserver> mAlertListener;
+ nsString mAlertCookie;
+
+ PRPackedBool mLoadedFrame;
+ PRPackedBool mAlertHasAction;
+
+ nsresult StartRequest(const nsAString & aImageUrl);
+ nsresult ShowAlert(GdkPixbuf* aPixbuf);
+};
+
+#endif
diff -up /dev/null mozilla-1.9.1/toolkit/system/gnome/nsAlertsService.cpp
--- /dev/null 2009-08-21 10:27:01.489538501 +0200
+++ mozilla-1.9.1/toolkit/system/gnome/nsAlertsService.cpp 2009-08-21 15:31:20.000000000 +0200
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsAlertsService.h"
+#include "nsAlertsIconListener.h"
+
+NS_IMPL_THREADSAFE_ADDREF(nsAlertsService)
+NS_IMPL_THREADSAFE_RELEASE(nsAlertsService)
+
+NS_INTERFACE_MAP_BEGIN(nsAlertsService)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAlertsService)
+ NS_INTERFACE_MAP_ENTRY(nsIAlertsService)
+NS_INTERFACE_MAP_END_THREADSAFE
+
+nsAlertsService::nsAlertsService()
+{}
+
+nsAlertsService::~nsAlertsService()
+{}
+
+nsresult
+nsAlertsService::Init()
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const nsAString & aImageUrl, const nsAString & aAlertTitle,
+ const nsAString & aAlertText, PRBool aAlertTextClickable,
+ const nsAString & aAlertCookie,
+ nsIObserver * aAlertListener,
+ const nsAString & aAlertName)
+{
+ nsCOMPtr<nsAlertsIconListener> alertListener = new nsAlertsIconListener();
+ if (!alertListener)
+ return NS_ERROR_OUT_OF_MEMORY;
+
+ return alertListener->InitAlertAsync(aImageUrl, aAlertTitle, aAlertText, aAlertTextClickable,
+ aAlertCookie, aAlertListener);
+}
diff -up /dev/null mozilla-1.9.1/toolkit/system/gnome/nsAlertsService.h
--- /dev/null 2009-08-21 10:27:01.489538501 +0200
+++ mozilla-1.9.1/toolkit/system/gnome/nsAlertsService.h 2009-08-21 15:31:20.000000000 +0200
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nsAlertsService_h__
+#define nsAlertsService_h__
+
+#include "nsIAlertsService.h"
+#include "nsCOMPtr.h"
+
+class nsAlertsService : public nsIAlertsService
+{
+public:
+ NS_DECL_NSIALERTSSERVICE
+ NS_DECL_ISUPPORTS
+
+ nsAlertsService();
+ virtual ~nsAlertsService();
+
+ nsresult Init();
+
+protected:
+
+};
+
+#endif /* nsAlertsService_h__ */
diff -up mozilla-1.9.1/toolkit/system/gnome/nsGnomeModule.cpp.libnotify mozilla-1.9.1/toolkit/system/gnome/nsGnomeModule.cpp
--- mozilla-1.9.1/toolkit/system/gnome/nsGnomeModule.cpp.libnotify 2009-07-30 17:30:33.000000000 +0200
+++ mozilla-1.9.1/toolkit/system/gnome/nsGnomeModule.cpp 2009-08-21 15:31:20.000000000 +0200
@@ -38,11 +38,20 @@
#include "nsGConfService.h"
#include "nsGnomeVFSService.h"
+#include "nsToolkitCompsCID.h"
#include "nsIGenericFactory.h"
+#ifdef MOZ_ENABLE_LIBNOTIFY
+#include "nsAlertsService.h"
+#endif
+
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGnomeVFSService, Init)
+#ifdef MOZ_ENABLE_LIBNOTIFY
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAlertsService, Init)
+#endif
+
static const nsModuleComponentInfo components[] = {
{ "GConf Service",
NS_GCONFSERVICE_CID,
@@ -51,7 +60,13 @@ static const nsModuleComponentInfo compo
{ "GnomeVFS Service",
NS_GNOMEVFSSERVICE_CID,
NS_GNOMEVFSSERVICE_CONTRACTID,
- nsGnomeVFSServiceConstructor }
+ nsGnomeVFSServiceConstructor },
+#ifdef MOZ_ENABLE_LIBNOTIFY
+ { "Gnome Alerts Service",
+ NS_SYSTEMALERTSSERVICE_CID,
+ NS_SYSTEMALERTSERVICE_CONTRACTID,
+ nsAlertsServiceConstructor },
+#endif
};
NS_IMPL_NSGETMODULE(mozgnome, components)
Index: xulrunner-mozconfig
===================================================================
RCS file: /cvs/pkgs/rpms/xulrunner/devel/xulrunner-mozconfig,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -p -r1.27 -r1.28
--- xulrunner-mozconfig 6 Aug 2009 07:52:21 -0000 1.27
+++ xulrunner-mozconfig 21 Aug 2009 13:40:34 -0000 1.28
@@ -28,6 +28,7 @@ ac_add_options --disable-javaxpcom
ac_add_options --disable-crashreporter
ac_add_options --enable-safe-browsing
ac_add_options --enable-extensions=default,python/xpcom
+ac_add_options --enable-libnotify
export BUILD_OFFICIAL=1
export MOZILLA_OFFICIAL=1
Index: xulrunner.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xulrunner/devel/xulrunner.spec,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -p -r1.173 -r1.174
--- xulrunner.spec 12 Aug 2009 10:49:32 -0000 1.173
+++ xulrunner.spec 21 Aug 2009 13:40:34 -0000 1.174
@@ -12,7 +12,7 @@
Summary: XUL Runtime for Gecko Applications
Name: xulrunner
Version: 1.9.1.2
-Release: 3%{?dist}
+Release: 4%{?dist}
URL: http://developer.mozilla.org/En/XULRunner
License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet
@@ -29,6 +29,7 @@ Patch2: mozilla-191-path.patch
Patch3: mozilla-jemalloc.patch
Patch4: mozilla-about-firefox-version.patch
Patch5: xulrunner-gtk-include.patch
+Patch6: mozilla-libnotify.patch
# Fedora specific patches
Patch10: mozilla-191-pkgconfig.patch
@@ -147,11 +148,13 @@ sed -e 's/__RPM_VERSION_INTERNAL__/%{ver
> version.patch
%{__patch} -p1 -b --suffix .version --fuzz=0 < version.patch
+
%patch1 -p1 -b .build
%patch2 -p1 -b .path
%patch3 -p1 -b .jemalloc
%patch4 -p1 -b .about-firefox-version
%patch5 -p1 -b .gtk-include
+%patch6 -p1 -b .libnotify
%patch10 -p1 -b .pk
@@ -451,6 +454,9 @@ fi
#---------------------------------------------------------------------
%changelog
+* Fri Aug 21 2009 Jan Horak <jhorak at redhat.com> - 1.9.1.2-4
+- Added libnotify support
+
* Wed Aug 12 2009 Martin Stransky <stransky at redhat.com> 1.9.1.2-3
- Added fix from #516118 - Headers not C89
More information about the fedora-extras-commits
mailing list