diff options
author | Christian Persch <chpe@src.gnome.org> | 2007-09-28 23:17:48 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2007-09-28 23:17:48 +0800 |
commit | bfd1d5ab3539021b0e759756f748ac205f1eb645 (patch) | |
tree | 4f8c39a23e2bbb63de673339b8eaf054bb704389 /embed | |
parent | f3a7cf8b0223fdc39993d6da985dd3fe32a0740e (diff) | |
download | gsoc2013-epiphany-bfd1d5ab3539021b0e759756f748ac205f1eb645.tar gsoc2013-epiphany-bfd1d5ab3539021b0e759756f748ac205f1eb645.tar.gz gsoc2013-epiphany-bfd1d5ab3539021b0e759756f748ac205f1eb645.tar.bz2 gsoc2013-epiphany-bfd1d5ab3539021b0e759756f748ac205f1eb645.tar.lz gsoc2013-epiphany-bfd1d5ab3539021b0e759756f748ac205f1eb645.tar.xz gsoc2013-epiphany-bfd1d5ab3539021b0e759756f748ac205f1eb645.tar.zst gsoc2013-epiphany-bfd1d5ab3539021b0e759756f748ac205f1eb645.zip |
Make it build.
svn path=/trunk/; revision=7505
Diffstat (limited to 'embed')
-rw-r--r-- | embed/xulrunner/utils/Makefile.am | 2 | ||||
-rw-r--r-- | embed/xulrunner/utils/ggeAutoModalDialog.cpp | 35 | ||||
-rw-r--r-- | embed/xulrunner/utils/ggeAutoModalDialog.h | 6 |
3 files changed, 25 insertions, 18 deletions
diff --git a/embed/xulrunner/utils/Makefile.am b/embed/xulrunner/utils/Makefile.am index 781735962..a66ecf054 100644 --- a/embed/xulrunner/utils/Makefile.am +++ b/embed/xulrunner/utils/Makefile.am @@ -13,6 +13,8 @@ libephyxulrunnerutils_la_SOURCES = \ EphyUtils.h \ GeckoUtils.cpp \ GeckoUtils.h \ + ggeAutoModalDialog.cpp \ + ggeAutoModalDialog.h \ ggeAutoSurvivalArea.cpp \ ggeAutoSurvivalArea.h \ $(NULL) diff --git a/embed/xulrunner/utils/ggeAutoModalDialog.cpp b/embed/xulrunner/utils/ggeAutoModalDialog.cpp index 80e5a33a1..76029d2f3 100644 --- a/embed/xulrunner/utils/ggeAutoModalDialog.cpp +++ b/embed/xulrunner/utils/ggeAutoModalDialog.cpp @@ -37,24 +37,27 @@ struct JSContext; /* Just so we don't need to include a bunch of JS headers */ #include <nsIDOMEvent.h> #include <nsIDOMEventTarget.h> #include <nsIJSContextStack.h> +#include <nsIPrivateDOMEvent.h> #include <nsPIDOMWindow.h> #include <nsServiceManagerUtils.h> #include <nsThreadUtils.h> +#include <gtk/gtkdialog.h> + #include "ggeAutoModalDialog.h" ggeAutoModalDialog::ggeAutoModalDialog (nsIDOMWindow *aWindow, PRBool aNotifyDOM) : mWindow (aWindow), - mPWindow (do_QueryInterface (aWindow)) - mStack (do_GetService ("@mozilla.org/js/xpc/ContextStack;1")) + mPWindow (do_QueryInterface (aWindow)), + mStack (do_GetService ("@mozilla.org/js/xpc/ContextStack;1")), mDefaultEnabled (PR_TRUE), mContextPushed (PR_FALSE), mModalStateSet (PR_FALSE) { /* First we check whether we should show the dialogue at all */ if (aNotifyDOM) { - mDefaultEnabled = DispatchEvent ("DOMWillOpenModalDialog")); + mDefaultEnabled = DispatchEvent ("DOMWillOpenModalDialog"); if (!mDefaultEnabled) { return; } @@ -67,7 +70,7 @@ ggeAutoModalDialog::ggeAutoModalDialog (nsIDOMWindow *aWindow, if (mWindow) { NS_ASSERTION (mPWindow, "Should have a window here!"); - mWindow->EnterModalState (); + mPWindow->EnterModalState (); mModalStateSet = PR_TRUE; } } @@ -76,7 +79,7 @@ ggeAutoModalDialog::~ggeAutoModalDialog () { if (mModalStateSet) { NS_ASSERTION (mPWindow, "Should have a window here!"); - mWindow->LeaveModalState (); + mPWindow->LeaveModalState (); } if (mContextPushed) { @@ -102,7 +105,7 @@ ggeAutoModalDialog::ResponseCallback (GtkWidget *aDialog, obj->mContinueModalLoop = PR_FALSE; } -static gboolean PR_CALLBACK +/* static */ gboolean PR_CALLBACK ggeAutoModalDialog::DeleteCallback (GtkWidget *aDialog, void *aEvent, void *aData) @@ -111,8 +114,8 @@ ggeAutoModalDialog::DeleteCallback (GtkWidget *aDialog, return TRUE; } -int -ggeAutoModalDialog::Run (GtkDialog *aDialog) +void +ggeAutoModalDialog::Run (GtkWidget *aDialog) { NS_ASSERTION (ShouldShow(), "Calling ::Run on a prevented dialogue!"); @@ -125,18 +128,20 @@ ggeAutoModalDialog::Run (GtkDialog *aDialog) // being active the whole time a modal dialog is open. nsAutoPopupStatePusher popupStatePusher (mPWindow, openAbused); - mDialog = g_object_ref_sink (aDialog); + mDialog = aDialog; + g_object_ref_sink (mDialog); mResponse = GTK_RESPONSE_DELETE_EVENT; gulong responseHandler = g_signal_connect (mDialog, "response", - ResponseCallback, + G_CALLBACK (ResponseCallback), reinterpret_cast<void*>(this)); gulong deleteHandler = g_signal_connect (mDialog, "delete-event", - DeleteCallback, + G_CALLBACK (DeleteCallback), reinterpret_cast<void*>(this)); - - nsIThread *thread = NS_GetCurrentThread(); + + nsCOMPtr<nsIThread> thread (do_GetCurrentThread ()); + NS_ASSERTION (thread, "No UI thread?"); mContinueModalLoop = PR_TRUE; while (mContinueModalLoop) { @@ -152,7 +157,7 @@ ggeAutoModalDialog::Run (GtkDialog *aDialog) } PRBool -ggeAutoModalDialog::DispatchEvent (const char *aEvent) +ggeAutoModalDialog::DispatchEvent (const char *aEventName) { if (!mWindow) { return PR_TRUE; @@ -171,7 +176,7 @@ ggeAutoModalDialog::DispatchEvent (const char *aEvent) nsCOMPtr<nsIPrivateDOMEvent> privateEvent (do_QueryInterface (event)); if (privateEvent) { - event->InitEvent(NS_ConvertASCIItoUTF16(aEventName), PR_TRUE, PR_TRUE); + event->InitEvent (NS_ConvertASCIItoUTF16 (aEventName), PR_TRUE, PR_TRUE); privateEvent->SetTrusted(PR_TRUE); diff --git a/embed/xulrunner/utils/ggeAutoModalDialog.h b/embed/xulrunner/utils/ggeAutoModalDialog.h index e52ebc577..0c9da0fcd 100644 --- a/embed/xulrunner/utils/ggeAutoModalDialog.h +++ b/embed/xulrunner/utils/ggeAutoModalDialog.h @@ -50,10 +50,10 @@ class ggeAutoModalDialog // stack only please void *operator new (size_t) CPP_THROW_NEW; - PRBool DispatchEvent (const char *aEvent); + PRBool DispatchEvent (const char *aEventName); - static void PR_CALLBACK DialogResponseCallback (GtkWidget*, int, void*); - static gboolean PR_CALLBACK DialogDeleteCallback (GtkWidget*, void*, void*); + static void PR_CALLBACK ResponseCallback (GtkWidget*, int, void*); + static gboolean PR_CALLBACK DeleteCallback (GtkWidget*, void*, void*); nsCOMPtr<nsIDOMWindow> mWindow; nsCOMPtr<nsPIDOMWindow> mPWindow; |