[gnome-software: 4/14] gs-details-page: Simplify handling of progress boxes




commit e636124b39d4fdfcfc05551a521e2c959a4c14ad
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Aug 12 10:30:03 2021 +0100

    gs-details-page: Simplify handling of progress boxes
    
    The `box_progress` box will be shown exactly when the cancel button is
    visible, so bind their visibilities together.
    
    It’s not possible or desirable for the other child (`box_progress2`) to
    be shown without the cancel button being shown.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1351

 src/gs-details-page.c  | 17 -----------------
 src/gs-details-page.ui |  4 ++--
 2 files changed, 2 insertions(+), 19 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index d02eea54c..b34a7712e 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -93,7 +93,6 @@ struct _GsDetailsPage
        GtkWidget               *box_details;
        GtkWidget               *box_details_description;
        GtkWidget               *label_webapp_warning;
-       GtkWidget               *box_progress;
        GtkWidget               *box_progress2;
        GtkWidget               *star;
        GtkWidget               *label_review_count;
@@ -444,21 +443,6 @@ gs_details_page_refresh_progress (GsDetailsPage *self)
                gtk_widget_set_halign (self->box_progress2, GTK_ALIGN_CENTER);
                break;
        }
-
-       /* progress box */
-       switch (state) {
-       case GS_APP_STATE_REMOVING:
-       case GS_APP_STATE_INSTALLING:
-       case GS_APP_STATE_PENDING_INSTALL:
-       case GS_APP_STATE_PENDING_REMOVE:
-               gtk_widget_set_visible (self->box_progress, TRUE);
-               break;
-       default:
-               gtk_widget_set_visible (self->box_progress, FALSE);
-               break;
-       }
-       if (app_has_pending_action (self->app))
-               gtk_widget_set_visible (self->box_progress, TRUE);
 }
 
 static gboolean
@@ -2271,7 +2255,6 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_details);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_details_description);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_webapp_warning);
-       gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_progress);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_progress2);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, star);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_review_count);
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index 3968d7ce7..4f42d4739 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -286,8 +286,8 @@
                                           </object>
                                         </child>
                                         <child>
-                                          <object class="GtkBox" id="box_progress">
-                                            <property name="visible">True</property>
+                                          <object class="GtkBox">
+                                            <property name="visible" bind-source="button_cancel" 
bind-property="visible" bind-flags="sync-create"/>
                                             <property name="spacing">3</property>
                                             <property name="orientation">vertical</property>
                                             <property name="hexpand">True</property>


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