/*
 * 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 "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)

GtkWidget*
create_selectkb_window (void)
{
  GtkWidget *selectkb_window;
  GdkPixbuf *selectkb_window_icon_pixbuf;
  GtkWidget *vbox1;
  GtkWidget *label6;
  GtkWidget *scrolledwindow1;
  GtkWidget *keyboard_treeview;
  GtkWidget *frame1;
  GtkWidget *alignment3;
  GtkWidget *selectkb_help_textview;
  GtkWidget *hbox3;
  GtkWidget *image3;
  GtkWidget *help_label;
  GtkWidget *hbuttonbox1;
  GtkWidget *selectkb_cancel_button;
  GtkWidget *selectkb_ok_button;

  selectkb_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (selectkb_window), 10);
  gtk_window_set_title (GTK_WINDOW (selectkb_window), _("Select keyboard"));
  gtk_window_set_position (GTK_WINDOW (selectkb_window), GTK_WIN_POS_CENTER);
  gtk_window_set_modal (GTK_WINDOW (selectkb_window), TRUE);
  gtk_window_set_default_size (GTK_WINDOW (selectkb_window), 490, 430);
  selectkb_window_icon_pixbuf = create_pixbuf ("icon.png");
  if (selectkb_window_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (selectkb_window), selectkb_window_icon_pixbuf);
      gdk_pixbuf_unref (selectkb_window_icon_pixbuf);
    }

  vbox1 = gtk_vbox_new (FALSE, 7);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (selectkb_window), vbox1);

  label6 = gtk_label_new (_("Please select your keyboard:"));
  gtk_widget_show (label6);
  gtk_box_pack_start (GTK_BOX (vbox1), label6, FALSE, FALSE, 0);

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow1);
  gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0);
  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);

  keyboard_treeview = gtk_tree_view_new ();
  gtk_widget_show (keyboard_treeview);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), keyboard_treeview);

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (vbox1), frame1, FALSE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE);

  alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment3);
  gtk_container_add (GTK_CONTAINER (frame1), alignment3);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 12, 0);

  selectkb_help_textview = gtk_text_view_new ();
  gtk_widget_show (selectkb_help_textview);
  gtk_container_add (GTK_CONTAINER (alignment3), selectkb_help_textview);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (selectkb_help_textview), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (selectkb_help_textview), GTK_WRAP_WORD);
  gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (selectkb_help_textview), 3);
  gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (selectkb_help_textview), 3);
  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (selectkb_help_textview), 5);
  gtk_text_view_set_right_margin (GTK_TEXT_VIEW (selectkb_help_textview), 5);
  gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (selectkb_help_textview)), _("Every input device has its own \"event device\". All event devices are listed above. You should select the event device of your keyboard.\nClick \"OK\" after selecting the keyboard and this program will test if you selected the right device.\nNote USB keyboards have two event devices. The first is for all \"normal\" keys and the second for the extra function keys. Choose the second device."), -1);

  hbox3 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox3);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), hbox3);

  image3 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image3);
  gtk_box_pack_start (GTK_BOX (hbox3), image3, TRUE, TRUE, 0);

  help_label = gtk_label_new (_("<b>Help information:</b>"));
  gtk_widget_show (help_label);
  gtk_box_pack_start (GTK_BOX (hbox3), help_label, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (help_label), TRUE);

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

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

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

  g_signal_connect ((gpointer) selectkb_window, "delete_event",
                    G_CALLBACK (on_selectkb_window_delete_event),
                    NULL);
  g_signal_connect ((gpointer) selectkb_window, "show",
                    G_CALLBACK (on_selectkb_window_show),
                    NULL);
  g_signal_connect ((gpointer) selectkb_cancel_button, "clicked",
                    G_CALLBACK (on_selectkb_cancel_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) selectkb_ok_button, "clicked",
                    G_CALLBACK (on_selectkb_ok_button_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (selectkb_window, selectkb_window, "selectkb_window");
  GLADE_HOOKUP_OBJECT (selectkb_window, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (selectkb_window, label6, "label6");
  GLADE_HOOKUP_OBJECT (selectkb_window, scrolledwindow1, "scrolledwindow1");
  GLADE_HOOKUP_OBJECT (selectkb_window, keyboard_treeview, "keyboard_treeview");
  GLADE_HOOKUP_OBJECT (selectkb_window, frame1, "frame1");
  GLADE_HOOKUP_OBJECT (selectkb_window, alignment3, "alignment3");
  GLADE_HOOKUP_OBJECT (selectkb_window, selectkb_help_textview, "selectkb_help_textview");
  GLADE_HOOKUP_OBJECT (selectkb_window, hbox3, "hbox3");
  GLADE_HOOKUP_OBJECT (selectkb_window, image3, "image3");
  GLADE_HOOKUP_OBJECT (selectkb_window, help_label, "help_label");
  GLADE_HOOKUP_OBJECT (selectkb_window, hbuttonbox1, "hbuttonbox1");
  GLADE_HOOKUP_OBJECT (selectkb_window, selectkb_cancel_button, "selectkb_cancel_button");
  GLADE_HOOKUP_OBJECT (selectkb_window, selectkb_ok_button, "selectkb_ok_button");

  return selectkb_window;
}

GtkWidget*
create_main_window (void)
{
  GtkWidget *main_window;
  GdkPixbuf *main_window_icon_pixbuf;
  GtkWidget *vbox4;
  GtkWidget *menubar1;
  GtkWidget *menuitem4;
  GtkWidget *menuitem4_menu;
  GtkWidget *new1;
  GtkWidget *open1;
  GtkWidget *save1;
  GtkWidget *save_as1;
  GtkWidget *separator1;
  GtkWidget *quit1;
  GtkWidget *edit2;
  GtkWidget *edit2_menu;
  GtkWidget *change_keyboard_menuitem;
  GtkWidget *menuitem7;
  GtkWidget *menuitem7_menu;
  GtkWidget *about1;
  GtkWidget *vbox6;
  GtkWidget *frame2;
  GtkWidget *table6;
  GtkWidget *label27;
  GtkWidget *label28;
  GtkWidget *model_entry;
  GtkWidget *manufacturer_entry;
  GtkWidget *label16;
  GtkWidget *frame3;
  GtkWidget *hpaned1;
  GtkWidget *vbox5;
  GtkWidget *scrolledwindow2;
  GtkWidget *key_treeview;
  GtkWidget *hbuttonbox3;
  GtkWidget *remove_key_button;
  GtkWidget *new_key_button;
  GtkWidget *frame4;
  GtkWidget *table2;
  GtkWidget *label19;
  GtkWidget *scancode_event_descr_label;
  GtkWidget *key_name_entry;
  GtkWidget *hbox8;
  GtkWidget *scancode_entry;
  GtkWidget *scancode_change_button;
  GtkWidget *alignment8;
  GtkWidget *hbox9;
  GtkWidget *image8;
  GtkWidget *label23;
  GtkWidget *table4;
  GtkWidget *program_radiobutton;
  GSList *program_radiobutton_group = NULL;
  GtkWidget *program_entry;
  GtkWidget *frame5;
  GtkWidget *table5;
  GtkWidget *label25;
  GtkWidget *label26;
  GtkWidget *plugin_combo;
  GtkWidget *plugin_comboentry;
  GtkWidget *plugin_function_combo;
  GtkWidget *plugin_function_comboentry;
  GtkWidget *label24;
  GtkWidget *special_action_radiobutton;
  GtkWidget *label22;
  GtkWidget *label21;
  GtkWidget *keycode_combobox;
  GtkWidget *hbox11;
  GtkWidget *usbcode_entry;
  GtkWidget *usbcode_change_button;
  GtkWidget *alignment12;
  GtkWidget *hbox12;
  GtkWidget *image12;
  GtkWidget *label44;
  GtkWidget *usbcode_label;
  GtkWidget *label18;
  GtkWidget *label17;
  GtkAccelGroup *accel_group;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  accel_group = gtk_accel_group_new ();

  main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (main_window), _("keyTouch-editor"));
  main_window_icon_pixbuf = create_pixbuf ("icon.png");
  if (main_window_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (main_window), main_window_icon_pixbuf);
      gdk_pixbuf_unref (main_window_icon_pixbuf);
    }

  vbox4 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox4);
  gtk_container_add (GTK_CONTAINER (main_window), vbox4);

  menubar1 = gtk_menu_bar_new ();
  gtk_widget_show (menubar1);
  gtk_box_pack_start (GTK_BOX (vbox4), menubar1, FALSE, FALSE, 0);

  menuitem4 = gtk_menu_item_new_with_mnemonic (_("_File"));
  gtk_widget_show (menuitem4);
  gtk_container_add (GTK_CONTAINER (menubar1), menuitem4);

  menuitem4_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu);

  new1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
  gtk_widget_show (new1);
  gtk_container_add (GTK_CONTAINER (menuitem4_menu), new1);

  open1 = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
  gtk_widget_show (open1);
  gtk_container_add (GTK_CONTAINER (menuitem4_menu), open1);

  save1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
  gtk_widget_show (save1);
  gtk_container_add (GTK_CONTAINER (menuitem4_menu), save1);

  save_as1 = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group);
  gtk_widget_show (save_as1);
  gtk_container_add (GTK_CONTAINER (menuitem4_menu), save_as1);

  separator1 = gtk_separator_menu_item_new ();
  gtk_widget_show (separator1);
  gtk_container_add (GTK_CONTAINER (menuitem4_menu), separator1);
  gtk_widget_set_sensitive (separator1, FALSE);

  quit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
  gtk_widget_show (quit1);
  gtk_container_add (GTK_CONTAINER (menuitem4_menu), quit1);

  edit2 = gtk_menu_item_new_with_mnemonic (_("_Edit"));
  gtk_widget_show (edit2);
  gtk_container_add (GTK_CONTAINER (menubar1), edit2);

  edit2_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (edit2), edit2_menu);

  change_keyboard_menuitem = gtk_menu_item_new_with_mnemonic (_("Change _keyboard..."));
  gtk_widget_show (change_keyboard_menuitem);
  gtk_container_add (GTK_CONTAINER (edit2_menu), change_keyboard_menuitem);
  gtk_widget_add_accelerator (change_keyboard_menuitem, "activate", accel_group,
                              GDK_K, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  menuitem7 = gtk_menu_item_new_with_mnemonic (_("_Help"));
  gtk_widget_show (menuitem7);
  gtk_container_add (GTK_CONTAINER (menubar1), menuitem7);

  menuitem7_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem7), menuitem7_menu);

  about1 = gtk_menu_item_new_with_mnemonic (_("_About"));
  gtk_widget_show (about1);
  gtk_container_add (GTK_CONTAINER (menuitem7_menu), about1);

  vbox6 = gtk_vbox_new (FALSE, 6);
  gtk_widget_show (vbox6);
  gtk_box_pack_start (GTK_BOX (vbox4), vbox6, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox6), 6);

  frame2 = gtk_frame_new (NULL);
  gtk_widget_show (frame2);
  gtk_box_pack_start (GTK_BOX (vbox6), frame2, FALSE, TRUE, 0);

  table6 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table6);
  gtk_container_add (GTK_CONTAINER (frame2), table6);
  gtk_container_set_border_width (GTK_CONTAINER (table6), 7);
  gtk_table_set_row_spacings (GTK_TABLE (table6), 5);
  gtk_table_set_col_spacings (GTK_TABLE (table6), 5);

  label27 = gtk_label_new (_("Manufacturer:"));
  gtk_widget_show (label27);
  gtk_table_attach (GTK_TABLE (table6), label27, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label27), 0, 0.5);

  label28 = gtk_label_new (_("Model:"));
  gtk_widget_show (label28);
  gtk_table_attach (GTK_TABLE (table6), label28, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label28), 0, 0.5);

  model_entry = gtk_entry_new ();
  gtk_widget_show (model_entry);
  gtk_table_attach (GTK_TABLE (table6), model_entry, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  manufacturer_entry = gtk_entry_new ();
  gtk_widget_show (manufacturer_entry);
  gtk_table_attach (GTK_TABLE (table6), manufacturer_entry, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label16 = gtk_label_new (_("Keyboard"));
  gtk_widget_show (label16);
  gtk_frame_set_label_widget (GTK_FRAME (frame2), label16);
  gtk_label_set_use_markup (GTK_LABEL (label16), TRUE);

  frame3 = gtk_frame_new (NULL);
  gtk_widget_show (frame3);
  gtk_box_pack_start (GTK_BOX (vbox6), frame3, TRUE, TRUE, 0);

  hpaned1 = gtk_hpaned_new ();
  gtk_widget_show (hpaned1);
  gtk_container_add (GTK_CONTAINER (frame3), hpaned1);
  gtk_container_set_border_width (GTK_CONTAINER (hpaned1), 7);
  gtk_paned_set_position (GTK_PANED (hpaned1), 1);

  vbox5 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox5);
  gtk_paned_pack1 (GTK_PANED (hpaned1), vbox5, FALSE, FALSE);

  scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow2);
  gtk_box_pack_start (GTK_BOX (vbox5), scrolledwindow2, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN);

  key_treeview = gtk_tree_view_new ();
  gtk_widget_show (key_treeview);
  gtk_container_add (GTK_CONTAINER (scrolledwindow2), key_treeview);
  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (key_treeview), FALSE);

  hbuttonbox3 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox3);
  gtk_box_pack_start (GTK_BOX (vbox5), hbuttonbox3, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox3), 3);
  gtk_box_set_spacing (GTK_BOX (hbuttonbox3), 3);

  remove_key_button = gtk_button_new_from_stock ("gtk-remove");
  gtk_widget_show (remove_key_button);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), remove_key_button);
  GTK_WIDGET_SET_FLAGS (remove_key_button, GTK_CAN_DEFAULT);

  new_key_button = gtk_button_new_from_stock ("gtk-new");
  gtk_widget_show (new_key_button);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), new_key_button);
  GTK_WIDGET_SET_FLAGS (new_key_button, GTK_CAN_DEFAULT);

  frame4 = gtk_frame_new (NULL);
  gtk_widget_show (frame4);
  gtk_paned_pack2 (GTK_PANED (hpaned1), frame4, TRUE, TRUE);

  table2 = gtk_table_new (5, 2, FALSE);
  gtk_widget_show (table2);
  gtk_container_add (GTK_CONTAINER (frame4), table2);
  gtk_container_set_border_width (GTK_CONTAINER (table2), 7);
  gtk_table_set_row_spacings (GTK_TABLE (table2), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table2), 6);

  label19 = gtk_label_new (_("Name:"));
  gtk_widget_show (label19);
  gtk_table_attach (GTK_TABLE (table2), label19, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label19), 0, 0.5);

  scancode_event_descr_label = gtk_label_new (_("Scancode:"));
  gtk_widget_show (scancode_event_descr_label);
  gtk_table_attach (GTK_TABLE (table2), scancode_event_descr_label, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (scancode_event_descr_label), 0, 0.5);

  key_name_entry = gtk_entry_new ();
  gtk_widget_show (key_name_entry);
  gtk_table_attach (GTK_TABLE (table2), key_name_entry, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  hbox8 = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (hbox8);
  gtk_table_attach (GTK_TABLE (table2), hbox8, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  scancode_entry = gtk_entry_new ();
  gtk_widget_show (scancode_entry);
  gtk_box_pack_start (GTK_BOX (hbox8), scancode_entry, TRUE, TRUE, 0);
  gtk_editable_set_editable (GTK_EDITABLE (scancode_entry), FALSE);

  scancode_change_button = gtk_button_new ();
  gtk_widget_show (scancode_change_button);
  gtk_box_pack_start (GTK_BOX (hbox8), scancode_change_button, FALSE, FALSE, 0);

  alignment8 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment8);
  gtk_container_add (GTK_CONTAINER (scancode_change_button), alignment8);

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

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

  label23 = gtk_label_new_with_mnemonic (_("_Change..."));
  gtk_widget_show (label23);
  gtk_box_pack_start (GTK_BOX (hbox9), label23, FALSE, FALSE, 0);

  table4 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table4);
  gtk_table_attach (GTK_TABLE (table2), table4, 1, 2, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table4), 4);
  gtk_table_set_col_spacings (GTK_TABLE (table4), 4);

  program_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("_Program:"));
  gtk_widget_show (program_radiobutton);
  gtk_table_attach (GTK_TABLE (table4), program_radiobutton, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (program_radiobutton), program_radiobutton_group);
  program_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (program_radiobutton));

  program_entry = gtk_entry_new ();
  gtk_widget_show (program_entry);
  gtk_table_attach (GTK_TABLE (table4), program_entry, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  frame5 = gtk_frame_new (NULL);
  gtk_widget_show (frame5);
  gtk_table_attach (GTK_TABLE (table4), frame5, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame5), GTK_SHADOW_IN);

  table5 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table5);
  gtk_container_add (GTK_CONTAINER (frame5), table5);
  gtk_container_set_border_width (GTK_CONTAINER (table5), 3);
  gtk_table_set_row_spacings (GTK_TABLE (table5), 3);
  gtk_table_set_col_spacings (GTK_TABLE (table5), 3);

  label25 = gtk_label_new (_("Plugin:"));
  gtk_widget_show (label25);
  gtk_table_attach (GTK_TABLE (table5), label25, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label25), 0, 0.5);

  label26 = gtk_label_new (_("Function:"));
  gtk_widget_show (label26);
  gtk_table_attach (GTK_TABLE (table5), label26, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label26), 0, 0.5);

  plugin_combo = gtk_combo_new ();
  g_object_set_data (G_OBJECT (GTK_COMBO (plugin_combo)->popwin),
                     "GladeParentKey", plugin_combo);
  gtk_widget_show (plugin_combo);
  gtk_table_attach (GTK_TABLE (table5), plugin_combo, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  plugin_comboentry = GTK_COMBO (plugin_combo)->entry;
  gtk_widget_show (plugin_comboentry);
  gtk_editable_set_editable (GTK_EDITABLE (plugin_comboentry), FALSE);

  plugin_function_combo = gtk_combo_new ();
  g_object_set_data (G_OBJECT (GTK_COMBO (plugin_function_combo)->popwin),
                     "GladeParentKey", plugin_function_combo);
  gtk_widget_show (plugin_function_combo);
  gtk_table_attach (GTK_TABLE (table5), plugin_function_combo, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  plugin_function_comboentry = GTK_COMBO (plugin_function_combo)->entry;
  gtk_widget_show (plugin_function_comboentry);
  gtk_editable_set_editable (GTK_EDITABLE (plugin_function_comboentry), FALSE);

  label24 = gtk_label_new (_("Plugin"));
  gtk_widget_show (label24);
  gtk_frame_set_label_widget (GTK_FRAME (frame5), label24);
  gtk_label_set_use_markup (GTK_LABEL (label24), TRUE);

  special_action_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _("Special _action:"));
  gtk_widget_show (special_action_radiobutton);
  gtk_table_attach (GTK_TABLE (table4), special_action_radiobutton, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND), 0, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (special_action_radiobutton), program_radiobutton_group);
  program_radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (special_action_radiobutton));

  label22 = gtk_label_new (_("Default:"));
  gtk_widget_show (label22);
  gtk_table_attach (GTK_TABLE (table2), label22, 0, 1, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label22), 0, 0);

  label21 = gtk_label_new (_("Keycode:"));
  gtk_widget_show (label21);
  gtk_table_attach (GTK_TABLE (table2), label21, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label21), 0, 0.5);

  keycode_combobox = gtk_combo_box_new_text ();
  gtk_widget_show (keycode_combobox);
  gtk_table_attach (GTK_TABLE (table2), keycode_combobox, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hbox11 = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (hbox11);
  gtk_table_attach (GTK_TABLE (table2), hbox11, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  usbcode_entry = gtk_entry_new ();
  gtk_widget_show (usbcode_entry);
  gtk_box_pack_start (GTK_BOX (hbox11), usbcode_entry, TRUE, TRUE, 0);
  gtk_tooltips_set_tip (tooltips, usbcode_entry, _("The keys code sent when the keyboard is connected via USB"), NULL);
  gtk_editable_set_editable (GTK_EDITABLE (usbcode_entry), FALSE);

  usbcode_change_button = gtk_button_new ();
  gtk_widget_show (usbcode_change_button);
  gtk_box_pack_start (GTK_BOX (hbox11), usbcode_change_button, FALSE, FALSE, 0);

  alignment12 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment12);
  gtk_container_add (GTK_CONTAINER (usbcode_change_button), alignment12);

  hbox12 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox12);
  gtk_container_add (GTK_CONTAINER (alignment12), hbox12);

  image12 = gtk_image_new_from_stock ("gtk-edit", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image12);
  gtk_box_pack_start (GTK_BOX (hbox12), image12, FALSE, FALSE, 0);

  label44 = gtk_label_new_with_mnemonic (_("_Change..."));
  gtk_widget_show (label44);
  gtk_box_pack_start (GTK_BOX (hbox12), label44, FALSE, FALSE, 0);

  usbcode_label = gtk_label_new (_("USB code:"));
  gtk_widget_show (usbcode_label);
  gtk_table_attach (GTK_TABLE (table2), usbcode_label, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (usbcode_label), 0, 0.5);

  label18 = gtk_label_new (_("Key settings"));
  gtk_widget_show (label18);
  gtk_frame_set_label_widget (GTK_FRAME (frame4), label18);
  gtk_label_set_use_markup (GTK_LABEL (label18), TRUE);

  label17 = gtk_label_new (_("Keys"));
  gtk_widget_show (label17);
  gtk_frame_set_label_widget (GTK_FRAME (frame3), label17);
  gtk_label_set_use_markup (GTK_LABEL (label17), TRUE);

  g_signal_connect ((gpointer) main_window, "delete_event",
                    G_CALLBACK (on_main_window_delete_event),
                    NULL);
  g_signal_connect ((gpointer) new1, "activate",
                    G_CALLBACK (on_new1_activate),
                    NULL);
  g_signal_connect ((gpointer) open1, "activate",
                    G_CALLBACK (on_open1_activate),
                    NULL);
  g_signal_connect ((gpointer) save1, "activate",
                    G_CALLBACK (on_save1_activate),
                    NULL);
  g_signal_connect ((gpointer) save_as1, "activate",
                    G_CALLBACK (on_save_as1_activate),
                    NULL);
  g_signal_connect ((gpointer) quit1, "activate",
                    G_CALLBACK (on_quit1_activate),
                    NULL);
  g_signal_connect ((gpointer) change_keyboard_menuitem, "activate",
                    G_CALLBACK (on_change_keyboard_menuitem_activate),
                    NULL);
  g_signal_connect ((gpointer) about1, "activate",
                    G_CALLBACK (on_about1_activate),
                    NULL);
  g_signal_connect ((gpointer) model_entry, "changed",
                    G_CALLBACK (on_manufacturer_model_entry_changed),
                    NULL);
  g_signal_connect ((gpointer) manufacturer_entry, "changed",
                    G_CALLBACK (on_manufacturer_model_entry_changed),
                    NULL);
  g_signal_connect ((gpointer) remove_key_button, "clicked",
                    G_CALLBACK (on_remove_key_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) new_key_button, "clicked",
                    G_CALLBACK (on_new_key_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) key_name_entry, "changed",
                    G_CALLBACK (on_key_name_entry_changed),
                    NULL);
  g_signal_connect ((gpointer) scancode_change_button, "clicked",
                    G_CALLBACK (on_scancode_change_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) program_radiobutton, "toggled",
                    G_CALLBACK (on_program_radiobutton_toggled),
                    NULL);
  g_signal_connect ((gpointer) program_entry, "changed",
                    G_CALLBACK (on_program_entry_changed),
                    NULL);
  g_signal_connect ((gpointer) plugin_comboentry, "changed",
                    G_CALLBACK (on_plugin_comboentry_changed),
                    NULL);
  g_signal_connect ((gpointer) plugin_function_comboentry, "changed",
                    G_CALLBACK (on_plugin_function_comboentry_changed),
                    NULL);
  g_signal_connect ((gpointer) special_action_radiobutton, "toggled",
                    G_CALLBACK (on_special_action_radiobutton_toggled),
                    NULL);
  g_signal_connect ((gpointer) keycode_combobox, "changed",
                    G_CALLBACK (on_keycode_combobox_changed),
                    NULL);
  g_signal_connect ((gpointer) usbcode_change_button, "clicked",
                    G_CALLBACK (on_usbcode_change_button_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (main_window, main_window, "main_window");
  GLADE_HOOKUP_OBJECT (main_window, vbox4, "vbox4");
  GLADE_HOOKUP_OBJECT (main_window, menubar1, "menubar1");
  GLADE_HOOKUP_OBJECT (main_window, menuitem4, "menuitem4");
  GLADE_HOOKUP_OBJECT (main_window, menuitem4_menu, "menuitem4_menu");
  GLADE_HOOKUP_OBJECT (main_window, new1, "new1");
  GLADE_HOOKUP_OBJECT (main_window, open1, "open1");
  GLADE_HOOKUP_OBJECT (main_window, save1, "save1");
  GLADE_HOOKUP_OBJECT (main_window, save_as1, "save_as1");
  GLADE_HOOKUP_OBJECT (main_window, separator1, "separator1");
  GLADE_HOOKUP_OBJECT (main_window, quit1, "quit1");
  GLADE_HOOKUP_OBJECT (main_window, edit2, "edit2");
  GLADE_HOOKUP_OBJECT (main_window, edit2_menu, "edit2_menu");
  GLADE_HOOKUP_OBJECT (main_window, change_keyboard_menuitem, "change_keyboard_menuitem");
  GLADE_HOOKUP_OBJECT (main_window, menuitem7, "menuitem7");
  GLADE_HOOKUP_OBJECT (main_window, menuitem7_menu, "menuitem7_menu");
  GLADE_HOOKUP_OBJECT (main_window, about1, "about1");
  GLADE_HOOKUP_OBJECT (main_window, vbox6, "vbox6");
  GLADE_HOOKUP_OBJECT (main_window, frame2, "frame2");
  GLADE_HOOKUP_OBJECT (main_window, table6, "table6");
  GLADE_HOOKUP_OBJECT (main_window, label27, "label27");
  GLADE_HOOKUP_OBJECT (main_window, label28, "label28");
  GLADE_HOOKUP_OBJECT (main_window, model_entry, "model_entry");
  GLADE_HOOKUP_OBJECT (main_window, manufacturer_entry, "manufacturer_entry");
  GLADE_HOOKUP_OBJECT (main_window, label16, "label16");
  GLADE_HOOKUP_OBJECT (main_window, frame3, "frame3");
  GLADE_HOOKUP_OBJECT (main_window, hpaned1, "hpaned1");
  GLADE_HOOKUP_OBJECT (main_window, vbox5, "vbox5");
  GLADE_HOOKUP_OBJECT (main_window, scrolledwindow2, "scrolledwindow2");
  GLADE_HOOKUP_OBJECT (main_window, key_treeview, "key_treeview");
  GLADE_HOOKUP_OBJECT (main_window, hbuttonbox3, "hbuttonbox3");
  GLADE_HOOKUP_OBJECT (main_window, remove_key_button, "remove_key_button");
  GLADE_HOOKUP_OBJECT (main_window, new_key_button, "new_key_button");
  GLADE_HOOKUP_OBJECT (main_window, frame4, "frame4");
  GLADE_HOOKUP_OBJECT (main_window, table2, "table2");
  GLADE_HOOKUP_OBJECT (main_window, label19, "label19");
  GLADE_HOOKUP_OBJECT (main_window, scancode_event_descr_label, "scancode_event_descr_label");
  GLADE_HOOKUP_OBJECT (main_window, key_name_entry, "key_name_entry");
  GLADE_HOOKUP_OBJECT (main_window, hbox8, "hbox8");
  GLADE_HOOKUP_OBJECT (main_window, scancode_entry, "scancode_entry");
  GLADE_HOOKUP_OBJECT (main_window, scancode_change_button, "scancode_change_button");
  GLADE_HOOKUP_OBJECT (main_window, alignment8, "alignment8");
  GLADE_HOOKUP_OBJECT (main_window, hbox9, "hbox9");
  GLADE_HOOKUP_OBJECT (main_window, image8, "image8");
  GLADE_HOOKUP_OBJECT (main_window, label23, "label23");
  GLADE_HOOKUP_OBJECT (main_window, table4, "table4");
  GLADE_HOOKUP_OBJECT (main_window, program_radiobutton, "program_radiobutton");
  GLADE_HOOKUP_OBJECT (main_window, program_entry, "program_entry");
  GLADE_HOOKUP_OBJECT (main_window, frame5, "frame5");
  GLADE_HOOKUP_OBJECT (main_window, table5, "table5");
  GLADE_HOOKUP_OBJECT (main_window, label25, "label25");
  GLADE_HOOKUP_OBJECT (main_window, label26, "label26");
  GLADE_HOOKUP_OBJECT (main_window, plugin_combo, "plugin_combo");
  GLADE_HOOKUP_OBJECT (main_window, plugin_comboentry, "plugin_comboentry");
  GLADE_HOOKUP_OBJECT (main_window, plugin_function_combo, "plugin_function_combo");
  GLADE_HOOKUP_OBJECT (main_window, plugin_function_comboentry, "plugin_function_comboentry");
  GLADE_HOOKUP_OBJECT (main_window, label24, "label24");
  GLADE_HOOKUP_OBJECT (main_window, special_action_radiobutton, "special_action_radiobutton");
  GLADE_HOOKUP_OBJECT (main_window, label22, "label22");
  GLADE_HOOKUP_OBJECT (main_window, label21, "label21");
  GLADE_HOOKUP_OBJECT (main_window, keycode_combobox, "keycode_combobox");
  GLADE_HOOKUP_OBJECT (main_window, hbox11, "hbox11");
  GLADE_HOOKUP_OBJECT (main_window, usbcode_entry, "usbcode_entry");
  GLADE_HOOKUP_OBJECT (main_window, usbcode_change_button, "usbcode_change_button");
  GLADE_HOOKUP_OBJECT (main_window, alignment12, "alignment12");
  GLADE_HOOKUP_OBJECT (main_window, hbox12, "hbox12");
  GLADE_HOOKUP_OBJECT (main_window, image12, "image12");
  GLADE_HOOKUP_OBJECT (main_window, label44, "label44");
  GLADE_HOOKUP_OBJECT (main_window, usbcode_label, "usbcode_label");
  GLADE_HOOKUP_OBJECT (main_window, label18, "label18");
  GLADE_HOOKUP_OBJECT (main_window, label17, "label17");
  GLADE_HOOKUP_OBJECT_NO_REF (main_window, tooltips, "tooltips");

  gtk_window_add_accel_group (GTK_WINDOW (main_window), accel_group);

  return main_window;
}

GtkWidget*
create_get_scancode_dialog (void)
{
  GtkWidget *get_scancode_dialog;
  GdkPixbuf *get_scancode_dialog_icon_pixbuf;
  GtkWidget *dialog_vbox1;
  GtkWidget *alignment9;
  GtkWidget *msg_label;
  GtkWidget *dialog_action_area1;
  GtkWidget *get_scancode_cancel_button;

  get_scancode_dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (get_scancode_dialog), _("Press key"));
  gtk_window_set_position (GTK_WINDOW (get_scancode_dialog), GTK_WIN_POS_CENTER);
  gtk_window_set_modal (GTK_WINDOW (get_scancode_dialog), TRUE);
  get_scancode_dialog_icon_pixbuf = create_pixbuf ("icon.png");
  if (get_scancode_dialog_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (get_scancode_dialog), get_scancode_dialog_icon_pixbuf);
      gdk_pixbuf_unref (get_scancode_dialog_icon_pixbuf);
    }
  gtk_window_set_type_hint (GTK_WINDOW (get_scancode_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);

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

  alignment9 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment9);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), alignment9, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (alignment9), 10);

  msg_label = gtk_label_new ("-");
  gtk_widget_show (msg_label);
  gtk_container_add (GTK_CONTAINER (alignment9), msg_label);
  gtk_label_set_line_wrap (GTK_LABEL (msg_label), TRUE);

  dialog_action_area1 = GTK_DIALOG (get_scancode_dialog)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_SPREAD);

  get_scancode_cancel_button = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (get_scancode_cancel_button);
  gtk_dialog_add_action_widget (GTK_DIALOG (get_scancode_dialog), get_scancode_cancel_button, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (get_scancode_cancel_button, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) get_scancode_dialog, "show",
                    G_CALLBACK (on_get_scancode_dialog_show),
                    NULL);
  g_signal_connect ((gpointer) get_scancode_dialog, "delete_event",
                    G_CALLBACK (on_get_scancode_dialog_delete_event),
                    NULL);
  g_signal_connect ((gpointer) get_scancode_cancel_button, "clicked",
                    G_CALLBACK (on_get_scancode_cancel_button_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (get_scancode_dialog, get_scancode_dialog, "get_scancode_dialog");
  GLADE_HOOKUP_OBJECT_NO_REF (get_scancode_dialog, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (get_scancode_dialog, alignment9, "alignment9");
  GLADE_HOOKUP_OBJECT (get_scancode_dialog, msg_label, "msg_label");
  GLADE_HOOKUP_OBJECT_NO_REF (get_scancode_dialog, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (get_scancode_dialog, get_scancode_cancel_button, "get_scancode_cancel_button");

  return get_scancode_dialog;
}

GtkWidget*
create_new_key_name_dialog (void)
{
  GtkWidget *new_key_name_dialog;
  GdkPixbuf *new_key_name_dialog_icon_pixbuf;
  GtkWidget *dialog_vbox2;
  GtkWidget *vbox7;
  GtkWidget *label29;
  GtkWidget *new_key_name_entry;
  GtkWidget *frame7;
  GtkWidget *alignment11;
  GtkWidget *textview1;
  GtkWidget *hbox10;
  GtkWidget *image10;
  GtkWidget *label30;
  GtkWidget *dialog_action_area2;
  GtkWidget *new_key_cancel_button;
  GtkWidget *new_key_okbutton;

  new_key_name_dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (new_key_name_dialog), _("New key"));
  gtk_window_set_modal (GTK_WINDOW (new_key_name_dialog), TRUE);
  new_key_name_dialog_icon_pixbuf = create_pixbuf ("icon.png");
  if (new_key_name_dialog_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (new_key_name_dialog), new_key_name_dialog_icon_pixbuf);
      gdk_pixbuf_unref (new_key_name_dialog_icon_pixbuf);
    }
  gtk_window_set_type_hint (GTK_WINDOW (new_key_name_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox2 = GTK_DIALOG (new_key_name_dialog)->vbox;
  gtk_widget_show (dialog_vbox2);

  vbox7 = gtk_vbox_new (FALSE, 6);
  gtk_widget_show (vbox7);
  gtk_box_pack_start (GTK_BOX (dialog_vbox2), vbox7, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox7), 6);

  label29 = gtk_label_new (_("Please enter the name of the new key:"));
  gtk_widget_show (label29);
  gtk_box_pack_start (GTK_BOX (vbox7), label29, FALSE, FALSE, 0);

  new_key_name_entry = gtk_entry_new ();
  gtk_widget_show (new_key_name_entry);
  gtk_box_pack_start (GTK_BOX (vbox7), new_key_name_entry, FALSE, FALSE, 0);

  frame7 = gtk_frame_new (NULL);
  gtk_widget_show (frame7);
  gtk_box_pack_start (GTK_BOX (vbox7), frame7, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame7), GTK_SHADOW_NONE);

  alignment11 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment11);
  gtk_container_add (GTK_CONTAINER (frame7), alignment11);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment11), 0, 0, 12, 0);

  textview1 = gtk_text_view_new ();
  gtk_widget_show (textview1);
  gtk_container_add (GTK_CONTAINER (alignment11), textview1);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (textview1), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview1), GTK_WRAP_WORD);
  gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (textview1), 3);
  gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (textview1), 3);
  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview1), 5);
  gtk_text_view_set_right_margin (GTK_TEXT_VIEW (textview1), 5);
  gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview1)), _("Choose an appropriate name for the key. Is there for example a text label on the key, use the label as the key's name."), -1);

  hbox10 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox10);
  gtk_frame_set_label_widget (GTK_FRAME (frame7), hbox10);

  image10 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image10);
  gtk_box_pack_start (GTK_BOX (hbox10), image10, TRUE, TRUE, 0);

  label30 = gtk_label_new (_("<b>Help information:</b>"));
  gtk_widget_show (label30);
  gtk_box_pack_start (GTK_BOX (hbox10), label30, FALSE, FALSE, 0);
  gtk_label_set_use_markup (GTK_LABEL (label30), TRUE);

  dialog_action_area2 = GTK_DIALOG (new_key_name_dialog)->action_area;
  gtk_widget_show (dialog_action_area2);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END);

  new_key_cancel_button = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (new_key_cancel_button);
  gtk_dialog_add_action_widget (GTK_DIALOG (new_key_name_dialog), new_key_cancel_button, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (new_key_cancel_button, GTK_CAN_DEFAULT);

  new_key_okbutton = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (new_key_okbutton);
  gtk_dialog_add_action_widget (GTK_DIALOG (new_key_name_dialog), new_key_okbutton, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (new_key_okbutton, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (new_key_name_dialog, new_key_name_dialog, "new_key_name_dialog");
  GLADE_HOOKUP_OBJECT_NO_REF (new_key_name_dialog, dialog_vbox2, "dialog_vbox2");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, vbox7, "vbox7");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, label29, "label29");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, new_key_name_entry, "new_key_name_entry");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, frame7, "frame7");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, alignment11, "alignment11");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, textview1, "textview1");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, hbox10, "hbox10");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, image10, "image10");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, label30, "label30");
  GLADE_HOOKUP_OBJECT_NO_REF (new_key_name_dialog, dialog_action_area2, "dialog_action_area2");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, new_key_cancel_button, "new_key_cancel_button");
  GLADE_HOOKUP_OBJECT (new_key_name_dialog, new_key_okbutton, "new_key_okbutton");

  return new_key_name_dialog;
}

GtkWidget*
create_contact_dialog (void)
{
  GtkWidget *contact_dialog;
  GdkPixbuf *contact_dialog_icon_pixbuf;
  GtkWidget *dialog_vbox3;
  GtkWidget *vbox8;
  GtkWidget *label34;
  GtkWidget *frame8;
  GtkWidget *table7;
  GtkWidget *label31;
  GtkWidget *label32;
  GtkWidget *email_entry;
  GtkWidget *author_entry;
  GtkWidget *label33;
  GtkWidget *dialog_action_area3;
  GtkWidget *contact_dialog_cancelbutton;
  GtkWidget *contact_dialog_okbutton;

  contact_dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (contact_dialog), _("Contact information"));
  gtk_window_set_position (GTK_WINDOW (contact_dialog), GTK_WIN_POS_CENTER);
  contact_dialog_icon_pixbuf = create_pixbuf ("icon.png");
  if (contact_dialog_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (contact_dialog), contact_dialog_icon_pixbuf);
      gdk_pixbuf_unref (contact_dialog_icon_pixbuf);
    }
  gtk_window_set_type_hint (GTK_WINDOW (contact_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);

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

  vbox8 = gtk_vbox_new (FALSE, 7);
  gtk_widget_show (vbox8);
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), vbox8, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox8), 5);

  label34 = gtk_label_new (_("Please fill in your real name and e-mail address. This information will be used for the administration of the keyboard files.\nThe e-mail address must be real in order to send the keyboard file."));
  gtk_widget_show (label34);
  gtk_box_pack_start (GTK_BOX (vbox8), label34, FALSE, FALSE, 0);
  gtk_label_set_line_wrap (GTK_LABEL (label34), TRUE);

  frame8 = gtk_frame_new (NULL);
  gtk_widget_show (frame8);
  gtk_box_pack_start (GTK_BOX (vbox8), frame8, TRUE, TRUE, 0);

  table7 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table7);
  gtk_container_add (GTK_CONTAINER (frame8), table7);
  gtk_container_set_border_width (GTK_CONTAINER (table7), 7);
  gtk_table_set_row_spacings (GTK_TABLE (table7), 5);
  gtk_table_set_col_spacings (GTK_TABLE (table7), 5);

  label31 = gtk_label_new (_("Your name:"));
  gtk_widget_show (label31);
  gtk_table_attach (GTK_TABLE (table7), label31, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label31), 0, 0.5);

  label32 = gtk_label_new (_("E-mail address:"));
  gtk_widget_show (label32);
  gtk_table_attach (GTK_TABLE (table7), label32, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label32), 0, 0.5);

  email_entry = gtk_entry_new ();
  gtk_widget_show (email_entry);
  gtk_table_attach (GTK_TABLE (table7), email_entry, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  author_entry = gtk_entry_new ();
  gtk_widget_show (author_entry);
  gtk_table_attach (GTK_TABLE (table7), author_entry, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label33 = gtk_label_new (_("Contact information"));
  gtk_widget_show (label33);
  gtk_frame_set_label_widget (GTK_FRAME (frame8), label33);
  gtk_label_set_use_markup (GTK_LABEL (label33), TRUE);

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

  contact_dialog_cancelbutton = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (contact_dialog_cancelbutton);
  gtk_dialog_add_action_widget (GTK_DIALOG (contact_dialog), contact_dialog_cancelbutton, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (contact_dialog_cancelbutton, GTK_CAN_DEFAULT);

  contact_dialog_okbutton = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (contact_dialog_okbutton);
  gtk_dialog_add_action_widget (GTK_DIALOG (contact_dialog), contact_dialog_okbutton, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (contact_dialog_okbutton, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) contact_dialog, "delete_event",
                    G_CALLBACK (on_contact_dialog_delete_event),
                    NULL);
  g_signal_connect ((gpointer) contact_dialog_cancelbutton, "clicked",
                    G_CALLBACK (on_contact_dialog_cancelbutton_clicked),
                    NULL);
  g_signal_connect ((gpointer) contact_dialog_okbutton, "clicked",
                    G_CALLBACK (on_contact_dialog_okbutton_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (contact_dialog, contact_dialog, "contact_dialog");
  GLADE_HOOKUP_OBJECT_NO_REF (contact_dialog, dialog_vbox3, "dialog_vbox3");
  GLADE_HOOKUP_OBJECT (contact_dialog, vbox8, "vbox8");
  GLADE_HOOKUP_OBJECT (contact_dialog, label34, "label34");
  GLADE_HOOKUP_OBJECT (contact_dialog, frame8, "frame8");
  GLADE_HOOKUP_OBJECT (contact_dialog, table7, "table7");
  GLADE_HOOKUP_OBJECT (contact_dialog, label31, "label31");
  GLADE_HOOKUP_OBJECT (contact_dialog, label32, "label32");
  GLADE_HOOKUP_OBJECT (contact_dialog, email_entry, "email_entry");
  GLADE_HOOKUP_OBJECT (contact_dialog, author_entry, "author_entry");
  GLADE_HOOKUP_OBJECT (contact_dialog, label33, "label33");
  GLADE_HOOKUP_OBJECT_NO_REF (contact_dialog, dialog_action_area3, "dialog_action_area3");
  GLADE_HOOKUP_OBJECT (contact_dialog, contact_dialog_cancelbutton, "contact_dialog_cancelbutton");
  GLADE_HOOKUP_OBJECT (contact_dialog, contact_dialog_okbutton, "contact_dialog_okbutton");

  return contact_dialog;
}

GtkWidget*
create_about_dialog (void)
{
  GtkWidget *about_dialog;
  GdkPixbuf *about_dialog_icon_pixbuf;
  GtkWidget *dialog_vbox4;
  GtkWidget *vbox9;
  GtkWidget *image11;
  GtkWidget *table8;
  GtkWidget *label35;
  GtkWidget *version_label;
  GtkWidget *label37;
  GtkWidget *developer_label;
  GtkWidget *label39;
  GtkWidget *License;
  GtkWidget *label41;
  GtkWidget *label42;
  GtkWidget *dialog_action_area4;
  GtkWidget *about_closebutton;

  about_dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (about_dialog), _("About keyTouch-editor"));
  gtk_window_set_resizable (GTK_WINDOW (about_dialog), FALSE);
  about_dialog_icon_pixbuf = create_pixbuf ("icon.png");
  if (about_dialog_icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (about_dialog), about_dialog_icon_pixbuf);
      gdk_pixbuf_unref (about_dialog_icon_pixbuf);
    }
  gtk_window_set_type_hint (GTK_WINDOW (about_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox4 = GTK_DIALOG (about_dialog)->vbox;
  gtk_widget_show (dialog_vbox4);

  vbox9 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox9);
  gtk_box_pack_start (GTK_BOX (dialog_vbox4), vbox9, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox9), 5);

  image11 = create_pixmap (about_dialog, "logo.png");
  gtk_widget_show (image11);
  gtk_box_pack_start (GTK_BOX (vbox9), image11, FALSE, TRUE, 0);

  table8 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table8);
  gtk_box_pack_start (GTK_BOX (vbox9), table8, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (table8), 5);
  gtk_table_set_row_spacings (GTK_TABLE (table8), 2);
  gtk_table_set_col_spacings (GTK_TABLE (table8), 7);

  label35 = gtk_label_new (_("Version:"));
  gtk_widget_show (label35);
  gtk_table_attach (GTK_TABLE (table8), label35, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label35), 0, 0.5);

  version_label = gtk_label_new ("3.2.0 beta");
  gtk_widget_show (version_label);
  gtk_table_attach (GTK_TABLE (table8), version_label, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (version_label), 0, 0.5);

  label37 = gtk_label_new (_("Developer:"));
  gtk_widget_show (label37);
  gtk_table_attach (GTK_TABLE (table8), label37, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label37), 0, 0.5);

  developer_label = gtk_label_new ("Marvin Raaijmakers");
  gtk_widget_show (developer_label);
  gtk_table_attach (GTK_TABLE (table8), developer_label, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (developer_label), 0, 0.5);

  label39 = gtk_label_new (_("License:"));
  gtk_widget_show (label39);
  gtk_table_attach (GTK_TABLE (table8), label39, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label39), 0, 0.5);

  License = gtk_label_new ("GPL 2");
  gtk_widget_show (License);
  gtk_table_attach (GTK_TABLE (table8), License, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (License), 0, 0.5);

  label41 = gtk_label_new (_("Website:"));
  gtk_widget_show (label41);
  gtk_table_attach (GTK_TABLE (table8), label41, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label41), 0, 0.5);

  label42 = gtk_label_new (_("http://keytouch.sf.net"));
  gtk_widget_show (label42);
  gtk_table_attach (GTK_TABLE (table8), label42, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  GTK_WIDGET_SET_FLAGS (label42, GTK_CAN_FOCUS);
  gtk_label_set_use_markup (GTK_LABEL (label42), TRUE);
  gtk_label_set_selectable (GTK_LABEL (label42), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label42), 0, 0.5);

  dialog_action_area4 = GTK_DIALOG (about_dialog)->action_area;
  gtk_widget_show (dialog_action_area4);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_END);

  about_closebutton = gtk_button_new_from_stock ("gtk-close");
  gtk_widget_show (about_closebutton);
  gtk_dialog_add_action_widget (GTK_DIALOG (about_dialog), about_closebutton, GTK_RESPONSE_CLOSE);
  GTK_WIDGET_SET_FLAGS (about_closebutton, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (about_dialog, about_dialog, "about_dialog");
  GLADE_HOOKUP_OBJECT_NO_REF (about_dialog, dialog_vbox4, "dialog_vbox4");
  GLADE_HOOKUP_OBJECT (about_dialog, vbox9, "vbox9");
  GLADE_HOOKUP_OBJECT (about_dialog, image11, "image11");
  GLADE_HOOKUP_OBJECT (about_dialog, table8, "table8");
  GLADE_HOOKUP_OBJECT (about_dialog, label35, "label35");
  GLADE_HOOKUP_OBJECT (about_dialog, version_label, "version_label");
  GLADE_HOOKUP_OBJECT (about_dialog, label37, "label37");
  GLADE_HOOKUP_OBJECT (about_dialog, developer_label, "developer_label");
  GLADE_HOOKUP_OBJECT (about_dialog, label39, "label39");
  GLADE_HOOKUP_OBJECT (about_dialog, License, "License");
  GLADE_HOOKUP_OBJECT (about_dialog, label41, "label41");
  GLADE_HOOKUP_OBJECT (about_dialog, label42, "label42");
  GLADE_HOOKUP_OBJECT_NO_REF (about_dialog, dialog_action_area4, "dialog_action_area4");
  GLADE_HOOKUP_OBJECT (about_dialog, about_closebutton, "about_closebutton");

  return about_dialog;
}

