/*
 * 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 convertwidget1_uiinfo[] =
{
  {
    GNOME_APP_UI_ITEM, "Bluetooth",
    NULL,
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  {
    GNOME_APP_UI_ITEM, "Cable",
    NULL,
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  {
    GNOME_APP_UI_ITEM, "IR",
    NULL,
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  GNOMEUIINFO_END
};

static GnomeUIInfo menu1_uiinfo[] =
{
  {
    GNOME_APP_UI_ITEM, "SonyEricsson / Ericsson",
    NULL,
    (gpointer) on_sonyericssoncable_activate, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  {
    GNOME_APP_UI_ITEM, "Siemens",
    NULL,
    (gpointer) on_siemenscable_activate, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  GNOMEUIINFO_END
};

static GnomeUIInfo convertwidget5_uiinfo[] =
{
  {
    GNOME_APP_UI_ITEM, "None",
    NULL,
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  {
    GNOME_APP_UI_ITEM, "SonyEricsson T68i",
    NULL,
    (gpointer) NULL, NULL, NULL,
    GNOME_APP_PIXMAP_NONE, NULL,
    0, (GdkModifierType) 0, NULL
  },
  GNOMEUIINFO_END
};

GtkWidget*
create_optionwin (void)
{
  GtkWidget *optionwin;
  GtkWidget *vbox1;
  GtkWidget *notebook1;
  GtkWidget *vbox5;
  GtkWidget *label24;
  GtkWidget *hbox9;
  GtkWidget *label25;
  GtkWidget *connectmenu;
  GtkWidget *convertwidget1;
  GtkWidget *label26;
  GtkWidget *hbox10;
  GtkWidget *label27;
  GtkWidget *vbox9;
  GtkWidget *bttable;
  GtkWidget *addresslabel;
  GtkWidget *addressentry;
  GtkWidget *channellabel;
  GtkWidget *searchbutton;
  GtkWidget *alignment2;
  GtkWidget *hbox13;
  GtkWidget *image2;
  GtkWidget *label30;
  GtkWidget *channelentry;
  GtkWidget *irdatable;
  GtkWidget *label13;
  GtkWidget *label14;
  GtkWidget *irdevnameentry;
  GtkWidget *irdevidentry;
  GtkWidget *irsearchbutton;
  GtkWidget *alignment3;
  GtkWidget *hbox14;
  GtkWidget *image3;
  GtkWidget *label31;
  GtkWidget *cabletable;
  GtkWidget *serialportradio1;
  GSList *serialportradio1_group = NULL;
  GtkWidget *hbox5;
  GtkWidget *serialportradioother;
  GtkWidget *serialportentry;
  GtkWidget *serialportradio0;
  GtkWidget *hbox15;
  GtkWidget *label32;
  GtkWidget *cablemanumenu;
  GtkWidget *menu1;
  GtkWidget *label29;
  GtkWidget *testconnbutton;
  GtkWidget *alignment1;
  GtkWidget *hbox11;
  GtkWidget *image1;
  GtkWidget *label28;
  GtkWidget *label1;
  GtkWidget *vbox2;
  GtkWidget *table1;
  GtkWidget *label6;
  GtkWidget *optionpresetmenu;
  GtkWidget *convertwidget5;
  GtkWidget *notebook2;
  GtkWidget *table2;
  GtkWidget *keepdbsizecheck;
  GtkWidget *hbox8;
  GtkWidget *vbox8;
  GtkWidget *alarmtoirmccheck;
  GtkWidget *alarmfromirmccheck;
  GtkWidget *convertadecheck;
  GtkWidget *fakerecurcheck;
  GtkWidget *vbox6;
  GtkWidget *hbox12;
  GtkWidget *nooldercheck;
  GtkWidget *hbox6;
  GtkWidget *ageslider;
  GtkWidget *agelabel;
  GtkWidget *label20;
  GtkWidget *table3;
  GtkWidget *onlyphonecheck;
  GtkWidget *label21;
  GtkWidget *table4;
  GtkWidget *fixdstcheck;
  GtkWidget *donttellsynccheck;
  GtkWidget *vbox7;
  GtkWidget *hbox7;
  GtkWidget *charsetcheck;
  GtkWidget *charsetentry;
  GtkWidget *label22;
  GtkWidget *label2;
  GtkWidget *hseparator1;
  GtkWidget *hbuttonbox1;
  GtkWidget *cancelbutton;
  GtkWidget *okbutton;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  optionwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (optionwin), 12);
  gtk_window_set_title (GTK_WINDOW (optionwin), "Mobile Device Syncronization (IrMC)");

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

  notebook1 = gtk_notebook_new ();
  gtk_widget_show (notebook1);
  gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);

  vbox5 = gtk_vbox_new (FALSE, 6);
  gtk_widget_show (vbox5);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox5);
  gtk_container_set_border_width (GTK_CONTAINER (vbox5), 6);

  label24 = gtk_label_new_with_mnemonic ("<span weight='bold'>Connection type:</span>");
  gtk_widget_show (label24);
  gtk_box_pack_start (GTK_BOX (vbox5), label24, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (label24), TRUE);
  gtk_label_set_justify (GTK_LABEL (label24), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label24), 0, 0.5);

  hbox9 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox9);
  gtk_box_pack_start (GTK_BOX (vbox5), hbox9, FALSE, TRUE, 0);

  label25 = gtk_label_new ("    ");
  gtk_widget_show (label25);
  gtk_box_pack_start (GTK_BOX (hbox9), label25, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label25), GTK_JUSTIFY_LEFT);

  connectmenu = gtk_option_menu_new ();
  gtk_widget_show (connectmenu);
  gtk_box_pack_start (GTK_BOX (hbox9), connectmenu, TRUE, TRUE, 0);
  gtk_tooltips_set_tip (tooltips, connectmenu, "Select your connection type.", 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 (connectmenu), convertwidget1);

  label26 = gtk_label_new_with_mnemonic ("<span weight='bold'>Options:</span>");
  gtk_widget_show (label26);
  gtk_box_pack_start (GTK_BOX (vbox5), label26, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (label26), TRUE);
  gtk_label_set_justify (GTK_LABEL (label26), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label26), 0, 0.5);

  hbox10 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox10);
  gtk_box_pack_start (GTK_BOX (vbox5), hbox10, FALSE, TRUE, 0);

  label27 = gtk_label_new ("    ");
  gtk_widget_show (label27);
  gtk_box_pack_start (GTK_BOX (hbox10), label27, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label27), GTK_JUSTIFY_LEFT);

  vbox9 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox9);
  gtk_box_pack_start (GTK_BOX (hbox10), vbox9, TRUE, TRUE, 0);

  bttable = gtk_table_new (2, 3, FALSE);
  gtk_box_pack_start (GTK_BOX (vbox9), bttable, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (bttable), 2);
  gtk_table_set_row_spacings (GTK_TABLE (bttable), 3);
  gtk_table_set_col_spacings (GTK_TABLE (bttable), 3);

  addresslabel = gtk_label_new_with_mnemonic ("_Bluetooth address:");
  gtk_widget_show (addresslabel);
  gtk_table_attach (GTK_TABLE (bttable), addresslabel, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (addresslabel), 0, 0.5);

  addressentry = gtk_entry_new ();
  gtk_widget_show (addressentry);
  gtk_table_attach (GTK_TABLE (bttable), addressentry, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, addressentry, "The address of the Bluetooth unit. The unit must be paired with the computer.", NULL);

  channellabel = gtk_label_new_with_mnemonic ("C_hannel:");
  gtk_widget_show (channellabel);
  gtk_table_attach (GTK_TABLE (bttable), channellabel, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (channellabel), 0, 0.5);

  searchbutton = gtk_button_new ();
  gtk_widget_show (searchbutton);
  gtk_table_attach (GTK_TABLE (bttable), searchbutton, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (searchbutton), alignment2);

  hbox13 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox13);
  gtk_container_add (GTK_CONTAINER (alignment2), hbox13);

  image2 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image2);
  gtk_box_pack_start (GTK_BOX (hbox13), image2, FALSE, FALSE, 0);

  label30 = gtk_label_new_with_mnemonic ("_Search for units...");
  gtk_widget_show (label30);
  gtk_box_pack_start (GTK_BOX (hbox13), label30, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label30), GTK_JUSTIFY_LEFT);

  channelentry = gtk_entry_new ();
  gtk_widget_show (channelentry);
  gtk_table_attach (GTK_TABLE (bttable), channelentry, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, channelentry, "The RFCOMM channel for synchronization. Use \"Search for units\" to find out.", NULL);

  irdatable = gtk_table_new (2, 3, FALSE);
  gtk_widget_show (irdatable);
  gtk_box_pack_start (GTK_BOX (vbox9), irdatable, TRUE, TRUE, 0);

  label13 = gtk_label_new_with_mnemonic ("_Device Name:");
  gtk_widget_show (label13);
  gtk_table_attach (GTK_TABLE (irdatable), label13, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);

  label14 = gtk_label_new_with_mnemonic ("Serial _Number:");
  gtk_widget_show (label14);
  gtk_table_attach (GTK_TABLE (irdatable), label14, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label14), 0, 0.5);

  irdevnameentry = gtk_entry_new ();
  gtk_widget_show (irdevnameentry);
  gtk_table_attach (GTK_TABLE (irdatable), irdevnameentry, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, irdevnameentry, "The address of the Bluetooth unit. The unit must be paired with the computer.", NULL);

  irdevidentry = gtk_entry_new ();
  gtk_widget_show (irdevidentry);
  gtk_table_attach (GTK_TABLE (irdatable), irdevidentry, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, irdevidentry, "The RFCOMM channel for synchronization. Use \"Search for units\" to find out.", NULL);

  irsearchbutton = gtk_button_new ();
  gtk_widget_show (irsearchbutton);
  gtk_table_attach (GTK_TABLE (irdatable), irsearchbutton, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

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

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

  image3 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image3);
  gtk_box_pack_start (GTK_BOX (hbox14), image3, FALSE, FALSE, 0);

  label31 = gtk_label_new_with_mnemonic ("_Search for units...");
  gtk_widget_show (label31);
  gtk_box_pack_start (GTK_BOX (hbox14), label31, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label31), GTK_JUSTIFY_LEFT);

  cabletable = gtk_table_new (4, 1, FALSE);
  gtk_box_pack_start (GTK_BOX (vbox9), cabletable, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (cabletable), 2);
  gtk_table_set_row_spacings (GTK_TABLE (cabletable), 3);
  gtk_table_set_col_spacings (GTK_TABLE (cabletable), 3);

  serialportradio1 = gtk_radio_button_new_with_mnemonic (NULL, "Serial port _1 (/dev/ttyS1)");
  gtk_widget_show (serialportradio1);
  gtk_table_attach (GTK_TABLE (cabletable), serialportradio1, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (serialportradio1), serialportradio1_group);
  serialportradio1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (serialportradio1));

  hbox5 = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (hbox5);
  gtk_table_attach (GTK_TABLE (cabletable), hbox5, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  serialportradioother = gtk_radio_button_new_with_mnemonic (NULL, "_Other device:");
  gtk_widget_show (serialportradioother);
  gtk_box_pack_start (GTK_BOX (hbox5), serialportradioother, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (serialportradioother), serialportradio1_group);
  serialportradio1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (serialportradioother));

  serialportentry = gtk_entry_new ();
  gtk_widget_show (serialportentry);
  gtk_box_pack_start (GTK_BOX (hbox5), serialportentry, TRUE, TRUE, 0);

  serialportradio0 = gtk_radio_button_new_with_mnemonic (NULL, "Serial port _0 (/dev/ttyS0)");
  gtk_widget_show (serialportradio0);
  gtk_table_attach (GTK_TABLE (cabletable), serialportradio0, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (serialportradio0), serialportradio1_group);
  serialportradio1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (serialportradio0));

  hbox15 = gtk_hbox_new (FALSE, 12);
  gtk_widget_show (hbox15);
  gtk_table_attach (GTK_TABLE (cabletable), hbox15, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

  label32 = gtk_label_new ("Device manufacturer:");
  gtk_widget_show (label32);
  gtk_box_pack_start (GTK_BOX (hbox15), label32, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label32), GTK_JUSTIFY_LEFT);

  cablemanumenu = gtk_option_menu_new ();
  gtk_widget_show (cablemanumenu);
  gtk_box_pack_start (GTK_BOX (hbox15), cablemanumenu, TRUE, TRUE, 0);

  menu1 = gtk_menu_new ();
  gnome_app_fill_menu (GTK_MENU_SHELL (menu1), menu1_uiinfo,
                       NULL, FALSE, 0);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (cablemanumenu), menu1);

  label29 = gtk_label_new ("");
  gtk_widget_show (label29);
  gtk_box_pack_start (GTK_BOX (vbox5), label29, TRUE, TRUE, 0);
  gtk_label_set_justify (GTK_LABEL (label29), GTK_JUSTIFY_LEFT);

  testconnbutton = gtk_button_new ();
  gtk_widget_show (testconnbutton);
  gtk_box_pack_start (GTK_BOX (vbox5), testconnbutton, FALSE, FALSE, 0);

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (testconnbutton), alignment1);

  hbox11 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox11);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox11);

  image1 = gtk_image_new_from_stock ("gtk-apply", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox11), image1, FALSE, FALSE, 0);

  label28 = gtk_label_new_with_mnemonic ("_Test connection...");
  gtk_widget_show (label28);
  gtk_box_pack_start (GTK_BOX (hbox11), label28, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label28), GTK_JUSTIFY_LEFT);

  label1 = gtk_label_new_with_mnemonic ("_Connection");
  gtk_widget_show (label1);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);

  vbox2 = gtk_vbox_new (FALSE, 6);
  gtk_widget_show (vbox2);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 6);

  table1 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox2), table1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (table1), 2);
  gtk_table_set_row_spacings (GTK_TABLE (table1), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table1), 12);

  label6 = gtk_label_new ("Set default options for:");
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);

  optionpresetmenu = gtk_option_menu_new ();
  gtk_widget_show (optionpresetmenu);
  gtk_table_attach (GTK_TABLE (table1), optionpresetmenu, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, optionpresetmenu, "Select your device type here to get good default settings.", NULL);

  convertwidget5 = gtk_menu_new ();
  gnome_app_fill_menu (GTK_MENU_SHELL (convertwidget5), convertwidget5_uiinfo,
                       NULL, FALSE, 0);

  gtk_option_menu_set_menu (GTK_OPTION_MENU (optionpresetmenu), convertwidget5);

  notebook2 = gtk_notebook_new ();
  gtk_widget_show (notebook2);
  gtk_table_attach (GTK_TABLE (table1), notebook2, 0, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

  table2 = gtk_table_new (4, 1, FALSE);
  gtk_widget_show (table2);
  gtk_container_add (GTK_CONTAINER (notebook2), table2);
  gtk_container_set_border_width (GTK_CONTAINER (table2), 6);
  gtk_table_set_row_spacings (GTK_TABLE (table2), 4);
  gtk_table_set_col_spacings (GTK_TABLE (table2), 3);

  keepdbsizecheck = gtk_check_button_new_with_mnemonic ("Delete oldest entries when database is getting full");
  gtk_widget_show (keepdbsizecheck);
  gtk_table_attach (GTK_TABLE (table2), keepdbsizecheck, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, keepdbsizecheck, "This option will delete the oldest events when the database size reaches 75% of its capacity. If not set, the database may refuse new entries.", NULL);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (keepdbsizecheck), TRUE);

  hbox8 = gtk_hbox_new (FALSE, 4);
  gtk_widget_show (hbox8);
  gtk_table_attach (GTK_TABLE (table2), hbox8, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

  vbox8 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox8);
  gtk_box_pack_start (GTK_BOX (hbox8), vbox8, TRUE, TRUE, 0);

  alarmtoirmccheck = gtk_check_button_new_with_mnemonic ("Transfer alarms to the mobile device");
  gtk_widget_show (alarmtoirmccheck);
  gtk_box_pack_start (GTK_BOX (vbox8), alarmtoirmccheck, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, alarmtoirmccheck, "Enable transfering of alarms (reminders) TO the mobile device.", NULL);

  alarmfromirmccheck = gtk_check_button_new_with_mnemonic ("Transfer alarms from the mobile device");
  gtk_widget_show (alarmfromirmccheck);
  gtk_box_pack_start (GTK_BOX (vbox8), alarmfromirmccheck, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, alarmfromirmccheck, "Enable transfering of alarms (reminders) FROM the mobile device.", NULL);

  convertadecheck = gtk_check_button_new_with_mnemonic ("Convert all day events");
  gtk_widget_show (convertadecheck);
  gtk_box_pack_start (GTK_BOX (vbox8), convertadecheck, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, convertadecheck, "Convert all day events to a format that is understandable by some devices.", NULL);

  fakerecurcheck = gtk_check_button_new_with_mnemonic ("Add new entries for recurring events");
  gtk_widget_show (fakerecurcheck);
  gtk_table_attach (GTK_TABLE (table2), fakerecurcheck, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, fakerecurcheck, "Many mobile devices have a simple calendar which cannot handle recurrances (e.g. \"daily\"). This option will add new unique entries for every recurrance.", NULL);

  vbox6 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox6);
  gtk_table_attach (GTK_TABLE (table2), vbox6, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hbox12 = gtk_hbox_new (FALSE, 6);
  gtk_widget_show (hbox12);
  gtk_box_pack_start (GTK_BOX (vbox6), hbox12, FALSE, FALSE, 0);

  nooldercheck = gtk_check_button_new_with_mnemonic ("Don't accept events older than");
  gtk_widget_show (nooldercheck);
  gtk_box_pack_start (GTK_BOX (hbox12), nooldercheck, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, nooldercheck, "If this option is checked, events which ended more than a certain number of days ago will not be synchronized.", NULL);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (nooldercheck), TRUE);

  hbox6 = gtk_hbox_new (FALSE, 3);
  gtk_widget_show (hbox6);
  gtk_box_pack_start (GTK_BOX (hbox12), hbox6, TRUE, TRUE, 0);

  ageslider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (20, 1, 31, 1, 1, 1)));
  gtk_widget_show (ageslider);
  gtk_box_pack_start (GTK_BOX (hbox6), ageslider, TRUE, TRUE, 0);
  gtk_scale_set_draw_value (GTK_SCALE (ageslider), FALSE);
  gtk_scale_set_value_pos (GTK_SCALE (ageslider), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (ageslider), 0);

  agelabel = gtk_label_new ("14 days");
  gtk_widget_show (agelabel);
  gtk_box_pack_start (GTK_BOX (hbox6), agelabel, FALSE, FALSE, 0);

  label20 = gtk_label_new ("Calendar options");
  gtk_widget_show (label20);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 0), label20);

  table3 = gtk_table_new (1, 1, FALSE);
  gtk_widget_show (table3);
  gtk_container_add (GTK_CONTAINER (notebook2), table3);
  gtk_container_set_border_width (GTK_CONTAINER (table3), 6);
  gtk_table_set_row_spacings (GTK_TABLE (table3), 4);
  gtk_table_set_col_spacings (GTK_TABLE (table3), 3);

  onlyphonecheck = gtk_check_button_new_with_mnemonic ("Accept only contacts with phone numbers");
  gtk_widget_show (onlyphonecheck);
  gtk_table_attach (GTK_TABLE (table3), onlyphonecheck, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, onlyphonecheck, "If set, the addressbook will only accept contacts which contain at least one phone number. This is used to avoid synchronizing a lot of e-mail contacts which are uselss in e.g. a mobile phone.", NULL);

  label21 = gtk_label_new ("Phonebook options");
  gtk_widget_show (label21);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 1), label21);

  table4 = gtk_table_new (3, 1, FALSE);
  gtk_widget_show (table4);
  gtk_container_add (GTK_CONTAINER (notebook2), table4);
  gtk_container_set_border_width (GTK_CONTAINER (table4), 6);
  gtk_table_set_row_spacings (GTK_TABLE (table4), 4);
  gtk_table_set_col_spacings (GTK_TABLE (table4), 3);

  fixdstcheck = gtk_check_button_new_with_mnemonic ("Fix broken daylight savings time handling");
  gtk_widget_show (fixdstcheck);
  gtk_table_attach (GTK_TABLE (table4), fixdstcheck, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, fixdstcheck, "Some devices do not handle daylight savings time correctly. This option will try to fix that.", NULL);

  donttellsynccheck = gtk_check_button_new_with_mnemonic ("Do not tell client we are synchronizing");
  gtk_widget_show (donttellsynccheck);
  gtk_table_attach (GTK_TABLE (table4), donttellsynccheck, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_tooltips_set_tip (tooltips, donttellsynccheck, "If this option is checked, the mobile client will not be explicitly told that we are synchronizing. This will prevent lighting up the disply on the T68i, for example.", NULL);

  vbox7 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox7);
  gtk_table_attach (GTK_TABLE (table4), vbox7, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hbox7 = gtk_hbox_new (FALSE, 4);
  gtk_widget_show (hbox7);
  gtk_box_pack_start (GTK_BOX (vbox7), hbox7, FALSE, FALSE, 0);

  charsetcheck = gtk_check_button_new_with_mnemonic ("Translate from character set");
  gtk_widget_show (charsetcheck);
  gtk_box_pack_start (GTK_BOX (hbox7), charsetcheck, FALSE, FALSE, 0);
  gtk_tooltips_set_tip (tooltips, charsetcheck, "Some devices do not state the correct character set. This option will make MultiSync assume a certain character set.", NULL);

  charsetentry = gtk_entry_new ();
  gtk_widget_show (charsetentry);
  gtk_box_pack_start (GTK_BOX (hbox7), charsetentry, TRUE, TRUE, 0);
  gtk_entry_set_text (GTK_ENTRY (charsetentry), "iso-8859-1");

  label22 = gtk_label_new ("Bug workarounds");
  gtk_widget_show (label22);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 2), label22);

  label2 = gtk_label_new_with_mnemonic ("_Options");
  gtk_widget_show (label2);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label2);

  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, FALSE, TRUE, 0);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30);

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

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

  g_signal_connect ((gpointer) optionwin, "delete_event",
                    G_CALLBACK (on_optionwin_delete_event),
                    NULL);
  g_signal_connect ((gpointer) searchbutton, "clicked",
                    G_CALLBACK (on_searchbutton_clicked),
                    NULL);
  g_signal_connect ((gpointer) irsearchbutton, "clicked",
                    G_CALLBACK (on_irsearchbutton_clicked),
                    NULL);
  g_signal_connect ((gpointer) testconnbutton, "clicked",
                    G_CALLBACK (on_testconnbutton_clicked),
                    NULL);
  g_signal_connect ((gpointer) nooldercheck, "toggled",
                    G_CALLBACK (irmc_nooldercheck_toggled),
                    NULL);
  g_signal_connect ((gpointer) cancelbutton, "clicked",
                    G_CALLBACK (on_cancelbutton_clicked),
                    NULL);
  g_signal_connect ((gpointer) okbutton, "clicked",
                    G_CALLBACK (on_okbutton_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (optionwin, optionwin, "optionwin");
  GLADE_HOOKUP_OBJECT (optionwin, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (optionwin, notebook1, "notebook1");
  GLADE_HOOKUP_OBJECT (optionwin, vbox5, "vbox5");
  GLADE_HOOKUP_OBJECT (optionwin, label24, "label24");
  GLADE_HOOKUP_OBJECT (optionwin, hbox9, "hbox9");
  GLADE_HOOKUP_OBJECT (optionwin, label25, "label25");
  GLADE_HOOKUP_OBJECT (optionwin, connectmenu, "connectmenu");
  GLADE_HOOKUP_OBJECT (optionwin, convertwidget1, "convertwidget1");
  GLADE_HOOKUP_OBJECT (optionwin, convertwidget1_uiinfo[0].widget, "convertwidget2");
  GLADE_HOOKUP_OBJECT (optionwin, convertwidget1_uiinfo[1].widget, "convertwidget3");
  GLADE_HOOKUP_OBJECT (optionwin, convertwidget1_uiinfo[2].widget, "convertwidget4");
  GLADE_HOOKUP_OBJECT (optionwin, label26, "label26");
  GLADE_HOOKUP_OBJECT (optionwin, hbox10, "hbox10");
  GLADE_HOOKUP_OBJECT (optionwin, label27, "label27");
  GLADE_HOOKUP_OBJECT (optionwin, vbox9, "vbox9");
  GLADE_HOOKUP_OBJECT (optionwin, bttable, "bttable");
  GLADE_HOOKUP_OBJECT (optionwin, addresslabel, "addresslabel");
  GLADE_HOOKUP_OBJECT (optionwin, addressentry, "addressentry");
  GLADE_HOOKUP_OBJECT (optionwin, channellabel, "channellabel");
  GLADE_HOOKUP_OBJECT (optionwin, searchbutton, "searchbutton");
  GLADE_HOOKUP_OBJECT (optionwin, alignment2, "alignment2");
  GLADE_HOOKUP_OBJECT (optionwin, hbox13, "hbox13");
  GLADE_HOOKUP_OBJECT (optionwin, image2, "image2");
  GLADE_HOOKUP_OBJECT (optionwin, label30, "label30");
  GLADE_HOOKUP_OBJECT (optionwin, channelentry, "channelentry");
  GLADE_HOOKUP_OBJECT (optionwin, irdatable, "irdatable");
  GLADE_HOOKUP_OBJECT (optionwin, label13, "label13");
  GLADE_HOOKUP_OBJECT (optionwin, label14, "label14");
  GLADE_HOOKUP_OBJECT (optionwin, irdevnameentry, "irdevnameentry");
  GLADE_HOOKUP_OBJECT (optionwin, irdevidentry, "irdevidentry");
  GLADE_HOOKUP_OBJECT (optionwin, irsearchbutton, "irsearchbutton");
  GLADE_HOOKUP_OBJECT (optionwin, alignment3, "alignment3");
  GLADE_HOOKUP_OBJECT (optionwin, hbox14, "hbox14");
  GLADE_HOOKUP_OBJECT (optionwin, image3, "image3");
  GLADE_HOOKUP_OBJECT (optionwin, label31, "label31");
  GLADE_HOOKUP_OBJECT (optionwin, cabletable, "cabletable");
  GLADE_HOOKUP_OBJECT (optionwin, serialportradio1, "serialportradio1");
  GLADE_HOOKUP_OBJECT (optionwin, hbox5, "hbox5");
  GLADE_HOOKUP_OBJECT (optionwin, serialportradioother, "serialportradioother");
  GLADE_HOOKUP_OBJECT (optionwin, serialportentry, "serialportentry");
  GLADE_HOOKUP_OBJECT (optionwin, serialportradio0, "serialportradio0");
  GLADE_HOOKUP_OBJECT (optionwin, hbox15, "hbox15");
  GLADE_HOOKUP_OBJECT (optionwin, label32, "label32");
  GLADE_HOOKUP_OBJECT (optionwin, cablemanumenu, "cablemanumenu");
  GLADE_HOOKUP_OBJECT (optionwin, menu1, "menu1");
  GLADE_HOOKUP_OBJECT (optionwin, menu1_uiinfo[0].widget, "sonyericssoncable");
  GLADE_HOOKUP_OBJECT (optionwin, menu1_uiinfo[1].widget, "siemenscable");
  GLADE_HOOKUP_OBJECT (optionwin, label29, "label29");
  GLADE_HOOKUP_OBJECT (optionwin, testconnbutton, "testconnbutton");
  GLADE_HOOKUP_OBJECT (optionwin, alignment1, "alignment1");
  GLADE_HOOKUP_OBJECT (optionwin, hbox11, "hbox11");
  GLADE_HOOKUP_OBJECT (optionwin, image1, "image1");
  GLADE_HOOKUP_OBJECT (optionwin, label28, "label28");
  GLADE_HOOKUP_OBJECT (optionwin, label1, "label1");
  GLADE_HOOKUP_OBJECT (optionwin, vbox2, "vbox2");
  GLADE_HOOKUP_OBJECT (optionwin, table1, "table1");
  GLADE_HOOKUP_OBJECT (optionwin, label6, "label6");
  GLADE_HOOKUP_OBJECT (optionwin, optionpresetmenu, "optionpresetmenu");
  GLADE_HOOKUP_OBJECT (optionwin, convertwidget5, "convertwidget5");
  GLADE_HOOKUP_OBJECT (optionwin, convertwidget5_uiinfo[0].widget, "convertwidget6");
  GLADE_HOOKUP_OBJECT (optionwin, convertwidget5_uiinfo[1].widget, "convertwidget7");
  GLADE_HOOKUP_OBJECT (optionwin, notebook2, "notebook2");
  GLADE_HOOKUP_OBJECT (optionwin, table2, "table2");
  GLADE_HOOKUP_OBJECT (optionwin, keepdbsizecheck, "keepdbsizecheck");
  GLADE_HOOKUP_OBJECT (optionwin, hbox8, "hbox8");
  GLADE_HOOKUP_OBJECT (optionwin, vbox8, "vbox8");
  GLADE_HOOKUP_OBJECT (optionwin, alarmtoirmccheck, "alarmtoirmccheck");
  GLADE_HOOKUP_OBJECT (optionwin, alarmfromirmccheck, "alarmfromirmccheck");
  GLADE_HOOKUP_OBJECT (optionwin, convertadecheck, "convertadecheck");
  GLADE_HOOKUP_OBJECT (optionwin, fakerecurcheck, "fakerecurcheck");
  GLADE_HOOKUP_OBJECT (optionwin, vbox6, "vbox6");
  GLADE_HOOKUP_OBJECT (optionwin, hbox12, "hbox12");
  GLADE_HOOKUP_OBJECT (optionwin, nooldercheck, "nooldercheck");
  GLADE_HOOKUP_OBJECT (optionwin, hbox6, "hbox6");
  GLADE_HOOKUP_OBJECT (optionwin, ageslider, "ageslider");
  GLADE_HOOKUP_OBJECT (optionwin, agelabel, "agelabel");
  GLADE_HOOKUP_OBJECT (optionwin, label20, "label20");
  GLADE_HOOKUP_OBJECT (optionwin, table3, "table3");
  GLADE_HOOKUP_OBJECT (optionwin, onlyphonecheck, "onlyphonecheck");
  GLADE_HOOKUP_OBJECT (optionwin, label21, "label21");
  GLADE_HOOKUP_OBJECT (optionwin, table4, "table4");
  GLADE_HOOKUP_OBJECT (optionwin, fixdstcheck, "fixdstcheck");
  GLADE_HOOKUP_OBJECT (optionwin, donttellsynccheck, "donttellsynccheck");
  GLADE_HOOKUP_OBJECT (optionwin, vbox7, "vbox7");
  GLADE_HOOKUP_OBJECT (optionwin, hbox7, "hbox7");
  GLADE_HOOKUP_OBJECT (optionwin, charsetcheck, "charsetcheck");
  GLADE_HOOKUP_OBJECT (optionwin, charsetentry, "charsetentry");
  GLADE_HOOKUP_OBJECT (optionwin, label22, "label22");
  GLADE_HOOKUP_OBJECT (optionwin, label2, "label2");
  GLADE_HOOKUP_OBJECT (optionwin, hseparator1, "hseparator1");
  GLADE_HOOKUP_OBJECT (optionwin, hbuttonbox1, "hbuttonbox1");
  GLADE_HOOKUP_OBJECT (optionwin, cancelbutton, "cancelbutton");
  GLADE_HOOKUP_OBJECT (optionwin, okbutton, "okbutton");
  GLADE_HOOKUP_OBJECT_NO_REF (optionwin, tooltips, "tooltips");

  return optionwin;
}

GtkWidget*
create_infodialog (void)
{
  GtkWidget *infodialog;
  GtkWidget *dialog_vbox1;
  GtkWidget *hbox3;
  GtkWidget *infolabel;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbuttonbox2;
  GtkWidget *infook;

  infodialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (infodialog), "IrMC Information");

  dialog_vbox1 = GTK_DIALOG (infodialog)->vbox;
  gtk_widget_show (dialog_vbox1);

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

  infolabel = gtk_label_new ("You have information.");
  gtk_widget_show (infolabel);
  gtk_box_pack_start (GTK_BOX (hbox3), infolabel, TRUE, TRUE, 0);
  gtk_misc_set_padding (GTK_MISC (infolabel), 10, 10);

  dialog_action_area1 = GTK_DIALOG (infodialog)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  hbuttonbox2 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox2);
  gtk_container_add (GTK_CONTAINER (dialog_action_area1), hbuttonbox2);
  gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 30);

  infook = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (infook);
  gtk_container_add (GTK_CONTAINER (hbuttonbox2), infook);
  GTK_WIDGET_SET_FLAGS (infook, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) infodialog, "delete_event",
                    G_CALLBACK (on_infodialog_delete_event),
                    NULL);
  g_signal_connect ((gpointer) infook, "clicked",
                    G_CALLBACK (on_infook_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (infodialog, infodialog, "infodialog");
  GLADE_HOOKUP_OBJECT_NO_REF (infodialog, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (infodialog, hbox3, "hbox3");
  GLADE_HOOKUP_OBJECT (infodialog, infolabel, "infolabel");
  GLADE_HOOKUP_OBJECT_NO_REF (infodialog, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (infodialog, hbuttonbox2, "hbuttonbox2");
  GLADE_HOOKUP_OBJECT (infodialog, infook, "infook");

  return infodialog;
}

GtkWidget*
create_listdialog (void)
{
  GtkWidget *listdialog;
  GtkWidget *dialog_vbox3;
  GtkWidget *frame1;
  GtkWidget *vbox3;
  GtkWidget *scrolledwindow1;
  GtkWidget *unitlist;
  GtkWidget *listlabel;
  GtkWidget *label23;
  GtkWidget *dialog_action_area3;
  GtkWidget *hbuttonbox3;
  GtkWidget *listcancel;
  GtkWidget *listok;

  listdialog = gtk_dialog_new ();
  gtk_container_set_border_width (GTK_CONTAINER (listdialog), 3);
  gtk_window_set_title (GTK_WINDOW (listdialog), "List of units");

  dialog_vbox3 = GTK_DIALOG (listdialog)->vbox;
  gtk_widget_show (dialog_vbox3);

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), frame1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame1), 3);

  vbox3 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox3);
  gtk_container_add (GTK_CONTAINER (frame1), vbox3);

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow1);
  gtk_box_pack_start (GTK_BOX (vbox3), scrolledwindow1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow1), 4);
  GTK_WIDGET_UNSET_FLAGS (scrolledwindow1, GTK_CAN_FOCUS);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);

  unitlist = gtk_tree_view_new ();
  gtk_widget_show (unitlist);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), unitlist);
  gtk_widget_set_size_request (unitlist, 300, 100);
  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (unitlist), FALSE);

  listlabel = gtk_label_new ("Searching...");
  gtk_widget_show (listlabel);
  gtk_box_pack_start (GTK_BOX (vbox3), listlabel, FALSE, FALSE, 0);
  gtk_misc_set_padding (GTK_MISC (listlabel), 0, 2);

  label23 = gtk_label_new ("Found units");
  gtk_widget_show (label23);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), label23);
  gtk_label_set_justify (GTK_LABEL (label23), GTK_JUSTIFY_LEFT);

  dialog_action_area3 = GTK_DIALOG (listdialog)->action_area;
  gtk_widget_show (dialog_action_area3);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area3), GTK_BUTTONBOX_END);

  hbuttonbox3 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox3);
  gtk_container_add (GTK_CONTAINER (dialog_action_area3), hbuttonbox3);
  gtk_box_set_spacing (GTK_BOX (hbuttonbox3), 30);

  listcancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (listcancel);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), listcancel);
  GTK_WIDGET_SET_FLAGS (listcancel, GTK_CAN_DEFAULT);

  listok = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (listok);
  gtk_dialog_add_action_widget (GTK_DIALOG (listdialog), listok, 0);
  GTK_WIDGET_SET_FLAGS (listok, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) unitlist, "row_activated",
                    G_CALLBACK (on_unitlist_row_activated),
                    NULL);
  g_signal_connect ((gpointer) listcancel, "clicked",
                    G_CALLBACK (on_listcancel_clicked),
                    NULL);
  g_signal_connect ((gpointer) listok, "clicked",
                    G_CALLBACK (on_listok_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (listdialog, listdialog, "listdialog");
  GLADE_HOOKUP_OBJECT_NO_REF (listdialog, dialog_vbox3, "dialog_vbox3");
  GLADE_HOOKUP_OBJECT (listdialog, frame1, "frame1");
  GLADE_HOOKUP_OBJECT (listdialog, vbox3, "vbox3");
  GLADE_HOOKUP_OBJECT (listdialog, scrolledwindow1, "scrolledwindow1");
  GLADE_HOOKUP_OBJECT (listdialog, unitlist, "unitlist");
  GLADE_HOOKUP_OBJECT (listdialog, listlabel, "listlabel");
  GLADE_HOOKUP_OBJECT (listdialog, label23, "label23");
  GLADE_HOOKUP_OBJECT_NO_REF (listdialog, dialog_action_area3, "dialog_action_area3");
  GLADE_HOOKUP_OBJECT (listdialog, hbuttonbox3, "hbuttonbox3");
  GLADE_HOOKUP_OBJECT (listdialog, listcancel, "listcancel");
  GLADE_HOOKUP_OBJECT (listdialog, listok, "listok");

  return listdialog;
}

