/* FIGARO'S PASSWORD MANAGER 2 (FPM2)
 * Copyright (C) 2000 John Conneely
 * Copyright (C) 2008-2020 Aleš Koval
 *
 * FPM is open source / free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * FPM is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 *
 * interface.c - GTK Interface - originally 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"
#include "fpm_crypt.h"

#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    g_object_ref (widget), (GDestroyNotify) g_object_unref)

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

GtkWidget*
create_app_safe (void)
{
  GtkWidget *app_safe;
  GtkWidget *vbox1;
  GtkWidget *menubar1;
  GtkWidget *file1;
  GtkWidget *file1_menu;
  GtkWidget *new_file;
  GtkWidget *open1;
  GtkWidget *save1;
  GtkWidget *save_as1;
  GtkWidget *odd__lova__5;
  GtkWidget *import_passwords1;
  GtkWidget *image1011;
  GtkWidget *export1;
  GtkWidget *image1012;
  GtkWidget *separatormenuitem1;
  GtkWidget *hide_to_tray;
  GtkWidget *image1013;
  GtkWidget *exit1;
  GtkWidget *edit1;
  GtkWidget *edit1_menu;
  GtkWidget *copy_pass;
  GtkWidget *image1014;
  GtkWidget *copy_user;
  GtkWidget *image1015;
  GtkWidget *copy_both1;
  GtkWidget *image1016;
  GtkWidget *odd__lova__1;
  GtkWidget *add_item1;
  GtkWidget *image1017;
  GtkWidget *edit_item1;
  GtkWidget *image1018;
  GtkWidget *clone_item1;
  GtkWidget *image1019;
  GtkWidget *item_delete;
  GtkWidget *image1020;
  GtkWidget *odd__lova__8;
  GtkWidget *find;
  GtkWidget *view1;
  GtkWidget *view1_menu;
  GtkWidget *title1;
  GtkWidget *url1;
  GtkWidget *user1;
  GtkWidget *password1;
  GtkWidget *category1;
  GtkWidget *notes1;
  GtkWidget *launcher1;
  GtkWidget *odd__lova__10;
  GtkWidget *toolbar2;
  GtkWidget *settings1;
  GtkWidget *settings1_menu;
  GtkWidget *launcher_menu;
  GtkWidget *image1021;
  GtkWidget *item_password;
  GtkWidget *image1022;
  GtkWidget *odd__lova__11;
  GtkWidget *preferences2;
  GtkWidget *help1;
  GtkWidget *help1_menu;
  GtkWidget *current_password_file1;
  GtkWidget *image1023;
  GtkWidget *odd__lova__9;
  GtkWidget *about1;
  GtkWidget *toolbar1;
  GtkIconSize tmp_toolbar_icon_size;
  GtkWidget *button_save;
  GtkWidget *separatortoolitem1;
  GtkWidget *tmp_image;
  GtkWidget *button_new;
  GtkWidget *button_edit;
  GtkWidget *separatortoolitem2;
  GtkWidget *button_jump;
  GtkWidget *button_user;
  GtkWidget *button_pass;
  GtkWidget *toolitem1;
  GtkWidget *vbox21;
  GtkWidget *label_category;
  GtkWidget *optionmenu_category;
  GtkWidget *scrolledwindow1;
  GtkWidget *clist_main;
  GtkWidget *findbar;
  GtkWidget *find_close;
  GtkWidget *find_entry;
  GtkWidget *find_match_case;
  GtkWidget *statusbar;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  app_safe = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (app_safe), _("Figaro's Password Manager 2"));
  gtk_window_set_position (GTK_WINDOW (app_safe), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size (GTK_WINDOW (app_safe), 500, 350);

  gtk_window_set_default_icon_name ("fpm2");

  vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (app_safe), vbox1);

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

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

  file1_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (file1), file1_menu);

  new_file = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
  gtk_widget_show (new_file);
  gtk_container_add (GTK_CONTAINER (file1_menu), new_file);

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

  save1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
  gtk_widget_show (save1);
  gtk_container_add (GTK_CONTAINER (file1_menu), save1);
  gtk_widget_set_sensitive (save1, FALSE);

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

  odd__lova__5 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__5);
  gtk_container_add (GTK_CONTAINER (file1_menu), odd__lova__5);
  gtk_widget_set_sensitive (odd__lova__5, FALSE);

  import_passwords1 = gtk_image_menu_item_new_with_mnemonic (_("_Import Passwords"));
  gtk_widget_show (import_passwords1);
  gtk_container_add (GTK_CONTAINER (file1_menu), import_passwords1);

  image1011 = gtk_image_new_from_icon_name ("gtk-convert", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1011);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (import_passwords1), image1011);

  export1 = gtk_image_menu_item_new_with_mnemonic (_("_Export Passwords"));
  gtk_widget_show (export1);
  gtk_container_add (GTK_CONTAINER (file1_menu), export1);

  image1012 = gtk_image_new_from_icon_name ("gtk-harddisk", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1012);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (export1), image1012);

  separatormenuitem1 = gtk_separator_menu_item_new ();
  gtk_widget_show (separatormenuitem1);
  gtk_container_add (GTK_CONTAINER (file1_menu), separatormenuitem1);
  gtk_widget_set_sensitive (separatormenuitem1, FALSE);

  hide_to_tray = gtk_image_menu_item_new_with_mnemonic (_("_Minimize to tray"));
  gtk_widget_show (hide_to_tray);
  gtk_container_add (GTK_CONTAINER (file1_menu), hide_to_tray);
  gtk_widget_add_accelerator (hide_to_tray, "activate", accel_group,
                              GDK_KEY_w, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  image1013 = gtk_image_new_from_icon_name ("gtk-leave-fullscreen", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1013);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (hide_to_tray), image1013);

  exit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
  gtk_widget_show (exit1);
  gtk_container_add (GTK_CONTAINER (file1_menu), exit1);

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

  edit1_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (edit1), edit1_menu);

  copy_pass = gtk_image_menu_item_new_with_mnemonic (_("Copy _Password"));
  gtk_widget_show (copy_pass);
  gtk_container_add (GTK_CONTAINER (edit1_menu), copy_pass);
  gtk_widget_set_sensitive (copy_pass, FALSE);
  gtk_widget_add_accelerator (copy_pass, "activate", accel_group,
                              GDK_KEY_p, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  image1014 = gtk_image_new_from_icon_name ("gtk-copy", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1014);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (copy_pass), image1014);

  copy_user = gtk_image_menu_item_new_with_mnemonic (_("Copy _Username"));
  gtk_widget_show (copy_user);
  gtk_container_add (GTK_CONTAINER (edit1_menu), copy_user);
  gtk_widget_set_sensitive (copy_user, FALSE);
  gtk_widget_add_accelerator (copy_user, "activate", accel_group,
                              GDK_KEY_u, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  image1015 = gtk_image_new_from_icon_name ("gtk-copy", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1015);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (copy_user), image1015);

  copy_both1 = gtk_image_menu_item_new_with_mnemonic (_("Copy _Both"));
  gtk_widget_show (copy_both1);
  gtk_container_add (GTK_CONTAINER (edit1_menu), copy_both1);
  gtk_widget_set_sensitive (copy_both1, FALSE);
  gtk_widget_add_accelerator (copy_both1, "activate", accel_group,
                              GDK_KEY_b, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  image1016 = gtk_image_new_from_icon_name ("gtk-copy", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1016);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (copy_both1), image1016);

  odd__lova__1 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__1);
  gtk_container_add (GTK_CONTAINER (edit1_menu), odd__lova__1);
  gtk_widget_set_sensitive (odd__lova__1, FALSE);

  add_item1 = gtk_image_menu_item_new_with_mnemonic (_("_Add Item"));
  gtk_widget_show (add_item1);
  gtk_container_add (GTK_CONTAINER (edit1_menu), add_item1);
  gtk_widget_add_accelerator (add_item1, "activate", accel_group,
                              GDK_KEY_a, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  image1017 = gtk_image_new_from_icon_name ("gtk-new", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1017);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_item1), image1017);

  edit_item1 = gtk_image_menu_item_new_with_mnemonic (_("_Edit Item"));
  gtk_widget_show (edit_item1);
  gtk_container_add (GTK_CONTAINER (edit1_menu), edit_item1);
  gtk_widget_set_sensitive (edit_item1, FALSE);
  gtk_widget_add_accelerator (edit_item1, "activate", accel_group,
                              GDK_KEY_e, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  image1018 = gtk_image_new_from_icon_name ("gtk-edit", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1018);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (edit_item1), image1018);

  clone_item1 = gtk_image_menu_item_new_with_mnemonic (_("_Clone Item"));
  gtk_widget_show (clone_item1);
  gtk_container_add (GTK_CONTAINER (edit1_menu), clone_item1);
  gtk_widget_set_sensitive (clone_item1, FALSE);
  gtk_widget_add_accelerator (clone_item1, "activate", accel_group,
                              GDK_KEY_c, (GdkModifierType) GDK_CONTROL_MASK,
                              GTK_ACCEL_VISIBLE);

  image1019 = gtk_image_new_from_icon_name ("gtk-copy", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1019);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (clone_item1), image1019);

  item_delete = gtk_image_menu_item_new_with_mnemonic (_("_Delete Item"));
  gtk_widget_show (item_delete);
  gtk_container_add (GTK_CONTAINER (edit1_menu), item_delete);
  gtk_widget_set_sensitive (item_delete, FALSE);
  gtk_widget_add_accelerator (item_delete, "activate", accel_group,
                              GDK_KEY_Delete, (GdkModifierType) 0,
                              GTK_ACCEL_VISIBLE);

  image1020 = gtk_image_new_from_icon_name ("gtk-delete", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1020);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_delete), image1020);

  odd__lova__8 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__8);
  gtk_container_add (GTK_CONTAINER (edit1_menu), odd__lova__8);
  gtk_widget_set_sensitive (odd__lova__8, FALSE);

  find = gtk_image_menu_item_new_from_stock ("gtk-find", accel_group);
  gtk_widget_show (find);
  gtk_container_add (GTK_CONTAINER (edit1_menu), find);

  view1 = gtk_menu_item_new_with_mnemonic (_("_View"));
  gtk_widget_show (view1);
  gtk_container_add (GTK_CONTAINER (menubar1), view1);

  view1_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (view1), view1_menu);

  title1 = gtk_check_menu_item_new_with_mnemonic (_("_Title"));
  gtk_widget_show (title1);
  gtk_container_add (GTK_CONTAINER (view1_menu), title1);

  url1 = gtk_check_menu_item_new_with_mnemonic (_("U_RL"));
  gtk_widget_show (url1);
  gtk_container_add (GTK_CONTAINER (view1_menu), url1);

  user1 = gtk_check_menu_item_new_with_mnemonic (_("_User"));
  gtk_widget_show (user1);
  gtk_container_add (GTK_CONTAINER (view1_menu), user1);

  password1 = gtk_check_menu_item_new_with_mnemonic (_("_Password"));
  gtk_widget_show (password1);
  gtk_container_add (GTK_CONTAINER (view1_menu), password1);

  category1 = gtk_check_menu_item_new_with_mnemonic (_("_Category"));
  gtk_widget_show (category1);
  gtk_container_add (GTK_CONTAINER (view1_menu), category1);

  notes1 = gtk_check_menu_item_new_with_mnemonic (_("_Notes"));
  gtk_widget_show (notes1);
  gtk_container_add (GTK_CONTAINER (view1_menu), notes1);

  launcher1 = gtk_check_menu_item_new_with_mnemonic (_("_Launcher"));
  gtk_widget_show (launcher1);
  gtk_container_add (GTK_CONTAINER (view1_menu), launcher1);

  odd__lova__10 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__10);
  gtk_container_add (GTK_CONTAINER (view1_menu), odd__lova__10);
  gtk_widget_set_sensitive (odd__lova__10, FALSE);

  toolbar2 = gtk_check_menu_item_new_with_mnemonic (_("Tool_bar"));
  gtk_widget_show (toolbar2);
  gtk_container_add (GTK_CONTAINER (view1_menu), toolbar2);
  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (toolbar2), TRUE);

  settings1 = gtk_menu_item_new_with_mnemonic (_("_Settings"));
  gtk_widget_show (settings1);
  gtk_container_add (GTK_CONTAINER (menubar1), settings1);

  settings1_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (settings1), settings1_menu);

  launcher_menu = gtk_image_menu_item_new_with_mnemonic (_("_Launcher Preferences"));
  gtk_widget_show (launcher_menu);
  gtk_container_add (GTK_CONTAINER (settings1_menu), launcher_menu);

  image1021 = gtk_image_new_from_icon_name ("gtk-execute", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1021);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (launcher_menu), image1021);

  item_password = gtk_image_menu_item_new_with_mnemonic (_("Change _Password"));
  gtk_widget_show (item_password);
  gtk_container_add (GTK_CONTAINER (settings1_menu), item_password);

  image1022 = gtk_image_new_from_icon_name ("gtk-dialog-authentication", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1022);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_password), image1022);

  odd__lova__11 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__11);
  gtk_container_add (GTK_CONTAINER (settings1_menu), odd__lova__11);
  gtk_widget_set_sensitive (odd__lova__11, FALSE);

  preferences2 = gtk_image_menu_item_new_from_stock ("gtk-preferences", accel_group);
  gtk_widget_show (preferences2);
  gtk_container_add (GTK_CONTAINER (settings1_menu), preferences2);

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

  help1_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (help1), help1_menu);

  current_password_file1 = gtk_image_menu_item_new_with_mnemonic (_("Current Password File"));
  gtk_widget_show (current_password_file1);
  gtk_container_add (GTK_CONTAINER (help1_menu), current_password_file1);

  image1023 = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image1023);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (current_password_file1), image1023);

  odd__lova__9 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__9);
  gtk_container_add (GTK_CONTAINER (help1_menu), odd__lova__9);
  gtk_widget_set_sensitive (odd__lova__9, FALSE);

  about1 = gtk_image_menu_item_new_from_stock ("gtk-about", accel_group);
  gtk_widget_show (about1);
  gtk_container_add (GTK_CONTAINER (help1_menu), about1);

  toolbar1 = gtk_toolbar_new ();
  gtk_widget_show (toolbar1);
  gtk_box_pack_start (GTK_BOX (vbox1), toolbar1, FALSE, FALSE, 0);
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH);
  tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1));

  button_save = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-save");
  gtk_widget_show (button_save);
  gtk_container_add (GTK_CONTAINER (toolbar1), button_save);
  gtk_widget_set_sensitive (button_save, FALSE);

  separatortoolitem1 = (GtkWidget*) gtk_separator_tool_item_new ();
  gtk_widget_show (separatortoolitem1);

  gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem1);

  tmp_image = gtk_image_new_from_icon_name ("gtk-new", tmp_toolbar_icon_size);
  gtk_widget_show (tmp_image);
  button_new = (GtkWidget*) gtk_tool_button_new (tmp_image, _("New"));
  gtk_widget_show (button_new);
  gtk_container_add (GTK_CONTAINER (toolbar1), button_new);

  button_edit = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-edit");
  gtk_widget_show (button_edit);
  gtk_container_add (GTK_CONTAINER (toolbar1), button_edit);
  gtk_widget_set_sensitive (button_edit, FALSE);

  separatortoolitem2 = (GtkWidget*) gtk_separator_tool_item_new ();
  gtk_widget_show (separatortoolitem2);
  gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem2);

  tmp_image = gtk_image_new_from_icon_name ("gtk-go-forward", tmp_toolbar_icon_size);
  gtk_widget_show (tmp_image);
  button_jump = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Jump"));
  gtk_widget_show (button_jump);
  gtk_container_add (GTK_CONTAINER (toolbar1), button_jump);
  gtk_widget_set_sensitive (button_jump, FALSE);

  tmp_image = gtk_image_new_from_icon_name ("gtk-copy", tmp_toolbar_icon_size);
  gtk_widget_show (tmp_image);
  button_user = (GtkWidget*) gtk_tool_button_new (tmp_image, _("User"));
  gtk_widget_show (button_user);
  gtk_container_add (GTK_CONTAINER (toolbar1), button_user);
  gtk_widget_set_sensitive (button_user, FALSE);

  tmp_image = gtk_image_new_from_icon_name ("gtk-copy", tmp_toolbar_icon_size);
  gtk_widget_show (tmp_image);
  button_pass = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Pass"));
  gtk_widget_show (button_pass);
  gtk_container_add (GTK_CONTAINER (toolbar1), button_pass);
  gtk_widget_set_sensitive (button_pass, FALSE);

  toolitem1 = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem1);
  gtk_container_add (GTK_CONTAINER (toolbar1), toolitem1);

  vbox21 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_widget_show (vbox21);
  gtk_container_add (GTK_CONTAINER (toolitem1), vbox21);
  gtk_container_set_border_width (GTK_CONTAINER (vbox21), 2);

  label_category = gtk_label_new (_("Category"));
  gtk_widget_show (label_category);
  gtk_box_pack_start (GTK_BOX (vbox21), label_category, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label_category), 0.06, 0.5);

  optionmenu_category = gtk_combo_box_text_new ();
  gtk_widget_show (optionmenu_category);
  gtk_box_pack_start (GTK_BOX (vbox21), optionmenu_category, TRUE, TRUE, 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);

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

  findbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  gtk_box_set_spacing (GTK_BOX (findbar), 5);
  gtk_container_set_border_width (GTK_CONTAINER (findbar), 3);
  gtk_box_pack_start (GTK_BOX (vbox1), findbar, FALSE, FALSE, 0);

  find_close = (GtkWidget*) gtk_button_new_from_icon_name ("gtk-close", GTK_ICON_SIZE_BUTTON);
  gtk_widget_set_name (find_close, "fclose");
  gtk_button_set_relief (GTK_BUTTON (find_close), GTK_RELIEF_NONE);
  gtk_widget_show (find_close);
  gtk_container_add (GTK_CONTAINER (findbar), find_close);

  find_entry = gtk_search_entry_new ();
  gtk_widget_set_name (find_entry, "fentry");
  gtk_widget_show (find_entry);
  gtk_container_add (GTK_CONTAINER(findbar), find_entry);

  find_match_case = gtk_toggle_button_new_with_mnemonic (_("_Match case"));
  gtk_widget_set_name (find_match_case, "fcase");
  gtk_button_set_relief (GTK_BUTTON (find_match_case), GTK_RELIEF_NONE);
  gtk_widget_show (find_match_case);
  gtk_container_add (GTK_CONTAINER (findbar), find_match_case);

  statusbar = gtk_statusbar_new ();
  gtk_widget_show (statusbar);

  /* Compact statusbar */
  gtk_widget_set_margin_start (statusbar, 0);
  gtk_widget_set_margin_end (statusbar, 0);
  gtk_widget_set_margin_top (statusbar, 0);
  gtk_widget_set_margin_bottom (statusbar, 0);

  gtk_container_add (GTK_CONTAINER (vbox1), statusbar);

  /* Compact other widgets */
  GtkCssProvider *provider = gtk_css_provider_new ();
  gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
				   "toolbar .image-button { padding-left: 0px; padding-right: 0px; margin-right: 0px; } "
				   "statusbar border { margin-bottom: -2px; } "
                            	   "#fclose { padding: 0px; min-width: 22px;} "
                                   "#fentry { padding: 1px 8px 0px 8px; min-height: 22px;} "
                                   "#fcase { padding: 1px 8px 0px 8px; min-height: 22px; }"
                                   , -1, NULL);

  GdkDisplay *display = gdk_display_get_default ();
  GdkScreen *screen = gdk_display_get_default_screen (display);
  gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider), 
					     GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
  g_object_unref (provider);


  g_signal_connect ((gpointer) app_safe, "destroy",
                    G_CALLBACK (on_app_safe_destroy),
                    NULL);
  g_signal_connect ((gpointer) app_safe, "delete_event",
                    G_CALLBACK (on_app_safe_delete_event),
                    NULL);
  g_signal_connect ((gpointer) app_safe, "window_state_event",
                    G_CALLBACK (on_app_safe_window_state_event),
                    NULL);
  g_signal_connect ((gpointer) app_safe, "focus_in_event",
                    G_CALLBACK (on_app_safe_focus_in_event),
                    NULL);
  g_signal_connect ((gpointer) app_safe, "focus_out_event",
                    G_CALLBACK (on_app_safe_focus_out_event),
                    NULL);
  g_signal_connect ((gpointer) new_file, "activate",
                    G_CALLBACK (on_new_file_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) import_passwords1, "activate",
                    G_CALLBACK (on_import_passwords1_activate),
                    NULL);
  g_signal_connect ((gpointer) export1, "activate",
                    G_CALLBACK (on_export1_activate),
                    NULL);
  g_signal_connect ((gpointer) hide_to_tray, "activate",
                    G_CALLBACK (on_hide_to_tray_activate),
                    NULL);
  g_signal_connect ((gpointer) exit1, "activate",
                    G_CALLBACK (on_exit1_activate),
                    NULL);
  g_signal_connect ((gpointer) copy_pass, "activate",
                    G_CALLBACK (on_copy_pass_activate),
                    NULL);
  g_signal_connect ((gpointer) copy_user, "activate",
                    G_CALLBACK (on_copy_user_activate),
                    NULL);
  g_signal_connect ((gpointer) copy_both1, "activate",
                    G_CALLBACK (on_copy_both1_activate),
                    NULL);
  g_signal_connect ((gpointer) add_item1, "activate",
                    G_CALLBACK (on_add_item1_activate),
                    NULL);
  g_signal_connect ((gpointer) edit_item1, "activate",
                    G_CALLBACK (on_edit_item1_activate),
                    NULL);
  g_signal_connect ((gpointer) clone_item1, "activate",
                    G_CALLBACK (on_clone_item1_activate),
                    NULL);
  g_signal_connect ((gpointer) item_delete, "activate",
                    G_CALLBACK (on_item_delete_activate),
                    NULL);
  g_signal_connect ((gpointer) find, "activate",
                    G_CALLBACK (on_find_activate),
                    NULL);
  g_signal_connect ((gpointer) title1, "activate",
                    G_CALLBACK (on_view_menu_activate),
                    NULL);
  g_signal_connect ((gpointer) url1, "activate",
                    G_CALLBACK (on_view_menu_activate),
                    NULL);
  g_signal_connect ((gpointer) user1, "activate",
                    G_CALLBACK (on_view_menu_activate),
                    NULL);
  g_signal_connect ((gpointer) password1, "activate",
                    G_CALLBACK (on_view_menu_activate),
                    NULL);
  g_signal_connect ((gpointer) category1, "activate",
                    G_CALLBACK (on_view_menu_activate),
                    NULL);
  g_signal_connect ((gpointer) notes1, "activate",
                    G_CALLBACK (on_view_menu_activate),
                    NULL);
  g_signal_connect ((gpointer) launcher1, "activate",
                    G_CALLBACK (on_view_menu_activate),
                    NULL);
  g_signal_connect ((gpointer) toolbar2, "activate",
                    G_CALLBACK (on_toolbar2_activate),
                    NULL);
  g_signal_connect ((gpointer) launcher_menu, "activate",
                    G_CALLBACK (on_launcher_menu_activate),
                    NULL);
  g_signal_connect ((gpointer) item_password, "activate",
                    G_CALLBACK (on_item_password_activate),
                    NULL);
  g_signal_connect ((gpointer) preferences2, "activate",
                    G_CALLBACK (on_preferences2_activate),
                    NULL);
  g_signal_connect ((gpointer) current_password_file1, "activate",
                    G_CALLBACK (on_current_password_file1_activate),
                    NULL);
  g_signal_connect ((gpointer) about1, "activate",
                    G_CALLBACK (on_about1_activate),
                    NULL);
  g_signal_connect ((gpointer) toolbar1, "popup_context_menu",
                    G_CALLBACK (on_toolbar1_popup_context_menu),
                    NULL);
  g_signal_connect ((gpointer) button_save, "clicked",
                    G_CALLBACK (on_button_save_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_new, "clicked",
                    G_CALLBACK (on_button_new_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_edit, "clicked",
                    G_CALLBACK (on_button_edit_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_jump, "clicked",
                    G_CALLBACK (on_button_jump_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_user, "clicked",
                    G_CALLBACK (on_button_user_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_pass, "clicked",
                    G_CALLBACK (on_button_pass_clicked),
                    NULL);
  g_signal_connect ((gpointer) optionmenu_category, "changed",
                    G_CALLBACK (on_optionmenu_category_changed),
                    NULL);
  g_signal_connect ((gpointer) clist_main, "button_press_event",
                    G_CALLBACK (on_clist_main_button_press_event),
                    NULL);
  g_signal_connect ((gpointer) clist_main, "button_release_event",
                    G_CALLBACK (on_clist_main_button_release_event),
                    NULL);
  g_signal_connect ((gpointer) clist_main, "cursor_changed",
                    G_CALLBACK (on_clist_main_select_row),
                    NULL);
  g_signal_connect ((gpointer) clist_main, "row_activated",
                    G_CALLBACK (on_clist_main_row_activated),
                    NULL);
  g_signal_connect ((gpointer) clist_main, "columns_changed",
                    G_CALLBACK (on_clist_main_columns_changed),
                    NULL);
  g_signal_connect ((gpointer) find_close, "clicked",
                    G_CALLBACK (on_find_close_clicked),
                    NULL);
  g_signal_connect ((gpointer) find_entry, "key_press_event",
                    G_CALLBACK (on_find_entry_key_press_event),
                    NULL);
  g_signal_connect ((gpointer) find_entry, "changed",
                    G_CALLBACK (on_find_entry_changed),
                    NULL);
  g_signal_connect ((gpointer) find_entry, "activate",
                    G_CALLBACK (on_find_entry_activate),
                    NULL);
  g_signal_connect ((gpointer) find_match_case, "toggled",
                    G_CALLBACK (on_find_match_case_toggled),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (app_safe, app_safe, "app_safe");
  GLADE_HOOKUP_OBJECT (app_safe, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (app_safe, menubar1, "menubar1");
  GLADE_HOOKUP_OBJECT (app_safe, file1, "file1");
  GLADE_HOOKUP_OBJECT (app_safe, file1_menu, "file1_menu");
  GLADE_HOOKUP_OBJECT (app_safe, new_file, "new_file");
  GLADE_HOOKUP_OBJECT (app_safe, open1, "open1");
  GLADE_HOOKUP_OBJECT (app_safe, save1, "save1");
  GLADE_HOOKUP_OBJECT (app_safe, save_as1, "save_as1");
  GLADE_HOOKUP_OBJECT (app_safe, import_passwords1, "import_passwords1");
  GLADE_HOOKUP_OBJECT (app_safe, image1011, "image1011");
  GLADE_HOOKUP_OBJECT (app_safe, export1, "export1");
  GLADE_HOOKUP_OBJECT (app_safe, image1012, "image1012");
  GLADE_HOOKUP_OBJECT (app_safe, separatormenuitem1, "separatormenuitem1");
  GLADE_HOOKUP_OBJECT (app_safe, hide_to_tray, "hide_to_tray");
  GLADE_HOOKUP_OBJECT (app_safe, image1013, "image1013");
  GLADE_HOOKUP_OBJECT (app_safe, exit1, "exit1");
  GLADE_HOOKUP_OBJECT (app_safe, edit1, "edit1");
  GLADE_HOOKUP_OBJECT (app_safe, edit1_menu, "edit1_menu");
  GLADE_HOOKUP_OBJECT (app_safe, copy_pass, "copy_pass");
  GLADE_HOOKUP_OBJECT (app_safe, image1014, "image1014");
  GLADE_HOOKUP_OBJECT (app_safe, copy_user, "copy_user");
  GLADE_HOOKUP_OBJECT (app_safe, image1015, "image1015");
  GLADE_HOOKUP_OBJECT (app_safe, copy_both1, "copy_both1");
  GLADE_HOOKUP_OBJECT (app_safe, image1016, "image1016");
  GLADE_HOOKUP_OBJECT (app_safe, add_item1, "add_item1");
  GLADE_HOOKUP_OBJECT (app_safe, image1017, "image1017");
  GLADE_HOOKUP_OBJECT (app_safe, edit_item1, "edit_item1");
  GLADE_HOOKUP_OBJECT (app_safe, image1018, "image1018");
  GLADE_HOOKUP_OBJECT (app_safe, clone_item1, "clone_item1");
  GLADE_HOOKUP_OBJECT (app_safe, image1019, "image1019");
  GLADE_HOOKUP_OBJECT (app_safe, item_delete, "item_delete");
  GLADE_HOOKUP_OBJECT (app_safe, image1020, "image1020");
  GLADE_HOOKUP_OBJECT (app_safe, find, "find");
  GLADE_HOOKUP_OBJECT (app_safe, view1, "view1");
  GLADE_HOOKUP_OBJECT (app_safe, view1_menu, "view1_menu");
  GLADE_HOOKUP_OBJECT (app_safe, title1, "title1");
  GLADE_HOOKUP_OBJECT (app_safe, url1, "url1");
  GLADE_HOOKUP_OBJECT (app_safe, user1, "user1");
  GLADE_HOOKUP_OBJECT (app_safe, password1, "password1");
  GLADE_HOOKUP_OBJECT (app_safe, category1, "category1");
  GLADE_HOOKUP_OBJECT (app_safe, notes1, "notes1");
  GLADE_HOOKUP_OBJECT (app_safe, launcher1, "launcher1");
  GLADE_HOOKUP_OBJECT (app_safe, toolbar2, "toolbar2");
  GLADE_HOOKUP_OBJECT (app_safe, settings1, "settings1");
  GLADE_HOOKUP_OBJECT (app_safe, settings1_menu, "settings1_menu");
  GLADE_HOOKUP_OBJECT (app_safe, launcher_menu, "launcher_menu");
  GLADE_HOOKUP_OBJECT (app_safe, image1021, "image1021");
  GLADE_HOOKUP_OBJECT (app_safe, item_password, "item_password");
  GLADE_HOOKUP_OBJECT (app_safe, image1022, "image1022");
  GLADE_HOOKUP_OBJECT (app_safe, preferences2, "preferences2");
  GLADE_HOOKUP_OBJECT (app_safe, help1, "help1");
  GLADE_HOOKUP_OBJECT (app_safe, help1_menu, "help1_menu");
  GLADE_HOOKUP_OBJECT (app_safe, current_password_file1, "current_password_file1");
  GLADE_HOOKUP_OBJECT (app_safe, image1023, "image1023");
  GLADE_HOOKUP_OBJECT (app_safe, about1, "about1");
  GLADE_HOOKUP_OBJECT (app_safe, toolbar1, "toolbar1");
  GLADE_HOOKUP_OBJECT (app_safe, button_save, "button_save");
  GLADE_HOOKUP_OBJECT (app_safe, separatortoolitem1, "separatortoolitem1");
  GLADE_HOOKUP_OBJECT (app_safe, button_new, "button_new");
  GLADE_HOOKUP_OBJECT (app_safe, button_edit, "button_edit");
  GLADE_HOOKUP_OBJECT (app_safe, separatortoolitem2, "separatortoolitem2");
  GLADE_HOOKUP_OBJECT (app_safe, button_jump, "button_jump");
  GLADE_HOOKUP_OBJECT (app_safe, button_user, "button_user");
  GLADE_HOOKUP_OBJECT (app_safe, button_pass, "button_pass");
  GLADE_HOOKUP_OBJECT (app_safe, toolitem1, "toolitem1");
  GLADE_HOOKUP_OBJECT (app_safe, vbox21, "vbox21");
  GLADE_HOOKUP_OBJECT (app_safe, label_category, "label_category");
  GLADE_HOOKUP_OBJECT (app_safe, optionmenu_category, "optionmenu_category");
  GLADE_HOOKUP_OBJECT (app_safe, scrolledwindow1, "scrolledwindow1");
  GLADE_HOOKUP_OBJECT (app_safe, clist_main, "clist_main");
  GLADE_HOOKUP_OBJECT (app_safe, findbar, "findbar");
  GLADE_HOOKUP_OBJECT (app_safe, find_close, "find_close");
  GLADE_HOOKUP_OBJECT (app_safe, find_entry, "find_entry");
  GLADE_HOOKUP_OBJECT (app_safe, find_match_case, "find_match_case");
  GLADE_HOOKUP_OBJECT (app_safe, statusbar, "statusbar");

  gtk_widget_grab_focus (clist_main);
  gtk_window_add_accel_group (GTK_WINDOW (app_safe), accel_group);

  return app_safe;
}

GtkWidget*
create_dialog_edit_passitem (void)
{
  GtkWidget *dialog_edit_passitem;
  GtkWidget *dialog_vbox2;
  GtkWidget *table1;
  GtkWidget *entry_user;
  GtkWidget *label_title;
  GtkWidget *entry_title;
  GtkWidget *label5;
  GtkWidget *label7;
  GtkWidget *hbox1;
  GtkWidget *entry_password;
  GtkWidget *togglebutton_showpass;
  GtkWidget *entry_arg;
  GtkWidget *label6;
  GtkWidget *label28;
  GtkWidget *checkbutton_default;
  GtkWidget *scrolledwindow2;
  GtkWidget *text_notes;
  GtkWidget *label8;
  GtkWidget *label29;
  GtkWidget *combo_box_category;
  GtkWidget *combo_box_launcher;
  GtkWidget *dialog_action_area2;
  GtkWidget *button_generate;
  GtkWidget *button_cancel;
  GtkWidget *button_ok;

  dialog_edit_passitem = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog_edit_passitem), _("View / Edit Password Item"));
  gtk_window_set_default_size (GTK_WINDOW (dialog_edit_passitem), -1, 300);

  gtk_window_set_type_hint (GTK_WINDOW (dialog_edit_passitem), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox2 = gtk_dialog_get_content_area(GTK_DIALOG (dialog_edit_passitem));
  gtk_widget_set_margin_bottom (dialog_vbox2, 8);
  gtk_widget_show (dialog_vbox2);

  GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

  gtk_container_add (GTK_CONTAINER (dialog_vbox2), vbox);
  gtk_widget_show (vbox);

  table1 = gtk_grid_new ();
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox), table1, TRUE, TRUE, 0);

  gtk_grid_set_column_spacing (GTK_GRID (table1), 5);
  gtk_grid_set_row_spacing (GTK_GRID (table1), 3);
  gtk_widget_set_margin_start (table1, 3);
  gtk_widget_set_margin_end (table1, 3);
  gtk_widget_set_margin_bottom (table1, 10);

  label_title = gtk_label_new (_("Title:"));
  gtk_widget_show (label_title);
  gtk_widget_set_halign (label_title, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (table1), label_title, 0, 0, 1, 1);

  label5 = gtk_label_new (_("URL / Arg:"));
  gtk_widget_show (label5);
  gtk_widget_set_halign (label5, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (table1), label5, 0, 1, 1, 1);

  label6 = gtk_label_new (_("User Name:"));
  gtk_widget_set_halign (label6, GTK_ALIGN_START);
  gtk_widget_show (label6);
  gtk_grid_attach (GTK_GRID (table1), label6, 0, 2, 1, 1);

  label7 = gtk_label_new (_("Password:"));
  gtk_widget_show (label7);
  gtk_widget_set_halign (label7, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (table1), label7, 0, 3, 1, 1);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_grid_attach (GTK_GRID (table1), hbox1, 1, 3, 1, 1);

  entry_password = gtk_entry_new ();
  gtk_widget_show (entry_password);
  gtk_box_pack_start (GTK_BOX (hbox1), entry_password, TRUE, TRUE, 0);
  gtk_entry_set_visibility (GTK_ENTRY (entry_password), FALSE);

  togglebutton_showpass = gtk_toggle_button_new_with_mnemonic (_("Show Password"));
  gtk_widget_show (togglebutton_showpass);
  gtk_box_pack_start (GTK_BOX (hbox1), togglebutton_showpass, FALSE, FALSE, 0);

  entry_title = gtk_entry_new ();
  gtk_widget_show (entry_title);
  gtk_grid_attach (GTK_GRID (table1), entry_title, 1, 0, 1, 1);

  /* Enable expansion column when window resize */
  gtk_widget_set_hexpand (entry_title, TRUE);

  entry_arg = gtk_entry_new ();
  gtk_widget_show (entry_arg);
  gtk_grid_attach (GTK_GRID (table1), entry_arg, 1, 1, 1, 1);

  entry_user = gtk_entry_new ();
  gtk_widget_show (entry_user);
  gtk_grid_attach (GTK_GRID (table1), entry_user, 1, 2, 1, 1);

  label28 = gtk_label_new (_("Category:"));
  gtk_widget_show (label28);
  gtk_widget_set_halign (label28, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (table1), label28, 0, 4, 1, 1);

  checkbutton_default = gtk_check_button_new_with_mnemonic (_("Include this password in the default list."));
  gtk_widget_show (checkbutton_default);
  gtk_grid_attach (GTK_GRID (table1), checkbutton_default, 1, 5, 1, 1);

  scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow2);
  gtk_grid_attach (GTK_GRID (table1), scrolledwindow2, 1, 6, 1, 1);

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN);
  gtk_widget_set_size_request (scrolledwindow2, -1, 70);

  text_notes = gtk_text_view_new ();
  gtk_widget_show (text_notes);
  gtk_widget_set_vexpand (text_notes, TRUE);
  gtk_container_add (GTK_CONTAINER (scrolledwindow2), text_notes);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_notes), GTK_WRAP_WORD);
  gtk_text_view_set_indent (GTK_TEXT_VIEW (text_notes), 2);

  label8 = gtk_label_new (_("Notes:"));
  gtk_widget_show (label8);
  gtk_widget_set_halign (label8, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (table1), label8, 0, 6, 1, 1);

  label29 = gtk_label_new (_("Launcher:"));
  gtk_widget_show (label29);
  gtk_widget_set_halign (label29, GTK_ALIGN_START);
  gtk_grid_attach (GTK_GRID (table1), label29, 0, 7, 1, 1);

  combo_box_category = gtk_combo_box_text_new_with_entry ();
  gtk_widget_show (combo_box_category);
  gtk_grid_attach (GTK_GRID (table1), combo_box_category, 1, 4, 1, 1);

  combo_box_launcher = gtk_combo_box_text_new ();
  gtk_widget_show (combo_box_launcher);
  gtk_grid_attach (GTK_GRID (table1), combo_box_launcher, 1, 7, 1, 1);

  dialog_action_area2 = gtk_dialog_get_action_area(GTK_DIALOG (dialog_edit_passitem));
  gtk_widget_set_margin_top (dialog_action_area2, 5);
  gtk_widget_show (dialog_action_area2);

  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_SPREAD);

  button_generate = gtk_button_new_with_mnemonic (_("Generate..."));
  gtk_widget_show (button_generate);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog_edit_passitem), button_generate, 0);

  button_cancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (button_cancel);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog_edit_passitem), button_cancel, 0);

  button_ok = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (button_ok);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog_edit_passitem), button_ok, 0);


  g_signal_connect ((gpointer) dialog_edit_passitem, "delete_event",
                    G_CALLBACK (on_dialog_edit_passitem_delete_event),
                    NULL);
  g_signal_connect ((gpointer) dialog_edit_passitem, "destroy",
                    G_CALLBACK (on_dialog_edit_passitem_destroy),
                    NULL);
  g_signal_connect ((gpointer) togglebutton_showpass, "toggled",
                    G_CALLBACK (on_togglebutton_showpass_toggled),
                    NULL);
  g_signal_connect ((gpointer) button_generate, "clicked",
                    G_CALLBACK (on_button_generate_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_cancel, "clicked",
                    G_CALLBACK (on_button_cancel_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_ok, "clicked",
                    G_CALLBACK (on_button_ok_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_edit_passitem, dialog_edit_passitem, "dialog_edit_passitem");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, entry_user, "entry_user");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, label_title, "label_title");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, entry_password, "entry_password");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, togglebutton_showpass, "togglebutton_showpass");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, entry_arg, "entry_arg");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, entry_title, "entry_title");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, checkbutton_default, "checkbutton_default");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, text_notes, "text_notes");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, combo_box_category, "combo_box_category");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, combo_box_launcher, "combo_box_launcher");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_edit_passitem, dialog_action_area2, "dialog_action_area2");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, button_generate, "button_generate");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, button_cancel, "button_cancel");
  GLADE_HOOKUP_OBJECT (dialog_edit_passitem, button_ok, "button_ok");

  gtk_widget_grab_focus (entry_title);
  return dialog_edit_passitem;
}

