calvados/bulk_disk_image_converter.c
2017-04-18 14:15:24 -05:00

73 lines
2.7 KiB
C

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "calvados.h"
/*
*
* bulk_disk_image_converter()
*
* Display bulk disk image converter dialog
*
*/
void bulk_disk_image_converter(GtkWidget *widget, gpointer data)
{
GtkWidget *dialog;
gint res;
GtkFileFilter *diskImagesFilt;
GtkFileFilter *allFilesFilt;
/*g_print("bulk disk image convert 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 images to convert",
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_bulk_disk_converter(filename);
g_free(filename);
}
gtk_widget_destroy(dialog);
}