aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--embed/mozilla/EphyPromptService.cpp58
-rw-r--r--embed/mozilla/EphyPromptService.h12
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp8
-rw-r--r--m4/gecko.m416
5 files changed, 103 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 0132f6107..51b563084 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2006-02-02 Christian Persch <chpe@cvs.gnome.org>
+ * m4/gecko.m4:
+
+ Add GECKO_CHECK_HEADERS, wrapping AC_CHECK_HEADERS.
+
+ * configure.ac:
+
+ Simplify some header checks with GECKO_CHECK_HEADERS.
+ Check for nsINonBlockingAlertService.h.
+
+ * embed/mozilla/EphyPromptService.cpp:
+ * embed/mozilla/EphyPromptService.h:
+ * embed/mozilla/MozRegisterComponents.cpp:
+
+ Implement nsINonBlockingAlertService.
+
+2006-02-02 Christian Persch <chpe@cvs.gnome.org>
+
* embed/downloader-view.c:
* embed/downloader-view.h:
* embed/ephy-embed-shell.c:
diff --git a/embed/mozilla/EphyPromptService.cpp b/embed/mozilla/EphyPromptService.cpp
index 265dd9f31..6b6abf382 100644
--- a/embed/mozilla/EphyPromptService.cpp
+++ b/embed/mozilla/EphyPromptService.cpp
@@ -86,6 +86,7 @@ public:
void GetSelected (PRInt32*);
PRInt32 Run (PRBool * = nsnull);
+ static void ShowAndForget (Prompter*);
PRBool IsCalledFromScript ();
void PerformScriptAbortion ();
@@ -515,6 +516,35 @@ Prompter::Run (PRBool *aSuccess)
return mResponse;
}
+static void
+DeletePrompter (gpointer aPromptPtr,
+ GObject *aZombie)
+{
+ Prompter *prompt = NS_STATIC_CAST (Prompter*, aPromptPtr);
+
+ delete prompt;
+}
+
+static void
+DestroyOnResonse (GtkWidget *aDialog,
+ int aResponse,
+ gpointer aUserData)
+{
+ gtk_widget_destroy (aDialog);
+}
+
+/* static */ void
+Prompter::ShowAndForget (Prompter *aPrompt)
+{
+ g_signal_connect (aPrompt->mDialog, "response",
+ G_CALLBACK (DestroyOnResonse), NULL);
+ g_object_weak_ref (G_OBJECT (aPrompt->mDialog),
+ (GWeakNotify) DeletePrompter,
+ NS_STATIC_CAST (gpointer, aPrompt));
+
+ gtk_widget_show (GTK_WIDGET (aPrompt->mDialog));
+}
+
PRBool
Prompter::IsCalledFromScript()
{
@@ -604,7 +634,14 @@ Prompter::ConvertAndEscapeButtonText(const PRUnichar *aText,
}
/* FIXME: needs THREADSAFE? */
-NS_IMPL_ISUPPORTS1 (EphyPromptService, nsIPromptService)
+#if HAVE_NSINONBLOCKINGALERTSERVICE_H
+NS_IMPL_ISUPPORTS2 (EphyPromptService,
+ nsIPromptService,
+ nsINonBlockingAlertService)
+#else
+NS_IMPL_ISUPPORTS1 (EphyPromptService,
+ nsIPromptService)
+#endif
EphyPromptService::EphyPromptService()
{
@@ -822,3 +859,22 @@ EphyPromptService::Select (nsIDOMWindow *aParent,
return RETVAL(response);
}
+
+#if HAVE_NSINONBLOCKINGALERTSERVICE_H
+
+/* showNonBlockingAlert (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText); */
+NS_IMETHODIMP
+EphyPromptService::ShowNonBlockingAlert (nsIDOMWindow *aParent,
+ const PRUnichar *aDialogTitle,
+ const PRUnichar *aText)
+{
+ Prompter *prompt = new Prompter (GTK_STOCK_DIALOG_INFO, aParent, aDialogTitle, aText);
+ if (!prompt) return NS_ERROR_OUT_OF_MEMORY;
+
+ prompt->AddStockButton (GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
+ prompt->ShowAndForget ();
+
+ return NS_OK;
+}
+
+#endif /* HAVE_NSINONBLOCKINGALERTSERVICE_H */
diff --git a/embed/mozilla/EphyPromptService.h b/embed/mozilla/EphyPromptService.h
index 0eb100d76..915ecf947 100644
--- a/embed/mozilla/EphyPromptService.h
+++ b/embed/mozilla/EphyPromptService.h
@@ -23,6 +23,10 @@
#include <nsIPromptService.h>
+#if HAVE_NSINONBLOCKINGALERTSERVICE_H
+#include <nsINonBlockingAlertService.h>
+#endif
+
#define EPHY_PROMPT_SERVICE_IID \
{ /* 6e8b90d4-78a6-41c5-98da-b1559a40d30d */ \
0x6e8b90d4, 0x78a6, 0x41c5, \
@@ -31,11 +35,17 @@
#define EPHY_PROMPT_SERVICE_CLASSNAME "Epiphany Prompt Service"
class EphyPromptService : public nsIPromptService
+#if HAVE_NSINONBLOCKINGALERTSERVICE_H
+ , public nsINonBlockingAlertService
+#endif
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPROMPTSERVICE
-
+#if HAVE_NSINONBLOCKINGALERTSERVICE_H
+ NS_DECL_NSINONBLOCKINALERTSERVICE
+#endif
+
EphyPromptService();
virtual ~EphyPromptService();
};
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index a7fe6d08b..03867c699 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -229,6 +229,14 @@ static const nsModuleComponentInfo sAppComps[] = {
"@mozilla.org/embedcomp/prompt-service;1",
EphyPromptServiceConstructor
},
+#ifdef HAVE_NSINONBLOCKINGALERTSERVICE_H
+ {
+ EPHY_PROMPT_SERVICE_CLASSNAME,
+ EPHY_PROMPT_SERVICE_IID,
+ "@mozilla.org/embedcomp/nbalert-service;1",
+ EphyPromptServiceConstructor
+ },
+#endif /* HAVE_NSINONBLOCKINGALERTSERVICE_H */
};
#if defined(HAVE_MOZILLA_PSM) && !defined(HAVE_GECKO_1_8)
diff --git a/m4/gecko.m4 b/m4/gecko.m4
index 22f95151f..0611b024d 100644
--- a/m4/gecko.m4
+++ b/m4/gecko.m4
@@ -283,7 +283,7 @@ $1[]_VERSION_MINOR=$gecko_cv_gecko_version_minor
# ***************************************************************************
# ***************************************************************************
-# GECKO_DISPATCH([MACRO], [HEADERS], ...)
+# GECKO_DISPATCH([MACRO], [INCLUDEDIRS], ...)
m4_define([GECKO_DISPATCH],
[
@@ -301,15 +301,15 @@ CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS -I$_GECKO_INCLUDE_ROOT $($PKG_CONFIG
CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-xpcom)"
LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS $($PKG_CONFIG --libs ${gecko_cv_gecko}-xpcom) -Wl,--rpath=$_GECKO_HOME"
-_GECKO_DISPATCH_HEADERS="$2"
+_GECKO_DISPATCH_INCLUDEDIRS="$2"
# Sigh Gentoo has a rubbish header layout
# http://bugs.gentoo.org/show_bug.cgi?id=100804
# Mind you, it's useful to be able to test against uninstalled mozilla builds...
-_GECKO_DISPATCH_HEADERS="$_GECKO_DISPATCH_HEADERS necko dom"
+_GECKO_DISPATCH_INCLUDEDIRS="$_GECKO_DISPATCH_INCLUDEDIRS dom necko pref"
# Now add them to CPPFLAGS
-for i in $_GECKO_DISPATCH_HEADERS; do
+for i in $_GECKO_DISPATCH_INCLUDEDIRS; do
CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT/$i"
done
@@ -327,11 +327,15 @@ AC_LANG_POP([C++])
# ***************************************************************************
# ***************************************************************************
-# GECKO_COMPILE_IFELSE(HEADERS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# GECKO_CHECK_HEADERS(INCLUDEDIRS, HEADERS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [INCLUDES])
+
+AC_DEFUN([GECKO_CHECK_HEADERS],[GECKO_DISPATCH([AC_CHECK_HEADERS],$@)])
+
+# GECKO_COMPILE_IFELSE(INCLUDEDIRS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
AC_DEFUN([GECKO_COMPILE_IFELSE],[GECKO_DISPATCH([AC_COMPILE_IFELSE],$@)])
-# GECKO_RUN_IFELSE(HEADERS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# GECKO_RUN_IFELSE(INCLUDEDIRS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
AC_DEFUN([GECKO_RUN_IFELSE],[GECKO_DISPATCH([AC_RUN_IFELSE],$@)])