/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

#include "setup_callbacks.h"
#include "setup_interface.h"
#include "support.h"



gboolean check_has_mime_support();


#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)

GtkWidget*
create_setup_assistant (void)
{
  GtkWidget *setup_assistant;
  GdkPixbuf *setup_assistant_icon_pixbuf;
  GtkWidget *setup_vbox;
  GtkWidget *setup_image;
  GtkWidget *setup_notebook;
  GtkWidget *welcome_hbox;
  GtkWidget *welcome_image;
  GtkWidget *welcome_vbox;
  GtkWidget *welcome_title;
  GtkWidget *welcome_hbuttonbox;
  GtkWidget *welcome_quit;
  GtkWidget *welcome_forward;
//  GtkWidget *label29;
  GtkWidget *notes_vbox;
  GtkWidget *notes_title;
  GtkWidget *notes_subtitle;
  GtkWidget *notes_scrolledwindow;
  GtkWidget *notes_textview;
  GtkWidget *notes_hbuttonbox;
  GtkWidget *notes_print;
  GtkWidget *notes_quit;
  GtkWidget *notes_back;
  GtkWidget *notes_forward;
//  GtkWidget *label32;
#ifdef HELIX_FEATURE_REAL_BRANDING // XXXNH: no EULA for helix player
  GtkWidget *eula_vbox;
  GtkWidget *eula_title;
  GtkWidget *eula_subtitle;
  GtkWidget *eula_scrolledwindow;
  GtkWidget *eula_textview;
  GtkWidget *privacy_hbox;
  GtkWidget *privacy_button;
  GtkWidget *privacy_label;
  GtkWidget *eula_hbuttonbox;
  GtkWidget *eula_print;
  GtkWidget *eula_quit;
  GtkWidget *eula_back;
  GtkWidget *eula_accept;
  GtkWidget *alignment3;
  GtkWidget *hbox9;
  GtkWidget *accept_image;
  GtkWidget *accept_label;
//  GtkWidget *label37;
#endif
  GtkWidget *mime_vbox;
  GtkWidget *mime_title;
  GtkWidget *mime_subtitle;
  GtkWidget *mime_options_vbox;
#ifndef HELIX_FEATURE_REAL_BRANDING // XXXNH: we offer to claim this in hxplay
  GtkWidget *rn_checkbox;
#endif
  GtkWidget *smil_checkbox;
  GtkWidget *rtsp_checkbox;
  GtkWidget *sdp_checkbox;
  GtkWidget *mime_hbuttonbox;
  GtkWidget *mime_forward;
  GtkWidget *mime_back;
  GtkWidget *mime_done;
  GtkWidget *alignment4;
  GtkWidget *hbox10;
  GtkWidget *done_image;
  GtkWidget *done_label;
//  GtkWidget *label41;

  GtkWidget* almost_finished_vbox;
  GtkWidget* almost_finished_title;
  GtkWidget* almost_finished_subtitle;

  GtkWidget* almost_finished_options_alignment;
  GtkWidget* almost_finished_options_vbox;
  GtkWidget* check_for_updates_checkbox;
  GtkWidget* configure_mozilla_helpers_checkbox;

  GtkWidget* almost_finished_back;
  GtkWidget* almost_finished_quit;
  GtkWidget* almost_finished_hbuttonbox;
  gchar* setup_text;
  gchar* welcome_text;
  gchar* notes_text;
  gchar* eula_text;
  gchar* mime_text;
  gchar* mime_text2;
  gchar* almost_text;
  gboolean bHasMimeSupport;

  bHasMimeSupport = check_has_mime_support();
      
  setup_assistant = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_size_request (setup_assistant, 491, 337);
  setup_text = g_strdup_printf (_("%s Setup Assistant"), APP_NAME_LONG);
  gtk_window_set_title (GTK_WINDOW (setup_assistant), setup_text);
  g_free (setup_text);
  gtk_window_set_position (GTK_WINDOW (setup_assistant), GTK_WIN_POS_CENTER);
  gtk_window_set_resizable (GTK_WINDOW (setup_assistant), FALSE);
  setup_assistant_icon_pixbuf = create_pixbuf ("icon.png");
  if (setup_assistant_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (setup_assistant), setup_assistant_icon_pixbuf);
      gdk_pixbuf_unref (setup_assistant_icon_pixbuf);
    }

  setup_vbox = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (setup_vbox);
  gtk_container_add (GTK_CONTAINER (setup_assistant), setup_vbox);

  setup_image = create_pixmap (setup_assistant, "setup_title.png");
  gtk_widget_show (setup_image);
  gtk_box_pack_start (GTK_BOX (setup_vbox), setup_image, TRUE, TRUE, 0);

  setup_notebook = gtk_notebook_new ();
  gtk_widget_show (setup_notebook);
  gtk_box_pack_start (GTK_BOX (setup_vbox), setup_notebook, TRUE, TRUE, 0);
  GTK_WIDGET_UNSET_FLAGS (setup_notebook, GTK_CAN_FOCUS);
  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (setup_notebook), FALSE);
  gtk_notebook_set_show_border (GTK_NOTEBOOK (setup_notebook), FALSE);

  welcome_hbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (welcome_hbox);
  gtk_container_add (GTK_CONTAINER (setup_notebook), welcome_hbox);

  welcome_image = create_pixmap (setup_assistant, "setup_welcome.png");
  gtk_widget_show (welcome_image);
  gtk_box_pack_start (GTK_BOX (welcome_hbox), welcome_image, FALSE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (welcome_image), 0, 0);

  welcome_vbox = gtk_vbox_new (FALSE, 10);
  gtk_widget_show (welcome_vbox);
  gtk_box_pack_start (GTK_BOX (welcome_hbox), welcome_vbox, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (welcome_vbox), 10);

  welcome_text = g_strdup_printf (_("<span size=\"large\" weight=\"bold\" foreground=\"%s\">Welcome to %s</span>\nClick \"forward\" to set up %s."), APP_FG_COLOR, APP_NAME_LONG, APP_NAME_LONG);
  welcome_title = gtk_label_new (welcome_text);
  g_free (welcome_text);
  gtk_widget_show (welcome_title);
  gtk_box_pack_start (GTK_BOX (welcome_vbox), welcome_title, TRUE, TRUE, 0);
  gtk_label_set_use_markup (GTK_LABEL (welcome_title), TRUE);
  gtk_label_set_justify (GTK_LABEL (welcome_title), GTK_JUSTIFY_LEFT);
  gtk_label_set_line_wrap (GTK_LABEL (welcome_title), TRUE);

  welcome_hbuttonbox = gtk_hbutton_box_new ();
  gtk_widget_show (welcome_hbuttonbox);
  gtk_box_pack_start (GTK_BOX (welcome_vbox), welcome_hbuttonbox, FALSE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (welcome_hbuttonbox), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (welcome_hbuttonbox), 10);

  welcome_quit = gtk_button_new_from_stock ("gtk-quit");
  gtk_widget_show (welcome_quit);
  gtk_container_add (GTK_CONTAINER (welcome_hbuttonbox), welcome_quit);
  GTK_WIDGET_SET_FLAGS (welcome_quit, GTK_CAN_DEFAULT);

  welcome_forward = gtk_button_new_from_stock ("gtk-go-forward");
  gtk_widget_show (welcome_forward);
  gtk_container_add (GTK_CONTAINER (welcome_hbuttonbox), welcome_forward);
  GTK_WIDGET_SET_FLAGS (welcome_forward, GTK_CAN_DEFAULT);

