[gtk] demo: Fix tranparency overlay demo



commit c6da0c9a7aaf59785ea80c09d581f80657c24ae8
Author: Timm Bäder <mail baedert org>
Date:   Sun Jan 13 05:46:06 2019 +0100

    demo: Fix tranparency overlay demo
    
    We'd like the rose picture to be bigger than 16×16. Also remove the
    scrolledwindow since the GtkPicture now automatically scales down the
    rose image. This also fixes the picture always being allocated at y=0.

 demos/gtk-demo/transparent.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
---
diff --git a/demos/gtk-demo/transparent.c b/demos/gtk-demo/transparent.c
index b8d11c2ce8..6d5e80750b 100644
--- a/demos/gtk-demo/transparent.c
+++ b/demos/gtk-demo/transparent.c
@@ -12,12 +12,10 @@ do_transparent (GtkWidget *do_widget)
 
   if (!window)
     {
-      GtkWidget *sw;
       GtkWidget *overlay;
       GtkWidget *button;
       GtkWidget *label;
-      GtkWidget *box;
-      GtkWidget *image;
+      GtkWidget *picture;
 
       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
       gtk_window_set_display (GTK_WINDOW (window),
@@ -54,17 +52,8 @@ do_transparent (GtkWidget *do_widget)
       gtk_overlay_add_overlay (GTK_OVERLAY (overlay), button);
       gtk_container_child_set (GTK_CONTAINER (overlay), button, "blur", 5.0, NULL);
 
-      sw = gtk_scrolled_window_new (NULL, NULL);
-      sw = gtk_scrolled_window_new (NULL, NULL);
-      gtk_container_add (GTK_CONTAINER (overlay), sw);
-      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
-                                      GTK_POLICY_AUTOMATIC,
-                                      GTK_POLICY_AUTOMATIC);
-      box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_container_add (GTK_CONTAINER (sw), box);
-      image = gtk_image_new_from_resource ("/transparent/portland-rose.jpg");
-
-      gtk_container_add (GTK_CONTAINER (box), image);
+      picture = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
+      gtk_container_add (GTK_CONTAINER (overlay), picture);
     }
 
   if (!gtk_widget_get_visible (window))


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