Merge branch 'video-player-images' into 'master'

gtk-demo: Allow opening images in video player

See merge request GNOME/gtk!3371
This commit is contained in:
Matthias Clasen 2021-03-30 03:54:13 +00:00
commit 6db9215dd1

View File

@ -41,11 +41,26 @@ open_clicked_cb (GtkWidget *button,
"_Open", "_Open",
"_Cancel"); "_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 (); filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "video/*"); gtk_file_filter_add_mime_type (filter, "video/*");
gtk_file_filter_set_name (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); gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
g_object_unref (filter); g_object_unref (filter);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE); gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video); g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog)); gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));