GtkWidget*
create_dialog_password (void)
{
  GtkWidget *dialog_password;
  GtkWidget *dialog_vbox3;
  GtkWidget *vbox1;
  GtkWidget *label11;
  GtkWidget *drawingarea1;
  GtkWidget *pixmap1;
  GtkWidget *label27;
  GtkWidget *table6;
  GtkWidget *key_file_label;
  GtkWidget *label70;
  GtkWidget *key_file_select_btn;
  GtkWidget *image502;
  GtkWidget *key_file_combo;
  GtkWidget *entry_password;
  GtkWidget *btn_show_key_file;
  GtkWidget *arrow1;
  GtkWidget *label_password_message;
  GtkWidget *dialog_action_area3;
  GtkWidget *hbuttonbox2;
  GtkWidget *button_password_cancel;
  GtkWidget *button_password_ok;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  dialog_password = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog_password), _("Figaro's Password Manager 2"));
  gtk_window_set_modal (GTK_WINDOW (dialog_password), TRUE);
  gtk_window_set_resizable (GTK_WINDOW (dialog_password), FALSE);

  gtk_window_set_type_hint (GTK_WINDOW (dialog_password), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox3 = gtk_dialog_get_content_area (GTK_DIALOG (dialog_password));
  gtk_widget_set_margin_bottom (dialog_vbox3, 8);
  gtk_widget_show (dialog_vbox3);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), vbox1, TRUE, TRUE, 0);

  label11 = gtk_label_new (_("Welcome to"));
  gtk_widget_show (label11);
  gtk_box_pack_start (GTK_BOX (vbox1), label11, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_CENTER);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (vbox1), drawingarea1, FALSE, FALSE, 0);

  pixmap1 = create_pixmap ("logo.png");
  gtk_widget_show (pixmap1);
  gtk_box_pack_start (GTK_BOX (vbox1), pixmap1, TRUE, TRUE, 0);

  label27 = gtk_label_new (_("Figaro's Password Manager 2"));
  gtk_widget_show (label27);
  gtk_box_pack_start (GTK_BOX (vbox1), label27, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label27), GTK_JUSTIFY_CENTER);

  table6 = gtk_table_new (2, 3, FALSE);
  gtk_widget_show (table6);
  gtk_box_pack_start (GTK_BOX (vbox1), table6, FALSE, FALSE, 5);
  gtk_container_set_border_width (GTK_CONTAINER (table6), 5);
  gtk_table_set_row_spacings (GTK_TABLE (table6), 5);
  gtk_table_set_col_spacings (GTK_TABLE (table6), 5);

  key_file_label = gtk_label_new_with_mnemonic (_("Key _File:"));
  gtk_table_attach (GTK_TABLE (table6), key_file_label, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (key_file_label), 0, 0.5);

  label70 = gtk_label_new_with_mnemonic (_("_Password:"));
  gtk_widget_show (label70);
  gtk_table_attach (GTK_TABLE (table6), label70, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label70), 0, 0.5);

  key_file_select_btn = gtk_button_new ();
  gtk_table_attach (GTK_TABLE (table6), key_file_select_btn, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  image502 = gtk_image_new_from_icon_name ("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image502);
  gtk_container_add (GTK_CONTAINER (key_file_select_btn), image502);

  key_file_combo = gtk_combo_box_text_new ();
  gtk_table_attach (GTK_TABLE (table6), key_file_combo, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (key_file_combo, 170, -1);


        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (key_file_combo), C_("key_file","<NONE>"));
        gtk_combo_box_set_active(GTK_COMBO_BOX(key_file_combo), 0);


  entry_password = gtk_entry_new ();
  gtk_widget_show (entry_password);
  gtk_table_attach (GTK_TABLE (table6), entry_password, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_entry_set_visibility (GTK_ENTRY (entry_password), FALSE);

  btn_show_key_file = gtk_button_new ();
  gtk_widget_show (btn_show_key_file);
  gtk_table_attach (GTK_TABLE (table6), btn_show_key_file, 2, 3, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_add_accelerator (btn_show_key_file, "clicked", accel_group,
                              GDK_KEY_K, (GdkModifierType) GDK_MOD1_MASK,
                              GTK_ACCEL_VISIBLE);

  arrow1 = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
  gtk_widget_show (arrow1);
  gtk_container_add (GTK_CONTAINER (btn_show_key_file), arrow1);

  label_password_message = gtk_label_new ("");
  gtk_box_pack_start (GTK_BOX (dialog_vbox3), label_password_message, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label_password_message), GTK_JUSTIFY_CENTER);
  gtk_widget_set_margin_bottom (label_password_message, 15);

  dialog_action_area3 = gtk_dialog_get_action_area(GTK_DIALOG (dialog_password));
  gtk_widget_show (dialog_action_area3);

  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area3), GTK_BUTTONBOX_SPREAD);


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

  button_password_cancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (button_password_cancel);
  gtk_container_add (GTK_CONTAINER (hbuttonbox2), button_password_cancel);
//  GTK_WIDGET_SET_FLAGS (button_password_cancel, GTK_CAN_DEFAULT);
  gtk_widget_set_can_default(button_password_cancel, TRUE);

  button_password_ok = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (button_password_ok);
  gtk_container_add (GTK_CONTAINER (hbuttonbox2), button_password_ok);
//  GTK_WIDGET_SET_FLAGS (button_password_ok, GTK_CAN_DEFAULT);
  gtk_widget_set_can_default (button_password_ok, TRUE);
  gtk_widget_add_accelerator (button_password_ok, "clicked", accel_group,
                              GDK_KEY_Return, (GdkModifierType) 0,
                              GTK_ACCEL_VISIBLE);

  g_signal_connect ((gpointer) dialog_password, "delete_event",
                    G_CALLBACK (on_dialog_password_delete_event),
                    NULL);
  g_signal_connect ((gpointer) key_file_select_btn, "clicked",
                    G_CALLBACK (on_select_key_file_clicked),
                    NULL);
  g_signal_connect ((gpointer) btn_show_key_file, "clicked",
                    G_CALLBACK (on_btn_show_key_file_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_password_cancel, "clicked",
                    G_CALLBACK (on_button_password_cancel_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_password_ok, "clicked",
                    G_CALLBACK (on_button_password_ok_clicked),
                    NULL);

  gtk_label_set_mnemonic_widget (GTK_LABEL (key_file_label), key_file_select_btn);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label70), entry_password);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_password, dialog_password, "dialog_password");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_password, dialog_vbox3, "dialog_vbox3");
  GLADE_HOOKUP_OBJECT (dialog_password, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog_password, label11, "label11");
  GLADE_HOOKUP_OBJECT (dialog_password, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT (dialog_password, pixmap1, "pixmap1");
  GLADE_HOOKUP_OBJECT (dialog_password, label27, "label27");
  GLADE_HOOKUP_OBJECT (dialog_password, table6, "table6");
  GLADE_HOOKUP_OBJECT (dialog_password, key_file_label, "key_file_label");
  GLADE_HOOKUP_OBJECT (dialog_password, label70, "label70");
  GLADE_HOOKUP_OBJECT (dialog_password, key_file_select_btn, "key_file_select_btn");
  GLADE_HOOKUP_OBJECT (dialog_password, image502, "image502");
  GLADE_HOOKUP_OBJECT (dialog_password, key_file_combo, "key_file_combo");
  GLADE_HOOKUP_OBJECT (dialog_password, entry_password, "entry_password");
  GLADE_HOOKUP_OBJECT (dialog_password, btn_show_key_file, "btn_show_key_file");
  GLADE_HOOKUP_OBJECT (dialog_password, arrow1, "arrow1");
  GLADE_HOOKUP_OBJECT (dialog_password, label_password_message, "label_password_message");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_password, dialog_action_area3, "dialog_action_area3");
  GLADE_HOOKUP_OBJECT (dialog_password, hbuttonbox2, "hbuttonbox2");
  GLADE_HOOKUP_OBJECT (dialog_password, button_password_cancel, "button_password_cancel");
  GLADE_HOOKUP_OBJECT (dialog_password, button_password_ok, "button_password_ok");

  gtk_widget_grab_default (button_password_ok);
  gtk_window_add_accel_group (GTK_WINDOW (dialog_password), accel_group);

  gtk_widget_grab_focus (entry_password);

  return dialog_password;
}