/*
  label29 = gtk_label_new (_("label26"));
  gtk_widget_show (label29);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (setup_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (setup_notebook), 0), label29);
  gtk_label_set_justify (GTK_LABEL (label29), GTK_JUSTIFY_LEFT);
*/

  notes_vbox = gtk_vbox_new (FALSE, 10);
  gtk_widget_show (notes_vbox);
  gtk_container_add (GTK_CONTAINER (setup_notebook), notes_vbox);
  gtk_container_set_border_width (GTK_CONTAINER (notes_vbox), 10);

  notes_text = g_strdup_printf (_("<span foreground=\"%s\" size=\"medium\" weight=\"bold\">Release Notes</span>"), APP_FG_COLOR);
  notes_title = gtk_label_new (notes_text);
  g_free (notes_text);
  gtk_widget_show (notes_title);
  gtk_box_pack_start (GTK_BOX (notes_vbox), notes_title, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (notes_title), TRUE);
  gtk_label_set_justify (GTK_LABEL (notes_title), GTK_JUSTIFY_LEFT);
  gtk_label_set_line_wrap (GTK_LABEL (notes_title), TRUE);
  gtk_misc_set_alignment (GTK_MISC (notes_title), 0, 0);

  notes_subtitle = gtk_label_new (_("Please review the release notes."));
  gtk_widget_show (notes_subtitle);
  gtk_box_pack_start (GTK_BOX (notes_vbox), notes_subtitle, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (notes_subtitle), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (notes_subtitle), 0, 0);

  notes_scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (notes_scrolledwindow);
  gtk_box_pack_start (GTK_BOX (notes_vbox), notes_scrolledwindow, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (notes_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);

  notes_textview = gtk_text_view_new ();
  gtk_widget_show (notes_textview);
  gtk_container_add (GTK_CONTAINER (notes_scrolledwindow), notes_textview);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (notes_textview), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (notes_textview), GTK_WRAP_WORD);
  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (notes_textview), FALSE);

  notes_hbuttonbox = gtk_hbutton_box_new ();
  gtk_widget_show (notes_hbuttonbox);
  gtk_box_pack_start (GTK_BOX (notes_vbox), notes_hbuttonbox, FALSE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (notes_hbuttonbox), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (notes_hbuttonbox), 10);

  notes_print = gtk_button_new_from_stock ("gtk-print");
  //gtk_widget_show (notes_print);
  gtk_container_add (GTK_CONTAINER (notes_hbuttonbox), notes_print);
  GTK_WIDGET_SET_FLAGS (notes_print, GTK_CAN_DEFAULT);

  notes_quit = gtk_button_new_from_stock ("gtk-quit");
  gtk_widget_show (notes_quit);
  gtk_container_add (GTK_CONTAINER (notes_hbuttonbox), notes_quit);
  GTK_WIDGET_SET_FLAGS (notes_quit, GTK_CAN_DEFAULT);

  notes_back = gtk_button_new_from_stock ("gtk-go-back");
  gtk_widget_show (notes_back);
  gtk_container_add (GTK_CONTAINER (notes_hbuttonbox), notes_back);
  GTK_WIDGET_SET_FLAGS (notes_back, GTK_CAN_DEFAULT);

  notes_forward = gtk_button_new_from_stock ("gtk-go-forward");
  gtk_widget_show (notes_forward);
  gtk_container_add (GTK_CONTAINER (notes_hbuttonbox), notes_forward);
  GTK_WIDGET_SET_FLAGS (notes_forward, GTK_CAN_DEFAULT);

