From 8b64f0147ccd88d00f9e84a2855fc37883f61181 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 29 Mar 2021 23:39:25 -0400 Subject: [PATCH] gtk-demo: Allow opening images in video player It works, so why not. --- demos/gtk-demo/video_player.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/demos/gtk-demo/video_player.c b/demos/gtk-demo/video_player.c index 2ea4c9f3a3..8b467a25d9 100644 --- a/demos/gtk-demo/video_player.c +++ b/demos/gtk-demo/video_player.c @@ -41,11 +41,26 @@ open_clicked_cb (GtkWidget *button, "_Open", "_Cancel"); + 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 (dialog), filter); + g_object_unref (filter); + + filter = gtk_file_filter_new (); + gtk_file_filter_add_mime_type (filter, "image/*"); + gtk_file_filter_set_name (filter, "Images"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + g_object_unref (filter); + filter = gtk_file_filter_new (); gtk_file_filter_add_mime_type (filter, "video/*"); gtk_file_filter_set_name (filter, "Video"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter); g_object_unref (filter); + gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE); g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video); gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));