GtkWidget*
create_dialog_password_gen (void)
{
  GtkWidget *dialog_password_gen;
  GtkWidget *dialog_vbox4;
  GtkWidget *vbox2;
  GtkWidget *label15;
  GtkWidget *frame1;
  GtkWidget *vbox4;
  GtkWidget *hbox4;
  GtkWidget *label17;
  GtkAdjustment *spinbutton_num_char_adj;
  GtkWidget *spinbutton_num_char;
  GtkWidget *checkbutton_lcase;
  GtkWidget *checkbutton_ucase;
  GtkWidget *checkbutton_num;
  GtkWidget *checkbutton_sym;
  GtkWidget *checkbutton_amb;
  GtkWidget *table2;
  GtkWidget *entry_base_10;
  GtkWidget *entry_bits;
  GtkWidget *label19;
  GtkWidget *label18;
  GtkWidget *label30;
  GtkWidget *hbox5;
  GtkWidget *label16;
  GtkWidget *entry_gen_password;
  GtkWidget *dialog_action_area4;
  GtkWidget *hbuttonbox3;
  GtkWidget *button_gen_generate_now;
  GtkWidget *button_gen_cancel;
  GtkWidget *button_gen_ok;

  dialog_password_gen = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog_password_gen), _("Autogenerate Password"));
  gtk_window_set_modal (GTK_WINDOW (dialog_password_gen), TRUE);

  gtk_window_set_type_hint (GTK_WINDOW (dialog_password_gen), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox4 = gtk_dialog_get_content_area(GTK_DIALOG (dialog_password_gen));
  gtk_widget_show (dialog_vbox4);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox2);
  gtk_box_pack_start (GTK_BOX (dialog_vbox4), vbox2, TRUE, TRUE, 0);

  label15 = gtk_label_new (_("Autogenerate Password"));
  gtk_widget_show (label15);
  gtk_box_pack_start (GTK_BOX (vbox2), label15, FALSE, FALSE, 8);
  gtk_label_set_justify (GTK_LABEL (label15), GTK_JUSTIFY_CENTER);

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (vbox2), frame1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame1), 6);

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

  hbox4 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox4);
  gtk_box_pack_start (GTK_BOX (vbox4), hbox4, TRUE, TRUE, 0);

  label17 = gtk_label_new (_("Number of Characters:"));
  gtk_widget_show (label17);
  gtk_box_pack_start (GTK_BOX (hbox4), label17, FALSE, FALSE, 3);
  gtk_label_set_justify (GTK_LABEL (label17), GTK_JUSTIFY_CENTER);

  spinbutton_num_char_adj = GTK_ADJUSTMENT(gtk_adjustment_new (8.0, 6.0, 255.0, 1.0, 10.0, 0.0));
  spinbutton_num_char = gtk_spin_button_new (spinbutton_num_char_adj, 1, 0);
  gtk_widget_show (spinbutton_num_char);
  gtk_box_pack_start (GTK_BOX (hbox4), spinbutton_num_char, FALSE, FALSE, 0);

  checkbutton_lcase = gtk_check_button_new_with_mnemonic (_("Use lowercase letters (a, b, c,... )"));
  gtk_widget_show (checkbutton_lcase);
  gtk_box_pack_start (GTK_BOX (vbox4), checkbutton_lcase, FALSE, FALSE, 0);

  checkbutton_ucase = gtk_check_button_new_with_mnemonic (_("Use uppercase letters (A, B, C.. )"));
  gtk_widget_show (checkbutton_ucase);
  gtk_box_pack_start (GTK_BOX (vbox4), checkbutton_ucase, FALSE, FALSE, 0);

  checkbutton_num = gtk_check_button_new_with_mnemonic (_("Use numbers (1, 2, 3... )"));
  gtk_widget_show (checkbutton_num);
  gtk_box_pack_start (GTK_BOX (vbox4), checkbutton_num, FALSE, FALSE, 0);

  checkbutton_sym = gtk_check_button_new_with_mnemonic (_("Use symbols (!, @, #...)"));
  gtk_widget_show (checkbutton_sym);
  gtk_box_pack_start (GTK_BOX (vbox4), checkbutton_sym, FALSE, FALSE, 0);

  checkbutton_amb = gtk_check_button_new_with_mnemonic (_("Avoid ambiguous characters (l,I&1, O&0, etc.)"));
  gtk_widget_show (checkbutton_amb);
  gtk_box_pack_start (GTK_BOX (vbox4), checkbutton_amb, FALSE, FALSE, 0);

  table2 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table2);
  gtk_box_pack_start (GTK_BOX (vbox4), table2, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (table2), 9);

  entry_base_10 = gtk_entry_new ();
  gtk_widget_show (entry_base_10);
  gtk_table_attach (GTK_TABLE (table2), entry_base_10, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_editable_set_editable (GTK_EDITABLE (entry_base_10), FALSE);

  entry_bits = gtk_entry_new ();
  gtk_widget_show (entry_bits);
  gtk_table_attach (GTK_TABLE (table2), entry_bits, 1, 2, 1, 2,
                    (GtkAttachOptions) (0),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_editable_set_editable (GTK_EDITABLE (entry_bits), FALSE);

  label19 = gtk_label_new (_("Bit equivalent: 2 ^"));
  gtk_widget_show (label19);
  gtk_table_attach (GTK_TABLE (table2), label19, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label19), GTK_JUSTIFY_CENTER);
  gtk_misc_set_alignment (GTK_MISC (label19), 1, 0.5);

  label18 = gtk_label_new (_("Number of combinations: 10 ^"));
  gtk_widget_show (label18);
  gtk_table_attach (GTK_TABLE (table2), label18, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label18), GTK_JUSTIFY_CENTER);
  gtk_misc_set_alignment (GTK_MISC (label18), 1, 0.5);

  label30 = gtk_label_new (_("Generation Options"));
  gtk_widget_show (label30);
  gtk_frame_set_label_widget (GTK_FRAME (frame1), label30);

  hbox5 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox5);
  gtk_box_pack_start (GTK_BOX (vbox2), hbox5, FALSE, FALSE, 10);
  gtk_container_set_border_width (GTK_CONTAINER (hbox5), 5);

  label16 = gtk_label_new (_("Generated Password:"));
  gtk_widget_show (label16);
  gtk_box_pack_start (GTK_BOX (hbox5), label16, FALSE, FALSE, 2);
  gtk_label_set_justify (GTK_LABEL (label16), GTK_JUSTIFY_CENTER);

  entry_gen_password = gtk_entry_new ();
  gtk_widget_show (entry_gen_password);
  gtk_box_pack_start (GTK_BOX (hbox5), entry_gen_password, TRUE, TRUE, 2);

  dialog_action_area4 = gtk_dialog_get_action_area(GTK_DIALOG (dialog_password_gen));
  gtk_widget_show (dialog_action_area4);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_SPREAD);

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

  button_gen_generate_now = gtk_button_new_with_mnemonic (_("Generate!"));
  gtk_widget_show (button_gen_generate_now);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button_gen_generate_now);