/*
  label32 = gtk_label_new (_("label13"));
  gtk_widget_show (label32);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (setup_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (setup_notebook), 1), label32);
  gtk_label_set_justify (GTK_LABEL (label32), GTK_JUSTIFY_LEFT);
*/

#ifdef HELIX_FEATURE_REAL_BRANDING // XXXNH: no EULA for helix player
  eula_vbox = gtk_vbox_new (FALSE, 10);
  gtk_widget_show (eula_vbox);
  gtk_container_add (GTK_CONTAINER (setup_notebook), eula_vbox);
  gtk_container_set_border_width (GTK_CONTAINER (eula_vbox), 10);

  eula_text = g_strdup_printf (_("<span foreground=\"%s\" size=\"medium\" weight=\"bold\">License Agreement</span>"), APP_FG_COLOR);
  eula_title = gtk_label_new (eula_text);
  g_free (eula_text);
  gtk_widget_show (eula_title);
  gtk_box_pack_start (GTK_BOX (eula_vbox), eula_title, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (eula_title), TRUE);
  gtk_label_set_justify (GTK_LABEL (eula_title), GTK_JUSTIFY_LEFT);
  gtk_label_set_line_wrap (GTK_LABEL (eula_title), TRUE);
  gtk_misc_set_alignment (GTK_MISC (eula_title), 0, 0);

  eula_subtitle = gtk_label_new (_("Please review the terms of the end user license agreement.\nBy clicking \"accept\" you indicate that you accept the terms of the license agreement"));
  gtk_widget_show (eula_subtitle);
  gtk_box_pack_start (GTK_BOX (eula_vbox), eula_subtitle, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (eula_subtitle), GTK_JUSTIFY_LEFT);
  gtk_label_set_line_wrap (GTK_LABEL (eula_subtitle), TRUE);
  gtk_misc_set_alignment (GTK_MISC (eula_subtitle), 0, 0);

  eula_scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (eula_scrolledwindow);
  gtk_box_pack_start (GTK_BOX (eula_vbox), eula_scrolledwindow, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (eula_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);

  eula_textview = gtk_text_view_new ();
  gtk_widget_show (eula_textview);
  gtk_container_add (GTK_CONTAINER (eula_scrolledwindow), eula_textview);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (eula_textview), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (eula_textview), GTK_WRAP_WORD);
  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (eula_textview), FALSE);

  privacy_hbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (privacy_hbox);
  gtk_box_pack_start (GTK_BOX (eula_vbox), privacy_hbox, FALSE, FALSE, 0);
 
  privacy_button = gtk_button_new();
  gtk_button_set_relief(GTK_BUTTON(privacy_button), GTK_RELIEF_NONE);
  gtk_box_pack_start (GTK_BOX (privacy_hbox), privacy_button, FALSE, FALSE, 0);
  gtk_widget_show(privacy_button);

  privacy_label = gtk_label_new (_("<span foreground=\"blue\" underline=\"single\">RealNetworks Privacy Policy</span>"));
  gtk_widget_show (privacy_label);
  gtk_label_set_use_markup (GTK_LABEL (privacy_label), TRUE);
  gtk_label_set_justify (GTK_LABEL (privacy_label), GTK_JUSTIFY_LEFT);
  gtk_label_set_line_wrap (GTK_LABEL (privacy_label), TRUE);
  gtk_misc_set_alignment (GTK_MISC (privacy_label), 0, 0);
  gtk_container_add(GTK_CONTAINER(privacy_button), privacy_label);

  eula_hbuttonbox = gtk_hbutton_box_new ();
  gtk_widget_show (eula_hbuttonbox);
  gtk_box_pack_start (GTK_BOX (eula_vbox), eula_hbuttonbox, FALSE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (eula_hbuttonbox), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (eula_hbuttonbox), 10);

  eula_print = gtk_button_new_from_stock ("gtk-print");
  //gtk_widget_show (eula_print);
  gtk_container_add (GTK_CONTAINER (eula_hbuttonbox), eula_print);
  GTK_WIDGET_SET_FLAGS (eula_print, GTK_CAN_DEFAULT);

  eula_quit = gtk_button_new_from_stock ("gtk-quit");
  gtk_widget_show (eula_quit);
  gtk_container_add (GTK_CONTAINER (eula_hbuttonbox), eula_quit);
  GTK_WIDGET_SET_FLAGS (eula_quit, GTK_CAN_DEFAULT);

  eula_back = gtk_button_new_from_stock ("gtk-go-back");
  gtk_widget_show (eula_back);
  gtk_container_add (GTK_CONTAINER (eula_hbuttonbox), eula_back);
  GTK_WIDGET_SET_FLAGS (eula_back, GTK_CAN_DEFAULT);

  eula_accept = gtk_button_new ();
  gtk_widget_show (eula_accept);
  gtk_container_add (GTK_CONTAINER (eula_hbuttonbox), eula_accept);
  GTK_WIDGET_SET_FLAGS (eula_accept, GTK_CAN_DEFAULT);

  alignment3 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment3);
  gtk_container_add (GTK_CONTAINER (eula_accept), alignment3);

  hbox9 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox9);
  gtk_container_add (GTK_CONTAINER (alignment3), hbox9);

  accept_image = gtk_image_new_from_stock ("gtk-yes", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (accept_image);
  gtk_box_pack_start (GTK_BOX (hbox9), accept_image, FALSE, FALSE, 0);

  accept_label = gtk_label_new_with_mnemonic (_("_Accept"));
  gtk_widget_show (accept_label);
  gtk_box_pack_start (GTK_BOX (hbox9), accept_label, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (accept_label), GTK_JUSTIFY_LEFT);

/*
  label37 = gtk_label_new (_("label14"));
  gtk_widget_show (label37);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (setup_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (setup_notebook), 2), label37);
  gtk_label_set_justify (GTK_LABEL (label37), GTK_JUSTIFY_LEFT);
*/
#endif

  if (bHasMimeSupport)
  {
      mime_vbox = gtk_vbox_new (FALSE, 10);
      gtk_widget_show (mime_vbox);
      gtk_container_add (GTK_CONTAINER (setup_notebook), mime_vbox);
      gtk_container_set_border_width (GTK_CONTAINER (mime_vbox), 10);
      
      mime_text = g_strdup_printf (_("<span foreground=\"%s\" size=\"medium\" weight=\"bold\">Media Types</span>"), APP_FG_COLOR);
      mime_title = gtk_label_new (mime_text);
      g_free (mime_text);
      gtk_widget_show (mime_title);
      gtk_box_pack_start (GTK_BOX (mime_vbox), mime_title, FALSE, FALSE, 0);
      gtk_label_set_use_markup (GTK_LABEL (mime_title), TRUE);
      gtk_label_set_justify (GTK_LABEL (mime_title), GTK_JUSTIFY_LEFT);
      gtk_label_set_line_wrap (GTK_LABEL (mime_title), TRUE);
      gtk_misc_set_alignment (GTK_MISC (mime_title), 0, 0);
      
      mime_text2 = g_strdup_printf (_("Select the media types that you want to play using %s."), APP_NAME_LONG);
      mime_subtitle = gtk_label_new (mime_text2);
      g_free (mime_text2);
      gtk_widget_show (mime_subtitle);
      gtk_box_pack_start (GTK_BOX (mime_vbox), mime_subtitle, FALSE, FALSE, 0);
      gtk_label_set_justify (GTK_LABEL (mime_subtitle), GTK_JUSTIFY_LEFT);
      gtk_misc_set_alignment (GTK_MISC (mime_subtitle), 0, 0);
      
      mime_options_vbox = gtk_vbox_new (FALSE, 10);
      gtk_widget_show (mime_options_vbox);
      gtk_box_pack_start (GTK_BOX (mime_vbox), mime_options_vbox, TRUE, TRUE, 0);
      gtk_container_set_border_width (GTK_CONTAINER (mime_options_vbox), 10);
      
#ifndef HELIX_FEATURE_REAL_BRANDING // XXXNH: we offer to claim this in hxplay
      rn_checkbox = gtk_check_button_new_with_mnemonic (_("_RealNetworks media types"));
      gtk_widget_show (rn_checkbox);
      gtk_box_pack_start (GTK_BOX (mime_options_vbox), rn_checkbox, FALSE, FALSE, 0);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rn_checkbox), TRUE);
