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

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

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

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

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

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

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

GtkWidget*
create_main_window (void)
{
  GtkWidget *main_window;
  GtkWidget *vbox1;
  GtkWidget *handlebox2;
  GtkWidget *menubar1;
  GtkWidget *File;
  GtkWidget *File_menu;
  GtkWidget *New;
  GtkWidget *Open;
  GtkWidget *Save;
  GtkWidget *Save_As;
  GtkWidget *separator1;
  GtkWidget *Exit;
  GtkWidget *Edit;
  GtkWidget *Edit_menu;
  GtkWidget *Cut;
  GtkWidget *Copy;
  GtkWidget *Paste;
  GtkWidget *Clear;
  GtkWidget *View;
  GtkWidget *View_menu;
  GtkWidget *Font;
  GtkWidget *Help;
  GtkWidget *Help_menu;
  GtkWidget *About;
  GtkWidget *handlebox1;
  GtkWidget *toolbar1;
  GtkWidget *button1;
  GtkWidget *button2;
  GtkWidget *button3;
  GtkWidget *scrolledwindow1;
  GtkWidget *text1;
  GtkWidget *statusbar1;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (main_window), _("Glade Text Editor"));
  gtk_window_set_default_size (GTK_WINDOW (main_window), 600, 450);

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

  handlebox2 = gtk_handle_box_new ();
  gtk_widget_show (handlebox2);
  gtk_box_pack_start (GTK_BOX (vbox1), handlebox2, FALSE, TRUE, 0);

  menubar1 = gtk_menu_bar_new ();
  gtk_widget_show (menubar1);
  gtk_container_add (GTK_CONTAINER (handlebox2), menubar1);

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

  File_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (File), File_menu);

  New = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
  gtk_widget_show (New);
  gtk_container_add (GTK_CONTAINER (File_menu), New);

  Open = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
  gtk_widget_show (Open);
  gtk_container_add (GTK_CONTAINER (File_menu), Open);

  Save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
  gtk_widget_show (Save);
  gtk_container_add (GTK_CONTAINER (File_menu), Save);

  Save_As = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group);
  gtk_widget_show (Save_As);
  gtk_container_add (GTK_CONTAINER (File_menu), Save_As);

  separator1 = gtk_menu_item_new ();
  gtk_widget_show (separator1);
  gtk_container_add (GTK_CONTAINER (File_menu), separator1);
  gtk_widget_set_sensitive (separator1, FALSE);

  Exit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
  gtk_widget_show (Exit);
  gtk_container_add (GTK_CONTAINER (File_menu), Exit);

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

  Edit_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (Edit), Edit_menu);

  Cut = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group);
  gtk_widget_show (Cut);
  gtk_container_add (GTK_CONTAINER (Edit_menu), Cut);

  Copy = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group);
  gtk_widget_show (Copy);
  gtk_container_add (GTK_CONTAINER (Edit_menu), Copy);

  Paste = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group);
  gtk_widget_show (Paste);
  gtk_container_add (GTK_CONTAINER (Edit_menu), Paste);

  Clear = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group);
  gtk_widget_show (Clear);
  gtk_container_add (GTK_CONTAINER (Edit_menu), Clear);

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

  View_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (View), View_menu);

  Font = gtk_menu_item_new_with_mnemonic (_("Change _Font..."));
  gtk_widget_show (Font);
  gtk_container_add (GTK_CONTAINER (View_menu), Font);

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

  Help_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (Help), Help_menu);

  About = gtk_menu_item_new_with_mnemonic (_("_About..."));
  gtk_widget_show (About);
  gtk_container_add (GTK_CONTAINER (Help_menu), About);

  handlebox1 = gtk_handle_box_new ();
  gtk_widget_show (handlebox1);
  gtk_box_pack_start (GTK_BOX (vbox1), handlebox1, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (handlebox1), 2);

  toolbar1 = gtk_toolbar_new ();
  gtk_widget_show (toolbar1);
  gtk_container_add (GTK_CONTAINER (handlebox1), toolbar1);
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH);

  button1 = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar1),
                                "gtk-new",
                                NULL,
                                NULL, NULL, NULL, -1);
  gtk_widget_show (button1);

  button2 = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar1),
                                "gtk-open",
                                NULL,
                                NULL, NULL, NULL, -1);
  gtk_widget_show (button2);

  button3 = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar1),
                                "gtk-save",
                                NULL,
                                NULL, NULL, NULL, -1);
  gtk_widget_show (button3);

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

  text1 = gtk_text_view_new ();
  gtk_widget_show (text1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow1), text1);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text1), GTK_WRAP_WORD);

  statusbar1 = gtk_statusbar_new ();
  gtk_widget_show (statusbar1);
  gtk_box_pack_start (GTK_BOX (vbox1), statusbar1, FALSE, TRUE, 0);

  g_signal_connect ((gpointer) main_window, "delete_event",
                    G_CALLBACK (on_main_window_delete_event),
                    NULL);
  g_signal_connect ((gpointer) New, "activate",
                    G_CALLBACK (on_New_activate),
                    NULL);
  g_signal_connect ((gpointer) Open, "activate",
                    G_CALLBACK (on_Open_activate),
                    NULL);
  g_signal_connect ((gpointer) Save, "activate",
                    G_CALLBACK (on_Save_activate),
                    NULL);
  g_signal_connect ((gpointer) Save_As, "activate",
                    G_CALLBACK (on_Save_As_activate),
                    NULL);
  g_signal_connect ((gpointer) Exit, "activate",
                    G_CALLBACK (on_Exit_activate),
                    NULL);
  g_signal_connect ((gpointer) Cut, "activate",
                    G_CALLBACK (on_Cut_activate),
                    NULL);
  g_signal_connect ((gpointer) Copy, "activate",
                    G_CALLBACK (on_Copy_activate),
                    NULL);
  g_signal_connect ((gpointer) Paste, "activate",
                    G_CALLBACK (on_Paste_activate),
                    NULL);
  g_signal_connect ((gpointer) Clear, "activate",
                    G_CALLBACK (on_Clear_activate),
                    NULL);
  g_signal_connect ((gpointer) Font, "activate",
                    G_CALLBACK (on_Font_activate),
                    NULL);
  g_signal_connect ((gpointer) About, "activate",
                    G_CALLBACK (on_About_activate),
                    NULL);
  g_signal_connect ((gpointer) button1, "clicked",
                    G_CALLBACK (on_new_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) button2, "clicked",
                    G_CALLBACK (on_open_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) button3, "clicked",
                    G_CALLBACK (on_save_button_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (main_window, main_window, "main_window");
  GLADE_HOOKUP_OBJECT (main_window, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (main_window, handlebox2, "handlebox2");
  GLADE_HOOKUP_OBJECT (main_window, menubar1, "menubar1");
  GLADE_HOOKUP_OBJECT (main_window, File, "File");
  GLADE_HOOKUP_OBJECT (main_window, File_menu, "File_menu");
  GLADE_HOOKUP_OBJECT (main_window, New, "New");
  GLADE_HOOKUP_OBJECT (main_window, Open, "Open");
  GLADE_HOOKUP_OBJECT (main_window, Save, "Save");
  GLADE_HOOKUP_OBJECT (main_window, Save_As, "Save_As");
  GLADE_HOOKUP_OBJECT (main_window, separator1, "separator1");
  GLADE_HOOKUP_OBJECT (main_window, Exit, "Exit");
  GLADE_HOOKUP_OBJECT (main_window, Edit, "Edit");
  GLADE_HOOKUP_OBJECT (main_window, Edit_menu, "Edit_menu");
  GLADE_HOOKUP_OBJECT (main_window, Cut, "Cut");
  GLADE_HOOKUP_OBJECT (main_window, Copy, "Copy");
  GLADE_HOOKUP_OBJECT (main_window, Paste, "Paste");
  GLADE_HOOKUP_OBJECT (main_window, Clear, "Clear");
  GLADE_HOOKUP_OBJECT (main_window, View, "View");
  GLADE_HOOKUP_OBJECT (main_window, View_menu, "View_menu");
  GLADE_HOOKUP_OBJECT (main_window, Font, "Font");
  GLADE_HOOKUP_OBJECT (main_window, Help, "Help");
  GLADE_HOOKUP_OBJECT (main_window, Help_menu, "Help_menu");
  GLADE_HOOKUP_OBJECT (main_window, About, "About");
  GLADE_HOOKUP_OBJECT (main_window, handlebox1, "handlebox1");
  GLADE_HOOKUP_OBJECT (main_window, toolbar1, "toolbar1");
  GLADE_HOOKUP_OBJECT (main_window, button1, "button1");
  GLADE_HOOKUP_OBJECT (main_window, button2, "button2");
  GLADE_HOOKUP_OBJECT (main_window, button3, "button3");
  GLADE_HOOKUP_OBJECT (main_window, scrolledwindow1, "scrolledwindow1");
  GLADE_HOOKUP_OBJECT (main_window, text1, "text1");
  GLADE_HOOKUP_OBJECT (main_window, statusbar1, "statusbar1");

  gtk_window_add_accel_group (GTK_WINDOW (main_window), accel_group);

  return main_window;
}

GtkWidget*
create_open_file_selection (void)
{
  GtkWidget *open_file_selection;
  GtkWidget *ok_button1;
  GtkWidget *cancel_button1;

  open_file_selection = gtk_file_selection_new (_("Open File"));
  gtk_container_set_border_width (GTK_CONTAINER (open_file_selection), 10);

  ok_button1 = GTK_FILE_SELECTION (open_file_selection)->ok_button;
  gtk_widget_show (ok_button1);
  GTK_WIDGET_SET_FLAGS (ok_button1, GTK_CAN_DEFAULT);

  cancel_button1 = GTK_FILE_SELECTION (open_file_selection)->cancel_button;
  gtk_widget_show (cancel_button1);
  GTK_WIDGET_SET_FLAGS (cancel_button1, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) open_file_selection, "delete_event",
                    G_CALLBACK (on_open_filesel_delete_event),
                    NULL);
  g_signal_connect ((gpointer) ok_button1, "clicked",
                    G_CALLBACK (on_open_filesel_ok_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) cancel_button1, "clicked",
                    G_CALLBACK (on_open_filesel_cancel_button_clicked),
                    NULL);

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

  return open_file_selection;
}

GtkWidget*
create_font_selection (void)
{
  GtkWidget *font_selection;
  GtkWidget *ok_button2;
  GtkWidget *cancel_button2;
  GtkWidget *apply_button1;
  GtkWidget *fontselection1;

  font_selection = gtk_font_selection_dialog_new (_("Select Font"));
  gtk_container_set_border_width (GTK_CONTAINER (font_selection), 4);

  ok_button2 = GTK_FONT_SELECTION_DIALOG (font_selection)->ok_button;
  gtk_widget_show (ok_button2);
  GTK_WIDGET_SET_FLAGS (ok_button2, GTK_CAN_DEFAULT);

  cancel_button2 = GTK_FONT_SELECTION_DIALOG (font_selection)->cancel_button;
  gtk_widget_show (cancel_button2);
  GTK_WIDGET_SET_FLAGS (cancel_button2, GTK_CAN_DEFAULT);

  apply_button1 = GTK_FONT_SELECTION_DIALOG (font_selection)->apply_button;
  gtk_widget_show (apply_button1);
  GTK_WIDGET_SET_FLAGS (apply_button1, GTK_CAN_DEFAULT);

  fontselection1 = GTK_FONT_SELECTION_DIALOG (font_selection)->fontsel;
  gtk_widget_show (fontselection1);
  gtk_container_set_border_width (GTK_CONTAINER (fontselection1), 4);

  g_signal_connect ((gpointer) font_selection, "delete_event",
                    G_CALLBACK (on_fontsel_delete_event),
                    NULL);
  g_signal_connect ((gpointer) ok_button2, "clicked",
                    G_CALLBACK (on_fontsel_ok_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) cancel_button2, "clicked",
                    G_CALLBACK (on_fontsel_cancel_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) apply_button1, "clicked",
                    G_CALLBACK (on_fontsel_apply_button_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (font_selection, font_selection, "font_selection");
  GLADE_HOOKUP_OBJECT_NO_REF (font_selection, ok_button2, "ok_button2");
  GLADE_HOOKUP_OBJECT_NO_REF (font_selection, cancel_button2, "cancel_button2");
  GLADE_HOOKUP_OBJECT_NO_REF (font_selection, apply_button1, "apply_button1");
  GLADE_HOOKUP_OBJECT_NO_REF (font_selection, fontselection1, "fontselection1");

  return font_selection;
}

GtkWidget*
create_about_dialog (void)
{
  GtkWidget *about_dialog;
  GtkWidget *dialog_vbox2;
  GtkWidget *label2;
  GtkWidget *dialog_action_area2;
  GtkWidget *button7;

  about_dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (about_dialog), _("About The Glade Text Editor"));

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

  label2 = gtk_label_new (_("The Glade Text Editor\n\nv 1.0\n\n(Example program for Glade)"));
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (dialog_vbox2), label2, TRUE, TRUE, 10);
  gtk_misc_set_padding (GTK_MISC (label2), 12, 0);

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

  button7 = gtk_button_new_with_mnemonic (_("  OK  "));
  gtk_widget_show (button7);
  gtk_dialog_add_action_widget (GTK_DIALOG (about_dialog), button7, 0);
  GTK_WIDGET_SET_FLAGS (button7, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) button7, "clicked",
                    G_CALLBACK (on_about_ok_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (about_dialog, about_dialog, "about_dialog");
  GLADE_HOOKUP_OBJECT_NO_REF (about_dialog, dialog_vbox2, "dialog_vbox2");
  GLADE_HOOKUP_OBJECT (about_dialog, label2, "label2");
  GLADE_HOOKUP_OBJECT_NO_REF (about_dialog, dialog_action_area2, "dialog_action_area2");
  GLADE_HOOKUP_OBJECT (about_dialog, button7, "button7");

  gtk_widget_grab_default (button7);
  return about_dialog;
}

GtkWidget*
create_save_file_selection (void)
{
  GtkWidget *save_file_selection;
  GtkWidget *ok_button3;
  GtkWidget *cancel_button3;

  save_file_selection = gtk_file_selection_new (_("Save File"));
  gtk_container_set_border_width (GTK_CONTAINER (save_file_selection), 10);

  ok_button3 = GTK_FILE_SELECTION (save_file_selection)->ok_button;
  gtk_widget_show (ok_button3);
  GTK_WIDGET_SET_FLAGS (ok_button3, GTK_CAN_DEFAULT);

  cancel_button3 = GTK_FILE_SELECTION (save_file_selection)->cancel_button;
  gtk_widget_show (cancel_button3);
  GTK_WIDGET_SET_FLAGS (cancel_button3, GTK_CAN_DEFAULT);

  g_signal_connect ((gpointer) save_file_selection, "delete_event",
                    G_CALLBACK (on_save_filesel_delete_event),
                    NULL);
  g_signal_connect ((gpointer) ok_button3, "clicked",
                    G_CALLBACK (on_save_filesel_ok_button_clicked),
                    NULL);
  g_signal_connect ((gpointer) cancel_button3, "clicked",
                    G_CALLBACK (on_save_filesel_cancel_button_clicked),
                    NULL);

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

  return save_file_selection;
}

