/*
 * 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 <bonobo.h>
#include <gnome.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"

#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)

static GnomeUIInfo convertwidget4_uiinfo[] =
{
  {
    GNOME_APP_UI_ITEM, N_("Opie/OpenZaurus"),
    N_("The Zaurus operating system type."),
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  {
    GNOME_APP_UI_ITEM, N_("Zaurus"),
    NULL,
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  GNOMEUIINFO_END
};

static GnomeUIInfo convertwidget1_uiinfo[] =
{
  {
    GNOME_APP_UI_ITEM, N_("FTP"),
    NULL,
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  {
    GNOME_APP_UI_ITEM, N_("SFTP"),
    NULL,
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  GNOMEUIINFO_END
};

GtkWidget*
create_opie_config (void)
{
  GtkWidget *opie_config;
  GtkWidget *vbox1;
  GtkWidget *label1;
  GtkWidget *hbox1;
  GtkWidget *label2;
  GtkWidget *table2;
  GtkWidget *device_type;
  GtkWidget *device_type_entry;
  GtkWidget *convertwidget4;
  GtkWidget *label4;
  GtkWidget *hbox2;
  GtkWidget *label5;
  GtkWidget *table3;
  GtkWidget *label3;
  GtkWidget *device_ip_entry;
  GtkWidget *port;
  GtkWidget *port_entry;
  GtkWidget *protocol;
  GtkWidget *protocol_entry;
  GtkWidget *convertwidget1;
  GtkWidget *enable_qcop_label;
  GtkWidget *enable_qcop;
  GtkWidget *label6;
  GtkWidget *hbox3;
  GtkWidget *label7;
  GtkWidget *table4;
  GtkWidget *username;
  GtkWidget *username_entry;
  GtkWidget *password;
  GtkWidget *password_entry;
  GtkWidget *hseparator1;
  GtkWidget *hbuttonbox1;
  GtkWidget *cancel;
  GtkWidget *ok;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  opie_config = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (opie_config), 12);
  gtk_window_set_title (GTK_WINDOW (opie_config), _("Multisync Opie/Zaurus Configuration"));
  gtk_window_set_modal (GTK_WINDOW (opie_config), TRUE);

  vbox1 = gtk_vbox_new (FALSE, 6);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (opie_config), vbox1);

  label1 = gtk_label_new_with_mnemonic (_("<span weight=\"bold\">Device information:</span>"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, TRUE, 0);
  gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0);

  label2 = gtk_label_new (_("    "));
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (hbox1), label2, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

  table2 = gtk_table_new (1, 2, FALSE);
  gtk_widget_show (table2);
  gtk_box_pack_start (GTK_BOX (hbox1), table2, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table2), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table2), 12);

  device_type = gtk_label_new_with_mnemonic (_("_Type:"));
  gtk_widget_show (device_type);
  gtk_table_attach (GTK_TABLE (table2), device_type, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (device_type), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (device_type), 0, 0.5);

  device_type_entry = gtk_option_menu_new ();
  gtk_widget_show (device_type_entry);
  gtk_table_attach (GTK_TABLE (table2), device_type_entry, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, device_type_entry, _("The Zaurus operating system type."), NULL);

  convertwidget4 = gtk_menu_new ();
  gnome_app_fill_menu (GTK_MENU_SHELL (convertwidget4), convertwidget4_uiinfo,
                       NULL, FALSE, 0);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (device_type_entry), convertwidget4);

  label4 = gtk_label_new_with_mnemonic (_("<span weight=\"bold\">Connection:</span>"));
  gtk_widget_show (label4);
  gtk_box_pack_start (GTK_BOX (vbox1), label4, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (label4), TRUE);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, TRUE, 0);

  label5 = gtk_label_new (_("    "));
  gtk_widget_show (label5);
  gtk_box_pack_start (GTK_BOX (hbox2), label5, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);

  table3 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table3);
  gtk_box_pack_start (GTK_BOX (hbox2), table3, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table3), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table3), 12);

  label3 = gtk_label_new_with_mnemonic (_("_IP Address:"));
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table3), label3, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);

  device_ip_entry = gtk_entry_new ();
  gtk_widget_show (device_ip_entry);
  gtk_table_attach (GTK_TABLE (table3), device_ip_entry, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, device_ip_entry, _("The address of the Zaurus."), NULL);
  gtk_entry_set_text (GTK_ENTRY (device_ip_entry), _("192.168.0.1"));

  port = gtk_label_new_with_mnemonic (_("Po_rt:"));
  gtk_widget_show (port);
  gtk_table_attach (GTK_TABLE (table3), port, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (port), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (port), 0, 0.5);

  port_entry = gtk_entry_new ();
  gtk_widget_show (port_entry);
  gtk_table_attach (GTK_TABLE (table3), port_entry, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, port_entry, _("The port to connect to using the protocol above. Use 4242 for FTP and 22 for SFTP."), NULL);
  gtk_entry_set_text (GTK_ENTRY (port_entry), _("4242"));

  protocol = gtk_label_new_with_mnemonic (_("_Protocol:"));
  gtk_widget_show (protocol);
  gtk_table_attach (GTK_TABLE (table3), protocol, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (protocol), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (protocol), 0, 0.5);

  protocol_entry = gtk_option_menu_new ();
  gtk_widget_show (protocol_entry);
  gtk_table_attach (GTK_TABLE (table3), protocol_entry, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, protocol_entry, _("The protocol used to get data from the Zaurus. SFTP is an encrypted version of FTP, so that no one can snoop your data."), NULL);

  convertwidget1 = gtk_menu_new ();
  gnome_app_fill_menu (GTK_MENU_SHELL (convertwidget1), convertwidget1_uiinfo,
                       NULL, FALSE, 0);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (protocol_entry), convertwidget1);

  enable_qcop_label = gtk_label_new_with_mnemonic (_("Enable _QCop:"));
  gtk_widget_show (enable_qcop_label);
  gtk_table_attach (GTK_TABLE (table3), enable_qcop_label, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (enable_qcop_label), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (enable_qcop_label), 0, 0.5);

  enable_qcop = gtk_check_button_new_with_mnemonic ("");
  gtk_widget_show (enable_qcop);
  gtk_table_attach (GTK_TABLE (table3), enable_qcop, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, enable_qcop, _("Enable QCop communication with Opie."), NULL);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enable_qcop), TRUE);

  label6 = gtk_label_new_with_mnemonic (_("<span weight=\"bold\">Authentication:</span>"));
  gtk_widget_show (label6);
  gtk_box_pack_start (GTK_BOX (vbox1), label6, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (label6), TRUE);
  gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);

  hbox3 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox3);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox3, FALSE, TRUE, 0);

  label7 = gtk_label_new (_("    "));
  gtk_widget_show (label7);
  gtk_box_pack_start (GTK_BOX (hbox3), label7, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT);

  table4 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table4);
  gtk_box_pack_start (GTK_BOX (hbox3), table4, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table4), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table4), 12);

  username = gtk_label_new_with_mnemonic (_("_Username:"));
  gtk_widget_show (username);
  gtk_table_attach (GTK_TABLE (table4), username, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (username), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (username), 0, 0.5);

  username_entry = gtk_entry_new ();
  gtk_widget_show (username_entry);
  gtk_table_attach (GTK_TABLE (table4), username_entry, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, username_entry, _("The user name used to log in on the Zaurus. Default is \"root\"."), NULL);
  gtk_entry_set_text (GTK_ENTRY (username_entry), _("root"));

  password = gtk_label_new_with_mnemonic (_("P_assword:"));
  gtk_widget_show (password);
  gtk_table_attach (GTK_TABLE (table4), password, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (password), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (password), 0, 0.5);

  password_entry = gtk_entry_new ();
  gtk_widget_show (password_entry);
  gtk_table_attach (GTK_TABLE (table4), password_entry, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, password_entry, _("The password used to log in on the Zaurus. Default is \"rootme\"."), NULL);
  gtk_entry_set_visibility (GTK_ENTRY (password_entry), FALSE);
  gtk_entry_set_text (GTK_ENTRY (password_entry), _("rootme"));

  hseparator1 = gtk_hseparator_new ();
  gtk_widget_show (hseparator1);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, FALSE, TRUE, 0);

  hbuttonbox1 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 24);

  cancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancel);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), cancel);

  ok = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (ok);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), ok);

  g_signal_connect ((gpointer) opie_config, "delete_event",
                    G_CALLBACK (on_opie_config_delete_event),
                    NULL);
  g_signal_connect ((gpointer) cancel, "clicked",
                    G_CALLBACK (on_cancel_clicked),
                    NULL);
  g_signal_connect ((gpointer) ok, "clicked",
                    G_CALLBACK (on_ok_clicked),
                    NULL);

  gtk_label_set_mnemonic_widget (GTK_LABEL (device_type), device_type_entry);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label3), device_ip_entry);
  gtk_label_set_mnemonic_widget (GTK_LABEL (port), port_entry);
  gtk_label_set_mnemonic_widget (GTK_LABEL (protocol), protocol_entry);
  gtk_label_set_mnemonic_widget (GTK_LABEL (enable_qcop_label), enable_qcop);
  gtk_label_set_mnemonic_widget (GTK_LABEL (username), username_entry);
  gtk_label_set_mnemonic_widget (GTK_LABEL (password), password_entry);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (opie_config, opie_config, "opie_config");
  GLADE_HOOKUP_OBJECT (opie_config, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (opie_config, label1, "label1");
  GLADE_HOOKUP_OBJECT (opie_config, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (opie_config, label2, "label2");
  GLADE_HOOKUP_OBJECT (opie_config, table2, "table2");
  GLADE_HOOKUP_OBJECT (opie_config, device_type, "device_type");
  GLADE_HOOKUP_OBJECT (opie_config, device_type_entry, "device_type_entry");
  GLADE_HOOKUP_OBJECT (opie_config, convertwidget4, "convertwidget4");
  GLADE_HOOKUP_OBJECT (opie_config, convertwidget4_uiinfo[0].widget, "convertwidget5");
  GLADE_HOOKUP_OBJECT (opie_config, convertwidget4_uiinfo[1].widget, "convertwidget6");
  GLADE_HOOKUP_OBJECT (opie_config, label4, "label4");
  GLADE_HOOKUP_OBJECT (opie_config, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (opie_config, label5, "label5");
  GLADE_HOOKUP_OBJECT (opie_config, table3, "table3");
  GLADE_HOOKUP_OBJECT (opie_config, label3, "label3");
  GLADE_HOOKUP_OBJECT (opie_config, device_ip_entry, "device_ip_entry");
  GLADE_HOOKUP_OBJECT (opie_config, port, "port");
  GLADE_HOOKUP_OBJECT (opie_config, port_entry, "port_entry");
  GLADE_HOOKUP_OBJECT (opie_config, protocol, "protocol");
  GLADE_HOOKUP_OBJECT (opie_config, protocol_entry, "protocol_entry");
  GLADE_HOOKUP_OBJECT (opie_config, convertwidget1, "convertwidget1");
  GLADE_HOOKUP_OBJECT (opie_config, convertwidget1_uiinfo[0].widget, "convertwidget2");
  GLADE_HOOKUP_OBJECT (opie_config, convertwidget1_uiinfo[1].widget, "convertwidget3");
  GLADE_HOOKUP_OBJECT (opie_config, enable_qcop_label, "enable_qcop_label");
  GLADE_HOOKUP_OBJECT (opie_config, enable_qcop, "enable_qcop");
  GLADE_HOOKUP_OBJECT (opie_config, label6, "label6");
  GLADE_HOOKUP_OBJECT (opie_config, hbox3, "hbox3");
  GLADE_HOOKUP_OBJECT (opie_config, label7, "label7");
  GLADE_HOOKUP_OBJECT (opie_config, table4, "table4");
  GLADE_HOOKUP_OBJECT (opie_config, username, "username");
  GLADE_HOOKUP_OBJECT (opie_config, username_entry, "username_entry");
  GLADE_HOOKUP_OBJECT (opie_config, password, "password");
  GLADE_HOOKUP_OBJECT (opie_config, password_entry, "password_entry");
  GLADE_HOOKUP_OBJECT (opie_config, hseparator1, "hseparator1");
  GLADE_HOOKUP_OBJECT (opie_config, hbuttonbox1, "hbuttonbox1");
  GLADE_HOOKUP_OBJECT (opie_config, cancel, "cancel");
  GLADE_HOOKUP_OBJECT (opie_config, ok, "ok");
  GLADE_HOOKUP_OBJECT_NO_REF (opie_config, tooltips, "tooltips");

  return opie_config;
}