#endif

      smil_checkbox = gtk_check_button_new_with_mnemonic (_("_SMIL multimedia presentation"));
      gtk_widget_show (smil_checkbox);
      gtk_box_pack_start (GTK_BOX (mime_options_vbox), smil_checkbox, FALSE, FALSE, 0);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (smil_checkbox), TRUE);
      
      rtsp_checkbox = gtk_check_button_new_with_mnemonic (_("R_TSP real-time streaming protocol"));
      gtk_widget_show (rtsp_checkbox);
      gtk_box_pack_start (GTK_BOX (mime_options_vbox), rtsp_checkbox, FALSE, FALSE, 0);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rtsp_checkbox), TRUE);
      
      sdp_checkbox = gtk_check_button_new_with_mnemonic (_("S_DP scalable multicast"));
      gtk_widget_show (sdp_checkbox);
      gtk_box_pack_start (GTK_BOX (mime_options_vbox), sdp_checkbox, FALSE, FALSE, 0);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sdp_checkbox), TRUE);

      mime_hbuttonbox = gtk_hbutton_box_new ();
      gtk_widget_show (mime_hbuttonbox);
      gtk_box_pack_start (GTK_BOX (mime_vbox), mime_hbuttonbox, FALSE, TRUE, 0);
      gtk_button_box_set_layout (GTK_BUTTON_BOX (mime_hbuttonbox), GTK_BUTTONBOX_END);
      gtk_box_set_spacing (GTK_BOX (mime_hbuttonbox), 10);

      mime_forward = gtk_button_new_from_stock ("gtk-go-forward");
      gtk_widget_show (mime_forward);
      gtk_container_add (GTK_CONTAINER (mime_hbuttonbox), mime_forward);
      GTK_WIDGET_SET_FLAGS (mime_forward, GTK_CAN_DEFAULT);
      
      mime_back = gtk_button_new_from_stock ("gtk-go-back");
      gtk_widget_show (mime_back);
      gtk_container_add (GTK_CONTAINER (mime_hbuttonbox), mime_back);
      GTK_WIDGET_SET_FLAGS (mime_back, GTK_CAN_DEFAULT);
      
      mime_done = gtk_button_new ();
      gtk_widget_show (mime_done);
      gtk_container_add (GTK_CONTAINER (mime_hbuttonbox), mime_done);
      GTK_WIDGET_SET_FLAGS (mime_done, GTK_CAN_DEFAULT);
      
      alignment4 = gtk_alignment_new (0.5, 0.5, 0, 0);
      gtk_widget_show (alignment4);
      gtk_container_add (GTK_CONTAINER (mime_done), alignment4);

      hbox10 = gtk_hbox_new (FALSE, 2);
      gtk_widget_show (hbox10);
      gtk_container_add (GTK_CONTAINER (alignment4), hbox10);
      
      done_image = gtk_image_new_from_stock ("gtk-ok", GTK_ICON_SIZE_BUTTON);
      gtk_widget_show (done_image);
      gtk_box_pack_start (GTK_BOX (hbox10), done_image, FALSE, FALSE, 0);
      
      done_label = gtk_label_new_with_mnemonic (_("_Done"));
      gtk_widget_show (done_label);
      gtk_box_pack_start (GTK_BOX (hbox10), done_label, FALSE, FALSE, 0);
      gtk_label_set_justify (GTK_LABEL (done_label), GTK_JUSTIFY_LEFT);
  }
  g_object_set_data(G_OBJECT(setup_assistant), "mime-support", (void*)bHasMimeSupport);


  /* Add "Almost finished" pane with an option to check for updates &
     an option to update mozilla helpers via ~/.mailcap */
  
  almost_finished_vbox = gtk_vbox_new (FALSE, 10);
  gtk_widget_show (almost_finished_vbox);
  gtk_container_add (GTK_CONTAINER (setup_notebook), almost_finished_vbox);
  gtk_container_set_border_width (GTK_CONTAINER (almost_finished_vbox), 10);

  almost_text = g_strdup_printf (_("<span foreground=\"%s\" size=\"medium\" weight=\"bold\">Almost Finished</span>"), APP_FG_COLOR);
  almost_finished_title = gtk_label_new (almost_text);
  g_free (almost_text);
  gtk_widget_show (almost_finished_title);
  gtk_box_pack_start (GTK_BOX (almost_finished_vbox), almost_finished_title, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (almost_finished_title), TRUE);
  gtk_label_set_justify (GTK_LABEL (almost_finished_title), GTK_JUSTIFY_LEFT);
  gtk_label_set_line_wrap (GTK_LABEL (almost_finished_title), TRUE);
  gtk_misc_set_alignment (GTK_MISC (almost_finished_title), 0, 0);

  almost_finished_subtitle = gtk_label_new (_("The setup assistant can configure your mozilla helpers, and check for any player updates."));
  gtk_widget_show (almost_finished_subtitle);
  gtk_box_pack_start (GTK_BOX (almost_finished_vbox), almost_finished_subtitle, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (almost_finished_subtitle), GTK_JUSTIFY_LEFT);
  gtk_label_set_line_wrap (GTK_LABEL (almost_finished_subtitle), TRUE);
  gtk_misc_set_alignment (GTK_MISC (almost_finished_subtitle), 0, 0);

  almost_finished_options_alignment = gtk_alignment_new (0.0, 0.0, 0, 0);
  gtk_widget_show (almost_finished_options_alignment);
  gtk_box_pack_start (GTK_BOX (almost_finished_vbox), almost_finished_options_alignment, TRUE, TRUE, 0);

  almost_finished_options_vbox = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (almost_finished_options_vbox);
  gtk_container_add (GTK_CONTAINER (almost_finished_options_alignment), almost_finished_options_vbox);  
  
  check_for_updates_checkbox = gtk_check_button_new_with_mnemonic (_("_Check for updates"));
  gtk_widget_show (check_for_updates_checkbox);
  gtk_box_pack_start (GTK_BOX (almost_finished_options_vbox), check_for_updates_checkbox, FALSE, FALSE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_for_updates_checkbox), TRUE);
  
  configure_mozilla_helpers_checkbox = gtk_check_button_new_with_mnemonic (_("Configure _mozilla helpers"));
  gtk_widget_show (configure_mozilla_helpers_checkbox);
  gtk_box_pack_start (GTK_BOX (almost_finished_options_vbox), configure_mozilla_helpers_checkbox, FALSE, FALSE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configure_mozilla_helpers_checkbox), TRUE);

  almost_finished_hbuttonbox = gtk_hbutton_box_new ();
  gtk_widget_show (almost_finished_hbuttonbox);
  gtk_box_pack_start (GTK_BOX (almost_finished_vbox), almost_finished_hbuttonbox, FALSE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (almost_finished_hbuttonbox), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (almost_finished_hbuttonbox), 10);

  almost_finished_back = gtk_button_new_from_stock ("gtk-go-back");
  gtk_widget_show (almost_finished_back);
  gtk_container_add (GTK_CONTAINER (almost_finished_hbuttonbox), almost_finished_back);
  GTK_WIDGET_SET_FLAGS (almost_finished_back, GTK_CAN_DEFAULT);

  almost_finished_quit = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (almost_finished_quit);
  gtk_container_add (GTK_CONTAINER (almost_finished_hbuttonbox), almost_finished_quit);
  GTK_WIDGET_SET_FLAGS (almost_finished_quit, GTK_CAN_DEFAULT);

