diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml index d28d7e4c65..f1b34d3641 100644 --- a/demos/gtk-demo/demo.gresource.xml +++ b/demos/gtk-demo/demo.gresource.xml @@ -121,6 +121,7 @@ alphatest.png floppybuddy.gif + gtk-logo.webm apple-red.png diff --git a/demos/gtk-demo/gtk-logo.webm b/demos/gtk-demo/gtk-logo.webm new file mode 100644 index 0000000000..7baa0588d6 Binary files /dev/null and b/demos/gtk-demo/gtk-logo.webm differ diff --git a/demos/gtk-demo/images.c b/demos/gtk-demo/images.c index c3f0f675f6..46e4390e5b 100644 --- a/demos/gtk-demo/images.c +++ b/demos/gtk-demo/images.c @@ -317,12 +317,15 @@ toggle_sensitivity_callback (GtkWidget *togglebutton, GtkWidget * do_images (GtkWidget *do_widget) { + GtkWidget *video; GtkWidget *frame; GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *base_vbox; GtkWidget *image; GtkWidget *label; GtkWidget *button; - GIcon *gicon; + GIcon *gicon; if (!window) { @@ -336,9 +339,15 @@ do_images (GtkWidget *do_widget) g_signal_connect (window, "destroy", G_CALLBACK (cleanup_callback), NULL); + base_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); + g_object_set (base_vbox, "margin", 16, NULL); + gtk_container_add (GTK_CONTAINER (window), base_vbox); + + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16); + gtk_container_add (GTK_CONTAINER (base_vbox), hbox); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); - g_object_set (vbox, "margin", 16, NULL); - gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_container_add (GTK_CONTAINER (hbox), vbox); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), @@ -395,6 +404,8 @@ do_images (GtkWidget *do_widget) /* Progressive */ + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); + gtk_container_add (GTK_CONTAINER (hbox), vbox); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), @@ -415,13 +426,32 @@ do_images (GtkWidget *do_widget) start_progressive_loading (image); + /* Video */ + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); + gtk_container_add (GTK_CONTAINER (hbox), vbox); + + label = gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (label), + "Displaying video"); + gtk_box_pack_start (GTK_BOX (vbox), label); + + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + gtk_widget_set_halign (frame, GTK_ALIGN_CENTER); + gtk_widget_set_valign (frame, GTK_ALIGN_CENTER); + gtk_box_pack_start (GTK_BOX (vbox), frame); + + video = gtk_video_new_for_resource ("/images/gtk-logo.webm"); + gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE); + gtk_container_add (GTK_CONTAINER (frame), video); + /* Sensitivity control */ button = gtk_toggle_button_new_with_mnemonic ("_Insensitive"); - gtk_box_pack_start (GTK_BOX (vbox), button); + gtk_box_pack_start (GTK_BOX (base_vbox), button); g_signal_connect (button, "toggled", G_CALLBACK (toggle_sensitivity_callback), - vbox); + base_vbox); } if (!gtk_widget_get_visible (window))