Bug 408823 - "Killing GTK1, deprecated glib uses" [p=romaxa@gmail.com (romaxa) r=mpgritti a1.9=schrep]

This commit is contained in:
reed@reedloden.com 2008-01-11 14:16:15 -08:00
parent 2e8592133a
commit 0c878c9e92
7 changed files with 365 additions and 325 deletions

View File

@ -77,9 +77,9 @@ EmbedContentListener::OnStartURIOpen(nsIURI *aURI,
return rv;
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[OPEN_URI],
specString.get(), &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[OPEN_URI], 0,
specString.get(), &return_val);
*aAbortOpen = return_val;

View File

@ -86,9 +86,9 @@ EmbedEventListener::KeyDown(nsIDOMEvent* aDOMEvent)
// Return FALSE to this function to mark the event as not
// consumed...
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_KEY_DOWN],
(void *)keyEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_KEY_DOWN], 0,
(void *)keyEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -106,9 +106,9 @@ EmbedEventListener::KeyUp(nsIDOMEvent* aDOMEvent)
// return FALSE to this function to mark this event as not
// consumed...
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_KEY_UP],
(void *)keyEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_KEY_UP], 0,
(void *)keyEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -125,9 +125,9 @@ EmbedEventListener::KeyPress(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_KEY_PRESS],
(void *)keyEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_KEY_PRESS], 0,
(void *)keyEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -144,9 +144,9 @@ EmbedEventListener::MouseDown(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_DOWN],
(void *)mouseEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_DOWN], 0,
(void *)mouseEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -163,9 +163,9 @@ EmbedEventListener::MouseUp(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_UP],
(void *)mouseEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_UP], 0,
(void *)mouseEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -182,9 +182,9 @@ EmbedEventListener::MouseClick(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_CLICK],
(void *)mouseEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_CLICK], 0,
(void *)mouseEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -201,9 +201,9 @@ EmbedEventListener::MouseDblClick(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_DBL_CLICK],
(void *)mouseEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_DBL_CLICK], 0,
(void *)mouseEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -220,9 +220,9 @@ EmbedEventListener::MouseOver(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_OVER],
(void *)mouseEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_OVER], 0,
(void *)mouseEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -239,9 +239,9 @@ EmbedEventListener::MouseOut(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_OUT],
(void *)mouseEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_MOUSE_OUT], 0,
(void *)mouseEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -257,9 +257,9 @@ EmbedEventListener::Activate(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_ACTIVATE],
(void *)uiEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_ACTIVATE], 0,
(void *)uiEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -275,9 +275,9 @@ EmbedEventListener::FocusIn(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_FOCUS_IN],
(void *)uiEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_FOCUS_IN], 0,
(void *)uiEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
@ -293,9 +293,9 @@ EmbedEventListener::FocusOut(nsIDOMEvent* aDOMEvent)
return NS_OK;
// Return TRUE from your signal handler to mark the event as consumed.
gint return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_FOCUS_OUT],
(void *)uiEvent, &return_val);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DOM_FOCUS_OUT], 0,
(void *)uiEvent, &return_val);
if (return_val) {
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();

View File

@ -75,8 +75,8 @@ EmbedProgress::OnStateChange(nsIWebProgress *aWebProgress,
if ((aStateFlags & GTK_MOZ_EMBED_FLAG_IS_NETWORK) &&
(aStateFlags & GTK_MOZ_EMBED_FLAG_START))
{
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_START]);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_START], 0);
}
// get the uri for this request
@ -87,20 +87,20 @@ EmbedProgress::OnStateChange(nsIWebProgress *aWebProgress,
if (mOwner->mURI.Equals(uriString))
{
// for people who know what they are doing
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STATE],
aStateFlags, aStatus);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STATE], 0,
aStateFlags, aStatus);
}
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STATE_ALL],
uriString.get(),
(gint)aStateFlags, (gint)aStatus);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STATE_ALL], 0,
uriString.get(),
(gint)aStateFlags, (gint)aStatus);
// and for stop, too
if ((aStateFlags & GTK_MOZ_EMBED_FLAG_IS_NETWORK) &&
if ((aStateFlags & GTK_MOZ_EMBED_FLAG_IS_NETWORK) &&
(aStateFlags & GTK_MOZ_EMBED_FLAG_STOP))
{
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STOP]);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[NET_STOP], 0);
// let our owner know that the load finished
mOwner->ContentFinishedLoading();
}
@ -119,18 +119,18 @@ EmbedProgress::OnProgressChange(nsIWebProgress *aWebProgress,
nsCAutoString uriString;
RequestToURIString(aRequest, uriString);
// is it the same as the current uri?
if (mOwner->mURI.Equals(uriString)) {
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[PROGRESS],
aCurTotalProgress, aMaxTotalProgress);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[PROGRESS], 0,
aCurTotalProgress, aMaxTotalProgress);
}
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[PROGRESS_ALL],
uriString.get(),
aCurTotalProgress, aMaxTotalProgress);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[PROGRESS_ALL], 0,
uriString.get(),
aCurTotalProgress, aMaxTotalProgress);
return NS_OK;
}
@ -162,8 +162,8 @@ EmbedProgress::OnLocationChange(nsIWebProgress *aWebProgress,
if (!isSubFrameLoad) {
mOwner->SetURI(newURI.get());
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[LOCATION]);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[LOCATION], 0);
}
return NS_OK;
@ -175,11 +175,11 @@ EmbedProgress::OnStatusChange(nsIWebProgress *aWebProgress,
nsresult aStatus,
const PRUnichar *aMessage)
{
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[STATUS_CHANGE],
static_cast<void *>(aRequest),
static_cast<int>(aStatus),
static_cast<const void *>(aMessage));
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[STATUS_CHANGE], 0,
static_cast<void *>(aRequest),
static_cast<int>(aStatus),
static_cast<const void *>(aMessage));
return NS_OK;
}
@ -189,10 +189,10 @@ EmbedProgress::OnSecurityChange(nsIWebProgress *aWebProgress,
nsIRequest *aRequest,
PRUint32 aState)
{
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[SECURITY_CHANGE],
static_cast<void *>(aRequest),
aState);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[SECURITY_CHANGE], 0,
static_cast<void *>(aRequest),
aState);
return NS_OK;
}