//  GTK_WIDGET_SET_FLAGS (button_gen_generate_now, GTK_CAN_DEFAULT);

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

  button_gen_ok = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (button_gen_ok);
  gtk_container_add (GTK_CONTAINER (hbuttonbox3), button_gen_ok);
//  GTK_WIDGET_SET_FLAGS (button_gen_ok, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) spinbutton_num_char, "value_changed",
                    G_CALLBACK (on_gpw_toggled),
                    NULL);
  g_signal_connect ((gpointer) checkbutton_lcase, "toggled",
                    G_CALLBACK (on_gpw_toggled),
                    NULL);
  g_signal_connect ((gpointer) checkbutton_ucase, "toggled",
                    G_CALLBACK (on_gpw_toggled),
                    NULL);
  g_signal_connect ((gpointer) checkbutton_num, "toggled",
                    G_CALLBACK (on_gpw_toggled),
                    NULL);
  g_signal_connect ((gpointer) checkbutton_sym, "toggled",
                    G_CALLBACK (on_gpw_toggled),
                    NULL);
  g_signal_connect ((gpointer) checkbutton_amb, "toggled",
                    G_CALLBACK (on_gpw_toggled),
                    NULL);
  g_signal_connect ((gpointer) button_gen_generate_now, "clicked",
                    G_CALLBACK (on_button_gen_generate_now_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_gen_cancel, "clicked",
                    G_CALLBACK (on_button_gen_cancel_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_gen_ok, "clicked",
                    G_CALLBACK (on_button_gen_ok_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_password_gen, dialog_password_gen, "dialog_password_gen");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_password_gen, dialog_vbox4, "dialog_vbox4");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, spinbutton_num_char, "spinbutton_num_char");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, checkbutton_lcase, "checkbutton_lcase");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, checkbutton_ucase, "checkbutton_ucase");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, checkbutton_num, "checkbutton_num");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, checkbutton_sym, "checkbutton_sym");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, checkbutton_amb, "checkbutton_amb");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, table2, "table2");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, entry_base_10, "entry_base_10");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, entry_bits, "entry_bits");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, label19, "label19");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, label18, "label18");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, label30, "label30");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, hbox5, "hbox5");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, label16, "label16");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, entry_gen_password, "entry_gen_password");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_password_gen, dialog_action_area4, "dialog_action_area4");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, hbuttonbox3, "hbuttonbox3");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, button_gen_generate_now, "button_gen_generate_now");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, button_gen_cancel, "button_gen_cancel");
  GLADE_HOOKUP_OBJECT (dialog_password_gen, button_gen_ok, "button_gen_ok");

  return dialog_password_gen;
}

GtkWidget*
create_dialog_cpw (void)
{
  GtkWidget *dialog_cpw;
  GtkWidget *dialog_vbox5;
  GtkWidget *vbox5;
  GtkWidget *pixmap_logo;
  GtkWidget *label62;
  GtkWidget *frame16;
  GtkWidget *alignment12;
  GtkWidget *vbox22;
  GtkWidget *label66;
  GtkWidget *table5;
  GtkWidget *entry_cpw1;
  GtkWidget *entry_cpw2;
  GtkWidget *label64;
  GtkWidget *label65;
  GtkWidget *label63;
  GtkWidget *frame17;
  GtkWidget *alignment13;
  GtkWidget *vbox23;
  GtkWidget *label68;
  GtkWidget *hbox20;
  GtkWidget *label69;
  GtkWidget *key_file_combo;
  GtkWidget *select_key_file;
  GtkWidget *image500;
  GtkWidget *label67;
  GtkWidget *dialog_action_area5;
  GtkWidget *hbuttonbox4;
  GtkWidget *button_cpw_cancel;
  GtkWidget *button_cpw_ok;

  dialog_cpw = gtk_dialog_new ();
  gtk_container_set_border_width (GTK_CONTAINER (dialog_cpw), 2);
  gtk_window_set_title (GTK_WINDOW (dialog_cpw), _("Choose Master Password"));
  gtk_window_set_resizable (GTK_WINDOW (dialog_cpw), FALSE);

//  gtk_window_set_modal (GTK_WINDOW (dialog_cpw), TRUE);

//  gtk_window_set_position (GTK_WINDOW (dialog_cpw), GTK_WIN_POS_CENTER);
 // gtk_window_set_default_size (GTK_WINDOW (dialog_cpw), 500, 350);

  gtk_window_set_type_hint (GTK_WINDOW (dialog_cpw), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox5 = gtk_dialog_get_content_area(GTK_DIALOG (dialog_cpw));
  gtk_widget_show (dialog_vbox5);

  vbox5 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox5);
  gtk_box_pack_start (GTK_BOX (dialog_vbox5), vbox5, TRUE, TRUE, 2);

  pixmap_logo = create_pixmap ("logo.png");
  gtk_widget_show (pixmap_logo);
  gtk_box_pack_start (GTK_BOX (vbox5), pixmap_logo, FALSE, FALSE, 5);

  label62 = gtk_label_new (_("Welcome to Figaro's Password Manager 2"));
  gtk_widget_show (label62);
  gtk_box_pack_start (GTK_BOX (vbox5), label62, FALSE, FALSE, 5);
  gtk_label_set_justify (GTK_LABEL (label62), GTK_JUSTIFY_CENTER);

  frame16 = gtk_frame_new (NULL);
  gtk_widget_show (frame16);
  gtk_box_pack_start (GTK_BOX (vbox5), frame16, TRUE, TRUE, 2);
  gtk_container_set_border_width (GTK_CONTAINER (frame16), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame16), GTK_SHADOW_IN);

  alignment12 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment12);
  gtk_container_add (GTK_CONTAINER (frame16), alignment12);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment12), 0, 3, 12, 0);

  vbox22 = gtk_vbox_new (FALSE, 2);
  gtk_widget_show (vbox22);
  gtk_container_add (GTK_CONTAINER (alignment12), vbox22);
  gtk_container_set_border_width (GTK_CONTAINER (vbox22), 5);

  label66 = gtk_label_new (_("Please choose the password which will be used to encrypt your passwords.  It is vital that you remember this password; without it, you can not access your password list."));
  gtk_label_set_max_width_chars(GTK_LABEL (label66), 50);
  gtk_widget_show (label66);
  gtk_box_pack_start (GTK_BOX (vbox22), label66, FALSE, FALSE, 0);
  gtk_widget_set_size_request (label66, 400, -1);
  gtk_label_set_line_wrap (GTK_LABEL (label66), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label66), 0, 0.5);

  table5 = gtk_table_new (2, 2, FALSE);
  gtk_widget_show (table5);
  gtk_box_pack_start (GTK_BOX (vbox22), table5, FALSE, FALSE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table5), 2);

  entry_cpw1 = gtk_entry_new ();
  gtk_widget_show (entry_cpw1);
  gtk_table_attach (GTK_TABLE (table5), entry_cpw1, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_entry_set_visibility (GTK_ENTRY (entry_cpw1), FALSE);

  entry_cpw2 = gtk_entry_new ();
  gtk_widget_show (entry_cpw2);
  gtk_table_attach (GTK_TABLE (table5), entry_cpw2, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_entry_set_visibility (GTK_ENTRY (entry_cpw2), FALSE);

  label64 = gtk_label_new_with_mnemonic (_("Please choose a _password:"));
  gtk_widget_show (label64);
  gtk_table_attach (GTK_TABLE (table5), label64, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label64), GTK_JUSTIFY_CENTER);
  gtk_misc_set_alignment (GTK_MISC (label64), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label64), 2, 0);

  label65 = gtk_label_new_with_mnemonic (_("_Verify it by typing it again here:"));
  gtk_widget_show (label65);
  gtk_table_attach (GTK_TABLE (table5), label65, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label65), GTK_JUSTIFY_CENTER);
  gtk_misc_set_alignment (GTK_MISC (label65), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label65), 2, 0);


  GtkWidget *label_cipher = gtk_label_new_with_mnemonic (_("_Cipher:"));
  gtk_widget_show (label_cipher);
  gtk_table_attach (GTK_TABLE (table5), label_cipher, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label_cipher), GTK_JUSTIFY_CENTER);
  gtk_misc_set_alignment (GTK_MISC (label_cipher), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label_cipher), 2, 0);

