mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
gtk-demo: Add a file filter for the video player
We are only interested in video files here.
This commit is contained in:
parent
17710709f9
commit
091289a85d
@ -31,6 +31,7 @@ open_clicked_cb (GtkWidget *button,
|
||||
GtkWidget *video)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkFileFilter *filter;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Select a video",
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
@ -38,6 +39,11 @@ open_clicked_cb (GtkWidget *button,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Open", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "video/*");
|
||||
gtk_file_filter_set_name (filter, "Video");
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_object_unref (filter);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video);
|
||||
|
Loading…
Reference in New Issue
Block a user