[gnome-photos] preview-view: Don't assume the presence of a GtkViewport



commit 9ca8a80632994069e36ee54f6887b5de6129a199
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Apr 6 16:20:54 2017 +0200

    preview-view: Don't assume the presence of a GtkViewport
    
    Once PhotosImageView implements GtkScrollable, there won't be a
    GtkViewport between the view and its GtkScrolledWindow container.

 src/photos-preview-view.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 41a10a1..f57cef1 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -258,11 +258,16 @@ photos_preview_view_create_view_with_container (PhotosPreviewView *self)
 static GtkWidget *
 photos_preview_view_get_view_from_view_container (GtkWidget *view_container)
 {
+  GtkWidget *child;
   GtkWidget *view;
-  GtkWidget *viewport;
 
-  viewport = gtk_bin_get_child (GTK_BIN (view_container));
-  view = gtk_bin_get_child (GTK_BIN (viewport));
+  child = gtk_bin_get_child (GTK_BIN (view_container));
+
+  if (GTK_IS_VIEWPORT (child))
+    view = gtk_bin_get_child (GTK_BIN (child));
+  else
+    view = child;
+
   return view;
 }
 


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