if (num_widgets == 0) { gboolean retval; retval = gtk_moz_embed_startup_xpcom(); g_return_if_fail(retval == TRUE);  }  num_widgets++;
gtk_moz_embed_init(GtkMozEmbed *embed){  GtkMozEmbedPrivate *embed_private;  // create our private struct  embed_private = new GtkMozEmbedPrivate();  // create an nsIWebBrowser object  embed_private->webBrowser = do_CreateInstance(NS_WEBBROWSER_PROGID);  g_return_if_fail(embed_private->webBrowser);  // create our glue widget  GtkMozEmbedChrome *chrome = new GtkMozEmbedChrome();  g_return_if_fail(chrome);  embed_private->embed = do_QueryInterface((nsISupports *)(nsIGtkEmbed *) chrome);  g_return_if_fail(embed_private->embed);  // hide it  embed->data = embed_private;  // this is how we hook into when show() is called on the widget  gtk_signal_connect(GTK_OBJECT(embed), "show",		     GTK_SIGNAL_FUNC(gtk_moz_embed_handle_show), NULL);  // get our hands on the browser chrome  nsCOMPtr<nsIWebBrowserChrome> browserChrome = do_QueryInterface(embed_private->embed);  g_return_if_fail(browserChrome);  // set the toplevel window  embed_private->webBrowser->SetTopLevelWindow(browserChrome);  // set the widget as the owner of the object  embed_private->embed->Init(GTK_WIDGET(embed));  // so the embedding widget can find it's owning nsIWebBrowser object  browserChrome->SetWebBrowser(embed_private->webBrowser);  // track the window changes  embed_private->embed->SetLinkChangeCallback((generic_cb_with_data)gtk_moz_embed_handle_link_change,					      embed);  embed_private->embed->SetJSStatusChangeCallback((generic_cb_with_data)gtk_moz_embed_handle_js_status_change,						  embed);  embed_private->embed->SetLocationChangeCallback((generic_cb_with_data)gtk_moz_embed_handle_location_change,						  embed);  embed_private->embed->SetTitleChangeCallback((generic_cb_with_data)gtk_moz_embed_handle_title_change,					       embed);  embed_private->embed->SetProgressCallback((void (*)(void *, gint, gint))gtk_moz_embed_handle_progress,					    embed);  embed_private->embed->SetNetCallback((void (*)(void *, gint, guint))gtk_moz_embed_handle_net,				       embed);  embed_private->embed->SetNewBrowserCallback(gtk_moz_embed_handle_new_window, embed);  embed_private->embed->SetVisibilityCallback(gtk_moz_embed_handle_visibility, embed);  embed_private->embed->SetDestroyCallback(gtk_moz_embed_handle_destroy, embed);  embed_private->embed->SetStartOpenCallback(gtk_moz_embed_handle_open_uri, embed);  // get our hands on a copy of the nsIWebNavigation interface for later  embed_private->navigation = do_QueryInterface(embed_private->webBrowser);  g_return_if_fail(embed_private->navigation);}