//        gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (key_file_combo), C_("key_file","<NONE>"));
//        gtk_combo_box_set_active (GTK_COMBO_BOX (key_file_combo), 0);

  GtkWidget *ciphers_combo = gtk_combo_box_text_new ();;
  gtk_widget_show (ciphers_combo);
  gtk_table_attach (GTK_TABLE (table5), ciphers_combo, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  GtkWidget *label_kdf_iterations = gtk_label_new_with_mnemonic (_("KDF _iterations:"));
  gtk_widget_show (label_kdf_iterations);
  gtk_table_attach (GTK_TABLE (table5), label_kdf_iterations, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label_kdf_iterations), GTK_JUSTIFY_CENTER);
  gtk_misc_set_alignment (GTK_MISC (label_kdf_iterations), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label_kdf_iterations), 2, 0);

  GtkAdjustment *number_kdf_iterations_adj = GTK_ADJUSTMENT(gtk_adjustment_new (PBKDF2_ITERATIONS_DEFAULT, 0, 4000000, 1000, 2, 0));
  GtkWidget *number_kdf_iterations = gtk_spin_button_new (number_kdf_iterations_adj, 1, 0);
  gtk_widget_show (number_kdf_iterations);
  gtk_table_attach (GTK_TABLE (table5), number_kdf_iterations, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label63 = gtk_label_new (_("<b>Master Password</b>"));
  gtk_widget_show (label63);
  gtk_frame_set_label_widget (GTK_FRAME (frame16), label63);
  gtk_label_set_use_markup (GTK_LABEL (label63), TRUE);

  frame17 = gtk_frame_new (NULL);
  gtk_widget_show (frame17);
  gtk_box_pack_start (GTK_BOX (vbox5), frame17, TRUE, TRUE, 2);
  gtk_container_set_border_width (GTK_CONTAINER (frame17), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame17), GTK_SHADOW_IN);

  alignment13 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment13);
  gtk_container_add (GTK_CONTAINER (frame17), alignment13);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment13), 0, 3, 12, 0);

  vbox23 = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox23);
  gtk_container_add (GTK_CONTAINER (alignment13), vbox23);
  gtk_container_set_border_width (GTK_CONTAINER (vbox23), 5);

  label68 = gtk_label_new (_("Optionally you may specify the file which will be used to encrypt your passwords along with master password. Do not lose this file, is necessary for access to your passwords."));
  gtk_label_set_max_width_chars(GTK_LABEL (label68), 50);
  gtk_widget_show (label68);
  gtk_box_pack_start (GTK_BOX (vbox23), label68, FALSE, FALSE, 0);
  gtk_widget_set_size_request (label68, 400, -1);
  gtk_label_set_line_wrap (GTK_LABEL (label68), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label68), 0, 0.5);

  hbox20 = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (hbox20);
  gtk_box_pack_start (GTK_BOX (vbox23), hbox20, TRUE, TRUE, 0);

  label69 = gtk_label_new_with_mnemonic (_("_Key File:"));
  gtk_widget_show (label69);
  gtk_box_pack_start (GTK_BOX (hbox20), label69, FALSE, FALSE, 0);

  key_file_combo = gtk_combo_box_text_new ();
  gtk_widget_show (key_file_combo);
  gtk_box_pack_start (GTK_BOX (hbox20), key_file_combo, TRUE, TRUE, 0);

  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (key_file_combo), C_("key_file","<NONE>"));
  gtk_combo_box_set_active (GTK_COMBO_BOX (key_file_combo), 0);

  select_key_file = gtk_button_new ();
  gtk_widget_show (select_key_file);
  gtk_box_pack_start (GTK_BOX (hbox20), select_key_file, FALSE, FALSE, 0);

  image500 = gtk_image_new_from_icon_name ("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image500);
  gtk_container_add (GTK_CONTAINER (select_key_file), image500);

  label67 = gtk_label_new (_("<b>Key File</b>"));
  gtk_widget_show (label67);
  gtk_frame_set_label_widget (GTK_FRAME (frame17), label67);
  gtk_label_set_use_markup (GTK_LABEL (label67), TRUE);

  dialog_action_area5 = gtk_dialog_get_action_area (GTK_DIALOG (dialog_cpw));
  gtk_widget_show (dialog_action_area5);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area5), GTK_BUTTONBOX_END);

  hbuttonbox4 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox4);
  gtk_container_add (GTK_CONTAINER (dialog_action_area5), hbuttonbox4);
  gtk_box_set_spacing (GTK_BOX (hbuttonbox4), 30);

  button_cpw_cancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (button_cpw_cancel);
  gtk_container_add (GTK_CONTAINER (hbuttonbox4), button_cpw_cancel);
//  GTK_WIDGET_SET_FLAGS (button_cpw_cancel, GTK_CAN_DEFAULT);

  button_cpw_ok = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (button_cpw_ok);
  gtk_container_add (GTK_CONTAINER (hbuttonbox4), button_cpw_ok);
//  GTK_WIDGET_SET_FLAGS (button_cpw_ok, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) dialog_cpw, "delete_event",
                    G_CALLBACK (on_button_cpw_cancel_clicked),
                    NULL);
  g_signal_connect ((gpointer) select_key_file, "clicked",
                    G_CALLBACK (on_select_key_file_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_cpw_cancel, "clicked",
                    G_CALLBACK (on_button_cpw_cancel_clicked),
                    NULL);
  g_signal_connect ((gpointer) button_cpw_ok, "clicked",
                    G_CALLBACK (on_button_cpw_ok_clicked),
                    NULL);

  gtk_label_set_mnemonic_widget (GTK_LABEL (label64), entry_cpw1);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label65), entry_cpw2);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label69), select_key_file);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_cpw, dialog_cpw, "dialog_cpw");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_cpw, dialog_vbox5, "dialog_vbox5");
  GLADE_HOOKUP_OBJECT (dialog_cpw, vbox5, "vbox5");
  GLADE_HOOKUP_OBJECT (dialog_cpw, pixmap_logo, "pixmap_logo");
  GLADE_HOOKUP_OBJECT (dialog_cpw, label62, "label62");
  GLADE_HOOKUP_OBJECT (dialog_cpw, frame16, "frame16");
  GLADE_HOOKUP_OBJECT (dialog_cpw, alignment12, "alignment12");
  GLADE_HOOKUP_OBJECT (dialog_cpw, vbox22, "vbox22");
  GLADE_HOOKUP_OBJECT (dialog_cpw, label66, "label66");
  GLADE_HOOKUP_OBJECT (dialog_cpw, table5, "table5");
  GLADE_HOOKUP_OBJECT (dialog_cpw, entry_cpw1, "entry_cpw1");
  GLADE_HOOKUP_OBJECT (dialog_cpw, entry_cpw2, "entry_cpw2");
  GLADE_HOOKUP_OBJECT (dialog_cpw, label64, "label64");
  GLADE_HOOKUP_OBJECT (dialog_cpw, label65, "label65");
  GLADE_HOOKUP_OBJECT (dialog_cpw, label63, "label63");
  GLADE_HOOKUP_OBJECT (dialog_cpw, frame17, "frame17");
  GLADE_HOOKUP_OBJECT (dialog_cpw, alignment13, "alignment13");
  GLADE_HOOKUP_OBJECT (dialog_cpw, vbox23, "vbox23");
  GLADE_HOOKUP_OBJECT (dialog_cpw, label68, "label68");
  GLADE_HOOKUP_OBJECT (dialog_cpw, hbox20, "hbox20");
  GLADE_HOOKUP_OBJECT (dialog_cpw, label69, "label69");
  GLADE_HOOKUP_OBJECT (dialog_cpw, key_file_combo, "key_file_combo");
  GLADE_HOOKUP_OBJECT (dialog_cpw, select_key_file, "select_key_file");
  GLADE_HOOKUP_OBJECT (dialog_cpw, image500, "image500");
  GLADE_HOOKUP_OBJECT (dialog_cpw, label67, "label67");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_cpw, dialog_action_area5, "dialog_action_area5");
  GLADE_HOOKUP_OBJECT (dialog_cpw, hbuttonbox4, "hbuttonbox4");
  GLADE_HOOKUP_OBJECT (dialog_cpw, button_cpw_cancel, "button_cpw_cancel");
  GLADE_HOOKUP_OBJECT (dialog_cpw, button_cpw_ok, "button_cpw_ok");
  GLADE_HOOKUP_OBJECT (dialog_cpw, number_kdf_iterations, "number_kdf_iterations");
  GLADE_HOOKUP_OBJECT (dialog_cpw, ciphers_combo, "ciphers_combo");

  gtk_widget_grab_focus (entry_cpw1);
  return dialog_cpw;
}

GtkWidget*
create_dialog_launcher (void)
{
  GtkWidget *dialog_launcher;
  GtkWidget *dialog_vbox6;
  GtkWidget *vbox6;
  GtkWidget *frame_edit_launcher;
  GtkWidget *alignment16;
  GtkWidget *vbox25;
  GtkWidget *table4;
  GtkWidget *entry_launcher_cmd;
  GtkWidget *combo_entry_launcher;
  GtkWidget *hbox_radio_pass;
  GtkWidget *radiobutton_pass_pri;
  GSList *radiobutton_pass_pri_group = NULL;
  GtkWidget *radiobutton_pass_clip;
  GtkWidget *radiobutton_pass_none;
  GtkWidget *hbox_radio_user;
  GtkWidget *radiobutton_user_pri;
  GSList *radiobutton_user_pri_group = NULL;
  GtkWidget *radiobutton_user_clip;
  GtkWidget *radiobutton_user_none;
  GtkWidget *label33;
  GtkWidget *label31;
  GtkWidget *label32;
  GtkWidget *label30;
  GtkWidget *hbuttonbox7;
  GtkWidget *btn_launcher_remove;
  GtkWidget *btn_launcher_add;
  GtkWidget *btn_launcher_apply;
  GtkWidget *label73;
  GtkWidget *expander1;
  GtkWidget *label_instructions;
  GtkWidget *label74;
  GtkWidget *dialog_action_area6;
  GtkWidget *hbuttonbox5;
  GtkWidget *btn_launcher_close;

  dialog_launcher = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog_launcher), _("Launcher Preferences"));
  gtk_window_set_resizable (GTK_WINDOW (dialog_launcher), FALSE);

  gtk_window_set_type_hint (GTK_WINDOW (dialog_launcher), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox6 = gtk_dialog_get_content_area(GTK_DIALOG (dialog_launcher));
  gtk_widget_show (dialog_vbox6);

  vbox6 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox6);
  gtk_box_pack_start (GTK_BOX (dialog_vbox6), vbox6, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox6), 5);

  frame_edit_launcher = gtk_frame_new (NULL);
  gtk_widget_show (frame_edit_launcher);
  gtk_box_pack_start (GTK_BOX (vbox6), frame_edit_launcher, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame_edit_launcher), 5);
  gtk_frame_set_shadow_type (GTK_FRAME (frame_edit_launcher), GTK_SHADOW_IN);

  alignment16 = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (alignment16);
  gtk_container_add (GTK_CONTAINER (frame_edit_launcher), alignment16);
  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment16), 5, 0, 10, 10);

  vbox25 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox25);
  gtk_container_add (GTK_CONTAINER (alignment16), vbox25);

  table4 = gtk_table_new (4, 2, FALSE);
  gtk_widget_show (table4);
  gtk_box_pack_start (GTK_BOX (vbox25), table4, FALSE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table4), 2);

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

  combo_entry_launcher = gtk_combo_box_text_new_with_entry ();
  gtk_widget_show (combo_entry_launcher);
  gtk_table_attach (GTK_TABLE (table4), combo_entry_launcher, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  hbox_radio_pass = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox_radio_pass);
  gtk_table_attach (GTK_TABLE (table4), hbox_radio_pass, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  radiobutton_pass_pri = gtk_radio_button_new_with_mnemonic (NULL, _("to primary sel."));
  gtk_widget_show (radiobutton_pass_pri);
  gtk_box_pack_start (GTK_BOX (hbox_radio_pass), radiobutton_pass_pri, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_pass_pri), radiobutton_pass_pri_group);
  radiobutton_pass_pri_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_pass_pri));

  radiobutton_pass_clip = gtk_radio_button_new_with_mnemonic (NULL, _("to clipboard"));
  gtk_widget_show (radiobutton_pass_clip);
  gtk_box_pack_start (GTK_BOX (hbox_radio_pass), radiobutton_pass_clip, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_pass_clip), radiobutton_pass_pri_group);
  radiobutton_pass_pri_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_pass_clip));

  radiobutton_pass_none = gtk_radio_button_new_with_mnemonic (NULL, _("don't copy"));
  gtk_widget_show (radiobutton_pass_none);
  gtk_box_pack_start (GTK_BOX (hbox_radio_pass), radiobutton_pass_none, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_pass_none), radiobutton_pass_pri_group);
  radiobutton_pass_pri_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_pass_none));

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

  radiobutton_user_pri = gtk_radio_button_new_with_mnemonic (NULL, _("to primary sel."));
  gtk_widget_show (radiobutton_user_pri);
  gtk_box_pack_start (GTK_BOX (hbox_radio_user), radiobutton_user_pri, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_user_pri), radiobutton_user_pri_group);
  radiobutton_user_pri_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_user_pri));

  radiobutton_user_clip = gtk_radio_button_new_with_mnemonic (NULL, _("to clipboard"));
  gtk_widget_show (radiobutton_user_clip);
  gtk_box_pack_start (GTK_BOX (hbox_radio_user), radiobutton_user_clip, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_user_clip), radiobutton_user_pri_group);
  radiobutton_user_pri_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_user_clip));

  radiobutton_user_none = gtk_radio_button_new_with_mnemonic (NULL, _("don't copy"));
  gtk_widget_show (radiobutton_user_none);
  gtk_box_pack_start (GTK_BOX (hbox_radio_user), radiobutton_user_none, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_user_none), radiobutton_user_pri_group);
  radiobutton_user_pri_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_user_none));

  label33 = gtk_label_new_with_mnemonic (_("Copy _User:"));
  gtk_widget_show (label33);
  gtk_table_attach (GTK_TABLE (table4), label33, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label33), 0, 0.5);

  label31 = gtk_label_new_with_mnemonic (_("Command _Line:"));
  gtk_widget_show (label31);
  gtk_table_attach (GTK_TABLE (table4), label31, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label31), 0, 0.5);

  label32 = gtk_label_new_with_mnemonic (_("Copy Pass_word:"));
  gtk_widget_show (label32);
  gtk_table_attach (GTK_TABLE (table4), label32, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label32), 0, 0.5);

  label30 = gtk_label_new_with_mnemonic (_("Launcher _Name:"));
  gtk_widget_show (label30);
  gtk_table_attach (GTK_TABLE (table4), label30, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label30), 0, 0.5);

  hbuttonbox7 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox7);
  gtk_box_pack_start (GTK_BOX (vbox25), hbuttonbox7, FALSE, FALSE, 10);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox7), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (hbuttonbox7), 15);

  btn_launcher_remove = gtk_button_new_from_stock ("gtk-remove");
  gtk_widget_show (btn_launcher_remove);
  gtk_container_add (GTK_CONTAINER (hbuttonbox7), btn_launcher_remove);
//  GTK_WIDGET_SET_FLAGS (btn_launcher_remove, GTK_CAN_DEFAULT);
  gtk_widget_set_can_default(btn_launcher_remove, TRUE);

  btn_launcher_add = gtk_button_new_from_stock ("gtk-add");
  gtk_widget_show (btn_launcher_add);
  gtk_container_add (GTK_CONTAINER (hbuttonbox7), btn_launcher_add);
//  GTK_WIDGET_SET_FLAGS (btn_launcher_add, GTK_CAN_DEFAULT);
  gtk_widget_set_can_default(btn_launcher_add, TRUE);

  btn_launcher_apply = gtk_button_new_from_stock ("gtk-apply");
  gtk_widget_show (btn_launcher_apply);
  gtk_container_add (GTK_CONTAINER (hbuttonbox7), btn_launcher_apply);
//  GTK_WIDGET_SET_FLAGS (btn_launcher_apply, GTK_CAN_DEFAULT);
  gtk_widget_set_can_default(btn_launcher_apply, TRUE);

  label73 = gtk_label_new (_("<b>Launcher</b>"));
  gtk_widget_show (label73);
  gtk_frame_set_label_widget (GTK_FRAME (frame_edit_launcher), label73);
  gtk_label_set_use_markup (GTK_LABEL (label73), TRUE);

  expander1 = gtk_expander_new (NULL);
  gtk_widget_show (expander1);
  gtk_box_pack_start (GTK_BOX (vbox6), expander1, FALSE, FALSE, 0);

  label_instructions = gtk_label_new (_("You can use the following variables in your command line:\n$a = argument / url\n$u = user name\n$p = password (not recommened)"));
  gtk_widget_show (label_instructions);
  gtk_container_add (GTK_CONTAINER (expander1), label_instructions);
  gtk_misc_set_alignment (GTK_MISC (label_instructions), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label_instructions), 22, 10);

  label74 = gtk_label_new_with_mnemonic (_("Command Line _Variables"));
  gtk_widget_show (label74);
  gtk_expander_set_label_widget (GTK_EXPANDER (expander1), label74);

  dialog_action_area6 = gtk_dialog_get_action_area(GTK_DIALOG (dialog_launcher));
  gtk_widget_show (dialog_action_area6);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area6), GTK_BUTTONBOX_END);

  hbuttonbox5 = gtk_hbutton_box_new ();
  gtk_widget_show (hbuttonbox5);
  gtk_container_add (GTK_CONTAINER (dialog_action_area6), hbuttonbox5);
  gtk_box_set_spacing (GTK_BOX (hbuttonbox5), 30);

  btn_launcher_close = gtk_button_new_from_stock ("gtk-close");
  gtk_widget_show (btn_launcher_close);
  gtk_container_add (GTK_CONTAINER (hbuttonbox5), btn_launcher_close);
