[gtk/matthiasc/for-master] docs: Improve the GtkVideo gallery image



commit 64e131f285b2d949372624a88a8b9fe436ab0a49
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 25 22:17:15 2020 -0400

    docs: Improve the GtkVideo gallery image

 docs/reference/gtk/images/video.png | Bin 3633 -> 11569 bytes
 docs/tools/shooter.c                |  17 ++++++++++++++++-
 docs/tools/widgets.c                |  14 ++++++++++----
 docs/tools/widgets.h                |   1 +
 4 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/docs/reference/gtk/images/video.png b/docs/reference/gtk/images/video.png
index c044c80058..4230baaaa4 100644
Binary files a/docs/reference/gtk/images/video.png and b/docs/reference/gtk/images/video.png differ
diff --git a/docs/tools/shooter.c b/docs/tools/shooter.c
index bf72d1e471..ff81d44e1f 100644
--- a/docs/tools/shooter.c
+++ b/docs/tools/shooter.c
@@ -117,6 +117,13 @@ snapshot_widget (GtkWidget *widget)
   return surface;
 }
 
+static gboolean
+quit_cb (gpointer data)
+{
+  *(gboolean *)data = TRUE;
+  return G_SOURCE_REMOVE;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -144,7 +151,15 @@ main (int argc, char **argv)
                                      NULL);
         }
 
-      //while (1) g_main_context_iteration (NULL, 1);
+      if (info->wait > 0)
+        {
+          gboolean quit = FALSE;
+
+          g_timeout_add (info->wait, quit_cb, &quit);
+
+          while (!quit)
+            g_main_context_iteration (NULL, TRUE);
+        }
 
       surface = snapshot_widget (info->window);
 
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 068ef81f43..96b9b6254c 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -1099,10 +1099,13 @@ create_video (void)
 {
   GtkWidget *widget;
   GtkWidget *vbox;
+  WidgetInfo *info;
 
-  widget = gtk_video_new_for_filename ("../../demos/gtk-demo/gtk-logo.webm");
-  gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
-  gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
+  widget = gtk_video_new_for_filename ("demos/gtk-demo/gtk-logo.webm");
+  gtk_video_set_autoplay (GTK_VIDEO (widget), TRUE);
+
+  gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (widget, GTK_ALIGN_FILL);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
   gtk_box_append (GTK_BOX (vbox), widget);
@@ -1110,7 +1113,10 @@ create_video (void)
 
   add_margin (vbox);
 
-  return new_widget_info ("video", vbox, SMALL);
+  info = new_widget_info ("video", vbox, MEDIUM);
+  info->wait = 2000;
+
+  return info;
 }
 
 static WidgetInfo *
diff --git a/docs/tools/widgets.h b/docs/tools/widgets.h
index 2e337038d6..99e0d4a1fa 100644
--- a/docs/tools/widgets.h
+++ b/docs/tools/widgets.h
@@ -18,6 +18,7 @@ typedef struct WidgetInfo
   char *name;
   gboolean no_focus;
   gboolean include_decorations;
+  guint wait;
   WidgetSize size;
 } WidgetInfo;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]