[gnome-software] details page: Fix the page alignment when only one screenshot is shown



commit 59bdd41ff1994562538ca2ea1126eae322f88a21
Author: Kalev Lember <klember redhat com>
Date:   Sun Feb 24 19:28:37 2019 +0100

    details page: Fix the page alignment when only one screenshot is shown
    
    Make sure that we hide the thumbnails scrolledwindow when no thumbnails
    are actually shown, fixing a 9 pixel empty border on the right side.

 src/gs-details-page.c  | 8 +++++++-
 src/gs-details-page.ui | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 8d9202e3..d0ca6c7e 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -68,6 +68,7 @@ struct _GsDetailsPage
        GtkWidget               *label_review_count;
        GtkWidget               *box_details_screenshot;
        GtkWidget               *box_details_screenshot_main;
+       GtkWidget               *box_details_screenshot_scrolledwindow;
        GtkWidget               *box_details_screenshot_thumbnails;
        GtkWidget               *box_details_license_list;
        GtkWidget               *button_details_launch;
@@ -548,6 +549,7 @@ gs_details_page_refresh_screenshots (GsDetailsPage *self)
                                screenshots->len > 0);
        if (screenshots->len == 0) {
                gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_thumbnails));
+               gtk_widget_hide (self->box_details_screenshot_scrolledwindow);
                return;
        }
 
@@ -573,12 +575,15 @@ gs_details_page_refresh_screenshots (GsDetailsPage *self)
 
        /* set all the thumbnails */
        gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_thumbnails));
-       if (screenshots->len < 2)
+       if (screenshots->len < 2) {
+               gtk_widget_hide (self->box_details_screenshot_scrolledwindow);
                return;
+       }
 
        list = gtk_list_box_new ();
        gtk_style_context_add_class (gtk_widget_get_style_context (list), "image-list");
        gtk_widget_show (list);
+       gtk_widget_show (self->box_details_screenshot_scrolledwindow);
        gtk_container_add (GTK_CONTAINER (self->box_details_screenshot_thumbnails), list);
        for (i = 0; i < screenshots->len; i++) {
                ss = g_ptr_array_index (screenshots, i);
@@ -2627,6 +2632,7 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_review_count);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_details_screenshot);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_details_screenshot_main);
+       gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, 
box_details_screenshot_scrolledwindow);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_details_screenshot_thumbnails);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_details_license_list);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, button_details_launch);
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index 70975c81..40814e2d 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -300,7 +300,7 @@
                               </object>
                             </child>
                             <child>
-                              <object class="GtkScrolledWindow">
+                              <object class="GtkScrolledWindow" id="box_details_screenshot_scrolledwindow">
                                 <property name="visible">True</property>
                                 <property name="shadow_type">none</property>
                                 <property name="can_focus">True</property>


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