//  GTK_WIDGET_SET_FLAGS (btn_launcher_close, GTK_CAN_DEFAULT);
  gtk_widget_set_can_default(btn_launcher_close, TRUE);

  g_signal_connect ((gpointer) dialog_launcher, "destroy",
                    G_CALLBACK (on_dialog_prefs_destroy),
                    NULL);
  g_signal_connect ((gpointer) combo_entry_launcher, "changed",
                    G_CALLBACK (on_combo_entry_launcher_changed),
                    NULL);
  g_signal_connect ((gpointer) btn_launcher_remove, "clicked",
                    G_CALLBACK (on_btn_launcher_remove_clicked),
                    NULL);
  g_signal_connect ((gpointer) btn_launcher_add, "clicked",
                    G_CALLBACK (on_btn_launcher_add_clicked),
                    NULL);
  g_signal_connect ((gpointer) btn_launcher_apply, "clicked",
                    G_CALLBACK (on_btn_launcher_apply_clicked),
                    NULL);
  g_signal_connect ((gpointer) btn_launcher_close, "destroy",
                    G_CALLBACK (dialog_launcher_destroy),
                    NULL);
  g_signal_connect ((gpointer) btn_launcher_close, "clicked",
                    G_CALLBACK (on_btn_launcher_close_clicked),
                    NULL);

  gtk_label_set_mnemonic_widget (GTK_LABEL (label33), radiobutton_user_pri);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label31), entry_launcher_cmd);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label32), radiobutton_pass_pri);
  gtk_label_set_mnemonic_widget (GTK_LABEL (label30), combo_entry_launcher);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_launcher, dialog_launcher, "dialog_launcher");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_launcher, dialog_vbox6, "dialog_vbox6");
  GLADE_HOOKUP_OBJECT (dialog_launcher, vbox6, "vbox6");
  GLADE_HOOKUP_OBJECT (dialog_launcher, frame_edit_launcher, "frame_edit_launcher");
  GLADE_HOOKUP_OBJECT (dialog_launcher, alignment16, "alignment16");
  GLADE_HOOKUP_OBJECT (dialog_launcher, vbox25, "vbox25");
  GLADE_HOOKUP_OBJECT (dialog_launcher, table4, "table4");
  GLADE_HOOKUP_OBJECT (dialog_launcher, entry_launcher_cmd, "entry_launcher_cmd");
  GLADE_HOOKUP_OBJECT (dialog_launcher, combo_entry_launcher, "combo_entry_launcher");
  GLADE_HOOKUP_OBJECT (dialog_launcher, hbox_radio_pass, "hbox_radio_pass");
  GLADE_HOOKUP_OBJECT (dialog_launcher, radiobutton_pass_pri, "radiobutton_pass_pri");
  GLADE_HOOKUP_OBJECT (dialog_launcher, radiobutton_pass_clip, "radiobutton_pass_clip");
  GLADE_HOOKUP_OBJECT (dialog_launcher, radiobutton_pass_none, "radiobutton_pass_none");
  GLADE_HOOKUP_OBJECT (dialog_launcher, hbox_radio_user, "hbox_radio_user");
  GLADE_HOOKUP_OBJECT (dialog_launcher, radiobutton_user_pri, "radiobutton_user_pri");
  GLADE_HOOKUP_OBJECT (dialog_launcher, radiobutton_user_clip, "radiobutton_user_clip");
  GLADE_HOOKUP_OBJECT (dialog_launcher, radiobutton_user_none, "radiobutton_user_none");
  GLADE_HOOKUP_OBJECT (dialog_launcher, label33, "label33");
  GLADE_HOOKUP_OBJECT (dialog_launcher, label31, "label31");
  GLADE_HOOKUP_OBJECT (dialog_launcher, label32, "label32");
  GLADE_HOOKUP_OBJECT (dialog_launcher, label30, "label30");
  GLADE_HOOKUP_OBJECT (dialog_launcher, hbuttonbox7, "hbuttonbox7");
  GLADE_HOOKUP_OBJECT (dialog_launcher, btn_launcher_remove, "btn_launcher_remove");
  GLADE_HOOKUP_OBJECT (dialog_launcher, btn_launcher_add, "btn_launcher_add");
  GLADE_HOOKUP_OBJECT (dialog_launcher, btn_launcher_apply, "btn_launcher_apply");
  GLADE_HOOKUP_OBJECT (dialog_launcher, label73, "label73");
  GLADE_HOOKUP_OBJECT (dialog_launcher, expander1, "expander1");
  GLADE_HOOKUP_OBJECT (dialog_launcher, label_instructions, "label_instructions");
  GLADE_HOOKUP_OBJECT (dialog_launcher, label74, "label74");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_launcher, dialog_action_area6, "dialog_action_area6");
  GLADE_HOOKUP_OBJECT (dialog_launcher, hbuttonbox5, "hbuttonbox5");
  GLADE_HOOKUP_OBJECT (dialog_launcher, btn_launcher_close, "btn_launcher_close");

  gtk_widget_grab_focus (btn_launcher_close);
  gtk_widget_grab_default (btn_launcher_close);
  return dialog_launcher;
}

GtkWidget*
create_dialog_about (void)
{
  GtkWidget *dialog_about;
  const gchar *authors[] = {
    "John Conneely and other contributors",
    "Aleš Koval",
    NULL
  };
  /* TRANSLATORS: Replace this string with your names, one name per line. */
  gchar *translators = "Basque - Ales Zabala Alava (Shagi)\nBulgarian - Yovko Yovkov\nCzech - Aleš Koval\nFrench - Christoph J. Thompson\nGerman - Mike Constabel\nHungarian - Peter Polonkai\nItalian - Nicola Jelmorini\nSpanish - Antonio Rguez. Capita\nRussian - Boorkov Sergey aka Leo";
  GdkPixbuf *dialog_about_logo_pixbuf;

  dialog_about = gtk_about_dialog_new ();
  gtk_container_set_border_width (GTK_CONTAINER (dialog_about), 5);
  gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (dialog_about), VERSION);
  gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (dialog_about), _("FPM2"));
  gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (dialog_about), _("(c) 2000-2003 John Conneely & other contributors\n(c) 2008-2020 Aleš Koval"));
  gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG (dialog_about), _("Figaro's Password Manager\nAdapted for GTK3."));
  gtk_about_dialog_set_license (GTK_ABOUT_DIALOG (dialog_about), _("This application is licensed under the GNU General Public License Version 2 or (at your option) any later version.\n"));
  gtk_about_dialog_set_wrap_license (GTK_ABOUT_DIALOG (dialog_about), TRUE);
  gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (dialog_about), "https://als.regnet.cz/fpm2/");
  gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG (dialog_about), _("FPM2 website"));
  gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (dialog_about), authors);
  gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (dialog_about), translators);
  dialog_about_logo_pixbuf = create_pixbuf ("logo.png");
  gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG (dialog_about), dialog_about_logo_pixbuf);

  g_signal_connect ((gpointer) dialog_about, "response",
                    G_CALLBACK (gtk_widget_destroy),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_about, dialog_about, "dialog_about");

  return dialog_about;
}

