aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-02-03 01:56:28 +0800
committerChristian Persch <chpe@src.gnome.org>2006-02-03 01:56:28 +0800
commitb311ff4ba10c572412ff812806a9e53c8928500c (patch)
tree1531366f72dbe745e96861f65465476e95936d7f /embed
parent02459287792457cac98e02641a7d2aaad303b88d (diff)
downloadgsoc2013-epiphany-b311ff4ba10c572412ff812806a9e53c8928500c.tar
gsoc2013-epiphany-b311ff4ba10c572412ff812806a9e53c8928500c.tar.gz
gsoc2013-epiphany-b311ff4ba10c572412ff812806a9e53c8928500c.tar.bz2
gsoc2013-epiphany-b311ff4ba10c572412ff812806a9e53c8928500c.tar.lz
gsoc2013-epiphany-b311ff4ba10c572412ff812806a9e53c8928500c.tar.xz
gsoc2013-epiphany-b311ff4ba10c572412ff812806a9e53c8928500c.tar.zst
gsoc2013-epiphany-b311ff4ba10c572412ff812806a9e53c8928500c.zip
Add GECKO_CHECK_HEADERS, wrapping AC_CHECK_HEADERS.
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.
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/EphyPromptService.cpp58
-rw-r--r--embed/mozilla/EphyPromptService.h12
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp8
3 files changed, 76 insertions, 2 deletions
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)