gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_activate", GTK_SIGNAL_FUNC(dom_activate_cb), browser); gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_focus_in", GTK_SIGNAL_FUNC(dom_focus_in_cb), browser); gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_focus_out", GTK_SIGNAL_FUNC(dom_focus_out_cb), browser);
new_gtk_browser(guint32 chromeMask){  guint32         actualChromeMask = chromeMask;  TestGtkBrowser *browser = 0;  num_browsers++;  browser = g_new0(TestGtkBrowser, 1);  browser_list = g_list_prepend(browser_list, browser);  browser->menuBarOn = FALSE;  browser->toolBarOn = FALSE;  browser->locationBarOn = FALSE;  browser->statusBarOn = FALSE;  g_print("new_gtk_browser\n");  if (chromeMask == GTK_MOZ_EMBED_FLAG_DEFAULTCHROME)    actualChromeMask = GTK_MOZ_EMBED_FLAG_ALLCHROME;  if (actualChromeMask & GTK_MOZ_EMBED_FLAG_MENUBARON)  {    browser->menuBarOn = TRUE;    g_print("\tmenu bar\n");  }  if (actualChromeMask & GTK_MOZ_EMBED_FLAG_TOOLBARON)  {    browser->toolBarOn = TRUE;    g_print("\ttool bar\n");  }  if (actualChromeMask & GTK_MOZ_EMBED_FLAG_LOCATIONBARON)  {    browser->locationBarOn = TRUE;    g_print("\tlocation bar\n");  }  if (actualChromeMask & GTK_MOZ_EMBED_FLAG_STATUSBARON)  {    browser->statusBarOn = TRUE;    g_print("\tstatus bar\n");  }  // create our new toplevel window  browser->topLevelWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);  // new vbox  browser->topLevelVBox = gtk_vbox_new(FALSE, 0);  // add it to the toplevel window  gtk_container_add(GTK_CONTAINER(browser->topLevelWindow),		    browser->topLevelVBox);  // create our menu bar  browser->menuBar = gtk_menu_bar_new();  // create the file menu  browser->fileMenuItem = gtk_menu_item_new_with_label("File");  browser->fileMenu = gtk_menu_new();  gtk_menu_item_set_submenu (GTK_MENU_ITEM(browser->fileMenuItem),			     browser->fileMenu);  browser->fileOpenNewBrowser =     gtk_menu_item_new_with_label("Open New Browser");  gtk_menu_append(GTK_MENU(browser->fileMenu),		  browser->fileOpenNewBrowser);    browser->fileStream =    gtk_menu_item_new_with_label("Test Stream");  gtk_menu_append(GTK_MENU(browser->fileMenu),		  browser->fileStream);  browser->fileClose =    gtk_menu_item_new_with_label("Close");  gtk_menu_append(GTK_MENU(browser->fileMenu),		  browser->fileClose);  browser->fileQuit =    gtk_menu_item_new_with_label("Quit");  gtk_menu_append(GTK_MENU(browser->fileMenu),		  browser->fileQuit);    // append it  gtk_menu_bar_append(GTK_MENU_BAR(browser->menuBar), browser->fileMenuItem);  // add it to the vbox  gtk_box_pack_start(GTK_BOX(browser->topLevelVBox),		     browser->menuBar,		     FALSE, // expand		     FALSE, // fill		     0);    // padding  // create the hbox that will contain the toolbar and the url text entry bar  browser->toolbarHBox = gtk_hbox_new(FALSE, 0);  // add that hbox to the vbox  gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), 		     browser->toolbarHBox,		     FALSE, // expand		     FALSE, // fill		     0);    // padding  // new horiz toolbar with buttons + icons#ifdef MOZ_WIDGET_GTK  browser->toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,				     GTK_TOOLBAR_BOTH);#endif /* MOZ_WIDGET_GTK */#ifdef MOZ_WIDGET_GTK2  browser->toolbar = gtk_toolbar_new();  gtk_toolbar_set_orientation(GTK_TOOLBAR(browser->toolbar),			      GTK_ORIENTATION_HORIZONTAL);  gtk_toolbar_set_style(GTK_TOOLBAR(browser->toolbar),			GTK_TOOLBAR_BOTH);#endif /* MOZ_WIDGET_GTK2 */  // add it to the hbox  gtk_box_pack_start(GTK_BOX(browser->toolbarHBox), browser->toolbar,		   FALSE, // expand		   FALSE, // fill		   0);    // padding  // new back button  browser->backButton =    gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),			    "Back",			    "Go Back",			    "Go Back",			    0, // XXX replace with icon			    GTK_SIGNAL_FUNC(back_clicked_cb),			    browser);  // new stop button  browser->stopButton =     gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),			    "Stop",			    "Stop",			    "Stop",			    0, // XXX replace with icon			    GTK_SIGNAL_FUNC(stop_clicked_cb),			    browser);  // new forward button  browser->forwardButton =    gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),			    "Forward",			    "Forward",			    "Forward",			    0, // XXX replace with icon			    GTK_SIGNAL_FUNC(forward_clicked_cb),			    browser);  // new reload button  browser->reloadButton =     gtk_toolbar_append_item(GTK_TOOLBAR(browser->toolbar),			    "Reload",			    "Reload",			    "Reload",			    0, // XXX replace with icon			    GTK_SIGNAL_FUNC(reload_clicked_cb),			    browser);  // create the url text entry  browser->urlEntry = gtk_entry_new();  // add it to the hbox  gtk_box_pack_start(GTK_BOX(browser->toolbarHBox), browser->urlEntry,		     TRUE, // expand		     TRUE, // fill		     0);    // padding  // create our new gtk moz embed widget  browser->mozEmbed = gtk_moz_embed_new();  // add it to the toplevel vbox  gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), browser->mozEmbed,		     TRUE, // expand		     TRUE, // fill		     0);   // padding  // create the new hbox for the progress area  browser->progressAreaHBox = gtk_hbox_new(FALSE, 0);  // add it to the vbox  gtk_box_pack_start(GTK_BOX(browser->topLevelVBox), browser->progressAreaHBox,		     FALSE, // expand		     FALSE, // fill		     0);   // padding  // create our new progress bar  browser->progressBar = gtk_progress_bar_new();  // add it to the hbox  gtk_box_pack_start(GTK_BOX(browser->progressAreaHBox), browser->progressBar,		     FALSE, // expand		     FALSE, // fill		     0); // padding    // create our status area and the alignment object that will keep it  // from expanding  browser->statusAlign = gtk_alignment_new(0, 0, 1, 1);  gtk_widget_set_usize(browser->statusAlign, 1, -1);  // create the status bar  browser->statusBar = gtk_statusbar_new();  gtk_container_add(GTK_CONTAINER(browser->statusAlign), browser->statusBar);  // add it to the hbox  gtk_box_pack_start(GTK_BOX(browser->progressAreaHBox), browser->statusAlign,		     TRUE, // expand		     TRUE, // fill		     0);   // padding  // by default none of the buttons are marked as sensitive.  gtk_widget_set_sensitive(browser->backButton, FALSE);  gtk_widget_set_sensitive(browser->stopButton, FALSE);  gtk_widget_set_sensitive(browser->forwardButton, FALSE);  gtk_widget_set_sensitive(browser->reloadButton, FALSE);    // catch the destruction of the toplevel window  gtk_signal_connect(GTK_OBJECT(browser->topLevelWindow), "delete_event",		     GTK_SIGNAL_FUNC(delete_cb), browser);  // hook up the activate signal to the right callback  gtk_signal_connect(GTK_OBJECT(browser->urlEntry), "activate",		     GTK_SIGNAL_FUNC(url_activate_cb), browser);  // hook up to the open new browser activation  gtk_signal_connect(GTK_OBJECT(browser->fileOpenNewBrowser), "activate",		     GTK_SIGNAL_FUNC(menu_open_new_cb), browser);  // hook up to the stream test  gtk_signal_connect(GTK_OBJECT(browser->fileStream), "activate",		     GTK_SIGNAL_FUNC(menu_stream_cb), browser);  // close this window  gtk_signal_connect(GTK_OBJECT(browser->fileClose), "activate",		     GTK_SIGNAL_FUNC(menu_close_cb), browser);  // quit the application  gtk_signal_connect(GTK_OBJECT(browser->fileQuit), "activate",		     GTK_SIGNAL_FUNC(menu_quit_cb), browser);  // hook up the location change to update the urlEntry  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "location",		     GTK_SIGNAL_FUNC(location_changed_cb), browser);  // hook up the title change to update the window title  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "title",		     GTK_SIGNAL_FUNC(title_changed_cb), browser);  // hook up the start and stop signals  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_start",		     GTK_SIGNAL_FUNC(load_started_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_stop",		     GTK_SIGNAL_FUNC(load_finished_cb), browser);  // hook up to the change in network status  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state",		     GTK_SIGNAL_FUNC(net_state_change_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state_all",		     GTK_SIGNAL_FUNC(net_state_change_all_cb), browser);  // hookup to changes in progress  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress",		     GTK_SIGNAL_FUNC(progress_change_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress_all",		     GTK_SIGNAL_FUNC(progress_change_all_cb), browser);  // hookup to changes in over-link message  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "link_message",		     GTK_SIGNAL_FUNC(link_message_cb), browser);  // hookup to changes in js status message  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "js_status",		     GTK_SIGNAL_FUNC(js_status_cb), browser);  // hookup to see whenever a new window is requested  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "new_window",		     GTK_SIGNAL_FUNC(new_window_cb), browser);  // hookup to any requested visibility changes  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "visibility",		     GTK_SIGNAL_FUNC(visibility_cb), browser);  // hookup to the signal that says that the browser requested to be  // destroyed  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy_browser",		     GTK_SIGNAL_FUNC(destroy_brsr_cb), browser);  // hookup to the signal that is called when someone clicks on a link  // to load a new uri  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "open_uri",		     GTK_SIGNAL_FUNC(open_uri_cb), browser);  // this signal is emitted when there's a request to change the  // containing browser window to a certain height, like with width  // and height args for a window.open in javascript  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "size_to",		     GTK_SIGNAL_FUNC(size_to_cb), browser);  // key event signals  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_down",		     GTK_SIGNAL_FUNC(dom_key_down_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_press",		     GTK_SIGNAL_FUNC(dom_key_press_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_key_up",		     GTK_SIGNAL_FUNC(dom_key_up_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_down",		     GTK_SIGNAL_FUNC(dom_mouse_down_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_up",		     GTK_SIGNAL_FUNC(dom_mouse_up_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_click",		     GTK_SIGNAL_FUNC(dom_mouse_click_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_dbl_click",		     GTK_SIGNAL_FUNC(dom_mouse_dbl_click_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_over",		     GTK_SIGNAL_FUNC(dom_mouse_over_cb), browser);  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "dom_mouse_out",		     GTK_SIGNAL_FUNC(dom_mouse_out_cb), browser);  // hookup to when the window is destroyed  gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "destroy",		     GTK_SIGNAL_FUNC(destroy_cb), browser);    // set the chrome type so it's stored in the object  gtk_moz_embed_set_chrome_mask(GTK_MOZ_EMBED(browser->mozEmbed),				actualChromeMask);  return browser;}