calvados/disk_sector_viewer_popup.c
2017-03-13 23:04:47 -05:00

125 lines
3.5 KiB
C

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "calvados.h"
/*
*
* disk_sector_viewer_popup()
*
* Disk Sector Viewer Popup dialog
*
*/
void disk_sector_viewer_popup()
{
GtkWidget *dialog_window;
GtkWidget *vbox;
GtkWidget *openDiskButton;
GtkWidget *openVolumeButton;
GtkWidget *openArchiveButton;
GtkWidget *cancelButton;
/* --- Create a dialog window --- */
dialog_window = gtk_dialog_new();
/* --- Trap the destroy button --- */
gtk_signal_connect(GTK_OBJECT(dialog_window), "destroy",
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
&dialog_window);
/* --- Add a title to the window --- */
/*gtk_window_set_title(GTK_WINDOW(dialog_window), "Disk sector viewer");*/
gtk_window_set_title(GTK_WINDOW(dialog_window), " ");
/* --- Create a small border --- */
gtk_container_border_width(GTK_CONTAINER(dialog_window), 5);
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_window)->vbox), vbox, TRUE, TRUE, 0);
gtk_widget_show(vbox);
/*
* --- "open disk" button
*/
/* --- Create the "open disk" button --- */
openDiskButton = gtk_button_new_with_label("Open disk image file");
/* --- Need to close the window if they press "ok" --- */
gtk_signal_connect(GTK_OBJECT(openDiskButton), "clicked",
GTK_SIGNAL_FUNC(close_dialog),
dialog_window);
/* --- Add the button to the dialog --- */
gtk_box_pack_start(GTK_BOX(vbox), openDiskButton, TRUE, TRUE, 0);
/* --- Make the button visible --- */
gtk_widget_show(openDiskButton);
/*
* --- "open volume" button
*/
/* --- Create the "open volume" button --- */
openVolumeButton = gtk_button_new_with_label("Open logical or physical volume");
/* --- Need to close the window if they press "ok" --- */
gtk_signal_connect(GTK_OBJECT(openVolumeButton), "clicked",
GTK_SIGNAL_FUNC(close_dialog),
dialog_window);
/* --- Add the button to the dialog --- */
gtk_box_pack_start(GTK_BOX(vbox), openVolumeButton, TRUE, TRUE, 0);
/* --- Make the button visible --- */
gtk_widget_show(openVolumeButton);
/*
* --- "open archive" button
*/
/* --- Create the "open archive" button --- */
openArchiveButton = gtk_button_new_with_label("Open current archive");
/* --- Need to close the window if they press "ok" --- */
gtk_signal_connect(GTK_OBJECT(openArchiveButton), "clicked",
GTK_SIGNAL_FUNC(close_dialog),
dialog_window);
/* --- Add the button to the dialog --- */
gtk_box_pack_start(GTK_BOX(vbox), openArchiveButton, TRUE, TRUE, 0);
/* --- Make the button visible --- */
gtk_widget_show(openArchiveButton);
/*
* --- "cancel" button
*/
/* --- Create the "cancel" button --- */
cancelButton = gtk_button_new_with_label("Cancel");
/* --- Need to close the window if they press "ok" --- */
gtk_signal_connect(GTK_OBJECT(cancelButton), "clicked",
GTK_SIGNAL_FUNC(close_dialog),
dialog_window);
/* --- Allow it to be the default button --- */
GTK_WIDGET_SET_FLAGS(cancelButton, GTK_CAN_DEFAULT);
/* --- Add the button to the dialog --- */
gtk_box_pack_start(GTK_BOX(vbox), cancelButton, TRUE, TRUE, 0);
/* --- Make the button the default button --- */
gtk_widget_grab_default(cancelButton);
/* --- Make the button visible --- */
gtk_widget_show(cancelButton);
/* --- Make the dialog visible --- */
gtk_widget_show(dialog_window);
gtk_grab_add(dialog_window);
}