diff --git a/configure.in b/configure.in index 2d9e8758ae04..c8afb58e5318 100644 --- a/configure.in +++ b/configure.in @@ -5282,15 +5282,13 @@ dnl ======================================================== dnl = libnotify support dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(libnotify, +[ --enable-libnotify Enable libnotify support ], + MOZ_ENABLE_LIBNOTIFY=1, + MOZ_ENABLE_LIBNOTIFY=) + 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) diff --git a/toolkit/components/alerts/Makefile.in b/toolkit/components/alerts/Makefile.in index e7d651b4d2b2..23f20b372b69 100644 --- a/toolkit/components/alerts/Makefile.in +++ b/toolkit/components/alerts/Makefile.in @@ -57,9 +57,5 @@ DIRS += \ $(NULL) endif -ifdef ENABLE_TESTS -DIRS += test -endif - include $(topsrcdir)/config/rules.mk diff --git a/toolkit/components/alerts/src/nsAlertsService.cpp b/toolkit/components/alerts/src/nsAlertsService.cpp index 6e9f42a6f0c8..9a57432ba487 100644 --- a/toolkit/components/alerts/src/nsAlertsService.cpp +++ b/toolkit/components/alerts/src/nsAlertsService.cpp @@ -76,16 +76,13 @@ NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const nsAString & aImageUrl { // Check if there is an optional service that handles system-level notifications nsCOMPtr 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; - } + if (sysAlerts) + return sysAlerts->ShowAlertNotification(aImageUrl, aAlertTitle, aAlertText, aAlertTextClickable, + aAlertCookie, aAlertListener, aAlertName); nsCOMPtr wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID)); nsCOMPtr newWindow; + nsresult rv; nsCOMPtr argsArray; rv = NS_NewISupportsArray(getter_AddRefs(argsArray)); diff --git a/toolkit/components/alerts/test/Makefile.in b/toolkit/components/alerts/test/Makefile.in deleted file mode 100644 index b6952df05464..000000000000 --- a/toolkit/components/alerts/test/Makefile.in +++ /dev/null @@ -1,55 +0,0 @@ -# -# ***** 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) 2009 -# 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 ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ -relativesrcdir = toolkit/components/alerts/test - -include $(DEPTH)/config/autoconf.mk - -# Mochitest tests -MOCHI_TESTS = \ - test_alerts.html \ - $(NULL) - - -include $(topsrcdir)/config/rules.mk - -libs:: $(MOCHI_TESTS) - $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) diff --git a/toolkit/components/alerts/test/test_alerts.html b/toolkit/components/alerts/test/test_alerts.html deleted file mode 100644 index 6ae4db03a562..000000000000 --- a/toolkit/components/alerts/test/test_alerts.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - Test for Alerts Service - - - - - -

- -Alerts service mochitest
- -Did an alert appear anywhere?
-If so, the test will finish once the alert disappears. If not, the test will time out.
- -
-
-
- - - diff --git a/toolkit/system/gnome/Makefile.in b/toolkit/system/gnome/Makefile.in index 007575690a9a..bf94c34137d5 100644 --- a/toolkit/system/gnome/Makefile.in +++ b/toolkit/system/gnome/Makefile.in @@ -56,8 +56,6 @@ REQUIRES = \ imglib2 \ intl \ widget \ - thebes \ - cairo \ $(NULL) CPPSRCS = \ diff --git a/toolkit/system/gnome/nsAlertsIconListener.cpp b/toolkit/system/gnome/nsAlertsIconListener.cpp index dbc12a2d3801..1e476609b1aa 100644 --- a/toolkit/system/gnome/nsAlertsIconListener.cpp +++ b/toolkit/system/gnome/nsAlertsIconListener.cpp @@ -46,26 +46,6 @@ #include #include -#include - -static PRBool gHasActions = PR_FALSE; - -static void notify_action_cb(NotifyNotification *notification, - gchar *action, gpointer user_data) -{ - nsAlertsIconListener* alert = static_cast (user_data); - alert->SendCallback(); -} - -static void notify_closed_cb(NotifyNotification *notification, - gpointer user_data) -{ - g_object_unref(notification); - - nsAlertsIconListener* alert = static_cast (user_data); - alert->SendClosed(); - NS_RELEASE(alert); -} NS_IMPL_ISUPPORTS2(nsAlertsIconListener, imgIContainerObserver, imgIDecoderObserver) @@ -213,17 +193,9 @@ nsAlertsIconListener::ShowAlert(GdkPixbuf* aPixbuf) 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); + notify_notification_set_timeout(notify, NOTIFY_EXPIRES_DEFAULT); gboolean result = notify_notification_show(notify, NULL); + g_object_unref(notify); return result ? NS_OK : NS_ERROR_FAILURE; } @@ -251,25 +223,10 @@ nsAlertsIconListener::StartRequest(const nsAString & aImageUrl) 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) + const nsAString & aAlertText) { if (!notify_is_initted()) { // Give the name of this application to libnotify @@ -297,30 +254,10 @@ nsAlertsIconListener::InitAlertAsync(const nsAString & aImageUrl, 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 --git a/toolkit/system/gnome/nsAlertsIconListener.h b/toolkit/system/gnome/nsAlertsIconListener.h index b05571e54a35..5ad04df30a73 100644 --- a/toolkit/system/gnome/nsAlertsIconListener.h +++ b/toolkit/system/gnome/nsAlertsIconListener.h @@ -41,7 +41,6 @@ #include "nsCOMPtr.h" #include "imgIDecoderObserver.h" #include "nsStringAPI.h" -#include "nsIObserver.h" #include @@ -59,24 +58,14 @@ public: nsresult InitAlertAsync(const nsAString & aImageUrl, const nsAString & aAlertTitle, - const nsAString & aAlertText, - PRBool aAlertTextClickable, - const nsAString & aAlertCookie, - nsIObserver * aAlertListener); - - void SendCallback(); - void SendClosed(); + const nsAString & aAlertText); protected: nsCOMPtr mIconRequest; nsCString mAlertTitle; nsCString mAlertText; - nsCOMPtr mAlertListener; - nsString mAlertCookie; - PRPackedBool mLoadedFrame; - PRPackedBool mAlertHasAction; nsresult StartRequest(const nsAString & aImageUrl); nsresult ShowAlert(GdkPixbuf* aPixbuf); diff --git a/toolkit/system/gnome/nsAlertsService.cpp b/toolkit/system/gnome/nsAlertsService.cpp index e9dc15ee9145..6881a5aade97 100644 --- a/toolkit/system/gnome/nsAlertsService.cpp +++ b/toolkit/system/gnome/nsAlertsService.cpp @@ -68,6 +68,5 @@ NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const nsAString & aImageUrl if (!alertListener) return NS_ERROR_OUT_OF_MEMORY; - return alertListener->InitAlertAsync(aImageUrl, aAlertTitle, aAlertText, aAlertTextClickable, - aAlertCookie, aAlertListener); + return alertListener->InitAlertAsync(aImageUrl, aAlertTitle, aAlertText); }