View File

@ -137,8 +137,8 @@ EmbedWindow::SetStatus(PRUint32 aStatusType, const PRUnichar *aStatus)
case STATUS_SCRIPT:
{
mJSStatus = aStatus;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[JS_STATUS]);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[JS_STATUS], 0);
}
break;
case STATUS_SCRIPT_DEFAULT:
@ -147,8 +147,8 @@ EmbedWindow::SetStatus(PRUint32 aStatusType, const PRUnichar *aStatus)
case STATUS_LINK:
{
mLinkMessage = aStatus;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[LINK_MESSAGE]);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[LINK_MESSAGE], 0);
}
break;
}
@ -190,16 +190,16 @@ EmbedWindow::DestroyBrowserWindow(void)
// mark the owner as destroyed so it won't emit events anymore.
mOwner->mIsDestroyed = PR_TRUE;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DESTROY_BROWSER]);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DESTROY_BROWSER], 0);
return NS_OK;
}
NS_IMETHODIMP
EmbedWindow::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
{
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[SIZE_TO], aCX, aCY);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[SIZE_TO], 0, aCX, aCY);
return NS_OK;
}
@ -320,8 +320,8 @@ NS_IMETHODIMP
EmbedWindow::SetTitle(const PRUnichar *aTitle)
{
mTitle = aTitle;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[TITLE]);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[TITLE], 0);
return NS_OK;
}
@ -359,9 +359,9 @@ EmbedWindow::SetVisibility(PRBool aVisibility)
if (mOwner->mIsChrome && !mOwner->mChromeLoaded)
return NS_OK;
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[VISIBILITY],
aVisibility);
g_signal_emit(G_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[VISIBILITY], 0,
aVisibility);
return NS_OK;
}
@ -406,7 +406,7 @@ EmbedWindow::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords,
sTipWindow = gtk_window_new(GTK_WINDOW_POPUP);
gtk_widget_set_app_paintable(sTipWindow, TRUE);
gtk_window_set_policy(GTK_WINDOW(sTipWindow), FALSE, FALSE, TRUE);
gtk_window_set_resizable(GTK_WINDOW(sTipWindow), TRUE);
// needed to get colors + fonts etc correctly
gtk_widget_set_name(sTipWindow, "gtk-tooltips");
@ -423,8 +423,8 @@ EmbedWindow::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords,
// realize the widget
gtk_widget_realize(sTipWindow);
gtk_signal_connect(GTK_OBJECT(sTipWindow), "expose_event",
GTK_SIGNAL_FUNC(tooltips_paint_window), NULL);
g_signal_connect(G_OBJECT(sTipWindow), "expose_event",
G_CALLBACK(tooltips_paint_window), NULL);
// set up the label for the tooltip
GtkWidget *label = gtk_label_new(tipString);

