[gnome-software/1851-source-chooser-breaks-layout-on-mobile] gs-details-page: Re-position the buttons and the source chooser in the narrow mode



commit 45855ed73550a0e762be3df0c210fa1f9a7bd118
Author: Milan Crha <mcrha redhat com>
Date:   Tue Aug 9 12:46:32 2022 +0200

    gs-details-page: Re-position the buttons and the source chooser in the narrow mode
    
    Let the buttons with the source chooser be below the app name in the narrow mode.
    Also use a smaller gap between the buttons and the source chooser.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1851

 src/gs-details-page.c  | 15 +++++++++++++++
 src/gs-details-page.ui |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index e59b602db..f83d96bff 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -144,6 +144,7 @@ struct _GsDetailsPage
        GtkWidget               *scrolledwindow_details;
        GtkWidget               *spinner_details;
        GtkWidget               *stack_details;
+       GtkWidget               *box_with_source;
        GtkWidget               *origin_popover;
        GtkWidget               *origin_popover_list_box;
        GtkWidget               *origin_box;
@@ -2460,6 +2461,7 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, scrolledwindow_details);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, spinner_details);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, stack_details);
+       gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_with_source);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, origin_popover);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, origin_popover_list_box);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, origin_box);
@@ -2506,6 +2508,17 @@ narrow_to_spacing (GBinding *binding, const GValue *from_value, GValue *to_value
        return TRUE;
 }
 
+static gboolean
+narrow_to_halign (GBinding *binding, const GValue *from_value, GValue *to_value, gpointer user_data)
+{
+       if (g_value_get_boolean (from_value))
+               g_value_set_enum (to_value, GTK_ALIGN_START);
+       else
+               g_value_set_enum (to_value, GTK_ALIGN_FILL);
+
+       return TRUE;
+}
+
 static void
 gs_details_page_init (GsDetailsPage *self)
 {
@@ -2542,6 +2555,8 @@ gs_details_page_init (GsDetailsPage *self)
 
        g_object_bind_property_full (self, "is-narrow", self->box_details_header, "spacing", 
G_BINDING_SYNC_CREATE,
                                     narrow_to_spacing, NULL, NULL, NULL);
+       g_object_bind_property_full (self, "is-narrow", self->box_with_source, "halign", 
G_BINDING_SYNC_CREATE,
+                                    narrow_to_halign, NULL, NULL, NULL);
        g_object_bind_property_full (self, "is-narrow", self->box_details_header_not_icon, "orientation", 
G_BINDING_SYNC_CREATE,
                                     narrow_to_orientation, NULL, NULL, NULL);
        g_object_bind_property_full (self, "is-narrow", self->box_license, "orientation", 
G_BINDING_SYNC_CREATE,
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index fca12edc1..490311b1b 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -214,7 +214,7 @@
                                           <object class="GtkBox" id="box_with_source">
                                             <property name="orientation">vertical</property>
                                             <property name="valign">center</property>
-                                            <property name="spacing">9</property>
+                                            <property name="spacing">6</property>
                                             <child>
                                               <object class="GtkBox" id="box_install_remove">
                                                 <property name="orientation">horizontal</property>


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