GtkWidget*
create_dialog_preferences (void)
{
  GtkWidget *dialog_preferences;
  GtkWidget *dialog_vbox9;
  GtkWidget *notebook1;
  GtkWidget *vbox_search;
  GtkWidget *frame12;
  GtkWidget *vbox15;
  GtkWidget *search_in_title;
  GtkWidget *search_in_url;
  GtkWidget *search_in_user;
  GtkWidget *search_in_notes;
  GtkWidget *label45;
  GtkWidget *frame13;
  GtkWidget *vbox16;
  GtkWidget *search_match_case;
  GtkWidget *search_limit_category;
  GtkWidget *label46;
  GtkWidget *label39;
  GtkWidget *vbox12;
  GtkWidget *frame11;
  GtkWidget *vbox14;
  GtkWidget *save_on_add;
  GtkWidget *save_on_change;
  GtkWidget *save_on_delete;
  GtkWidget *save_on_quit;
  GtkWidget *label44;
  GtkWidget *frame10;
  GtkWidget *vbox13;
  GtkWidget *create_backup;
  GtkWidget *backup_files_hbox;
  GtkWidget *label41;
  GtkAdjustment *number_backup_files_adj;
  GtkWidget *number_backup_files;
  GtkWidget *label42;
  GtkWidget *label43;
  GtkWidget *label40;
  GtkWidget *vbox_others;
  GtkWidget *frame14;
  GtkWidget *vbox18;
  GtkWidget *enable_tray_icon;
  GtkWidget *tr_always_visible;
  GtkWidget *tr_auto_hide_vbox;
  GtkWidget *tr_auto_hide;
  GtkWidget *tr_auto_hide_align;
  GtkWidget *hbox14;
  GtkWidget *label52;
  GtkAdjustment *tr_auto_hide_minutes_adj;
  GtkWidget *tr_auto_hide_minutes;
  GtkWidget *label53;
  GtkWidget *tr_auto_lock_vbox;
  GtkWidget *tr_auto_lock;
  GtkWidget *tr_auto_lock_align;
  GtkWidget *hbox15;
  GtkWidget *label54;
  GtkAdjustment *tr_auto_lock_minutes_adj;
  GtkWidget *tr_auto_lock_minutes;
  GtkWidget *label55;
  GtkWidget *label49;
  GtkWidget *label48;
  GtkWidget *vbox19;
  GtkWidget *frame15;
  GtkWidget *vbox20;
  GtkWidget *startup_category;
  GtkWidget *startup_category_combo;
  GtkWidget *startup_search;
  GtkWidget *label57;
  GtkWidget *frame19;
  GtkWidget *dblclick_action_combo;
  GtkWidget *label75;
  GtkWidget *frame18;
  GtkWidget *vbox24;
  GtkWidget *copy_target_combo;
  GtkWidget *clear_target;
  GtkWidget *label72;
  GtkWidget *label56;
  GtkWidget *dialog_action_area9;
  GtkWidget *cancelbutton2;
  GtkWidget *okbutton2;

  dialog_preferences = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog_preferences), _("Preferences"));

  gtk_window_set_type_hint (GTK_WINDOW (dialog_preferences), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox9 = gtk_dialog_get_content_area(GTK_DIALOG (dialog_preferences));
  gtk_widget_show (dialog_vbox9);

  notebook1 = gtk_notebook_new ();
  gtk_widget_show (notebook1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox9), notebook1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (notebook1), 10);

  vbox_search = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_search);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox_search);

  frame12 = gtk_frame_new (NULL);
  gtk_widget_show (frame12);
  gtk_box_pack_start (GTK_BOX (vbox_search), frame12, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame12), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame12), GTK_SHADOW_NONE);

  vbox15 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
  gtk_widget_set_margin_top(vbox15, 5);
  gtk_widget_set_margin_start(vbox15, 15);
  gtk_widget_show (vbox15);
  gtk_container_add (GTK_CONTAINER (frame12), vbox15);

  search_in_title = gtk_check_button_new_with_mnemonic (_("Search in _title"));
  gtk_widget_show (search_in_title);
  gtk_box_pack_start (GTK_BOX (vbox15), search_in_title, FALSE, FALSE, 0);

  search_in_url = gtk_check_button_new_with_mnemonic (_("Search in u_rl"));
  gtk_widget_show (search_in_url);
  gtk_box_pack_start (GTK_BOX (vbox15), search_in_url, FALSE, FALSE, 0);

  search_in_user = gtk_check_button_new_with_mnemonic (_("Search in _user"));
  gtk_widget_show (search_in_user);
  gtk_box_pack_start (GTK_BOX (vbox15), search_in_user, FALSE, FALSE, 0);

  search_in_notes = gtk_check_button_new_with_mnemonic (_("Search in _notes"));
  gtk_widget_show (search_in_notes);
  gtk_box_pack_start (GTK_BOX (vbox15), search_in_notes, FALSE, FALSE, 0);

  label45 = gtk_label_new (_("<b>Search Scope</b>"));
  gtk_widget_show (label45);
  gtk_frame_set_label_widget (GTK_FRAME (frame12), label45);
  gtk_label_set_use_markup (GTK_LABEL (label45), TRUE);

  frame13 = gtk_frame_new (NULL);
  gtk_widget_show (frame13);
  gtk_box_pack_start (GTK_BOX (vbox_search), frame13, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame13), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame13), GTK_SHADOW_NONE);

  vbox16 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
  gtk_widget_set_margin_top(vbox16, 5);
  gtk_widget_set_margin_start(vbox16, 15);
  gtk_widget_show (vbox16);
  gtk_container_add (GTK_CONTAINER (frame13), vbox16);

  search_match_case = gtk_check_button_new_with_mnemonic (_("_Match case"));
  gtk_widget_show (search_match_case);
  gtk_box_pack_start (GTK_BOX (vbox16), search_match_case, FALSE, FALSE, 0);

  search_limit_category = gtk_check_button_new_with_mnemonic (_("Only in current _category"));
  gtk_widget_show (search_limit_category);
  gtk_box_pack_start (GTK_BOX (vbox16), search_limit_category, FALSE, FALSE, 0);

  label46 = gtk_label_new (_("<b>Search Conditions</b>"));
  gtk_widget_show (label46);
  gtk_frame_set_label_widget (GTK_FRAME (frame13), label46);
  gtk_label_set_use_markup (GTK_LABEL (label46), TRUE);

  label39 = gtk_label_new (_("Search"));
  gtk_widget_show (label39);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label39);

  vbox12 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox12);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox12);

  frame11 = gtk_frame_new (NULL);
  gtk_widget_show (frame11);
  gtk_box_pack_start (GTK_BOX (vbox12), frame11, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame11), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame11), GTK_SHADOW_NONE);

  vbox14 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
  gtk_widget_set_margin_top(vbox14, 5);
  gtk_widget_set_margin_start(vbox14, 15);
  gtk_widget_show (vbox14);
  gtk_container_add (GTK_CONTAINER (frame11), vbox14);

  save_on_add = gtk_check_button_new_with_mnemonic (_("Save when entry _added"));
  gtk_widget_show (save_on_add);
  gtk_box_pack_start (GTK_BOX (vbox14), save_on_add, FALSE, FALSE, 0);

  save_on_change = gtk_check_button_new_with_mnemonic (_("Save when entry _changed"));
  gtk_widget_show (save_on_change);
  gtk_box_pack_start (GTK_BOX (vbox14), save_on_change, FALSE, FALSE, 0);

  save_on_delete = gtk_check_button_new_with_mnemonic (_("Save when entry _deleted"));
  gtk_widget_show (save_on_delete);
  gtk_box_pack_start (GTK_BOX (vbox14), save_on_delete, FALSE, FALSE, 0);

  save_on_quit = gtk_check_button_new_with_mnemonic (_("Save on _quit"));
  gtk_widget_show (save_on_quit);
  gtk_box_pack_start (GTK_BOX (vbox14), save_on_quit, FALSE, FALSE, 0);

  label44 = gtk_label_new (_("<b>Automatic File Saving</b>"));
  gtk_widget_show (label44);
  gtk_frame_set_label_widget (GTK_FRAME (frame11), label44);
  gtk_label_set_use_markup (GTK_LABEL (label44), TRUE);

  frame10 = gtk_frame_new (NULL);
  gtk_widget_show (frame10);
  gtk_box_pack_start (GTK_BOX (vbox12), frame10, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame10), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame10), GTK_SHADOW_NONE);

  vbox13 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
  gtk_widget_set_margin_top(vbox13, 5);
  gtk_widget_set_margin_start(vbox13, 15);
  gtk_widget_show (vbox13);
  gtk_container_add (GTK_CONTAINER (frame10), vbox13);

  create_backup = gtk_check_button_new_with_mnemonic (_("Create a backup copy of _files"));
  gtk_widget_show (create_backup);
  gtk_box_pack_start (GTK_BOX (vbox13), create_backup, FALSE, FALSE, 0);

  backup_files_hbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (backup_files_hbox);
  gtk_box_pack_start (GTK_BOX (vbox13), backup_files_hbox, TRUE, TRUE, 0);
  gtk_widget_set_sensitive (backup_files_hbox, FALSE);

  label41 = gtk_label_new (_("Keep "));
  gtk_widget_show (label41);
  gtk_widget_set_margin_start(label41, 25);
  gtk_box_pack_start (GTK_BOX (backup_files_hbox), label41, FALSE, FALSE, 0);

  number_backup_files_adj = GTK_ADJUSTMENT(gtk_adjustment_new (20, 1, 20, 1, 2, 0));
  number_backup_files = gtk_spin_button_new (number_backup_files_adj, 1, 0);
  gtk_widget_show (number_backup_files);
  gtk_box_pack_start (GTK_BOX (backup_files_hbox), number_backup_files, FALSE, TRUE, 0);
  gtk_widget_set_size_request (number_backup_files, 40, -1);

  label42 = gtk_label_new (_("  history backup files"));
  gtk_widget_show (label42);
  gtk_box_pack_start (GTK_BOX (backup_files_hbox), label42, FALSE, FALSE, 0);

  label43 = gtk_label_new (_("<b>File Saving</b>"));
  gtk_widget_show (label43);
  gtk_frame_set_label_widget (GTK_FRAME (frame10), label43);
  gtk_label_set_use_markup (GTK_LABEL (label43), TRUE);

  label40 = gtk_label_new (_("Saving"));
  gtk_widget_show (label40);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label40);

  vbox_others = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_others);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox_others);

  frame14 = gtk_frame_new (NULL);
  gtk_widget_show (frame14);
  gtk_box_pack_start (GTK_BOX (vbox_others), frame14, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame14), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame14), GTK_SHADOW_NONE);

  vbox18 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
  gtk_widget_set_margin_top(vbox18, 5);
  gtk_widget_set_margin_start(vbox18, 15);
  gtk_widget_show (vbox18);
  gtk_container_add (GTK_CONTAINER (frame14), vbox18);

  enable_tray_icon = gtk_check_button_new_with_mnemonic (_("Enable tray _icon"));
  gtk_widget_show (enable_tray_icon);
  gtk_box_pack_start (GTK_BOX (vbox18), enable_tray_icon, FALSE, FALSE, 0);

  tr_always_visible = gtk_check_button_new_with_mnemonic (_("Tray icon always _visible"));
  gtk_widget_show (tr_always_visible);
  gtk_box_pack_start (GTK_BOX (vbox18), tr_always_visible, FALSE, FALSE, 0);
  gtk_widget_set_sensitive (tr_always_visible, FALSE);

  tr_auto_hide_vbox = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (tr_auto_hide_vbox);
  gtk_box_pack_start (GTK_BOX (vbox18), tr_auto_hide_vbox, FALSE, TRUE, 0);

  tr_auto_hide = gtk_check_button_new_with_mnemonic (_("Auto _minimize to tray icon"));
  gtk_widget_show (tr_auto_hide);
  gtk_box_pack_start (GTK_BOX (tr_auto_hide_vbox), tr_auto_hide, FALSE, FALSE, 0);
  gtk_widget_set_sensitive (tr_auto_hide, FALSE);

  tr_auto_hide_align = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (tr_auto_hide_align);
  gtk_box_pack_start (GTK_BOX (tr_auto_hide_vbox), tr_auto_hide_align, TRUE, TRUE, 0);
  gtk_widget_set_sensitive (tr_auto_hide_align, FALSE);
  gtk_alignment_set_padding (GTK_ALIGNMENT (tr_auto_hide_align), 0, 0, 22, 0);

  hbox14 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox14);
  gtk_container_add (GTK_CONTAINER (tr_auto_hide_align), hbox14);

  label52 = gtk_label_new (_("after "));
  gtk_widget_show (label52);
  gtk_box_pack_start (GTK_BOX (hbox14), label52, FALSE, FALSE, 0);

  tr_auto_hide_minutes_adj = GTK_ADJUSTMENT(gtk_adjustment_new (15, 1, 600, 1, 10, 0));
  tr_auto_hide_minutes = gtk_spin_button_new (tr_auto_hide_minutes_adj, 1, 0);
  gtk_widget_show (tr_auto_hide_minutes);
  gtk_box_pack_start (GTK_BOX (hbox14), tr_auto_hide_minutes, FALSE, TRUE, 0);

  label53 = gtk_label_new (_(" minutes"));
  gtk_widget_show (label53);
  gtk_box_pack_start (GTK_BOX (hbox14), label53, FALSE, FALSE, 0);

  tr_auto_lock_vbox = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (tr_auto_lock_vbox);
  gtk_box_pack_start (GTK_BOX (vbox18), tr_auto_lock_vbox, FALSE, TRUE, 0);

  tr_auto_lock = gtk_check_button_new_with_mnemonic (_("_Lock program past minimize"));
  gtk_widget_show (tr_auto_lock);
  gtk_box_pack_start (GTK_BOX (tr_auto_lock_vbox), tr_auto_lock, FALSE, FALSE, 0);
  gtk_widget_set_sensitive (tr_auto_lock, FALSE);

  tr_auto_lock_align = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (tr_auto_lock_align);
  gtk_box_pack_start (GTK_BOX (tr_auto_lock_vbox), tr_auto_lock_align, TRUE, TRUE, 0);
  gtk_widget_set_sensitive (tr_auto_lock_align, FALSE);
  gtk_alignment_set_padding (GTK_ALIGNMENT (tr_auto_lock_align), 0, 0, 22, 0);

  hbox15 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox15);
  gtk_container_add (GTK_CONTAINER (tr_auto_lock_align), hbox15);

  label54 = gtk_label_new (_("after "));
  gtk_widget_show (label54);
  gtk_box_pack_start (GTK_BOX (hbox15), label54, FALSE, FALSE, 0);

  tr_auto_lock_minutes_adj = GTK_ADJUSTMENT(gtk_adjustment_new (15, 0, 100, 1, 10, 0));
  tr_auto_lock_minutes = gtk_spin_button_new (tr_auto_lock_minutes_adj, 1, 0);
  gtk_widget_show (tr_auto_lock_minutes);
  gtk_box_pack_start (GTK_BOX (hbox15), tr_auto_lock_minutes, FALSE, TRUE, 0);

  label55 = gtk_label_new (_(" minutes"));
  gtk_widget_show (label55);
  gtk_box_pack_start (GTK_BOX (hbox15), label55, FALSE, FALSE, 0);

  label49 = gtk_label_new (_("<b>Tray Icon</b>"));
  gtk_widget_show (label49);
  gtk_frame_set_label_widget (GTK_FRAME (frame14), label49);
  gtk_label_set_use_markup (GTK_LABEL (label49), TRUE);

  label48 = gtk_label_new (_("Tray Icon"));
  gtk_widget_show (label48);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label48);

  vbox19 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_widget_show (vbox19);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox19);

  frame15 = gtk_frame_new (NULL);
  gtk_widget_set_halign (frame15, GTK_ALIGN_START);
  gtk_widget_show (frame15);
  gtk_box_pack_start (GTK_BOX (vbox19), frame15, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame15), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame15), GTK_SHADOW_NONE);

  vbox20 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
  gtk_widget_set_margin_top (vbox20, 5);
  gtk_widget_set_margin_start (vbox20, 15);
  gtk_widget_show (vbox20);
  gtk_container_add (GTK_CONTAINER (frame15), vbox20);

  startup_category = gtk_check_button_new_with_mnemonic (_("_Open this category"));
  gtk_widget_show (startup_category);
  gtk_container_add (GTK_CONTAINER (vbox20), startup_category);

  startup_category_combo = gtk_combo_box_text_new ();
  gtk_widget_set_margin_start (startup_category_combo, 25);
  gtk_widget_show (startup_category_combo);
  gtk_container_add (GTK_CONTAINER (vbox20), startup_category_combo);
  gtk_widget_set_sensitive (startup_category_combo, FALSE);

  startup_search = gtk_check_button_new_with_mnemonic (_("Open _search dialog"));
  gtk_widget_show (startup_search);
  gtk_container_add (GTK_CONTAINER (vbox20), startup_search);
  label57 = gtk_label_new (_("<b>On Startup</b>"));
  gtk_widget_show (label57);
  gtk_frame_set_label_widget (GTK_FRAME (frame15), label57);
  gtk_label_set_use_markup (GTK_LABEL (label57), TRUE);

  frame19 = gtk_frame_new (NULL);
  gtk_widget_set_halign (frame19, GTK_ALIGN_START);
  gtk_widget_show (frame19);
  gtk_box_pack_start (GTK_BOX (vbox19), frame19, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame19), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame19), GTK_SHADOW_NONE);

  dblclick_action_combo = gtk_combo_box_text_new ();
  gtk_widget_set_margin_top (dblclick_action_combo, 5);
  gtk_widget_set_margin_start (dblclick_action_combo, 15);
  gtk_widget_show (dblclick_action_combo);
  gtk_container_add (GTK_CONTAINER (frame19), dblclick_action_combo);

  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dblclick_action_combo), _("Call Launcher"));
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dblclick_action_combo), _("Copy Username"));
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dblclick_action_combo), _("Copy Password"));
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dblclick_action_combo), _("Copy Both"));
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dblclick_action_combo), _("Open Edit Window"));

  label75 = gtk_label_new (_("<b>When Activated Entry</b>"));
  gtk_widget_show (label75);
  gtk_frame_set_label_widget (GTK_FRAME (frame19), label75);
  gtk_label_set_use_markup (GTK_LABEL (label75), TRUE);

  frame18 = gtk_frame_new (NULL);
  gtk_widget_set_halign (frame18, GTK_ALIGN_START);
  gtk_widget_show (frame18);
  gtk_box_pack_start (GTK_BOX (vbox19), frame18, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame18), 10);
  gtk_frame_set_shadow_type (GTK_FRAME (frame18), GTK_SHADOW_NONE);

  vbox24 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
  gtk_widget_set_margin_top (vbox24, 5);
  gtk_widget_set_margin_start (vbox24, 15);
  gtk_widget_show (vbox24);
  gtk_container_add (GTK_CONTAINER (frame18), vbox24);

  copy_target_combo = gtk_combo_box_text_new ();
  gtk_widget_show (copy_target_combo);
  gtk_container_add (GTK_CONTAINER (vbox24), copy_target_combo);

  clear_target = gtk_check_button_new_with_mnemonic (_("_Clear target after paste"));
  gtk_widget_show (clear_target);
  gtk_box_pack_start (GTK_BOX (vbox24), clear_target, FALSE, FALSE, 0);



  GtkWidget *clear_target_seconds_align = gtk_alignment_new (0.5, 0.5, 1, 1);
  gtk_widget_show (clear_target_seconds_align);
  gtk_box_pack_start (GTK_BOX (vbox24), clear_target_seconds_align, TRUE, TRUE, 0);
  gtk_widget_set_sensitive (clear_target_seconds_align, FALSE);
  gtk_alignment_set_padding (GTK_ALIGNMENT (clear_target_seconds_align), 0, 0, 22, 0);

  GtkWidget *hbox151 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox151);
  gtk_container_add (GTK_CONTAINER (clear_target_seconds_align), hbox151);

  GtkWidget *label541 = gtk_label_new (_("in "));
  gtk_widget_show (label541);
  gtk_box_pack_start (GTK_BOX (hbox151), label541, FALSE, FALSE, 0);

  GtkAdjustment *clear_target_seconds_adj = GTK_ADJUSTMENT(gtk_adjustment_new (15, 0, 100, 1, 10, 0));
  GtkWidget *clear_target_seconds = gtk_spin_button_new (clear_target_seconds_adj, 1, 0);
  gtk_widget_show (clear_target_seconds);
  gtk_box_pack_start (GTK_BOX (hbox151), clear_target_seconds, FALSE, TRUE, 0);

  GtkWidget *label551 = gtk_label_new (_(" seconds"));
  gtk_widget_show (label551);
  gtk_box_pack_start (GTK_BOX (hbox151), label551, FALSE, FALSE, 0);



  label72 = gtk_label_new (_("<b>Copy Target</b>"));
  gtk_widget_show (label72);
  gtk_frame_set_label_widget (GTK_FRAME (frame18), label72);
  gtk_label_set_use_markup (GTK_LABEL (label72), TRUE);

  label56 = gtk_label_new (_("Others"));
  gtk_widget_show (label56);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 3), label56);

  dialog_action_area9 = gtk_dialog_get_action_area(GTK_DIALOG (dialog_preferences));
  gtk_widget_show (dialog_action_area9);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area9), GTK_BUTTONBOX_END);

  cancelbutton2 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton2);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog_preferences), cancelbutton2, GTK_RESPONSE_CANCEL);
//  GTK_WIDGET_SET_FLAGS (cancelbutton2, GTK_CAN_DEFAULT);

  okbutton2 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton2);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog_preferences), okbutton2, GTK_RESPONSE_OK);
//  GTK_WIDGET_SET_FLAGS (okbutton2, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) create_backup, "toggled",
                    G_CALLBACK (on_create_backup_toggled),
                    NULL);
  g_signal_connect ((gpointer) enable_tray_icon, "toggled",
                    G_CALLBACK (on_enable_tray_icon_toggled),
                    NULL);
  g_signal_connect ((gpointer) tr_auto_hide, "toggled",
                    G_CALLBACK (on_tr_auto_hide_toggled),
                    NULL);
  g_signal_connect ((gpointer) tr_auto_lock, "toggled",
                    G_CALLBACK (on_tr_auto_lock_toggled),
                    NULL);
  g_signal_connect ((gpointer) startup_category, "toggled",
                    G_CALLBACK (on_startup_category_toggled),
                    NULL);
  g_signal_connect ((gpointer) startup_category_combo, "changed",
                    G_CALLBACK (on_startup_category_combo_changed),
                    NULL);
  g_signal_connect ((gpointer) startup_search, "toggled",
                    G_CALLBACK (on_startup_search_toggled),
                    NULL);
  g_signal_connect ((gpointer) dblclick_action_combo, "changed",
                    G_CALLBACK (on_dblclick_action_combo_changed),
                    NULL);
  g_signal_connect ((gpointer) copy_target_combo, "changed",
                    G_CALLBACK (on_copy_target_combo_changed),
                    NULL);
  g_signal_connect ((gpointer) clear_target, "toggled",
                    G_CALLBACK (on_clear_target_toggled),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_preferences, dialog_preferences, "dialog_preferences");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_preferences, dialog_vbox9, "dialog_vbox9");
  GLADE_HOOKUP_OBJECT (dialog_preferences, notebook1, "notebook1");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox_search, "vbox_search");
  GLADE_HOOKUP_OBJECT (dialog_preferences, frame12, "frame12");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox15, "vbox15");
  GLADE_HOOKUP_OBJECT (dialog_preferences, search_in_title, "search_in_title");
  GLADE_HOOKUP_OBJECT (dialog_preferences, search_in_url, "search_in_url");
  GLADE_HOOKUP_OBJECT (dialog_preferences, search_in_user, "search_in_user");
  GLADE_HOOKUP_OBJECT (dialog_preferences, search_in_notes, "search_in_notes");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label45, "label45");
  GLADE_HOOKUP_OBJECT (dialog_preferences, frame13, "frame13");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox16, "vbox16");
  GLADE_HOOKUP_OBJECT (dialog_preferences, search_match_case, "search_match_case");
  GLADE_HOOKUP_OBJECT (dialog_preferences, search_limit_category, "search_limit_category");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label46, "label46");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label39, "label39");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox12, "vbox12");
  GLADE_HOOKUP_OBJECT (dialog_preferences, frame11, "frame11");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox14, "vbox14");
  GLADE_HOOKUP_OBJECT (dialog_preferences, save_on_add, "save_on_add");
  GLADE_HOOKUP_OBJECT (dialog_preferences, save_on_change, "save_on_change");
  GLADE_HOOKUP_OBJECT (dialog_preferences, save_on_delete, "save_on_delete");
  GLADE_HOOKUP_OBJECT (dialog_preferences, save_on_quit, "save_on_quit");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label44, "label44");
  GLADE_HOOKUP_OBJECT (dialog_preferences, frame10, "frame10");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox13, "vbox13");
  GLADE_HOOKUP_OBJECT (dialog_preferences, create_backup, "create_backup");
  GLADE_HOOKUP_OBJECT (dialog_preferences, backup_files_hbox, "backup_files_hbox");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label41, "label41");
  GLADE_HOOKUP_OBJECT (dialog_preferences, number_backup_files, "number_backup_files");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label42, "label42");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label43, "label43");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label40, "label40");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox_others, "vbox_others");
  GLADE_HOOKUP_OBJECT (dialog_preferences, frame14, "frame14");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox18, "vbox18");
  GLADE_HOOKUP_OBJECT (dialog_preferences, enable_tray_icon, "enable_tray_icon");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_always_visible, "tr_always_visible");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_auto_hide_vbox, "tr_auto_hide_vbox");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_auto_hide, "tr_auto_hide");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_auto_hide_align, "tr_auto_hide_align");
  GLADE_HOOKUP_OBJECT (dialog_preferences, hbox14, "hbox14");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label52, "label52");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_auto_hide_minutes, "tr_auto_hide_minutes");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label53, "label53");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_auto_lock_vbox, "tr_auto_lock_vbox");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_auto_lock, "tr_auto_lock");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_auto_lock_align, "tr_auto_lock_align");
  GLADE_HOOKUP_OBJECT (dialog_preferences, hbox15, "hbox15");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label54, "label54");
  GLADE_HOOKUP_OBJECT (dialog_preferences, tr_auto_lock_minutes, "tr_auto_lock_minutes");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label55, "label55");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label49, "label49");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label48, "label48");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox19, "vbox19");
  GLADE_HOOKUP_OBJECT (dialog_preferences, frame15, "frame15");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox20, "vbox20");
  GLADE_HOOKUP_OBJECT (dialog_preferences, startup_category, "startup_category");
  GLADE_HOOKUP_OBJECT (dialog_preferences, startup_category_combo, "startup_category_combo");
  GLADE_HOOKUP_OBJECT (dialog_preferences, startup_search, "startup_search");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label57, "label57");
  GLADE_HOOKUP_OBJECT (dialog_preferences, frame19, "frame19");
  GLADE_HOOKUP_OBJECT (dialog_preferences, dblclick_action_combo, "dblclick_action_combo");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label75, "label75");
  GLADE_HOOKUP_OBJECT (dialog_preferences, frame18, "frame18");
  GLADE_HOOKUP_OBJECT (dialog_preferences, vbox24, "vbox24");
  GLADE_HOOKUP_OBJECT (dialog_preferences, copy_target_combo, "copy_target_combo");
  GLADE_HOOKUP_OBJECT (dialog_preferences, clear_target, "clear_target");
  GLADE_HOOKUP_OBJECT (dialog_preferences, clear_target_seconds, "clear_target_seconds");
  GLADE_HOOKUP_OBJECT (dialog_preferences, clear_target_seconds_align, "clear_target_seconds_align");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label72, "label72");
  GLADE_HOOKUP_OBJECT (dialog_preferences, label56, "label56");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog_preferences, dialog_action_area9, "dialog_action_area9");
  GLADE_HOOKUP_OBJECT (dialog_preferences, cancelbutton2, "cancelbutton2");
  GLADE_HOOKUP_OBJECT (dialog_preferences, okbutton2, "okbutton2");

  return dialog_preferences;
}