View File

@ -73,9 +73,9 @@ EmbedWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent,
if (!embedPrivate)
return NS_ERROR_FAILURE;
gtk_signal_emit(GTK_OBJECT(embedPrivate->mOwningWidget),
moz_embed_signals[NEW_WINDOW],
&newEmbed, (guint)aChromeFlags);
g_signal_emit(G_OBJECT(embedPrivate->mOwningWidget),
moz_embed_signals[NEW_WINDOW], 0,
&newEmbed, (guint)aChromeFlags);
}

View File

@ -137,7 +137,7 @@ struct _GtkMozEmbedClass
gint (* dom_focus_out) (GtkMozEmbed *embed, gpointer dom_event);
};
GTKMOZEMBED_API(GtkType, gtk_moz_embed_get_type, (void))
GTKMOZEMBED_API(GType, gtk_moz_embed_get_type, (void))
GTKMOZEMBED_API(GtkWidget*, gtk_moz_embed_new, (void))
GTKMOZEMBED_API(void, gtk_moz_embed_push_startup, (void))
GTKMOZEMBED_API(void, gtk_moz_embed_pop_startup, (void))
@ -257,6 +257,7 @@ typedef enum
#define GTK_MOZ_EMBED_SINGLE_CLASS(klass) GTK_CHEK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED_SINGLE, GtkMozEmbedSingleClass)
#define GTK_IS_MOZ_EMBED_SINGLE(obj) GTK_CHECK_TYPE((obj), GTK_TYPE_MOZ_EMBED_SINGLE)
#define GTK_IS_MOZ_EMBED_SINGLE_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED)
#define GTK_MOZ_EMBED_SINGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MOZ_EMBED_SINGLE, GtkMozEmbedSingleClass))
typedef struct _GtkMozEmbedSingle GtkMozEmbedSingle;
typedef struct _GtkMozEmbedSingleClass GtkMozEmbedSingleClass;
@ -276,7 +277,7 @@ struct _GtkMozEmbedSingleClass
guint chromemask);
};
GTKMOZEMBED_API(GtkType, gtk_moz_embed_single_get_type, (void))
GTKMOZEMBED_API(GType, gtk_moz_embed_single_get_type, (void))
GTKMOZEMBED_API(GtkMozEmbedSingle *, gtk_moz_embed_single_get, (void))
#ifdef __cplusplus

View File