/*
  label41 = gtk_label_new (_("label15"));
  gtk_widget_show (label41);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (setup_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (setup_notebook), 3), label41);
  gtk_label_set_justify (GTK_LABEL (label41), GTK_JUSTIFY_LEFT);
*/
  g_signal_connect_swapped ((gpointer) setup_assistant, "delete_event",
                            G_CALLBACK (hsad_setup_assistant_delete_event),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) setup_assistant, "configure_event",
                            G_CALLBACK (hsad_setup_assistant_configure_event),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) setup_notebook, "switch_page",
                            G_CALLBACK (hsad_setup_notebook_switch_page),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) welcome_quit, "clicked",
                            G_CALLBACK (hsad_quit_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) welcome_forward, "clicked",
                            G_CALLBACK (hsad_forward_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) notes_print, "clicked",
                            G_CALLBACK (hsad_print_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) notes_quit, "clicked",
                            G_CALLBACK (hsad_quit_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) notes_back, "clicked",
                            G_CALLBACK (hsad_back_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) notes_forward, "clicked",
                            G_CALLBACK (hsad_forward_clicked),
                            GTK_OBJECT (setup_assistant));
#ifdef HELIX_FEATURE_REAL_BRANDING // XXXNH: no EULA for helix player
  g_signal_connect_swapped ((gpointer) privacy_button, "clicked",
                            G_CALLBACK (hsad_privacy_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) eula_print, "clicked",
                            G_CALLBACK (hsad_print_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) eula_quit, "clicked",
                            G_CALLBACK (hsad_quit_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) eula_back, "clicked",
                            G_CALLBACK (hsad_back_clicked),
                            GTK_OBJECT (setup_assistant));
  g_signal_connect_swapped ((gpointer) eula_accept, "clicked",
                            G_CALLBACK (hsad_accept_clicked),
                            GTK_OBJECT (setup_assistant));