GtkWidget*
create_context_menu (void)
{
  GtkWidget *context_menu;
  GtkWidget *copy_password1;
  GtkWidget *image798;
  GtkWidget *copy_username1;
  GtkWidget *image799;
  GtkWidget *copy_both2;
  GtkWidget *image800;
  GtkWidget *odd__lova__2;
  GtkWidget *add_item2;
  GtkWidget *image801;
  GtkWidget *edit_item2;
  GtkWidget *image802;
  GtkWidget *clone_item2;
  GtkWidget *image803;
  GtkWidget *delete_item1;
  GtkWidget *image804;

  context_menu = gtk_menu_new ();

  copy_password1 = gtk_image_menu_item_new_with_mnemonic (_("Copy _Password"));
  gtk_widget_show (copy_password1);
  gtk_container_add (GTK_CONTAINER (context_menu), copy_password1);

  image798 = gtk_image_new_from_icon_name ("gtk-copy", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image798);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (copy_password1), image798);

  copy_username1 = gtk_image_menu_item_new_with_mnemonic (_("Copy _Username"));
  gtk_widget_show (copy_username1);
  gtk_container_add (GTK_CONTAINER (context_menu), copy_username1);

  image799 = gtk_image_new_from_icon_name ("gtk-copy", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image799);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (copy_username1), image799);

  copy_both2 = gtk_image_menu_item_new_with_mnemonic (_("Copy _Both"));
  gtk_widget_show (copy_both2);
  gtk_container_add (GTK_CONTAINER (context_menu), copy_both2);

  image800 = gtk_image_new_from_icon_name ("gtk-copy", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image800);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (copy_both2), image800);

  odd__lova__2 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__2);
  gtk_container_add (GTK_CONTAINER (context_menu), odd__lova__2);
  gtk_widget_set_sensitive (odd__lova__2, FALSE);

  add_item2 = gtk_image_menu_item_new_with_mnemonic (_("_Add Item"));
  gtk_widget_show (add_item2);
  gtk_container_add (GTK_CONTAINER (context_menu), add_item2);

  image801 = gtk_image_new_from_icon_name ("gtk-new", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image801);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_item2), image801);

  edit_item2 = gtk_image_menu_item_new_with_mnemonic (_("_Edit Item"));
  gtk_widget_show (edit_item2);
  gtk_container_add (GTK_CONTAINER (context_menu), edit_item2);

  image802 = gtk_image_new_from_icon_name ("gtk-edit", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image802);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (edit_item2), image802);

  clone_item2 = gtk_image_menu_item_new_with_mnemonic (_("_Clone Item"));
  gtk_widget_show (clone_item2);
  gtk_container_add (GTK_CONTAINER (context_menu), clone_item2);

  image803 = gtk_image_new_from_icon_name ("gtk-copy", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image803);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (clone_item2), image803);

  delete_item1 = gtk_image_menu_item_new_with_mnemonic (_("_Delete Item"));
  gtk_widget_show (delete_item1);
  gtk_container_add (GTK_CONTAINER (context_menu), delete_item1);

  image804 = gtk_image_new_from_icon_name ("gtk-delete", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image804);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (delete_item1), image804);

  g_signal_connect ((gpointer) copy_password1, "activate",
                    G_CALLBACK (on_copy_pass_activate),
                    NULL);
  g_signal_connect ((gpointer) copy_username1, "activate",
                    G_CALLBACK (on_copy_user_activate),
                    NULL);
  g_signal_connect ((gpointer) copy_both2, "activate",
                    G_CALLBACK (on_copy_both1_activate),
                    NULL);
  g_signal_connect ((gpointer) add_item2, "activate",
                    G_CALLBACK (on_add_item1_activate),
                    NULL);
  g_signal_connect ((gpointer) edit_item2, "activate",
                    G_CALLBACK (on_edit_item1_activate),
                    NULL);
  g_signal_connect ((gpointer) clone_item2, "activate",
                    G_CALLBACK (on_clone_item1_activate),
                    NULL);
  g_signal_connect ((gpointer) delete_item1, "activate",
                    G_CALLBACK (on_item_delete_activate),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (context_menu, context_menu, "context_menu");
  GLADE_HOOKUP_OBJECT (context_menu, copy_password1, "copy_password1");
  GLADE_HOOKUP_OBJECT (context_menu, image798, "image798");
  GLADE_HOOKUP_OBJECT (context_menu, copy_username1, "copy_username1");
  GLADE_HOOKUP_OBJECT (context_menu, image799, "image799");
  GLADE_HOOKUP_OBJECT (context_menu, copy_both2, "copy_both2");
  GLADE_HOOKUP_OBJECT (context_menu, image800, "image800");
  GLADE_HOOKUP_OBJECT (context_menu, add_item2, "add_item2");
  GLADE_HOOKUP_OBJECT (context_menu, image801, "image801");
  GLADE_HOOKUP_OBJECT (context_menu, edit_item2, "edit_item2");
  GLADE_HOOKUP_OBJECT (context_menu, image802, "image802");
  GLADE_HOOKUP_OBJECT (context_menu, clone_item2, "clone_item2");
  GLADE_HOOKUP_OBJECT (context_menu, image803, "image803");
  GLADE_HOOKUP_OBJECT (context_menu, delete_item1, "delete_item1");
  GLADE_HOOKUP_OBJECT (context_menu, image804, "image804");

  return context_menu;
}

GtkWidget*
create_window_entropy (void)
{
  GtkWidget *window_entropy;
  GtkWidget *frame_entropy;
  GtkWidget *label47;

  window_entropy = gtk_window_new (GTK_WINDOW_POPUP);
  gtk_widget_set_size_request (window_entropy, -1, 75);
  gtk_window_set_title (GTK_WINDOW (window_entropy), _("Generate Entropy"));
  gtk_window_set_position (GTK_WINDOW (window_entropy), GTK_WIN_POS_CENTER_ALWAYS);
  gtk_window_set_default_size (GTK_WINDOW (window_entropy), 400, 75);
  gtk_window_set_resizable (GTK_WINDOW (window_entropy), FALSE);
  gtk_window_set_destroy_with_parent (GTK_WINDOW (window_entropy), TRUE);
  gtk_window_set_decorated (GTK_WINDOW (window_entropy), FALSE);
  gtk_window_set_skip_taskbar_hint (GTK_WINDOW (window_entropy), TRUE);
  gtk_window_set_skip_pager_hint (GTK_WINDOW (window_entropy), TRUE);
  gtk_window_set_type_hint (GTK_WINDOW (window_entropy), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);

  frame_entropy = gtk_frame_new (NULL);
  gtk_widget_show (frame_entropy);
  gtk_container_add (GTK_CONTAINER (window_entropy), frame_entropy);
  gtk_container_set_border_width (GTK_CONTAINER (frame_entropy), 10);

  label47 = gtk_label_new (_("<b>Please move your mouse to collect entropy</b>"));
  gtk_widget_show (label47);
  gtk_container_add (GTK_CONTAINER (frame_entropy), label47);
  gtk_label_set_use_markup (GTK_LABEL (label47), TRUE);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window_entropy, window_entropy, "window_entropy");
  GLADE_HOOKUP_OBJECT (window_entropy, frame_entropy, "frame_entropy");
  GLADE_HOOKUP_OBJECT (window_entropy, label47, "label47");

  return window_entropy;
}

GtkWidget*
create_tray_menu (void)
{
  GtkWidget *tray_menu;
  GtkWidget *show1;
  GtkWidget *image419;
  GtkWidget *lock1;
  GtkWidget *image420;
  GtkWidget *unlock1;
  GtkWidget *image421;
  GtkWidget *tr_about1;
  GtkWidget *odd__lova__3;
  GtkWidget *tr_exit1;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  tray_menu = gtk_menu_new ();

  show1 = gtk_image_menu_item_new_with_mnemonic (_("_Show / Hide"));
  gtk_widget_show (show1);
  gtk_container_add (GTK_CONTAINER (tray_menu), show1);

  image419 = gtk_image_new_from_icon_name ("gtk-refresh", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image419);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (show1), image419);

  lock1 = gtk_image_menu_item_new_with_mnemonic (_("_Lock"));
  gtk_widget_show (lock1);
  gtk_container_add (GTK_CONTAINER (tray_menu), lock1);

  image420 = gtk_image_new_from_icon_name ("gtk-dialog-authentication", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image420);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (lock1), image420);

  unlock1 = gtk_image_menu_item_new_with_mnemonic (_("_Unlock"));
  gtk_widget_show (unlock1);
  gtk_container_add (GTK_CONTAINER (tray_menu), unlock1);

  image421 = gtk_image_new_from_icon_name ("gtk-dialog-authentication", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image421);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (unlock1), image421);

  tr_about1 = gtk_image_menu_item_new_from_stock ("gtk-about", accel_group);
  gtk_widget_show (tr_about1);
  gtk_container_add (GTK_CONTAINER (tray_menu), tr_about1);

  odd__lova__3 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__3);
  gtk_container_add (GTK_CONTAINER (tray_menu), odd__lova__3);
  gtk_widget_set_sensitive (odd__lova__3, FALSE);

  tr_exit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
  gtk_widget_show (tr_exit1);
  gtk_container_add (GTK_CONTAINER (tray_menu), tr_exit1);

  g_signal_connect ((gpointer) show1, "activate",
                    G_CALLBACK (on_show1_activate),
                    NULL);
  g_signal_connect ((gpointer) lock1, "activate",
                    G_CALLBACK (on_lock1_activate),
                    NULL);
  g_signal_connect ((gpointer) unlock1, "activate",
                    G_CALLBACK (on_unlock1_activate),
                    NULL);
  g_signal_connect ((gpointer) tr_about1, "activate",
                    G_CALLBACK (on_about1_activate),
                    NULL);
  g_signal_connect ((gpointer) tr_exit1, "activate",
                    G_CALLBACK (on_exit1_activate),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (tray_menu, tray_menu, "tray_menu");
  GLADE_HOOKUP_OBJECT (tray_menu, show1, "show1");
  GLADE_HOOKUP_OBJECT (tray_menu, image419, "image419");
  GLADE_HOOKUP_OBJECT (tray_menu, lock1, "lock1");
  GLADE_HOOKUP_OBJECT (tray_menu, image420, "image420");
  GLADE_HOOKUP_OBJECT (tray_menu, unlock1, "unlock1");
  GLADE_HOOKUP_OBJECT (tray_menu, image421, "image421");
  GLADE_HOOKUP_OBJECT (tray_menu, tr_about1, "tr_about1");
  GLADE_HOOKUP_OBJECT (tray_menu, tr_exit1, "tr_exit1");

  gtk_menu_set_accel_group (GTK_MENU (tray_menu), accel_group);

  return tray_menu;
}

GtkWidget*
create_toolbar_menu (void)
{
  GtkWidget *toolbar_menu;
  GSList *icons_and_text1_group = NULL;
  GtkWidget *icons_and_text1;
  GtkWidget *icons_only1;
  GtkWidget *text_only1;
  GtkWidget *odd__lova__4;
  GtkWidget *hide_toolbar1;
  GtkWidget *image441;

  toolbar_menu = gtk_menu_new ();

  icons_and_text1 = gtk_radio_menu_item_new_with_mnemonic (icons_and_text1_group, _("Icons and Text"));
  icons_and_text1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (icons_and_text1));
  gtk_widget_show (icons_and_text1);
  gtk_container_add (GTK_CONTAINER (toolbar_menu), icons_and_text1);
  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (icons_and_text1), TRUE);

  icons_only1 = gtk_radio_menu_item_new_with_mnemonic (icons_and_text1_group, _("Icons Only"));
  icons_and_text1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (icons_only1));
  gtk_widget_show (icons_only1);
  gtk_container_add (GTK_CONTAINER (toolbar_menu), icons_only1);

  text_only1 = gtk_radio_menu_item_new_with_mnemonic (icons_and_text1_group, _("Text Only"));
  icons_and_text1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (text_only1));
  gtk_widget_show (text_only1);
  gtk_container_add (GTK_CONTAINER (toolbar_menu), text_only1);

  odd__lova__4 = gtk_separator_menu_item_new ();
  gtk_widget_show (odd__lova__4);
  gtk_container_add (GTK_CONTAINER (toolbar_menu), odd__lova__4);
  gtk_widget_set_sensitive (odd__lova__4, FALSE);

  hide_toolbar1 = gtk_image_menu_item_new_with_mnemonic (_("Hide toolbar"));
  gtk_widget_show (hide_toolbar1);
  gtk_container_add (GTK_CONTAINER (toolbar_menu), hide_toolbar1);

  image441 = gtk_image_new_from_icon_name ("gtk-cancel", GTK_ICON_SIZE_MENU);
  gtk_widget_show (image441);
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (hide_toolbar1), image441);

  g_signal_connect ((gpointer) hide_toolbar1, "activate",
                    G_CALLBACK (on_hide_toolbar1_activate),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (toolbar_menu, toolbar_menu, "toolbar_menu");
  GLADE_HOOKUP_OBJECT (toolbar_menu, icons_and_text1, "icons_and_text1");
  GLADE_HOOKUP_OBJECT (toolbar_menu, icons_only1, "icons_only1");
  GLADE_HOOKUP_OBJECT (toolbar_menu, text_only1, "text_only1");
  GLADE_HOOKUP_OBJECT (toolbar_menu, hide_toolbar1, "hide_toolbar1");
  GLADE_HOOKUP_OBJECT (toolbar_menu, image441, "image441");

  return toolbar_menu;
}

