[gtk+] gtk-demo: Deal with big images



commit 4d3cdfae4438ccea048f22912aa2ff391be2f232
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Oct 6 21:59:34 2017 -0400

    gtk-demo: Deal with big images
    
    We don't want to grow our window to huge size just because
    there is a big source image.

 demos/gtk-demo/main.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index a389812..820f1db 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -592,6 +592,17 @@ add_data_tab (const gchar *demoname)
           g_bytes_unref (bytes);
         }
 
+      if (GTK_IS_IMAGE (widget))
+        {
+          GtkWidget *sw;
+
+          gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
+          gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
+          sw = gtk_scrolled_window_new (NULL, NULL);
+          gtk_container_add (GTK_CONTAINER (sw), widget);
+          widget = sw;
+        }
+
       label = gtk_label_new (resources[i]);
       gtk_widget_show (label);
       gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);


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