[GTK3] Add filters to file open dialog
This commit is contained in:
parent
f45613f715
commit
dcf2481fcf
27
gtk3/main.c
27
gtk3/main.c
@ -1338,6 +1338,33 @@ static void activate_open(GSimpleAction *action, GVariant *parameter, gpointer a
|
|||||||
stop();
|
stop();
|
||||||
|
|
||||||
GtkFileChooserNative *native = gtk_file_chooser_native_new("Open File", GTK_WINDOW(gui_data.main_window), GTK_FILE_CHOOSER_ACTION_OPEN, "_Open", "_Cancel");
|
GtkFileChooserNative *native = gtk_file_chooser_native_new("Open File", GTK_WINDOW(gui_data.main_window), GTK_FILE_CHOOSER_ACTION_OPEN, "_Open", "_Cancel");
|
||||||
|
|
||||||
|
GtkFileFilter *filter = gtk_file_filter_new();
|
||||||
|
gtk_file_filter_add_pattern(filter, "*.gb");
|
||||||
|
gtk_file_filter_add_pattern(filter, "*.gbc");
|
||||||
|
gtk_file_filter_add_pattern(filter, "*.isx");
|
||||||
|
gtk_file_filter_add_mime_type(filter, "application/x-gameboy-rom");
|
||||||
|
gtk_file_filter_add_mime_type(filter, "application/x-gameboy-color-rom");
|
||||||
|
gtk_file_filter_set_name(filter, "All Supported Files (*.gb, *.gbc, *.isx)");
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(native), filter);
|
||||||
|
|
||||||
|
filter = gtk_file_filter_new();
|
||||||
|
gtk_file_filter_add_pattern(filter, "*.gb");
|
||||||
|
gtk_file_filter_add_mime_type(filter, "application/x-gameboy-rom");
|
||||||
|
gtk_file_filter_set_name(filter, "Game Boy (*.gb)");
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(native), filter);
|
||||||
|
|
||||||
|
filter = gtk_file_filter_new();
|
||||||
|
gtk_file_filter_add_pattern(filter, "*.gbc");
|
||||||
|
gtk_file_filter_add_mime_type(filter, "application/x-gameboy-color-rom");
|
||||||
|
gtk_file_filter_set_name(filter, "Game Boy Color (*.gbc)");
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(native), filter);
|
||||||
|
|
||||||
|
filter = gtk_file_filter_new();
|
||||||
|
gtk_file_filter_add_pattern(filter, "*");
|
||||||
|
gtk_file_filter_set_name(filter, "All Files");
|
||||||
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(native), filter);
|
||||||
|
|
||||||
gint res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
|
gint res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
|
||||||
|
|
||||||
if (res == GTK_RESPONSE_ACCEPT) {
|
if (res == GTK_RESPONSE_ACCEPT) {
|
||||||
|
Loading…
Reference in New Issue
Block a user