#endif
  if (bHasMimeSupport)
  {
      g_signal_connect_swapped ((gpointer) mime_forward, "clicked",
				G_CALLBACK (hsad_forward_clicked),
				GTK_OBJECT (setup_assistant));
      g_signal_connect_swapped ((gpointer) mime_back, "clicked",
				G_CALLBACK (hsad_back_clicked),
				GTK_OBJECT (setup_assistant));
      g_signal_connect_swapped ((gpointer) mime_done, "clicked",
				G_CALLBACK (hsad_done_clicked),
				GTK_OBJECT (setup_assistant));
  }

  g_signal_connect_swapped ((gpointer) almost_finished_back, "clicked",
                            G_CALLBACK (hsad_back_clicked),
                            GTK_OBJECT (setup_assistant));
  
  g_signal_connect_swapped ((gpointer) almost_finished_quit, "clicked",
                            G_CALLBACK (hsad_quit_clicked),
                            GTK_OBJECT (setup_assistant));
  
  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (setup_assistant, setup_assistant, "setup_assistant");
  GLADE_HOOKUP_OBJECT (setup_assistant, setup_vbox, "setup_vbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, setup_image, "setup_image");
  GLADE_HOOKUP_OBJECT (setup_assistant, setup_notebook, "setup_notebook");
  GLADE_HOOKUP_OBJECT (setup_assistant, welcome_hbox, "welcome_hbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, welcome_image, "welcome_image");
  GLADE_HOOKUP_OBJECT (setup_assistant, welcome_vbox, "welcome_vbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, welcome_title, "welcome_title");
  GLADE_HOOKUP_OBJECT (setup_assistant, welcome_hbuttonbox, "welcome_hbuttonbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, welcome_quit, "welcome_quit");
  GLADE_HOOKUP_OBJECT (setup_assistant, welcome_forward, "welcome_forward");
//  GLADE_HOOKUP_OBJECT (setup_assistant, label29, "label29");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_vbox, "notes_vbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_title, "notes_title");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_subtitle, "notes_subtitle");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_scrolledwindow, "notes_scrolledwindow");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_textview, "notes_textview");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_hbuttonbox, "notes_hbuttonbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_print, "notes_print");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_quit, "notes_quit");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_back, "notes_back");
  GLADE_HOOKUP_OBJECT (setup_assistant, notes_forward, "notes_forward");
//  GLADE_HOOKUP_OBJECT (setup_assistant, label32, "label32");
#ifdef HELIX_FEATURE_REAL_BRANDING // XXXNH: no EULA for helix player
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_vbox, "eula_vbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_title, "eula_title");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_subtitle, "eula_subtitle");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_scrolledwindow, "eula_scrolledwindow");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_textview, "eula_textview");
  GLADE_HOOKUP_OBJECT (setup_assistant, privacy_hbox, "privacy_hbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, privacy_button, "privacy_button");
  GLADE_HOOKUP_OBJECT (setup_assistant, privacy_label, "privacy_label");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_hbuttonbox, "eula_hbuttonbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_print, "eula_print");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_quit, "eula_quit");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_back, "eula_back");
  GLADE_HOOKUP_OBJECT (setup_assistant, eula_accept, "eula_accept");

  GLADE_HOOKUP_OBJECT (setup_assistant, alignment3, "alignment3");
  GLADE_HOOKUP_OBJECT (setup_assistant, hbox9, "hbox9");
  GLADE_HOOKUP_OBJECT (setup_assistant, accept_image, "accept_image");
  GLADE_HOOKUP_OBJECT (setup_assistant, accept_label, "accept_label");
//  GLADE_HOOKUP_OBJECT (setup_assistant, label37, "label37");
#endif
  if (bHasMimeSupport)
  {
      GLADE_HOOKUP_OBJECT (setup_assistant, mime_vbox, "mime_vbox");
      GLADE_HOOKUP_OBJECT (setup_assistant, mime_title, "mime_title");
      GLADE_HOOKUP_OBJECT (setup_assistant, mime_subtitle, "mime_subtitle");
      GLADE_HOOKUP_OBJECT (setup_assistant, mime_options_vbox, "mime_options_vbox");
#ifndef HELIX_FEATURE_REAL_BRANDING // XXXNH: we offer to claim this in hxplay
      GLADE_HOOKUP_OBJECT (setup_assistant, rn_checkbox, "rn_checkbox");
#endif
      GLADE_HOOKUP_OBJECT (setup_assistant, smil_checkbox, "smil_checkbox");
      GLADE_HOOKUP_OBJECT (setup_assistant, rtsp_checkbox, "rtsp_checkbox");
      GLADE_HOOKUP_OBJECT (setup_assistant, sdp_checkbox, "sdp_checkbox");
      GLADE_HOOKUP_OBJECT (setup_assistant, mime_hbuttonbox, "mime_hbuttonbox");
      GLADE_HOOKUP_OBJECT (setup_assistant, mime_forward, "mime_forward");
      GLADE_HOOKUP_OBJECT (setup_assistant, mime_back, "mime_back");
      GLADE_HOOKUP_OBJECT (setup_assistant, mime_done, "mime_done");
      GLADE_HOOKUP_OBJECT (setup_assistant, alignment4, "alignment4");
      GLADE_HOOKUP_OBJECT (setup_assistant, hbox10, "hbox10");
      GLADE_HOOKUP_OBJECT (setup_assistant, done_image, "done_image");
      GLADE_HOOKUP_OBJECT (setup_assistant, done_label, "done_label");
      
//  GLADE_HOOKUP_OBJECT (setup_assistant, label41, "label41");
  }

  GLADE_HOOKUP_OBJECT (setup_assistant, check_for_updates_checkbox, "check_for_updates_checkbox");
  GLADE_HOOKUP_OBJECT (setup_assistant, configure_mozilla_helpers_checkbox, "configure_mozilla_helpers_checkbox");

  gtk_widget_grab_default (welcome_forward);
  return setup_assistant;
}

