diff options
Diffstat (limited to 'src/tspi/gtk/interface.c')
-rw-r--r-- | src/tspi/gtk/interface.c | 299 |
1 files changed, 299 insertions, 0 deletions
diff --git a/src/tspi/gtk/interface.c b/src/tspi/gtk/interface.c new file mode 100644 index 0000000..c295beb --- /dev/null +++ b/src/tspi/gtk/interface.c @@ -0,0 +1,299 @@ + +/* + * Licensed Materials - Property of IBM + * + * trousers - An open source TCG Software Stack + * + * (C) Copyright International Business Machines Corp. 2004, 2005 + * + */ + +/* + * 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_password_dialog (struct userdata *ud, char *message) +{ + GtkWidget *dialog1; + GtkWidget *dialog_vbox1; + GtkWidget *vbox1; + GtkWidget *entry; + GtkWidget *alignment1; + GtkWidget *table2; + GtkWidget *label1; + GtkWidget *alignment2; + GtkWidget *table1; + GtkWidget *dialog_action_area1; + GtkWidget *cancelbutton1; + GtkWidget *okbutton1; + GtkTooltips *tooltips; + + tooltips = gtk_tooltips_new (); + + dialog1 = gtk_dialog_new (); + gtk_widget_set_size_request (dialog1, 300, 150); + //gtk_tooltips_set_tip (tooltips, dialog1, _("This is a box for entering dialogue"), NULL); + gtk_window_set_title (GTK_WINDOW (dialog1), _("TSS Password")); + //gtk_window_set_title (GTK_WINDOW (dialog1), message); + gtk_window_set_position (GTK_WINDOW (dialog1), GTK_WIN_POS_CENTER); + gtk_window_set_default_size (GTK_WINDOW (dialog1), 300, 150); + + dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; + gtk_widget_show (dialog_vbox1); + + vbox1 = gtk_vbox_new (TRUE, 0); + gtk_widget_show (vbox1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); + + alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_show (alignment1); + gtk_box_pack_start (GTK_BOX (vbox1), alignment1, FALSE, FALSE, 0); + + table2 = gtk_table_new (3, 3, FALSE); + gtk_widget_show (table2); + gtk_container_add (GTK_CONTAINER (alignment1), table2); + + //label1 = gtk_label_new (_("Please enter a password, or not.")); + label1 = gtk_label_new (message); + gtk_widget_show (label1); + gtk_table_attach (GTK_TABLE (table2), label1, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); + + alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_show (alignment2); + gtk_box_pack_start (GTK_BOX (vbox1), alignment2, TRUE, TRUE, 0); + + table1 = gtk_table_new (2, 3, FALSE); + gtk_widget_show (table1); + gtk_container_add (GTK_CONTAINER (alignment2), table1); + + entry = gtk_entry_new (); + gtk_widget_show (entry); + gtk_table_attach (GTK_TABLE (table1), entry, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + //gtk_tooltips_set_tip (tooltips, entry, _("This is where you enter the characters of your password, using the computer input device of your choice."), NULL); + gtk_entry_set_max_length (GTK_ENTRY (entry), 255); + gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE); + + dialog_action_area1 = GTK_DIALOG (dialog1)->action_area; + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + + cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); + gtk_widget_show (cancelbutton1); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL); + GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); + //gtk_tooltips_set_tip (tooltips, cancelbutton1, _("Depress this button in order to indicate that you would like to cancel the submitting of authorization data at this time."), NULL); + + okbutton1 = gtk_button_new_from_stock ("gtk-ok"); + gtk_widget_show (okbutton1); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK); + GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); + //gtk_tooltips_set_tip (tooltips, okbutton1, _("Depress this button in order to indicate that you have completed the entry of your authorization data."), NULL); + + /* We need to pass the window in to destroy it */ + ud->window = dialog1; + /* Here we need a pointer to the entry to grab the text out of it */ + ud->entry = entry; + + g_signal_connect ((gpointer) dialog1, "close", + G_CALLBACK (on_dialog1_close), + ud); + + g_signal_connect ((gpointer) dialog1, "destroy", + G_CALLBACK (on_inputdialog1_destroy), + ud); + + g_signal_connect ((gpointer) entry, "activate", + G_CALLBACK (enter_event), + ud); + + g_signal_connect ((gpointer) cancelbutton1, "clicked", + G_CALLBACK (on_cancelbutton1_clicked), + ud); + + g_signal_connect ((gpointer) okbutton1, "clicked", + G_CALLBACK (on_okbutton1_clicked), + ud); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1"); + GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1"); + GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (dialog1, alignment1, "alignment1"); + GLADE_HOOKUP_OBJECT (dialog1, table2, "table2"); + GLADE_HOOKUP_OBJECT (dialog1, label1, "label1"); + GLADE_HOOKUP_OBJECT (dialog1, alignment2, "alignment2"); + GLADE_HOOKUP_OBJECT (dialog1, table1, "table1"); + GLADE_HOOKUP_OBJECT (dialog1, entry, "entry"); + GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); + GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1"); + GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1"); + GLADE_HOOKUP_OBJECT_NO_REF (dialog1, tooltips, "tooltips"); + + return dialog1; +} + +GtkWidget* +create_new_password_dialog (struct userdata *ud, char *message) +{ + GtkWidget *dialog1; + GtkWidget *dialog_vbox1; + GtkWidget *vbox1; + GtkWidget *table2; + GtkWidget *label7; + GtkWidget *table1; + GtkWidget *label5; + GtkWidget *label6; + GtkWidget *entryPassword; + GtkWidget *entryConfirm; + GtkWidget *dialog_action_area1; + GtkWidget *cancelbutton2; + GtkWidget *okbutton2; + + dialog1 = gtk_dialog_new (); + gtk_widget_set_size_request (dialog1, 300, 150); + gtk_window_set_title (GTK_WINDOW (dialog1), "TSS Password"); + //gtk_window_set_title (GTK_WINDOW (dialog1), message); + + dialog_vbox1 = GTK_DIALOG (dialog1)->vbox; + gtk_widget_show (dialog_vbox1); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); + + table2 = gtk_table_new (3, 3, FALSE); + gtk_widget_show (table2); + gtk_box_pack_start (GTK_BOX (vbox1), table2, TRUE, TRUE, 0); + + //label7 = gtk_label_new (_("Please enter a new password below.")); + label7 = gtk_label_new (message); + gtk_widget_show (label7); + gtk_table_attach (GTK_TABLE (table2), label7, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); + + table1 = gtk_table_new (5, 5, FALSE); + gtk_widget_show (table1); + gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 0); + + label5 = gtk_label_new (_("Password:")); + gtk_widget_show (label5); + gtk_table_attach (GTK_TABLE (table1), label5, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5); + + label6 = gtk_label_new (_("Confirm:")); + gtk_widget_show (label6); + gtk_table_attach (GTK_TABLE (table1), label6, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); + + entryPassword = gtk_entry_new (); + gtk_widget_show (entryPassword); + gtk_table_attach (GTK_TABLE (table1), entryPassword, 3, 4, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_max_length (GTK_ENTRY (entryPassword), 255); + gtk_entry_set_visibility (GTK_ENTRY (entryPassword), FALSE); + + entryConfirm = gtk_entry_new (); + gtk_widget_show (entryConfirm); + gtk_table_attach (GTK_TABLE (table1), entryConfirm, 3, 4, 3, 4, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_max_length (GTK_ENTRY (entryConfirm), 255); + gtk_entry_set_visibility (GTK_ENTRY (entryConfirm), FALSE); + + dialog_action_area1 = GTK_DIALOG (dialog1)->action_area; + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + + cancelbutton2 = gtk_button_new_from_stock ("gtk-cancel"); + gtk_widget_show (cancelbutton2); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), 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 (dialog1), okbutton2, GTK_RESPONSE_OK); + GTK_WIDGET_SET_FLAGS (okbutton2, GTK_CAN_DEFAULT); + + /* We need to pass the window in to destroy it */ + ud->window = dialog1; + /* Here we need a pointer to the entries to grab text out of them */ + ud->entryPass = entryPassword; + ud->entryConf = entryConfirm; + + g_signal_connect ((gpointer) dialog1, "destroy", + G_CALLBACK (on_inputdialog1_destroy), + ud); + + g_signal_connect ((gpointer) entryPassword, "activate", + G_CALLBACK (on_entryPassword_activate), + ud); + g_signal_connect ((gpointer) entryConfirm, "activate", + G_CALLBACK (on_entryConfirm_activate), + ud); + g_signal_connect ((gpointer) cancelbutton2, "clicked", + G_CALLBACK (on_cancelbutton2_clicked), + ud); + g_signal_connect ((gpointer) okbutton2, "clicked", + G_CALLBACK (on_okbutton2_clicked), + ud); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1"); + GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1"); + GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (dialog1, table2, "table2"); + GLADE_HOOKUP_OBJECT (dialog1, label7, "label7"); + GLADE_HOOKUP_OBJECT (dialog1, table1, "table1"); + GLADE_HOOKUP_OBJECT (dialog1, label5, "label5"); + GLADE_HOOKUP_OBJECT (dialog1, label6, "label6"); + GLADE_HOOKUP_OBJECT (dialog1, entryPassword, "entryPassword"); + GLADE_HOOKUP_OBJECT (dialog1, entryConfirm, "entryConfirm"); + GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1"); + GLADE_HOOKUP_OBJECT (dialog1, cancelbutton2, "cancelbutton2"); + GLADE_HOOKUP_OBJECT (dialog1, okbutton2, "okbutton2"); + + return dialog1; +} + + |