From 9df8ea81d84b4095f74c8eb998b3403fccebb026 Mon Sep 17 00:00:00 2001 From: Leeland Heins Date: Tue, 18 Apr 2017 14:15:24 -0500 Subject: [PATCH] Sprint 3 update --- Makefile | 8 +- acceptfunc_add_files.c | 8 +- add_disk_image.c | 2 +- add_files.c | 10 + archive_info.c | 118 +++++++- bulk_disk_image_converter.c | 4 +- calvados.c | 65 ++++- calvados.h | 26 ++ close.c | 6 +- close_dialog.c | 8 +- closing_dialog.c | 2 +- contents.c | 17 ++ convert_to_archive_file.c | 17 ++ convert_to_disk_image.c | 17 ++ copy.c | 6 +- create_subdirectory.c | 127 +++++++++ do_2mg_edit.c | 20 ++ do_add_files.c | 2 +- do_bulk_disk_converter.c | 18 ++ do_eol_scan.c | 20 ++ do_image_converter.c | 4 +- do_open_file.c | 6 + do_volume_copier_open_file.c | 23 ++ edit_attributes.c | 133 +++++++++ edit_comment.c | 9 +- eol_scanner.c | 48 ++++ extract_files.c | 22 +- file_viewer.c | 388 +++++++++++++++++++++++--- find.c | 180 +++++++++++- help_func_volume_copier_open_volume.c | 26 ++ import_bas_from_text.c | 17 ++ import_file_from_wav.c | 17 ++ invert_selection.c | 2 + okfunc_volume_copier_open_volume.c | 23 ++ open_as_disk_image.c | 17 ++ open_file.c | 4 +- paste.c | 6 +- paste_special.c | 6 +- preferences.c | 2 +- recompress_files.c | 2 +- rename_volume.c | 178 ++++++++++++ reopen.c | 6 +- save_changes.c | 6 +- select_all.c | 6 +- select_first_sst_image.c | 2 +- select_image_convert.c | 2 +- select_volume.c | 7 - show_about.c | 2 +- show_error.c | 4 +- test.c | 128 +++++++++ twomg_properties_editor.c | 54 ++++ visit_website.c | 17 ++ volume_copier_open_file.c | 73 +++++ volume_copier_open_volume.c | 202 ++++++++++++++ 54 files changed, 2027 insertions(+), 96 deletions(-) create mode 100644 contents.c create mode 100644 convert_to_archive_file.c create mode 100644 convert_to_disk_image.c create mode 100644 create_subdirectory.c create mode 100644 do_2mg_edit.c create mode 100644 do_bulk_disk_converter.c create mode 100644 do_eol_scan.c create mode 100644 do_volume_copier_open_file.c create mode 100644 edit_attributes.c create mode 100644 eol_scanner.c create mode 100644 help_func_volume_copier_open_volume.c create mode 100644 import_bas_from_text.c create mode 100644 import_file_from_wav.c create mode 100644 okfunc_volume_copier_open_volume.c create mode 100644 open_as_disk_image.c create mode 100644 rename_volume.c create mode 100644 twomg_properties_editor.c create mode 100644 visit_website.c create mode 100644 volume_copier_open_file.c create mode 100644 volume_copier_open_volume.c diff --git a/Makefile b/Makefile index 8761e80..8b2e20f 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,13 @@ SRCS=calvados.c select_volume.c closing_dialog.c close_dialog.c show_about.c \ recompress_files.c show_error.c file_viewer.c donefunc_file_viewer.c \ help_func_file_viewer.c add_disk_image.c test.c findfunc_file_viewer.c \ bulk_disk_image_converter.c close.c save_changes.c reopen.c copy.c paste.c \ - paste_special.c find.c select_all.c invert_selection.c + paste_special.c find.c select_all.c invert_selection.c create_subdirectory.c \ + open_as_disk_image.c edit_attributes.c rename_volume.c convert_to_disk_image.c \ + convert_to_archive_file.c import_file_from_wav.c import_bas_from_text.c \ + contents.c visit_website.c volume_copier_open_volume.c volume_copier_open_file.c \ + twomg_properties_editor.c eol_scanner.c do_eol_scan.c do_2mg_edit.c \ + do_volume_copier_open_file.c okfunc_volume_copier_open_volume.c \ + help_func_volume_copier_open_volume.c do_bulk_disk_converter.c OBJS=$(SRCS:.c=.o) HEADERS=calvados.h CC=gcc diff --git a/acceptfunc_add_files.c b/acceptfunc_add_files.c index b0f4e2e..325fd73 100644 --- a/acceptfunc_add_files.c +++ b/acceptfunc_add_files.c @@ -14,10 +14,10 @@ */ void acceptfunc_add_files(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Add function goes here.\n"); + /* --- Display message --- */ + g_print("Add function goes here.\n"); - /* --- Close it. --- */ - gtk_widget_destroy(GTK_WIDGET(data)); + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); } diff --git a/add_disk_image.c b/add_disk_image.c index 08dc427..0d5d72f 100644 --- a/add_disk_image.c +++ b/add_disk_image.c @@ -17,7 +17,7 @@ void add_disk_image(GtkWidget *widget, gpointer data) GtkFileFilter *diskImagesFilt; GtkFileFilter *allFilesFilt; - g_print("add disk image goes here\n"); + /*g_print("add disk image goes here\n");*/ diskImagesFilt = gtk_file_filter_new(); gtk_file_filter_set_name(diskImagesFilt, "Disk Images"); diff --git a/add_files.c b/add_files.c index 7a2c09e..f0c5344 100644 --- a/add_files.c +++ b/add_files.c @@ -3,12 +3,22 @@ #include "calvados.h" +/* + * + * fileAttributePreservationRbCallback() + * + */ void fileAttributePreservationRbCallback(GtkWidget *widget, gpointer *data) { g_print("clicked %s\n", (char *)data); } +/* + * + * textConversionRbCallback() + * + */ void textConversionRbCallback(GtkWidget *widget, gpointer *data) { g_print("clicked %s\n", (char *)data); diff --git a/archive_info.c b/archive_info.c index 060a25f..0aade8c 100644 --- a/archive_info.c +++ b/archive_info.c @@ -1,5 +1,6 @@ #include #include +#include #include "calvados.h" @@ -7,12 +8,14 @@ #define SHK 0 #define DSK 1 +extern char *open_file_ptr; + /* * * archive_info() * */ -void archive_info() +void archive_info(GtkWidget *widget, gpointer data) { GtkWidget *dialog; GtkWidget *vbox; @@ -22,6 +25,7 @@ void archive_info() GtkWidget *archiveInfoVboxl; GtkWidget *archiveInfoVboxr; GtkWidget *filenameLabel; + GtkWidget *filenameText; GtkWidget *formatLabel; GtkWidget *recordsLabel; GtkWidget *masterVersionLabel; @@ -38,13 +42,38 @@ void archive_info() GtkWidget *diskCharacteristicsInfoVboxl; GtkWidget *diskCharacteristicsInfoVboxr; + GtkWidget *subVolumeLabel; + GtkWidget *subVolumeCombo; + GtkWidget *sectorOrderingLabel; + GtkWidget *sectorOrderingText; + GtkWidget *filesystemFormatLabel; + GtkWidget *filesystemFormatText; + GtkWidget *filesDirectoriesLabel; + GtkWidget *filesDirectoriesText; + GtkWidget *storageCapacityLabel; + GtkWidget *storageCapacityText; + GtkWidget *freeSpaceLabel; + GtkWidget *freeSpaceText; + GtkWidget *writeableFormatLabel; + GtkWidget *writeableFormatText; + GtkWidget *damagedLabel; + GtkWidget *damagedText; + GtkWidget *notesLabel; + GtkWidget *notesText; + GtkWidget *hbox2; GtkWidget *helpButton; GtkWidget *doneButton; int archive_type = 0; char dialog_title[256]; - g_print("archive info goes here\n"); + /*g_print("archive info goes here\n");*/ + + if (strstr(open_file_ptr, ".shk") == 0) { + archive_type = SHK; + } else if (strstr(open_file_ptr, ".dsk") == 0) { + archive_type = DSK; + } /* FIXME -- need to detect what type of archive we are looking at */ if (archive_type == SHK) { @@ -134,6 +163,11 @@ void archive_info() gtk_box_pack_start(GTK_BOX(fileCharacteristicsVboxl), filenameLabel, TRUE, TRUE, 0); gtk_widget_show(filenameLabel); + filenameText = gtk_label_new(""); + gtk_widget_set_size_request(filenameText, 256, 32); + gtk_box_pack_start(GTK_BOX(fileCharacteristicsVboxr), filenameText, TRUE, TRUE, 0); + gtk_widget_show(filenameText); + diskCharacteristicsFrame = gtk_frame_new("Disk Characteristics"); gtk_box_pack_start(GTK_BOX(vbox), diskCharacteristicsFrame, TRUE, TRUE, 0); gtk_widget_show(diskCharacteristicsFrame); @@ -142,6 +176,86 @@ void archive_info() gtk_container_add(GTK_CONTAINER(diskCharacteristicsFrame), diskCharacteristicsHbox); gtk_widget_show(diskCharacteristicsHbox); + diskCharacteristicsInfoVboxl = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsHbox), diskCharacteristicsInfoVboxl, TRUE, TRUE, 0); + gtk_widget_show(diskCharacteristicsInfoVboxl); + + diskCharacteristicsInfoVboxr = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsHbox), diskCharacteristicsInfoVboxr, TRUE, TRUE, 0); + gtk_widget_show(diskCharacteristicsInfoVboxr); + + subVolumeLabel = gtk_label_new("Sub-Volume:"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), subVolumeLabel, TRUE, TRUE, 0); + gtk_widget_show(subVolumeLabel); + + sectorOrderingLabel = gtk_label_new("Sector Ordering:"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), sectorOrderingLabel, TRUE, TRUE, 0); + gtk_widget_show(sectorOrderingLabel); + + filesystemFormatLabel = gtk_label_new("Filesystem Format:"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), filesystemFormatLabel, TRUE, TRUE, 0); + gtk_widget_show(filesystemFormatLabel); + + filesDirectoriesLabel = gtk_label_new("Files+Directories:"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), filesDirectoriesLabel, TRUE, TRUE, 0); + gtk_widget_show(filesDirectoriesLabel); + + storageCapacityLabel = gtk_label_new("Storage Capacity:"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), storageCapacityLabel, TRUE, TRUE, 0); + gtk_widget_show(storageCapacityLabel); + + freeSpaceLabel = gtk_label_new("Free Space:"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), freeSpaceLabel, TRUE, TRUE, 0); + gtk_widget_show(freeSpaceLabel); + + writeableFormatLabel = gtk_label_new("Writeable format?"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), writeableFormatLabel, TRUE, TRUE, 0); + gtk_widget_show(writeableFormatLabel); + + damagedLabel = gtk_label_new("Damaged?"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), damagedLabel, TRUE, TRUE, 0); + gtk_widget_show(damagedLabel); + + notesLabel = gtk_label_new("Notes:"); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxl), notesLabel, TRUE, TRUE, 0); + gtk_widget_show(notesLabel); + + subVolumeCombo = gtk_label_new(""); + gtk_widget_set_size_request(subVolumeCombo, 256, 32); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), subVolumeCombo, TRUE, TRUE, 0); + gtk_widget_show(subVolumeCombo); + + sectorOrderingText = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), sectorOrderingText, TRUE, TRUE, 0); + gtk_widget_show(sectorOrderingText); + + filesystemFormatText = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), filesystemFormatText, TRUE, TRUE, 0); + gtk_widget_show(filesystemFormatText); + + filesDirectoriesText = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), filesDirectoriesText, TRUE, TRUE, 0); + gtk_widget_show(filesDirectoriesText); + + storageCapacityText = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), storageCapacityText, TRUE, TRUE, 0); + gtk_widget_show(storageCapacityText); + + freeSpaceText = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), freeSpaceText, TRUE, TRUE, 0); + gtk_widget_show(freeSpaceText); + + writeableFormatText = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), writeableFormatText, TRUE, TRUE, 0); + gtk_widget_show(writeableFormatText); + + damagedText = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), damagedText, TRUE, TRUE, 0); + gtk_widget_show(damagedText); + + notesText = gtk_label_new(""); + gtk_box_pack_start(GTK_BOX(diskCharacteristicsInfoVboxr), notesText, TRUE, TRUE, 0); + gtk_widget_show(notesText); } hbox2 = gtk_hbox_new(FALSE, 0); diff --git a/bulk_disk_image_converter.c b/bulk_disk_image_converter.c index b1f54cd..c7a0377 100644 --- a/bulk_disk_image_converter.c +++ b/bulk_disk_image_converter.c @@ -17,7 +17,7 @@ void bulk_disk_image_converter(GtkWidget *widget, gpointer data) GtkFileFilter *diskImagesFilt; GtkFileFilter *allFilesFilt; - g_print("bulk disk image convert goes here\n"); + /*g_print("bulk disk image convert goes here\n");*/ diskImagesFilt = gtk_file_filter_new(); gtk_file_filter_set_name(diskImagesFilt, "Disk Images"); @@ -63,7 +63,7 @@ void bulk_disk_image_converter(GtkWidget *widget, gpointer data) char *filename; GtkFileChooser *chooser = GTK_FILE_CHOOSER(dialog); filename = gtk_file_chooser_get_filename(chooser); - do_open_file(filename); + do_bulk_disk_converter(filename); g_free(filename); } diff --git a/calvados.c b/calvados.c index cb90b44..710ac5c 100644 --- a/calvados.c +++ b/calvados.c @@ -35,6 +35,9 @@ GtkCellRenderer *mw_renderer; GtkTreeModel *mw_model; GtkWidget *mw_view; +/* FIXME -- this needs to be done better. */ +char open_file_name[256]; +char *open_file_ptr; /* * @@ -250,7 +253,7 @@ int main(int argc, char *argv[]) GtkWidget *volumeCopierOpenFileMi; GtkWidget *mergeSSTImagesMi; GtkWidget *toolsSep2; - GtkWidget *TwoMGPropertiesEditorMi; + GtkWidget *twoMGPropertiesEditorMi; GtkWidget *EOLScannerMi; /* Help menu widgets */ @@ -314,6 +317,8 @@ int main(int argc, char *argv[]) GtkWidget *statusbar; + open_file_ptr = (char *)open_file_name; + /* Initialise GTK+ passing to it all command line arguments */ gtk_init(&argc, &argv); @@ -322,6 +327,7 @@ int main(int argc, char *argv[]) gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(window), WINDOW_WIDTH, WINDOW_HEIGHT); gtk_window_set_title(GTK_WINDOW(window), "Calvados"); + gtk_window_set_icon_from_file(GTK_WINDOW(window), "images/calvados.png", NULL); /* Primary app vbox */ vbox = gtk_vbox_new(FALSE, 0); @@ -421,7 +427,7 @@ int main(int argc, char *argv[]) g_signal_connect(G_OBJECT(archiveInfoMi), "activate", G_CALLBACK(archive_info), (gpointer)"archiveInfoMi"); /* Hook up the print menu item to the print dialog box */ - g_signal_connect(G_OBJECT(printMi), "activate", G_CALLBACK(print_page), (gpointer)"printMi"); + g_signal_connect(G_OBJECT(printMi), "activate", G_CALLBACK(print_page), (gpointer)window); /* Edit menu bar items */ editMi = gtk_menu_item_new_with_mnemonic("_Edit"); @@ -578,7 +584,7 @@ int main(int argc, char *argv[]) volumeCopierOpenFileMi = gtk_menu_item_new_with_label("Volume Copier (open file)"); mergeSSTImagesMi = gtk_menu_item_new_with_mnemonic("_Merge SST Images"); toolsSep2 = gtk_separator_menu_item_new(); - TwoMGPropertiesEditorMi = gtk_menu_item_new_with_label("2MG Properties Editor"); + twoMGPropertiesEditorMi = gtk_menu_item_new_with_label("2MG Properties Editor"); EOLScannerMi = gtk_menu_item_new_with_label("EOL Scanner"); /* Set up tools menu */ @@ -591,7 +597,7 @@ int main(int argc, char *argv[]) gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), volumeCopierOpenFileMi); gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), mergeSSTImagesMi); gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), toolsSep2); - gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), TwoMGPropertiesEditorMi); + gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), twoMGPropertiesEditorMi); gtk_menu_shell_append(GTK_MENU_SHELL(toolsMenu), EOLScannerMi); /* Add Tools menu to menu bar */ gtk_menu_shell_append(GTK_MENU_SHELL(menubar), toolsMi); @@ -621,6 +627,12 @@ int main(int argc, char *argv[]) /* connect 'view' menu item to the file viewer dialog event */ g_signal_connect(G_OBJECT(viewMi), "activate", G_CALLBACK(file_viewer), (gpointer)"viewMi"); + /* connect 'extract' menu item to the extract dialog event */ + g_signal_connect(G_OBJECT(extractMi), "activate", G_CALLBACK(extract_files), (gpointer)"extractMi"); + + /* connect 'test' menu item to the test dialog event */ + g_signal_connect(G_OBJECT(testMi), "activate", G_CALLBACK(test), (gpointer)"testMi"); + /* connect 'disk image' menu item to the create disk image dialog event */ g_signal_connect(G_OBJECT(diskImageMi), "activate", G_CALLBACK(create_disk_image), (gpointer)"diskImageMi"); @@ -642,9 +654,42 @@ int main(int argc, char *argv[]) /* connect 'recompress' menu item to the recompress dialog event */ g_signal_connect(G_OBJECT(recompressMi), "activate", G_CALLBACK(recompress_files), (gpointer)"recompressMi"); + /* connect 'add files' menu item to the add files dialog event */ + g_signal_connect(G_OBJECT(addFilesMi), "activate", G_CALLBACK(add_files), (gpointer)"addFilesMi"); + + /* connect 'create subdirectory' menu item to the create subdirectory dialog event */ + g_signal_connect(G_OBJECT(createSubdirectoryMi), "activate", G_CALLBACK(create_subdirectory), (gpointer)"createSubdirectoryMi"); + + /* connect 'open as disk image' menu item to the open as disk image dialog event */ + g_signal_connect(G_OBJECT(openAsDiskImageMi), "activate", G_CALLBACK(open_as_disk_image), (gpointer)"openAsDiskImageMi"); + + /* connect 'Edit Attributes' menu item to the edit_attributes dialog event */ + g_signal_connect(G_OBJECT(editAttributesMi), "activate", G_CALLBACK(edit_attributes), (gpointer)"editAttributesMi"); + + /* connect 'Rename Volume' menu item to the rename_volume dialog event */ + g_signal_connect(G_OBJECT(renameVolumeMi), "activate", G_CALLBACK(rename_volume), (gpointer)"renameVolumeMi"); + + /* connect 'Convert to disk image' menu item to the convert_to_disk_image dialog event */ + g_signal_connect(G_OBJECT(convertToDiskImageMi), "activate", G_CALLBACK(convert_to_disk_image), (gpointer)"convertToDiskImageMi"); + + /* connect 'Convert to archive file' menu item to the convert_to_archive_file dialog event */ + g_signal_connect(G_OBJECT(convertToArchiveFileMi), "activate", G_CALLBACK(convert_to_archive_file), (gpointer)"convertToArchiveFileMi"); + + /* connect 'Import File from WAV menu item to the import_file_from_wav dialog event */ + g_signal_connect(G_OBJECT(importFileFromWAVMi), "activate", G_CALLBACK(import_file_from_wav), (gpointer)"importFileFromWAVMi"); + + /* connect 'Import BAS from Text menu item to the import_bas_from_text dialog event */ + g_signal_connect(G_OBJECT(importBASFromTextMi), "activate", G_CALLBACK(import_bas_from_text), (gpointer)"importBASFromTextMi"); + /* connect 'edit comment' menu item to the edit comment dialog event */ g_signal_connect(G_OBJECT(editCommentMi), "activate", G_CALLBACK(edit_comment), (gpointer)"editCommentMi"); + /* connect 'contents' menu item to the contents box event */ + g_signal_connect(G_OBJECT(contentsMi), "activate", G_CALLBACK(contents), (gpointer)"contentsMi"); + + /* connect 'contents' menu item to the contents box event */ + g_signal_connect(G_OBJECT(visitCalvadosWebsiteMi), "activate", G_CALLBACK(visit_website), (gpointer)"visitCalvadosWebsiteMi"); + /* connect 'about' menu item to the about box event */ g_signal_connect(G_OBJECT(aboutCalvadosMi), "activate", G_CALLBACK(show_about), (gpointer)"aboutCalvadosMi"); @@ -657,9 +702,21 @@ int main(int argc, char *argv[]) /* connect 'Select bulk disk image converter' menu item to the bulk disk image converter popup menu event */ g_signal_connect(G_OBJECT(bulkDiskImageConverterMi), "activate", G_CALLBACK(bulk_disk_image_converter), (gpointer)"bulkDiskImageConverterMi"); + /* connect 'Volume Copier Open Volume' menu item to the volume copier open volume popup menu event */ + g_signal_connect(G_OBJECT(volumeCopierOpenVolumeMi), "activate", G_CALLBACK(volume_copier_open_volume), (gpointer)"volumeCopierOpenVolumeMi"); + + /* connect 'Volume Copier Open File' menu item to the volume copier open file popup menu event */ + g_signal_connect(G_OBJECT(volumeCopierOpenFileMi), "activate", G_CALLBACK(volume_copier_open_file), (gpointer)"volumeCopierOpenFileMi"); + /* connect 'Merge SST Images' menu item to the merge sst images popup menu event */ g_signal_connect(G_OBJECT(mergeSSTImagesMi), "activate", G_CALLBACK(select_first_sst_image), (gpointer)"mergeSSTImagesMi"); + /* connect '2MG Properties Editor' menu item to the 2MG properties editor popup menu event */ + g_signal_connect(G_OBJECT(twoMGPropertiesEditorMi), "activate", G_CALLBACK(twomg_properties_editor), (gpointer)"twoMGPropertiesEditorMi"); + + /* connect 'EOL Scanner' menu item to the eol scanner popup menu event */ + g_signal_connect(G_OBJECT(EOLScannerMi), "activate", G_CALLBACK(eol_scanner), (gpointer)"EOLScannerMi"); + /* Connect 'quit' menu item to the window's "destroy" event */ g_signal_connect(G_OBJECT(quitMi), "activate", G_CALLBACK(gtk_main_quit), (gpointer)"quitMi"); diff --git a/calvados.h b/calvados.h index 6b32963..c7db382 100644 --- a/calvados.h +++ b/calvados.h @@ -12,6 +12,12 @@ #define LIST_WIDTH 1280 #define LIST_HEIGHT 705 +enum { + COL_VOLUME_OR_DEVICE_NAME = 0, + COL_REMARK, + NUM_SELECT_VOLUME_COLS +}; + /* Prototypes */ void close_dialog(GtkWidget *widget, gpointer data); void closing_dialog(GtkWidget *widget, gpointer data); @@ -66,4 +72,24 @@ void paste_special(GtkWidget *widget, gpointer data); void find(GtkWidget *widget, gpointer data); void select_all(GtkWidget *widget, gpointer data); void invert_selection(GtkWidget *widget, gpointer data); +void create_subdirectory(GtkWidget *widget, gpointer data); +void open_as_disk_image(GtkWidget *widget, gpointer data); +void edit_attributes(GtkWidget *widget, gpointer data); +void rename_volume(GtkWidget *widget, gpointer data); +void convert_to_disk_image(GtkWidget *widget, gpointer data); +void convert_to_archive_file(GtkWidget *widget, gpointer data); +void import_file_from_wav(GtkWidget *widget, gpointer data); +void import_bas_from_text(GtkWidget *widget, gpointer data); +void contents(GtkWidget *widget, gpointer data); +void visit_website(GtkWidget *widget, gpointer data); +void volume_copier_open_volume(GtkWidget *widget, gpointer data); +void volume_copier_open_file(GtkWidget *widget, gpointer data); +void twomg_properties_editor(GtkWidget *widget, gpointer data); +void eol_scanner(GtkWidget *widget, gpointer data); +void do_eol_scan(char *filename); +void do_2mg_edit(char *filename); +void do_volume_copier_open_file(char *filename); +void okfunc_volume_copier_open_volume(GtkWidget *widget, gpointer data); +void help_func_volume_copier_open_volume(GtkWidget *widget, gpointer data); +void do_bulk_disk_converter(char *filename); diff --git a/close.c b/close.c index 90a716b..8346d3f 100644 --- a/close.c +++ b/close.c @@ -1,5 +1,7 @@ #include +#include "calvados.h" + /* * * close_menu_item() @@ -9,7 +11,7 @@ */ void close_menu_item(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Close function goes here.\n"); + /* --- Display message --- */ + g_print("Close function goes here.\n"); } diff --git a/close_dialog.c b/close_dialog.c index fb14012..6753fb5 100644 --- a/close_dialog.c +++ b/close_dialog.c @@ -10,10 +10,10 @@ */ void close_dialog(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - /*g_print("Cancel function goes here.\n");*/ + /* --- Display message --- */ + /*g_print("Cancel function goes here.\n");*/ - /* --- Close it. --- */ - gtk_widget_destroy(GTK_WIDGET(data)); + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); } diff --git a/closing_dialog.c b/closing_dialog.c index ceb40e9..8c2f0ff 100644 --- a/closing_dialog.c +++ b/closing_dialog.c @@ -11,6 +11,6 @@ */ void closing_dialog(GtkWidget *widget, gpointer data) { - gtk_grab_remove(GTK_WIDGET(widget)); + gtk_grab_remove(GTK_WIDGET(widget)); } diff --git a/contents.c b/contents.c new file mode 100644 index 0000000..ae391ab --- /dev/null +++ b/contents.c @@ -0,0 +1,17 @@ +#include + +#include "calvados.h" + +/* + * + * contents() + * + * contents Volume from the menu. + * + */ +void contents(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("contents function goes here.\n"); +} + diff --git a/convert_to_archive_file.c b/convert_to_archive_file.c new file mode 100644 index 0000000..9bce468 --- /dev/null +++ b/convert_to_archive_file.c @@ -0,0 +1,17 @@ +#include + +#include "calvados.h" + +/* + * + * convert_to_archive_file() + * + * convert_to_archive_file Volume from the menu. + * + */ +void convert_to_archive_file(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("convert_to_archive_file function goes here.\n"); +} + diff --git a/convert_to_disk_image.c b/convert_to_disk_image.c new file mode 100644 index 0000000..15ff740 --- /dev/null +++ b/convert_to_disk_image.c @@ -0,0 +1,17 @@ +#include + +#include "calvados.h" + +/* + * + * convert_to_disk_image() + * + * convert_to_disk_image Volume from the menu. + * + */ +void convert_to_disk_image(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("convert_to_disk_image function goes here.\n"); +} + diff --git a/copy.c b/copy.c index 80fa731..48953e1 100644 --- a/copy.c +++ b/copy.c @@ -1,5 +1,7 @@ #include +#include "calvados.h" + /* * * copy_menu_item() @@ -9,7 +11,7 @@ */ void copy_menu_item(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Copy function goes here.\n"); + /* --- Display message --- */ + g_print("Copy function goes here.\n"); } diff --git a/create_subdirectory.c b/create_subdirectory.c new file mode 100644 index 0000000..7e20ddf --- /dev/null +++ b/create_subdirectory.c @@ -0,0 +1,127 @@ +#include + +#include "calvados.h" + +/* + * + * create_subdirectory() + * + */ +void create_subdirectory(GtkWidget *widget, gpointer data) +{ + GtkWidget *dialog; + GtkWidget *parentDirectoryLabel; + GtkWidget *parentDirectoryEntry; + GtkWidget *newSubdirectoryNameLabel; + GtkWidget *newSubdirectoryNameEntry; + /*GtkWidget *hbox1;*/ + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *help_button; + + /*g_print("Rename file goes here.\n");*/ + + /*g_print("data=%s\n", (char *)data);*/ + + /* --- Create the dialog --- */ + dialog = gtk_dialog_new(); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog), "Create Subdirectory"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog), 5); + + /*hbox1 = gtk_hbox_new(FALSE, 0); + gtk_widget_show(hbox1);*/ + + parentDirectoryLabel = gtk_label_new("Parent directory: "); + gtk_widget_show(parentDirectoryLabel); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), parentDirectoryLabel, TRUE, TRUE, 0); + + parentDirectoryEntry = gtk_entry_new(); + gtk_widget_show(parentDirectoryEntry); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), parentDirectoryEntry, TRUE, TRUE, 0); + + newSubdirectoryNameLabel = gtk_label_new("New subdirectory name: "); + gtk_widget_show(newSubdirectoryNameLabel); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), newSubdirectoryNameLabel, TRUE, TRUE, 0); + + newSubdirectoryNameEntry = gtk_entry_new(); + gtk_widget_show(newSubdirectoryNameEntry); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), newSubdirectoryNameEntry, TRUE, TRUE, 0); + + /* FIXME -- need to add path separator widgets here */ + + /* + * --- OK button + */ + + /* --- Create the "OK" button --- */ + ok_button = gtk_button_new_with_label("OK"); + + gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", + GTK_SIGNAL_FUNC(okfunc_select_volume), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); + + /* --- Add the OK button to the bottom hbox2 --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), ok_button, TRUE, TRUE, 0); + + /* --- Make the "OK" the default --- */ + gtk_widget_grab_default(ok_button); + + /* --- Make the button visible --- */ + gtk_widget_show(ok_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* + * --- Help button + */ + + /* --- Create the "Help" button --- */ + help_button = gtk_button_new_with_label("Help"); + + gtk_signal_connect(GTK_OBJECT(help_button), "clicked", + GTK_SIGNAL_FUNC(help_func_select_volume), + dialog); + + /* --- Add the "Help" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), help_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(help_button); + + /* --- Show the dialog --- */ + gtk_widget_show(dialog); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog); +} + diff --git a/do_2mg_edit.c b/do_2mg_edit.c new file mode 100644 index 0000000..509b101 --- /dev/null +++ b/do_2mg_edit.c @@ -0,0 +1,20 @@ +#include +#include +#include + +#include "calvados.h" + +/* + * + * do_2mg_edit() + * + * Edit a 2mg disk image + * + */ +void do_2mg_edit(char *filename) +{ + /* --- Display message --- */ + g_print("2mg edit function goes here.\n"); + g_print("filename=%s\n", filename); +} + diff --git a/do_add_files.c b/do_add_files.c index 2059247..b990314 100644 --- a/do_add_files.c +++ b/do_add_files.c @@ -12,6 +12,6 @@ */ void do_add_files(char *filename) { - g_print("Do add files goes here.\n"); + g_print("Do add files goes here.\n"); } diff --git a/do_bulk_disk_converter.c b/do_bulk_disk_converter.c new file mode 100644 index 0000000..ef3d995 --- /dev/null +++ b/do_bulk_disk_converter.c @@ -0,0 +1,18 @@ +#include +#include + +#include "calvados.h" + +/* + * + * do_bulk_disk_converter() + * + * Convert an image. + * + */ +void do_bulk_disk_converter(char *filename) +{ + /* --- Display message --- */ + g_print("bulk_disk_converter function goes here.\n"); +} + diff --git a/do_eol_scan.c b/do_eol_scan.c new file mode 100644 index 0000000..85acf26 --- /dev/null +++ b/do_eol_scan.c @@ -0,0 +1,20 @@ +#include +#include +#include + +#include "calvados.h" + +/* + * + * do_eol_scan() + * + * eol scan a file. + * + */ +void do_eol_scan(char *filename) +{ + /* --- Display message --- */ + g_print("eol scan function goes here.\n"); + g_print("filename=%s\n", filename); +} + diff --git a/do_image_converter.c b/do_image_converter.c index f2d838d..6dc63a0 100644 --- a/do_image_converter.c +++ b/do_image_converter.c @@ -12,7 +12,7 @@ */ void do_image_converter(char *filename) { - /* --- Display message --- */ - g_print("Image converter function goes here.\n"); + /* --- Display message --- */ + g_print("Image converter function goes here.\n"); } diff --git a/do_open_file.c b/do_open_file.c index d7b3bfc..c47c4a5 100644 --- a/do_open_file.c +++ b/do_open_file.c @@ -1,8 +1,11 @@ #include #include +#include #include "calvados.h" +extern char *open_file_ptr; + /* * * do_open_file() @@ -14,5 +17,8 @@ void do_open_file(char *filename) { /* --- Display message --- */ g_print("Open file function goes here.\n"); + g_print("filename=%s\n", filename); + + strcpy(open_file_ptr, filename); } diff --git a/do_volume_copier_open_file.c b/do_volume_copier_open_file.c new file mode 100644 index 0000000..f5afc9b --- /dev/null +++ b/do_volume_copier_open_file.c @@ -0,0 +1,23 @@ +#include +#include +#include + +#include "calvados.h" + +extern char *open_file_ptr; + +/* + * + * do_volume_copier_open_file() + * + * Volume copier (open file). + * + */ +void do_volume_copier_open_file(char *filename) +{ + /* --- Display message --- */ + g_print("Volume copier (open file) function goes here.\n"); + + g_print("filename=%s\n", filename); +} + diff --git a/edit_attributes.c b/edit_attributes.c new file mode 100644 index 0000000..ae317ab --- /dev/null +++ b/edit_attributes.c @@ -0,0 +1,133 @@ +#include + +#include "calvados.h" + +/* + * + * edit_attributes() + * + * Edit Attributes from the menu. + * + */ +void edit_attributes(GtkWidget *widget, gpointer data) +{ + GtkWidget *dialog; + GtkWidget *hbox1; + GtkWidget *vbox1l; + GtkWidget *vbox1r; + GtkWidget *hbox2; + GtkWidget *hbox3; + GtkWidget *vbox2; + GtkWidget *hbox4; + GtkWidget *hbox5; + GtkWidget *pathnameLabel; + GtkWidget *pathnameEntry; + GtkWidget *creationDateLabel; + GtkWidget *creationDateEntry; + GtkWidget *modificationDateLabel; + GtkWidget *modificationDateEntry; + GtkWidget *fileTypeLabel; + GtkWidget *fileTypeCombo; + GtkWidget *hfsTypeCb; + GtkWidget *hfsTypeEntry; + GtkWidget *auxTypeLabel; + GtkWidget *auxTypeEntry; + GtkWidget *creatorLabel; + GtkWidget *creatorEntry; + GtkWidget *typeDescriptorLabel; + GtkWidget *typeDescriptorEntry; + GtkWidget *accessLabel; + GtkWidget *readCb; + GtkWidget *backupCb; + GtkWidget *invisibleCb; + GtkWidget *writeCb; + GtkWidget *renameCb; + GtkWidget *deleteCb; + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *help_button; + + /* --- Display message --- */ + /*g_print("edit_attributes function goes here.\n");*/ + + /* --- Create the dialog --- */ + dialog = gtk_dialog_new(); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog), "Edit Comment"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog), 5); + + /* + * --- OK button + */ + + /* --- Create the "OK" button --- */ + ok_button = gtk_button_new_with_label("OK"); + + gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", + GTK_SIGNAL_FUNC(okfunc_select_volume), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); + + /* --- Add the OK button to the bottom hbox2 --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), ok_button, TRUE, TRUE, 0); + + /* --- Make the "OK" the default --- */ + gtk_widget_grab_default(ok_button); + + /* --- Make the button visible --- */ + gtk_widget_show(ok_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* + * --- Help button + */ + + /* --- Create the "Help" button --- */ + help_button = gtk_button_new_with_label("Help"); + + gtk_signal_connect(GTK_OBJECT(help_button), "clicked", + GTK_SIGNAL_FUNC(help_func_select_volume), + dialog); + + /* --- Add the "Help" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), help_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(help_button); + + /* --- Show the dialog --- */ + gtk_widget_show(dialog); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog); +} + diff --git a/edit_comment.c b/edit_comment.c index 8291eb3..098f0c8 100644 --- a/edit_comment.c +++ b/edit_comment.c @@ -12,11 +12,13 @@ void edit_comment(GtkWidget *widget, gpointer data) { GtkWidget *dialog; + GtkTextBuffer *commentText; + GtkTextView *commentView; GtkWidget *ok_button; GtkWidget *cancel_button; GtkWidget *help_button; - g_print("edit comment goes here\n"); + /*g_print("edit comment goes here\n");*/ /* --- Create the dialog --- */ dialog = gtk_dialog_new(); @@ -32,6 +34,11 @@ void edit_comment(GtkWidget *widget, gpointer data) /* --- Add a small border --- */ gtk_container_border_width(GTK_CONTAINER(dialog), 5); + commentView = gtk_text_view_new(); + gtk_widget_set_size_request(commentView, 320, 256); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), commentView, TRUE, TRUE, 0); + gtk_widget_show(commentView); + /* * --- OK button */ diff --git a/eol_scanner.c b/eol_scanner.c new file mode 100644 index 0000000..2b8aaff --- /dev/null +++ b/eol_scanner.c @@ -0,0 +1,48 @@ +#include +#include + +#include "calvados.h" + +/* + * + * eol_scanner() + * + * eol_scanner Volume from the menu. + * + */ +void eol_scanner(GtkWidget *widget, gpointer data) +{ + GtkWidget *dialog; + gint res; + GtkFileFilter *allFilesFilt; + + /* --- Display message --- */ + /*g_print("eol_scanner function goes here.\n");*/ + + allFilesFilt = gtk_file_filter_new(); + gtk_file_filter_set_name(allFilesFilt, "All Files"); + gtk_file_filter_add_pattern(allFilesFilt, "*"); + + dialog = gtk_file_chooser_dialog_new("Select file to scan", + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, + GTK_RESPONSE_ACCEPT, + NULL); + + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), allFilesFilt); + + res = gtk_dialog_run(GTK_DIALOG(dialog)); + if (res == GTK_RESPONSE_ACCEPT) { + char *filename; + GtkFileChooser *chooser = GTK_FILE_CHOOSER(dialog); + filename = gtk_file_chooser_get_filename(chooser); + do_eol_scan(filename); + g_free(filename); + } + + gtk_widget_destroy(dialog); +} + diff --git a/extract_files.c b/extract_files.c index 66ba0a4..938e173 100644 --- a/extract_files.c +++ b/extract_files.c @@ -21,12 +21,22 @@ GtkWidget *addTypeExtensionCb; /* FIXME -- need to add a callback to the folder chooser to un-grey extract selected files radio button when there are selections */ +/* + * + * filesToExtractRbCallback() + * + */ void filesToExtractRbCallback(GtkWidget *widget, gpointer *data) { g_print("clicked %s\n", (char *)data); } +/* + * + * textConversionRbCallback2() + * + */ void textConversionRbCallback2(GtkWidget *widget, gpointer *data) { /*g_print("clicked %s\n", (char *)data);*/ @@ -39,6 +49,11 @@ void textConversionRbCallback2(GtkWidget *widget, gpointer *data) } +/* + * + * configureToPreserveAppleIIFormatsCallback() + * + */ void configureToPreserveAppleIIFormatsCallback(GtkWidget *widget, gpointer *data) { g_print("clicked %s\n", (char *)data); @@ -57,6 +72,11 @@ void configureToPreserveAppleIIFormatsCallback(GtkWidget *widget, gpointer *data } +/* + * + * configureForEasyAccessInLinuxCallback() + * + */ void configureForEasyAccessInLinuxCallback(GtkWidget *widget, gpointer *data) { g_print("clicked %s\n", (char *)data); @@ -126,7 +146,7 @@ void extract_files() homedir = pw->pw_dir; } - g_print("homedir=%s", homedir); + /*g_print("homedir=%s", homedir);*/ /* --- Create the dialog --- */ dialog = gtk_dialog_new(); diff --git a/file_viewer.c b/file_viewer.c index 911b385..856f296 100644 --- a/file_viewer.c +++ b/file_viewer.c @@ -2,6 +2,95 @@ #include "calvados.h" + +/* + * + * dataForkRbCallback() + * + */ +void dataForkRbCallback(GtkWidget *widget, gpointer *data) +{ + g_print("clicked %s\n", (char *)data); +} + + +/* + * + * resourceForkRbCallback() + * + */ +void resourceForkRbCallback(GtkWidget *widget, gpointer *data) +{ + g_print("clicked %s\n", (char *)data); +} + + +/* + * + * commentRbCallback() + * + */ +void commentRbCallback(GtkWidget *widget, gpointer *data) +{ + g_print("clicked %s\n", (char *)data); +} + + +/* + * + * view_next() + * + */ +void view_next() +{ + g_print("view_next func goes here\n"); +} + + +/* + * + * view_prev() + * + */ +void view_prev() +{ + g_print("view_prev func goes here\n"); +} + + +/* + * + * best() + * + */ +void best_func() +{ + g_print("Best func goes here\n"); +} + + +/* + * + * hex() + * + */ +void hex_func() +{ + g_print("Hex func goes here\n"); +} + + +/* + * + * raw() + * + */ +void raw_func() +{ + g_print("Raw func goes here\n"); +} + + /* * * file_viewer() @@ -15,22 +104,31 @@ void file_viewer(GtkWidget *widget, gpointer data) GtkWidget *scrolled_window; GtkWidget *table; GtkWidget *hbox1; + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *vbox3; + GtkWidget *vbox4; + GtkWidget *hbox2; + GtkWidget *hbox3; + GtkWidget *hbox4; + GSList *forkRbGroup = NULL; GtkWidget *dataForkRb; GtkWidget *resourceForkRb; GtkWidget *commentRb; + GList *fileComboItems = NULL; GtkWidget *fileCombo; GtkWidget *next_button; GtkWidget *prev_button; GtkWidget *best_button; + GtkWidget *hex_button; GtkWidget *raw_button; GtkWidget *find_button; - GtkWidget *hbox2; GtkWidget *print_button; GtkWidget *font_button; GtkWidget *done_button; GtkWidget *help_button; - g_print("File viewer dialog box goes here\n"); + /*g_print("File viewer dialog box goes here\n");*/ /* --- Create the dialog --- */ dialog = gtk_dialog_new(); @@ -50,6 +148,8 @@ void file_viewer(GtkWidget *widget, gpointer data) /* create a new scrolled window. */ scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_widget_set_size_request(scrolled_window, 512, 256); + gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 10); /* the policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. @@ -79,10 +179,241 @@ void file_viewer(GtkWidget *widget, gpointer data) gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), hbox1, TRUE, TRUE, 0); gtk_widget_show(hbox1); - hbox2 = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox1), hbox2, TRUE, TRUE, 0); - gtk_widget_show(hbox2); + vbox1 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox1), vbox1, TRUE, TRUE, 0); + gtk_widget_show(vbox1); + vbox2 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox1), vbox2, TRUE, TRUE, 0); + gtk_widget_show(vbox2); + + dataForkRb = create_radio(vbox1, &forkRbGroup, "Data fork"); + resourceForkRb = create_radio(vbox1, &forkRbGroup, "Resource fork"); + commentRb = create_radio(vbox1, &forkRbGroup, "Comment"); + + /* Set default selected item */ + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(dataForkRb), TRUE); + + /* Default grey out resource fork radio button */ + gtk_widget_set_sensitive(resourceForkRb, FALSE); + + /* Default grey out comment radio button */ + gtk_widget_set_sensitive(commentRb, FALSE); + + /* Set up callbacks for radio buttons */ + gtk_signal_connect(GTK_OBJECT(dataForkRb), "clicked", GTK_SIGNAL_FUNC(dataForkRbCallback), (gpointer)"dataForkRb"); + gtk_signal_connect(GTK_OBJECT(resourceForkRb), "clicked", GTK_SIGNAL_FUNC(resourceForkRbCallback), (gpointer)"resourceForkRb"); + gtk_signal_connect(GTK_OBJECT(commentRb), "clicked", GTK_SIGNAL_FUNC(commentRbCallback), (gpointer)"commentRb"); + + /* + * --- Next button + */ + + /* --- Create the "Next" button --- */ + next_button = gtk_button_new_with_label("Next"); + + gtk_signal_connect(GTK_OBJECT(next_button), "clicked", + GTK_SIGNAL_FUNC(view_next), + dialog); + + /* --- Allow "Next" to be a default --- */ + GTK_WIDGET_SET_FLAGS(next_button, GTK_CAN_DEFAULT); + + /* --- Add the Next button to the bottom right --- */ + gtk_box_pack_start(GTK_BOX(vbox2), next_button, TRUE, TRUE, 0); + + /* --- Make the "Next" the default --- */ + gtk_widget_grab_default(next_button); + + /* --- Make the button visible --- */ + gtk_widget_show(next_button); + + /* + * --- Prev button + */ + + /* --- Create the "Prev" button --- */ + prev_button = gtk_button_new_with_label("Prev"); + + gtk_signal_connect(GTK_OBJECT(prev_button), "clicked", + GTK_SIGNAL_FUNC(view_prev), + dialog); + + /* --- Allow "Prev" to be a default --- */ + GTK_WIDGET_SET_FLAGS(prev_button, GTK_CAN_DEFAULT); + + /* --- Add the Prev button to the bottom right --- */ + gtk_box_pack_start(GTK_BOX(vbox2), prev_button, TRUE, TRUE, 0); + + /* --- Make the "Prev" the default --- */ + gtk_widget_grab_default(prev_button); + + /* --- Make the button visible --- */ + gtk_widget_show(prev_button); + + vbox3 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox1), vbox3, TRUE, TRUE, 0); + gtk_widget_show(vbox3); + + vbox4 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox1), vbox4, TRUE, TRUE, 0); + gtk_widget_show(vbox4); + + /* + * --- Create a list of the items first + */ + fileComboItems = g_list_append(fileComboItems, "Converted Text"); + fileComboItems = g_list_append(fileComboItems, "Raw"); + fileComboItems = g_list_append(fileComboItems, "Hex Dump"); + fileComboItems = g_list_append(fileComboItems, "//e monitor listing"); + fileComboItems = g_list_append(fileComboItems, "IIgs monitor listing (long regs)"); + + /* --- Make a combo box. --- */ + fileCombo = gtk_combo_new(); + + /* --- Create the drop down portion of the combo --- */ + gtk_combo_set_popdown_strings(GTK_COMBO(fileCombo), fileComboItems); + + /* --- Default the text in the field to a value --- */ + gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(fileCombo)->entry), "Converted Text"); + + /* --- Make the edit portion non-editable. They can pick a + * value from the drop down, they just can't end up with + * a value that's not in the drop down. + */ + gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fileCombo)->entry), FALSE); + + gtk_box_pack_start(GTK_BOX(vbox3), fileCombo, TRUE, TRUE, 0); + + gtk_widget_show(fileCombo); + + hbox2 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox3), hbox2, TRUE, TRUE, 0); + gtk_widget_show(hbox2); + + hbox3 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox4), hbox3, TRUE, TRUE, 0); + gtk_widget_show(hbox3); + + hbox4 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox4), hbox4, TRUE, TRUE, 0); + gtk_widget_show(hbox4); + + /* + * --- Best button + */ + + /* --- Create the "Best" button --- */ + best_button = gtk_button_new_with_label("Best"); + + gtk_signal_connect(GTK_OBJECT(best_button), "clicked", + GTK_SIGNAL_FUNC(best_func), + dialog); + + /* --- Allow "Best" to be a default --- */ + GTK_WIDGET_SET_FLAGS(best_button, GTK_CAN_DEFAULT); + + /* --- Add the Best button to the bottom right --- */ + gtk_box_pack_start(GTK_BOX(hbox2), best_button, TRUE, TRUE, 0); + + /* --- Make the "Best" the default --- */ + gtk_widget_grab_default(best_button); + + /* --- Make the button visible --- */ + gtk_widget_show(best_button); + + /* + * --- Hex button + */ + + /* --- Create the "Hex" button --- */ + hex_button = gtk_button_new_with_label("Hex"); + + gtk_signal_connect(GTK_OBJECT(hex_button), "clicked", + GTK_SIGNAL_FUNC(hex_func), + dialog); + + /* --- Allow "Hex" to be a default --- */ + GTK_WIDGET_SET_FLAGS(hex_button, GTK_CAN_DEFAULT); + + /* --- Add the Hex button to the bottom right --- */ + gtk_box_pack_start(GTK_BOX(hbox2), hex_button, TRUE, TRUE, 0); + + /* --- Make the "Hex" the default --- */ + gtk_widget_grab_default(hex_button); + + /* --- Make the button visible --- */ + gtk_widget_show(hex_button); + + /* + * --- Raw button + */ + + /* --- Create the "Raw" button --- */ + raw_button = gtk_button_new_with_label("Raw"); + + gtk_signal_connect(GTK_OBJECT(raw_button), "clicked", + GTK_SIGNAL_FUNC(raw_func), + dialog); + + /* --- Allow "Raw" to be a default --- */ + GTK_WIDGET_SET_FLAGS(raw_button, GTK_CAN_DEFAULT); + + /* --- Add the Raw button to the bottom right --- */ + gtk_box_pack_start(GTK_BOX(hbox2), raw_button, TRUE, TRUE, 0); + + /* --- Make the "Raw" the default --- */ + gtk_widget_grab_default(raw_button); + + /* --- Make the button visible --- */ + gtk_widget_show(raw_button); + + /* + * --- Find button + */ + + /* --- Create the "Find" button --- */ + find_button = gtk_button_new_with_label("Find"); + + gtk_signal_connect(GTK_OBJECT(find_button), "clicked", + GTK_SIGNAL_FUNC(findfunc_file_viewer), + dialog); + + /* --- Allow "Find" to be a default --- */ + GTK_WIDGET_SET_FLAGS(find_button, GTK_CAN_DEFAULT); + + /* --- Add the Find button to the bottom right --- */ + gtk_box_pack_start(GTK_BOX(hbox3), find_button, TRUE, TRUE, 0); + + /* --- Make the "Find" the default --- */ + gtk_widget_grab_default(find_button); + + /* --- Make the button visible --- */ + gtk_widget_show(find_button); + + /* + * --- Font button + */ + + /* --- Create the "Font" button --- */ + font_button = gtk_button_new_with_label("Font"); + + gtk_signal_connect(GTK_OBJECT(font_button), "clicked", + GTK_SIGNAL_FUNC(donefunc_file_viewer), + dialog); + + /* --- Allow "Font" to be a default --- */ + GTK_WIDGET_SET_FLAGS(font_button, GTK_CAN_DEFAULT); + + /* --- Add the Font button to the bottom right --- */ + gtk_box_pack_start(GTK_BOX(hbox3), font_button, TRUE, TRUE, 0); + + /* --- Make the "Font" the default --- */ + gtk_widget_grab_default(font_button); + + /* --- Make the button visible --- */ + gtk_widget_show(font_button); + /* * --- Done button */ @@ -98,7 +429,7 @@ void file_viewer(GtkWidget *widget, gpointer data) GTK_WIDGET_SET_FLAGS(done_button, GTK_CAN_DEFAULT); /* --- Add the Done button to the bottom right --- */ - gtk_box_pack_start(GTK_BOX(hbox2), done_button, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox3), done_button, TRUE, TRUE, 0); /* --- Make the "Done" the default --- */ gtk_widget_grab_default(done_button); @@ -107,50 +438,27 @@ void file_viewer(GtkWidget *widget, gpointer data) gtk_widget_show(done_button); /* - * --- Font button + * --- Print button */ - /* --- Create the "Font" button --- */ - font_button = gtk_button_new_with_label("Font"); + /* --- Create the "Print" button --- */ + print_button = gtk_button_new_with_label("Print"); - gtk_signal_connect(GTK_OBJECT(done_button), "clicked", + gtk_signal_connect(GTK_OBJECT(print_button), "clicked", GTK_SIGNAL_FUNC(donefunc_file_viewer), dialog); - /* --- Allow "Font" to be a default --- */ - GTK_WIDGET_SET_FLAGS(font_button, GTK_CAN_DEFAULT); + /* --- Allow "Print" to be a default --- */ + GTK_WIDGET_SET_FLAGS(print_button, GTK_CAN_DEFAULT); /* --- Add the Font button to the bottom right --- */ - gtk_box_pack_start(GTK_BOX(hbox2), font_button, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox4), print_button, TRUE, TRUE, 0); - /* --- Make the "Font" the default --- */ - gtk_widget_grab_default(font_button); + /* --- Make the "Print" the default --- */ + gtk_widget_grab_default(print_button); /* --- Make the button visible --- */ - gtk_widget_show(font_button); - - /* - * --- Find button - */ - - /* --- Create the "Find" button --- */ - find_button = gtk_button_new_with_label("Find"); - - gtk_signal_connect(GTK_OBJECT(done_button), "clicked", - GTK_SIGNAL_FUNC(findfunc_file_viewer), - dialog); - - /* --- Allow "Font" to be a default --- */ - GTK_WIDGET_SET_FLAGS(find_button, GTK_CAN_DEFAULT); - - /* --- Add the Font button to the bottom right --- */ - gtk_box_pack_start(GTK_BOX(hbox2), find_button, TRUE, TRUE, 0); - - /* --- Make the "Find" the default --- */ - gtk_widget_grab_default(find_button); - - /* --- Make the button visible --- */ - gtk_widget_show(find_button); + gtk_widget_show(print_button); /* * --- Help button @@ -164,7 +472,7 @@ void file_viewer(GtkWidget *widget, gpointer data) dialog); /* --- Add the "Help" button to the dialog --- */ - gtk_box_pack_start(GTK_BOX(hbox2), done_button, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox4), help_button, TRUE, TRUE, 0); /* --- Make the button visible. --- */ gtk_widget_show(help_button); diff --git a/find.c b/find.c index 29dd71b..6683ec2 100644 --- a/find.c +++ b/find.c @@ -1,4 +1,43 @@ #include +#include + +#include "calvados.h" + +/* + * + * upRbCallback() + * + */ +void upRbCallback(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("clicked %s\n", (char *)data); +} + + +/* + * + * downRbCallback() + * + */ +void downRbCallback(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("clicked %s\n", (char *)data); +} + + +/* + * + * find_next() + * + */ +void find_next(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("Find Next function goes here.\n"); +} + /* * @@ -9,7 +48,144 @@ */ void find(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Find function goes here.\n"); + GtkWidget *dialog; + GtkWidget *hbox1; + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *vbox3; + GtkWidget *vbox4; + GtkWidget *hbox2; + GtkWidget *hbox3; + GtkWidget *findWhatLabel; + GtkWidget *findWhatEntry; + GtkWidget *matchWholeWordOnlyCb; + GtkWidget *matchCaseCb; + GtkWidget *directionFrame; + GSList *directionRbGroup = NULL; + GtkWidget *upRb; + GtkWidget *downRb; + GtkWidget *find_next_button; + GtkWidget *cancel_button; + + /* --- Display message --- */ + /*g_print("Find function goes here.\n");*/ + + /* --- Create the dialog --- */ + dialog = gtk_dialog_new(); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog), "Find"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog), 5); + + hbox1 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox1, TRUE, TRUE, 0); + gtk_widget_show(hbox1); + + vbox1 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox1), vbox1, TRUE, TRUE, 0); + gtk_widget_show(vbox1); + + hbox2 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox1), hbox2, TRUE, TRUE, 0); + gtk_widget_show(hbox2); + + findWhatLabel = gtk_label_new("Find What: "); + gtk_misc_set_alignment(GTK_MISC(findWhatLabel), 0, 0.5); + gtk_box_pack_start(GTK_BOX(hbox2), findWhatLabel, TRUE, TRUE, 0); + gtk_widget_show(findWhatLabel); + + findWhatEntry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox2), findWhatEntry, TRUE, TRUE, 0); + gtk_widget_show(findWhatEntry); + + hbox3 = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox1), hbox3, TRUE, TRUE, 0); + gtk_widget_show(hbox3); + + vbox2 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox3), vbox2, TRUE, TRUE, 0); + gtk_widget_show(vbox2); + + matchWholeWordOnlyCb = gtk_check_button_new_with_label("Match Whole Word Only"); + gtk_box_pack_start(GTK_BOX(vbox2), matchWholeWordOnlyCb, TRUE, TRUE, 0); + gtk_widget_show(matchWholeWordOnlyCb); + + matchCaseCb = gtk_check_button_new_with_label("Match Cased Only"); + gtk_box_pack_start(GTK_BOX(vbox2), matchCaseCb, TRUE, TRUE, 0); + gtk_widget_show(matchCaseCb); + + directionFrame = gtk_frame_new("Direction"); + gtk_box_pack_start(GTK_BOX(hbox3), directionFrame, TRUE, TRUE, 0); + gtk_widget_show(directionFrame); + + vbox3 = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(directionFrame), vbox3); + gtk_widget_show(vbox3); + + upRb = create_radio(vbox3, &directionRbGroup, "Up"); + downRb = create_radio(vbox3, &directionRbGroup, "Down"); + + gtk_signal_connect(GTK_OBJECT(upRb), "clicked", GTK_SIGNAL_FUNC(upRbCallback), (gpointer)"upRb"); + gtk_signal_connect(GTK_OBJECT(downRb), "clicked", GTK_SIGNAL_FUNC(downRbCallback), (gpointer)"downRb"); + + vbox4 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox1), vbox4, TRUE, TRUE, 0); + gtk_widget_show(vbox4); + + /* + * --- Find Next button + */ + + /* --- Create the "Find Next" button --- */ + find_next_button = gtk_button_new_with_label("Find Next"); + + gtk_signal_connect(GTK_OBJECT(find_next_button), "clicked", + GTK_SIGNAL_FUNC(find_next), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(find_next_button, GTK_CAN_DEFAULT); + + /* --- Add the Find Next button to the bottom hbox2 --- */ + gtk_box_pack_start(GTK_BOX(vbox4), find_next_button, TRUE, TRUE, 0); + + /* --- Make the "Find Next" the default --- */ + gtk_widget_grab_default(find_next_button); + + /* --- Make the button visible --- */ + gtk_widget_show(find_next_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(vbox4), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* --- Show the dialog --- */ + gtk_widget_show(dialog); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog); } diff --git a/help_func_volume_copier_open_volume.c b/help_func_volume_copier_open_volume.c new file mode 100644 index 0000000..e29c790 --- /dev/null +++ b/help_func_volume_copier_open_volume.c @@ -0,0 +1,26 @@ +#include +#include + +#include "calvados.h" + +/* + * + * help_func_volume_copier_open_volume() + * + * Help Function for volume copier open volume + * + * Show that the "Help" button was pressed + * + */ +void help_func_volume_copier_open_volume(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("Help function for volume copier open volume goes here.\n"); + + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); + + /* Now open the help dialog */ +/*FIXME*/ +} + diff --git a/import_bas_from_text.c b/import_bas_from_text.c new file mode 100644 index 0000000..645f469 --- /dev/null +++ b/import_bas_from_text.c @@ -0,0 +1,17 @@ +#include + +#include "calvados.h" + +/* + * + * import_bas_from_text() + * + * import_bas_from_text Volume from the menu. + * + */ +void import_bas_from_text(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("import_bas_from_text function goes here.\n"); +} + diff --git a/import_file_from_wav.c b/import_file_from_wav.c new file mode 100644 index 0000000..5e36b2b --- /dev/null +++ b/import_file_from_wav.c @@ -0,0 +1,17 @@ +#include + +#include "calvados.h" + +/* + * + * import_file_from_wav() + * + * import_file_from_wav Volume from the menu. + * + */ +void import_file_from_wav(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("import_file_from_wav function goes here.\n"); +} + diff --git a/invert_selection.c b/invert_selection.c index 7e2e546..6417584 100644 --- a/invert_selection.c +++ b/invert_selection.c @@ -1,5 +1,7 @@ #include +#include "calvados.h" + /* * * invert_selection() diff --git a/okfunc_volume_copier_open_volume.c b/okfunc_volume_copier_open_volume.c new file mode 100644 index 0000000..fa5ff8c --- /dev/null +++ b/okfunc_volume_copier_open_volume.c @@ -0,0 +1,23 @@ +#include +#include + +#include "calvados.h" + +/* + * + * okfunc_volume_copier_open_volume() + * + * OK Function for volume copier open volume + * + * Show that the "OK" button was pressed + * + */ +void okfunc_volume_copier_open_volume(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("Volume copier select volume function goes here.\n"); + + /* --- Close it. --- */ + gtk_widget_destroy(GTK_WIDGET(data)); +} + diff --git a/open_as_disk_image.c b/open_as_disk_image.c new file mode 100644 index 0000000..45d81f0 --- /dev/null +++ b/open_as_disk_image.c @@ -0,0 +1,17 @@ +#include + +#include "calvados.h" + +/* + * + * open_as_disk_image() + * + * Open as Disk Image from the menu. + * + */ +void open_as_disk_image(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("open_as_disk_image function goes here.\n"); +} + diff --git a/open_file.c b/open_file.c index 8e7b1bf..c80406f 100644 --- a/open_file.c +++ b/open_file.c @@ -46,9 +46,9 @@ void open_file() diskImagesFilt = gtk_file_filter_new(); gtk_file_filter_set_name(diskImagesFilt, "Disk Images"); - gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ss][Hh][Kk]"); - gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ss][Dd][Kk]"); gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd][Ss][Kk]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ss][Dd][Kk]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ss][Hh][Kk]"); gtk_file_filter_add_pattern(diskImagesFilt, "*.[Pp][Oo]"); gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd][Oo]"); gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd]13"); diff --git a/paste.c b/paste.c index 2203c2e..d0237f7 100644 --- a/paste.c +++ b/paste.c @@ -1,5 +1,7 @@ #include +#include "calvados.h" + /* * * paste() @@ -9,7 +11,7 @@ */ void paste(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Paste function goes here.\n"); + /* --- Display message --- */ + g_print("Paste function goes here.\n"); } diff --git a/paste_special.c b/paste_special.c index 1846c4a..0db2153 100644 --- a/paste_special.c +++ b/paste_special.c @@ -1,5 +1,7 @@ #include +#include "calvados.h" + /* * * paste_special() @@ -9,7 +11,7 @@ */ void paste_special(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Paste Special function goes here.\n"); + /* --- Display message --- */ + g_print("Paste Special function goes here.\n"); } diff --git a/preferences.c b/preferences.c index 30613e1..36d0f39 100644 --- a/preferences.c +++ b/preferences.c @@ -52,7 +52,7 @@ static void page_switch(GtkWidget *widget, GtkNotebookPage *page, gint page_num) { - g_print("page switch\n"); + g_print("page switch\n"); } diff --git a/recompress_files.c b/recompress_files.c index b238430..7046a56 100644 --- a/recompress_files.c +++ b/recompress_files.c @@ -13,7 +13,7 @@ void recompress_files(GtkWidget *widget, gpointer data) GtkWidget *ok_button; GtkWidget *cancel_button; - g_print("recompress files goes here\n"); + /*g_print("recompress files goes here\n");*/ /* --- Create the dialog --- */ dialog = gtk_dialog_new(); diff --git a/rename_volume.c b/rename_volume.c new file mode 100644 index 0000000..27afee3 --- /dev/null +++ b/rename_volume.c @@ -0,0 +1,178 @@ +#include + +#include "calvados.h" + +/* + * + * rename_volume() + * + * rename_volume Volume from the menu. + * + */ +void rename_volume(GtkWidget *widget, gpointer data) +{ + GtkWidget *dialog; + GtkWidget *selectVolumeLabel; + /*GtkWidget *selectVolumeEntry;*/ + GtkListStore *store; + /*GtkTreeIter iter;*/ + GtkCellRenderer *renderer; + GtkTreeModel *model; + GtkWidget *view; + GtkWidget *newNameLabel; + GtkWidget *newNameEntry; + /*GtkWidget *hbox1;*/ + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *help_button; + + /* --- Display message --- */ + /*g_print("rename_volume function goes here.\n");*/ + + /* --- Create the dialog --- */ + dialog = gtk_dialog_new(); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog), "Rename volume"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog), 5); + + /*hbox1 = gtk_hbox_new(FALSE, 0); + gtk_widget_show(hbox1);*/ + selectVolumeLabel = gtk_label_new("Select a volume to rename: "); + + gtk_widget_show(selectVolumeLabel); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), selectVolumeLabel, TRUE, TRUE, 0); + + /*selectVolumeEntry = gtk_entry_new(); + gtk_widget_show(selectVolumeEntry); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), selectVolumeEntry, TRUE, TRUE, 0);*/ + + store = gtk_list_store_new(NUM_SELECT_VOLUME_COLS, G_TYPE_STRING, G_TYPE_UINT); + +/*FIXME*/ + /* This needs to be in a loop reading from somewhere */ + /* Append a row and fill in some data */ + /*gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, + COL_VOLUME_OR_DEVICE_NAME, "", + COL_REMARK, "", + -1);*/ + + view = gtk_tree_view_new(); + gtk_widget_set_size_request(view, 320, 256); + + /* --- Column #1 --- */ + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), + -1, + "Volume or Device Name", + renderer, + "text", COL_VOLUME_OR_DEVICE_NAME, + NULL); + + /* --- Column #2 --- */ + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), + -1, + "Remarks", + renderer, + "text", COL_REMARK, + NULL); + + model = GTK_TREE_MODEL(store); + + gtk_tree_view_set_model(GTK_TREE_VIEW(view), model); + + /* The tree view has acquired its own reference to the + * model, so we can drop ours. That way the model will + * be freed automatically when the tree view is destroyed */ + g_object_unref(model); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), view, TRUE, TRUE, 0); + + gtk_widget_show(view); + + newNameLabel = gtk_label_new("New name: "); + gtk_widget_show(newNameLabel); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), newNameLabel, TRUE, TRUE, 0); + + newNameEntry = gtk_entry_new(); + gtk_widget_show(newNameEntry); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), newNameEntry, TRUE, TRUE, 0); + + /* FIXME -- need to add path separator widgets here */ + + /* + * --- OK button + */ + + /* --- Create the "OK" button --- */ + ok_button = gtk_button_new_with_label("OK"); + + gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", + GTK_SIGNAL_FUNC(okfunc_select_volume), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); + + /* --- Add the OK button to the bottom hbox2 --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), ok_button, TRUE, TRUE, 0); + + /* --- Make the "OK" the default --- */ + gtk_widget_grab_default(ok_button); + + /* --- Make the button visible --- */ + gtk_widget_show(ok_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* + * --- Help button + */ + + /* --- Create the "Help" button --- */ + help_button = gtk_button_new_with_label("Help"); + + gtk_signal_connect(GTK_OBJECT(help_button), "clicked", + GTK_SIGNAL_FUNC(help_func_select_volume), + dialog); + + /* --- Add the "Help" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), help_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(help_button); + + /* --- Show the dialog --- */ + gtk_widget_show(dialog); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog); +} + diff --git a/reopen.c b/reopen.c index 3edfc91..075fbcf 100644 --- a/reopen.c +++ b/reopen.c @@ -1,5 +1,7 @@ #include +#include "calvados.h" + /* * * reopen_menu_item() @@ -9,7 +11,7 @@ */ void reopen_menu_item(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Reopen function goes here.\n"); + /* --- Display message --- */ + g_print("Reopen function goes here.\n"); } diff --git a/save_changes.c b/save_changes.c index 75941be..4b6209b 100644 --- a/save_changes.c +++ b/save_changes.c @@ -1,5 +1,7 @@ #include +#include "calvados.h" + /* * * save_changes() @@ -9,7 +11,7 @@ */ void save_changes(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Save Changes function goes here.\n"); + /* --- Display message --- */ + g_print("Save Changes function goes here.\n"); } diff --git a/select_all.c b/select_all.c index 2653289..156702b 100644 --- a/select_all.c +++ b/select_all.c @@ -1,5 +1,7 @@ #include +#include "calvados.h" + /* * * select_all() @@ -9,7 +11,7 @@ */ void select_all(GtkWidget *widget, gpointer data) { - /* --- Display message --- */ - g_print("Select All function goes here.\n"); + /* --- Display message --- */ + g_print("Select All function goes here.\n"); } diff --git a/select_first_sst_image.c b/select_first_sst_image.c index 216880b..c954aae 100644 --- a/select_first_sst_image.c +++ b/select_first_sst_image.c @@ -15,7 +15,7 @@ void select_first_sst_image(GtkWidget *widget, gpointer data) GtkFileFilter *diskImagesFilt; GtkFileFilter *allFilesFilt; - g_print("Select first sst image goes here\n"); + /*g_print("Select first sst image goes here\n");*/ diskImagesFilt = gtk_file_filter_new(); diff --git a/select_image_convert.c b/select_image_convert.c index 5aa7238..68d7f8d 100644 --- a/select_image_convert.c +++ b/select_image_convert.c @@ -15,7 +15,7 @@ void select_image_convert(GtkWidget *widget, gpointer data) GtkFileFilter *diskImagesFilt; GtkFileFilter *allFilesFilt; - g_print("Select image convert goes here\n"); + /*g_print("Select image convert goes here\n");*/ diskImagesFilt = gtk_file_filter_new(); gtk_file_filter_set_name(diskImagesFilt, "Disk Images"); diff --git a/select_volume.c b/select_volume.c index 19bae99..64d318a 100644 --- a/select_volume.c +++ b/select_volume.c @@ -3,13 +3,6 @@ #include "calvados.h" -enum { - COL_VOLUME_OR_DEVICE_NAME = 0, - COL_REMARK, - NUM_SELECT_VOLUME_COLS -}; - - /* * * select_volume() diff --git a/show_about.c b/show_about.c index 2a5a942..ac02d93 100644 --- a/show_about.c +++ b/show_about.c @@ -14,7 +14,7 @@ void show_about(GtkWidget *widget, gpointer data) GtkWidget *dialog = gtk_about_dialog_new(); gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), "Calvados"); - gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), "0.2"); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), "0.3"); gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),"(c) 2017 Leeland Heins"); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), "Calvados is intended to be a work-alike of CiderPress for Linux."); diff --git a/show_error.c b/show_error.c index 3e42684..4ec2ede 100644 --- a/show_error.c +++ b/show_error.c @@ -9,7 +9,7 @@ * Show an error message dialog box * */ -void show_error(GtkWidget *widget, gpointer data, char *message) +void show_error(GtkWidget *widget, gpointer data, char *errmsg) { GtkWidget *dialog; @@ -19,7 +19,7 @@ void show_error(GtkWidget *widget, gpointer data, char *message) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - message); + errmsg); gtk_window_set_title(GTK_WINDOW(dialog), "Error"); gtk_dialog_run(GTK_DIALOG(dialog)); diff --git a/test.c b/test.c index fe4da27..d3aa43f 100644 --- a/test.c +++ b/test.c @@ -2,6 +2,42 @@ #include "calvados.h" +/* + * + * testSelectedFilesRbCallback() + * + */ +void testSelectedFilesRbCallback(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("clicked %s\n", (char *)data); +} + + +/* + * + * testAllFilesRbCallback() + * + */ +void testAllFilesRbCallback(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("clicked %s\n", (char *)data); +} + + +/* + * + * do_test() + * + */ +void do_test(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("Do Test function goes here.\n"); +} + + /* * * test() @@ -11,6 +47,98 @@ */ void test(GtkWidget *widget, gpointer data) { + GtkWidget *dialog; + GtkWidget *vbox; + GtkWidget *filesFrame; + GSList *filesRbGroup = NULL; + GtkWidget *testSelectedFilesRb; + GtkWidget *testAllFilesRb; + GtkWidget *hbox; + GtkWidget *test_button; + GtkWidget *cancel_button; + + /* --- Display message --- */ g_print("test goes here\n"); + + /* --- Create the dialog --- */ + dialog = gtk_dialog_new(); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog), "Test Files"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog), 5); + + filesFrame = gtk_frame_new("Files"); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), filesFrame, TRUE, TRUE, 0); + gtk_widget_show(filesFrame); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(filesFrame), vbox); + gtk_widget_show(vbox); + + testSelectedFilesRb = create_radio(vbox, &filesRbGroup, "Test selected files"); + testAllFilesRb = create_radio(vbox, &filesRbGroup, "Test all files"); + + gtk_signal_connect(GTK_OBJECT(testSelectedFilesRb), "clicked", GTK_SIGNAL_FUNC(testSelectedFilesRbCallback), (gpointer)"testSelectedFilesRb"); + gtk_signal_connect(GTK_OBJECT(testAllFilesRb), "clicked", GTK_SIGNAL_FUNC(testAllFilesRbCallback), (gpointer)"testAllFilesRb"); + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE, TRUE, 0); + gtk_widget_show(hbox); + + /* + * --- Test button + */ + + /* --- Create the "Test" button --- */ + test_button = gtk_button_new_with_label("Test"); + + gtk_signal_connect(GTK_OBJECT(test_button), "clicked", + GTK_SIGNAL_FUNC(do_test), + dialog); + + /* --- Allow "Test" to be a default --- */ + GTK_WIDGET_SET_FLAGS(test_button, GTK_CAN_DEFAULT); + + /* --- Add the Test button to the vbox --- */ + gtk_box_pack_start(GTK_BOX(hbox), test_button, TRUE, TRUE, 0); + + /* --- Make the "Test" the default --- */ + gtk_widget_grab_default(test_button); + + /* --- Make the button visible --- */ + gtk_widget_show(test_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(hbox), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* --- Show the dialog --- */ + gtk_widget_show(dialog); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog); } diff --git a/twomg_properties_editor.c b/twomg_properties_editor.c new file mode 100644 index 0000000..9e7e2fb --- /dev/null +++ b/twomg_properties_editor.c @@ -0,0 +1,54 @@ +#include +#include + +#include "calvados.h" + +/* + * + * twomg_properties_editor() + * + * twomg_properties_editor Volume from the menu. + * + */ +void twomg_properties_editor(GtkWidget *widget, gpointer data) +{ + GtkWidget *dialog; + gint res; + GtkFileFilter *twoMGFilesFilt; + GtkFileFilter *allFilesFilt; + + /* --- Display message --- */ + /*g_print("twomg_properties_editor function goes here.\n");*/ + + twoMGFilesFilt = gtk_file_filter_new(); + gtk_file_filter_set_name(twoMGFilesFilt, "2MG Disk Images (.2mg, .2img)"); + gtk_file_filter_add_pattern(twoMGFilesFilt, "*.2[Mm][Gg]"); + gtk_file_filter_add_pattern(twoMGFilesFilt, "*.2[Ii][Mm][Gg]"); + + allFilesFilt = gtk_file_filter_new(); + gtk_file_filter_set_name(allFilesFilt, "All Files"); + gtk_file_filter_add_pattern(allFilesFilt, "*"); + + dialog = gtk_file_chooser_dialog_new("Select file to edit", + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, + GTK_RESPONSE_ACCEPT, + NULL); + + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), allFilesFilt); + + res = gtk_dialog_run(GTK_DIALOG(dialog)); + if (res == GTK_RESPONSE_ACCEPT) { + char *filename; + GtkFileChooser *chooser = GTK_FILE_CHOOSER(dialog); + filename = gtk_file_chooser_get_filename(chooser); + do_2mg_edit(filename); + g_free(filename); + } + + gtk_widget_destroy(dialog); +} + diff --git a/visit_website.c b/visit_website.c new file mode 100644 index 0000000..2b8a929 --- /dev/null +++ b/visit_website.c @@ -0,0 +1,17 @@ +#include + +#include "calvados.h" + +/* + * + * visit_website() + * + * visit_website Volume from the menu. + * + */ +void visit_website(GtkWidget *widget, gpointer data) +{ + /* --- Display message --- */ + g_print("visit_website function goes here.\n"); +} + diff --git a/volume_copier_open_file.c b/volume_copier_open_file.c new file mode 100644 index 0000000..efd647d --- /dev/null +++ b/volume_copier_open_file.c @@ -0,0 +1,73 @@ +#include +#include + +#include "calvados.h" + +/* + * + * volume_copier_open_file() + * + * volume_copier_open_file Volume from the menu. + * + */ +void volume_copier_open_file(GtkWidget *widget, gpointer data) +{ + GtkWidget *dialog; + gint res; + GtkFileFilter *diskImagesFilt; + GtkFileFilter *allFilesFilt; + + /* --- Display message --- */ + /*g_print("volume_copier_open_file function goes here.\n");*/ + + diskImagesFilt = gtk_file_filter_new(); + gtk_file_filter_set_name(diskImagesFilt, "Disk Images"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ss][Hh][Kk]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ss][Dd][Kk]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd][Ss][Kk]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Pp][Oo]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd][Oo]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd]13"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.2[Mm][Gg]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ii][Mm][Gg]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Nn][Ii][Bb]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Nn][Bb]2"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Rr][Aa][Ww]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Hh][Dd][Vv]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd][Cc]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd][Cc]6"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Dd][Dd][Dd]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Aa][Pp][Pp]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ff][Dd][Ii]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Ii][Ss][Oo]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Gg][Zz]"); + gtk_file_filter_add_pattern(diskImagesFilt, "*.[Zz][Ii][Pp]"); + + allFilesFilt = gtk_file_filter_new(); + gtk_file_filter_set_name(allFilesFilt, "All Files"); + gtk_file_filter_add_pattern(allFilesFilt, "*"); + + dialog = gtk_file_chooser_dialog_new("Select disk image file", + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, + GTK_RESPONSE_ACCEPT, + NULL); + + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), diskImagesFilt); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), allFilesFilt); + + res = gtk_dialog_run(GTK_DIALOG(dialog)); + if (res == GTK_RESPONSE_ACCEPT) { + char *filename; + GtkFileChooser *chooser = GTK_FILE_CHOOSER(dialog); + filename = gtk_file_chooser_get_filename(chooser); + do_volume_copier_open_file(filename); + g_free(filename); + } + + gtk_widget_destroy(dialog); +} + diff --git a/volume_copier_open_volume.c b/volume_copier_open_volume.c new file mode 100644 index 0000000..81c3bfa --- /dev/null +++ b/volume_copier_open_volume.c @@ -0,0 +1,202 @@ +#include +#include + +#include "calvados.h" + +/* + * + * volume_copier_open_volume() + * + * volume_copier_open_volume Volume from the menu. + * + */ +void volume_copier_open_volume(GtkWidget *widget, gpointer data) +{ + GtkWidget *dialog; + GtkWidget *ok_button; + GtkWidget *cancel_button; + GtkWidget *help_button; + GtkWidget *showLabel; + GList *showComboItems = NULL; + GtkWidget *showCombo; + GtkWidget *showHbox; + GtkListStore *store; + /*GtkTreeIter iter;*/ + GtkCellRenderer *renderer; + GtkTreeModel *model; + GtkWidget *view; + GtkWidget *openAsReadOnlyCb; + + /* --- Display message --- */ + /*g_print("volume_copier_open_volume function goes here.\n");*/ + + /*g_print("data=%s\n", (char *)data);*/ + + /* --- Create the dialog --- */ + dialog = gtk_dialog_new(); + + /* --- Trap the window close signal to release the grab --- */ + gtk_signal_connect(GTK_OBJECT(dialog), "destroy", + GTK_SIGNAL_FUNC(closing_dialog), + &dialog); + + /* --- Set the title --- */ + gtk_window_set_title(GTK_WINDOW(dialog), "Select Volume"); + + /* --- Add a small border --- */ + gtk_container_border_width(GTK_CONTAINER(dialog), 5); + + showHbox = gtk_hbox_new(FALSE, 0); + + showLabel = gtk_label_new("Show: "); + gtk_misc_set_alignment(GTK_MISC(showLabel), 0, 0.5); + + /* + * --- Create a list of the items first + */ + showComboItems = g_list_append(showComboItems, "Both logical and physical"); + showComboItems = g_list_append(showComboItems, "Logical volumes"); + showComboItems = g_list_append(showComboItems, "Physical disks"); + + /* --- Make a combo box. --- */ + showCombo = gtk_combo_new(); + + /* --- Create the drop down portion of the combo --- */ + gtk_combo_set_popdown_strings(GTK_COMBO(showCombo), showComboItems); + + /* --- Default the text in the field to a value --- */ + gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(showCombo)->entry), "Both logical and physical"); + + /* --- Make the edit portion non-editable. They can pick a + * value from the drop down, they just can't end up with + * a value that's not in the drop down. + */ + gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(showCombo)->entry), FALSE); + + gtk_box_pack_start(GTK_BOX(showHbox), showLabel, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(showHbox), showCombo, TRUE, TRUE, 0); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), showHbox, TRUE, TRUE, 0); + + gtk_widget_show(showLabel); + gtk_widget_show(showCombo); + gtk_widget_show(showHbox); + + store = gtk_list_store_new(NUM_SELECT_VOLUME_COLS, G_TYPE_STRING, G_TYPE_UINT); + +/*FIXME*/ + /* Append a row and fill in some data */ + /*gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, + COL_VOLUME_OR_DEVICE_NAME, "", + COL_REMARK, "", + -1);*/ + + view = gtk_tree_view_new(); + gtk_widget_set_size_request(view, 320, 256); + + /* --- Column #1 --- */ + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), + -1, + "Volume or Device Name", + renderer, + "text", COL_VOLUME_OR_DEVICE_NAME, + NULL); + + /* --- Column #2 --- */ + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), + -1, + "Remarks", + renderer, + "text", COL_REMARK, + NULL); + + model = GTK_TREE_MODEL(store); + + gtk_tree_view_set_model(GTK_TREE_VIEW(view), model); + + /* The tree view has acquired its own reference to the + * model, so we can drop ours. That way the model will + * be freed automatically when the tree view is destroyed */ + g_object_unref(model); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), view, TRUE, TRUE, 0); + + gtk_widget_show(view); + + openAsReadOnlyCb = gtk_check_button_new_with_label("Open as read-only (writing to the volume will be disabled)"); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(openAsReadOnlyCb), TRUE); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), openAsReadOnlyCb, TRUE, TRUE, 0); + + gtk_widget_show(openAsReadOnlyCb); + + /* + * --- OK button + */ + + /* --- Create the "OK" button --- */ + ok_button = gtk_button_new_with_label("OK"); + + gtk_signal_connect(GTK_OBJECT(ok_button), "clicked", + GTK_SIGNAL_FUNC(okfunc_volume_copier_open_volume), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); + + /* --- Add the OK button to the bottom hbox2 --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), ok_button, TRUE, TRUE, 0); + + /* --- Make the "OK" the default --- */ + gtk_widget_grab_default(ok_button); + + /* --- Make the button visible --- */ + gtk_widget_show(ok_button); + + /* + * --- Cancel button + */ + + /* --- Create the "Cancel" button --- */ + cancel_button = gtk_button_new_with_label("Cancel"); + + gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked", + GTK_SIGNAL_FUNC(close_dialog), + dialog); + + /* --- Allow "Cancel" to be a default --- */ + GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); + + /* --- Add the "Cancel" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), cancel_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(cancel_button); + + /* + * --- Help button + */ + + /* --- Create the "Help" button --- */ + help_button = gtk_button_new_with_label("Help"); + + gtk_signal_connect(GTK_OBJECT(help_button), "clicked", + GTK_SIGNAL_FUNC(help_func_volume_copier_open_volume), + dialog); + + /* --- Add the "Help" button to the dialog --- */ + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), help_button, TRUE, TRUE, 0); + + /* --- Make the button visible. --- */ + gtk_widget_show(help_button); + + /* --- Show the dialog --- */ + gtk_widget_show(dialog); + + /* --- Only this window can be used for now --- */ + gtk_grab_add(dialog); +} +