@ -107,24 +107,29 @@ guint moz_embed_signals[EMBED_LAST_SIGNAL] = { 0 };
// GtkObject + class-related functions
GtkType
GType
gtk_moz_embed_get_type(void)
{
static GtkType moz_embed_type = 0;
if (!moz_embed_type)
static GType moz_embed_type = 0;
if (moz_embed_type == 0)
{
static const GtkTypeInfo moz_embed_info =
const GTypeInfo our_info =
{
"GtkMozEmbed",
sizeof(GtkMozEmbed),
sizeof(GtkMozEmbedClass),
(GtkClassInitFunc)gtk_moz_embed_class_init,
(GtkObjectInitFunc)gtk_moz_embed_init,
0,
0,
0
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc)gtk_moz_embed_class_init,
NULL,
NULL, /* class_data */
sizeof(GtkMozEmbed),
0, /* n_preallocs */
(GInstanceInitFunc)gtk_moz_embed_init,
};
moz_embed_type = gtk_type_unique(GTK_TYPE_BIN, &moz_embed_info);
moz_embed_type = g_type_register_static(GTK_TYPE_BIN,
"GtkMozEmbed",
&our_info,
(GTypeFlags)0);
}
return moz_embed_type;
@ -136,7 +141,7 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
GtkContainerClass *container_class;
GtkWidgetClass *widget_class;
GtkObjectClass *object_class;
container_class = GTK_CONTAINER_CLASS(klass);
widget_class = GTK_WIDGET_CLASS(klass);
object_class = GTK_OBJECT_CLASS(klass);
@ -154,218 +159,247 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
#endif
object_class->destroy = gtk_moz_embed_destroy;
// set up our signals
moz_embed_signals[LINK_MESSAGE] =
gtk_signal_new ("link_message",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, link_message),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
moz_embed_signals[LINK_MESSAGE] =
g_signal_new("link_message",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, link_message),
NULL, NULL,
gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
moz_embed_signals[JS_STATUS] =
gtk_signal_new ("js_status",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, js_status),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
g_signal_new("js_status",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, js_status),
NULL, NULL,
gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
moz_embed_signals[LOCATION] =
gtk_signal_new ("location",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, location),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
moz_embed_signals[TITLE] =
gtk_signal_new("title",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, title),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
g_signal_new("location",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, location),
NULL, NULL,
gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
moz_embed_signals[TITLE] =
g_signal_new("title",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, title),
NULL, NULL,
gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
moz_embed_signals[PROGRESS] =
gtk_signal_new("progress",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, progress),
gtk_marshal_NONE__INT_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
moz_embed_signals[PROGRESS_ALL] =
gtk_signal_new("progress_all",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, progress_all),
gtkmozembed_VOID__STRING_INT_INT,
GTK_TYPE_NONE, 3,
GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
GTK_TYPE_INT, GTK_TYPE_INT);
g_signal_new("progress",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, progress),
NULL, NULL,
gtk_marshal_NONE__INT_INT,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
moz_embed_signals[PROGRESS_ALL] =
g_signal_new("progress_all",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, progress_all),
NULL, NULL,
gtkmozembed_VOID__STRING_INT_INT,
G_TYPE_NONE, 3,
G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_INT, G_TYPE_INT);
moz_embed_signals[NET_STATE] =
gtk_signal_new("net_state",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, net_state),
gtkmozembed_VOID__INT_UINT,
GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_UINT);
g_signal_new("net_state",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, net_state),
NULL, NULL,
gtkmozembed_VOID__INT_UINT,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT);
moz_embed_signals[NET_STATE_ALL] =
gtk_signal_new("net_state_all",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, net_state_all),
gtkmozembed_VOID__STRING_INT_UINT,
GTK_TYPE_NONE, 3,
GTK_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
GTK_TYPE_INT, GTK_TYPE_UINT);
g_signal_new("net_state_all",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, net_state_all),
NULL, NULL,
gtkmozembed_VOID__STRING_INT_UINT,
G_TYPE_NONE, 3,
G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_INT, G_TYPE_UINT);
moz_embed_signals[NET_START] =
gtk_signal_new("net_start",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, net_start),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
g_signal_new("net_start",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, net_start),
NULL, NULL,
gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
moz_embed_signals[NET_STOP] =
gtk_signal_new("net_stop",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, net_stop),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
g_signal_new("net_stop",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, net_stop),
NULL, NULL,
gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
moz_embed_signals[NEW_WINDOW] =
gtk_signal_new("new_window",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, new_window),
gtk_marshal_NONE__POINTER_UINT,
GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_UINT);
g_signal_new("new_window",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, new_window),
NULL, NULL,
gtk_marshal_NONE__POINTER_UINT,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT);
moz_embed_signals[VISIBILITY] =
gtk_signal_new("visibility",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, visibility),
gtk_marshal_NONE__BOOL,
GTK_TYPE_NONE, 1, GTK_TYPE_BOOL);
g_signal_new("visibility",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, visibility),
NULL, NULL,
gtk_marshal_NONE__BOOL,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
moz_embed_signals[DESTROY_BROWSER] =
gtk_signal_new("destroy_browser",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, destroy_brsr),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
moz_embed_signals[OPEN_URI] =
gtk_signal_new("open_uri",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, open_uri),
gtkmozembed_BOOL__STRING,
GTK_TYPE_BOOL, 1, GTK_TYPE_STRING |
G_SIGNAL_TYPE_STATIC_SCOPE);
g_signal_new("destroy_browser",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedClass, destroy_brsr),
NULL, NULL,
gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
moz_embed_signals[OPEN_URI] =
g_signal_new("open_uri",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, open_uri),
NULL, NULL,
gtkmozembed_BOOL__STRING,
G_TYPE_BOOLEAN, 1, G_TYPE_STRING |
G_SIGNAL_TYPE_STATIC_SCOPE);
moz_embed_signals[SIZE_TO] =
gtk_signal_new("size_to",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, size_to),
gtk_marshal_NONE__INT_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
g_signal_new("size_to",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, size_to),
NULL, NULL,
gtk_marshal_NONE__INT_INT,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
moz_embed_signals[DOM_KEY_DOWN] =
gtk_signal_new("dom_key_down",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_key_down),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_key_down",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_down),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_KEY_PRESS] =
gtk_signal_new("dom_key_press",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_key_press),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_key_press",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_press),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_KEY_UP] =
gtk_signal_new("dom_key_up",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_key_up),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_key_up",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_key_up),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_MOUSE_DOWN] =
gtk_signal_new("dom_mouse_down",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_mouse_down),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_mouse_down",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_down),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_MOUSE_UP] =
gtk_signal_new("dom_mouse_up",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_mouse_up),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_mouse_up",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_up),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_MOUSE_CLICK] =
gtk_signal_new("dom_mouse_click",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_mouse_click),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_mouse_click",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_click),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_MOUSE_DBL_CLICK] =
gtk_signal_new("dom_mouse_dbl_click",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_mouse_dbl_click),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_mouse_dbl_click",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_dbl_click),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_MOUSE_OVER] =
gtk_signal_new("dom_mouse_over",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_mouse_over),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_mouse_over",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_over),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_MOUSE_OUT] =
gtk_signal_new("dom_mouse_out",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_mouse_out),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_mouse_out",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_mouse_out),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[SECURITY_CHANGE] =
gtk_signal_new("security_change",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, security_change),
gtk_marshal_NONE__POINTER_UINT,
GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_UINT);
g_signal_new("security_change",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, security_change),
NULL, NULL,
gtk_marshal_NONE__POINTER_UINT,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT);
moz_embed_signals[STATUS_CHANGE] =
gtk_signal_new("status_change",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, status_change),
gtkmozembed_VOID__POINTER_INT_POINTER,
GTK_TYPE_NONE, 3,
GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_POINTER);
g_signal_new("status_change",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, status_change),
NULL, NULL,
gtkmozembed_VOID__POINTER_INT_POINTER,
G_TYPE_NONE, 3,
G_TYPE_POINTER, G_TYPE_INT, G_TYPE_POINTER);
moz_embed_signals[DOM_ACTIVATE] =
gtk_signal_new("dom_activate",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_activate),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_activate",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_activate),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_FOCUS_IN] =
gtk_signal_new("dom_focus_in",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_focus_in),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_focus_in",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_focus_in),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
moz_embed_signals[DOM_FOCUS_OUT] =
gtk_signal_new("dom_focus_out",
GTK_RUN_LAST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, dom_focus_out),
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1, GTK_TYPE_POINTER);
g_signal_new("dom_focus_out",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkMozEmbedClass, dom_focus_out),
NULL, NULL,
gtk_marshal_BOOL__POINTER,
G_TYPE_BOOLEAN, 1, G_TYPE_POINTER);
}
static void
@ -381,7 +415,7 @@ gtk_moz_embed_init(GtkMozEmbed *embed)
GtkWidget *
gtk_moz_embed_new(void)
{
return GTK_WIDGET(gtk_type_new(gtk_moz_embed_get_type()));
return GTK_WIDGET(g_object_new(GTK_TYPE_MOZ_EMBED, NULL));
}
// GtkObject methods
@ -465,16 +499,16 @@ gtk_moz_embed_realize(GtkWidget *widget)
// connect to the focus out event for the child
GtkWidget *child_widget = GTK_BIN(widget)->child;
gtk_signal_connect_while_alive(GTK_OBJECT(child_widget),
"focus_out_event",
GTK_SIGNAL_FUNC(handle_child_focus_out),
embed,
GTK_OBJECT(child_widget));
gtk_signal_connect_while_alive(GTK_OBJECT(child_widget),
"focus_in_event",
GTK_SIGNAL_FUNC(handle_child_focus_in),
embed,
GTK_OBJECT(child_widget));
g_signal_connect_object(G_OBJECT(child_widget),
"focus_out_event",
GTK_SIGNAL_FUNC(handle_child_focus_out),
embed,
G_CONNECT_AFTER);
g_signal_connect_object(G_OBJECT(child_widget),
"focus_in_event",
GTK_SIGNAL_FUNC(handle_child_focus_in),
embed,
G_CONNECT_AFTER);
}
static void
@ -1012,25 +1046,29 @@ guint moz_embed_single_signals[SINGLE_LAST_SIGNAL] = { 0 };
// GtkObject + class-related functions
GtkType
GType
gtk_moz_embed_single_get_type(void)
{
static GtkType moz_embed_single_type = 0;
if (!moz_embed_single_type)
static GType moz_embed_single_type = 0;
if (moz_embed_single_type == 0)
{
static const GtkTypeInfo moz_embed_single_info =
const GTypeInfo our_info =
{
"GtkMozEmbedSingle",
sizeof(GtkMozEmbedSingle),
sizeof(GtkMozEmbedSingleClass),
(GtkClassInitFunc)gtk_moz_embed_single_class_init,
(GtkObjectInitFunc)gtk_moz_embed_single_init,
0,
0,
0
sizeof(GtkMozEmbedClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc)gtk_moz_embed_single_class_init,
NULL,
NULL, /* class_data */
sizeof(GtkMozEmbed),
0, /* n_preallocs */
(GInstanceInitFunc)gtk_moz_embed_single_init,
};
moz_embed_single_type = gtk_type_unique(GTK_TYPE_OBJECT,
&moz_embed_single_info);
moz_embed_single_type = g_type_register_static(GTK_TYPE_OBJECT,
"GtkMozEmbedSingle",
&our_info,
(GTypeFlags)0);
}
return moz_embed_single_type;
@ -1046,13 +1084,14 @@ gtk_moz_embed_single_class_init(GtkMozEmbedSingleClass *klass)
// set up our signals
moz_embed_single_signals[NEW_WINDOW_ORPHAN] =
gtk_signal_new("new_window_orphan",
GTK_RUN_FIRST,
GET_OBJECT_CLASS_TYPE(klass),
GTK_SIGNAL_OFFSET(GtkMozEmbedSingleClass,
new_window_orphan),
gtk_marshal_NONE__POINTER_UINT,
GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_UINT);
g_signal_new("new_window_orphan",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(GtkMozEmbedSingleClass, new_window_orphan),
NULL, NULL,
gtk_marshal_NONE__POINTER_UINT,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT);
}
static void
@ -1066,7 +1105,7 @@ gtk_moz_embed_single_init(GtkMozEmbedSingle *embed)
GtkMozEmbedSingle *
gtk_moz_embed_single_new(void)
{
return (GtkMozEmbedSingle *)gtk_type_new(gtk_moz_embed_single_get_type());
return (GtkMozEmbedSingle *)g_object_new(GTK_TYPE_MOZ_EMBED_SINGLE, NULL);
}
GtkMozEmbedSingle *
@ -1093,8 +1132,8 @@ gtk_moz_embed_single_create_window(GtkMozEmbed **aNewEmbed,
if (!single)
return;
gtk_signal_emit(GTK_OBJECT(single),
moz_embed_single_signals[NEW_WINDOW_ORPHAN],
aNewEmbed, aChromeFlags);
g_signal_emit(G_OBJECT(single),
moz_embed_single_signals[NEW_WINDOW_ORPHAN], 0,
aNewEmbed, aChromeFlags);
}