diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-12-03 19:36:53 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-12-03 19:44:34 -0500 |
commit | 2688b941333c5f834ef5c477db0a09532e791b8d (patch) | |
tree | 849388600a9ea67d59626eaabde31152af109726 /demos | |
parent | e035baee8a4765a5b5c26bcd175c13e4d03dc0f6 (diff) | |
download | gtk+-2688b941333c5f834ef5c477db0a09532e791b8d.tar.gz |
gtk-demo: Use a native filechooser in the video demo
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/video_player.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/demos/gtk-demo/video_player.c b/demos/gtk-demo/video_player.c index d2df677a5d..2ea4c9f3a3 100644 --- a/demos/gtk-demo/video_player.c +++ b/demos/gtk-demo/video_player.c @@ -10,11 +10,11 @@ static GtkWidget *window = NULL; static void -open_dialog_response_cb (GtkWidget *dialog, - int response, - GtkWidget *video) +open_dialog_response_cb (GtkNativeDialog *dialog, + int response, + GtkWidget *video) { - gtk_widget_hide (dialog); + gtk_native_dialog_hide (dialog); if (response == GTK_RESPONSE_ACCEPT) { @@ -25,32 +25,30 @@ open_dialog_response_cb (GtkWidget *dialog, g_object_unref (file); } - gtk_window_destroy (GTK_WINDOW (dialog)); + gtk_native_dialog_destroy (dialog); } static void open_clicked_cb (GtkWidget *button, GtkWidget *video) { - GtkWidget *dialog; + GtkFileChooserNative *dialog; GtkFileFilter *filter; - dialog = gtk_file_chooser_dialog_new ("Select a video", + dialog = gtk_file_chooser_native_new ("Select a video", GTK_WINDOW (gtk_widget_get_root (button)), GTK_FILE_CHOOSER_ACTION_OPEN, - "_Cancel", GTK_RESPONSE_CANCEL, - "_Open", GTK_RESPONSE_ACCEPT, - NULL); + "_Open", + "_Cancel"); 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); + gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE); g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video); - gtk_widget_show (dialog); + gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog)); } static void |