[gnome-software/wip/hughsie/flatpak-branch: 4/4] Show the branch in the source popover



commit 5109d777f1b7a25245dd85299a9bb41c21746424
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jun 25 14:15:30 2019 +0100

    Show the branch in the source popover
    
    Now we're not just pretending that only the newest branch exists we need to
    show the branch in the dropdown to avoid having identical entries. This new
    string should only be shown for runtimes and extension points and not actual
    applications as typically only one branch is available there.

 src/gs-origin-popover-row.c  | 14 ++++++++++++++
 src/gs-origin-popover-row.ui | 29 +++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
---
diff --git a/src/gs-origin-popover-row.c b/src/gs-origin-popover-row.c
index b3a5a4c4..0e02d742 100644
--- a/src/gs-origin-popover-row.c
+++ b/src/gs-origin-popover-row.c
@@ -24,6 +24,9 @@ typedef struct
        GtkWidget       *installation_box;
        GtkWidget       *installation_title;
        GtkWidget       *installation_label;
+       GtkWidget       *branch_box;
+       GtkWidget       *branch_title;
+       GtkWidget       *branch_label;
        GtkWidget       *selected_image;
 } GsOriginPopoverRowPrivate;
 
@@ -83,6 +86,13 @@ refresh_ui (GsOriginPopoverRow *row)
        } else {
                gtk_widget_hide (priv->installation_box);
        }
+
+       if (gs_app_get_branch (priv->app) != NULL) {
+               gtk_label_set_text (GTK_LABEL (priv->branch_label), gs_app_get_branch (priv->app));
+               gtk_widget_show (priv->branch_box);
+       } else {
+               gtk_widget_hide (priv->branch_box);
+       }
 }
 
 static void
@@ -119,6 +129,7 @@ gs_origin_popover_row_set_size_group (GsOriginPopoverRow *row, GtkSizeGroup *siz
        gtk_size_group_add_widget (size_group, priv->url_title);
        gtk_size_group_add_widget (size_group, priv->format_title);
        gtk_size_group_add_widget (size_group, priv->installation_title);
+       gtk_size_group_add_widget (size_group, priv->branch_title);
 }
 
 static void
@@ -157,6 +168,9 @@ gs_origin_popover_row_class_init (GsOriginPopoverRowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, installation_box);
        gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, installation_title);
        gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, installation_label);
+       gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, branch_box);
+       gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, branch_title);
+       gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, branch_label);
        gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, selected_image);
 }
 
diff --git a/src/gs-origin-popover-row.ui b/src/gs-origin-popover-row.ui
index 7cb4fe69..30498605 100644
--- a/src/gs-origin-popover-row.ui
+++ b/src/gs-origin-popover-row.ui
@@ -109,6 +109,35 @@
                 </child>
               </object>
             </child>
+            <child>
+              <object class="GtkBox" id="branch_box">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+                <property name="spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="branch_title">
+                    <property name="visible">True</property>
+                    <property name="halign">start</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes" comments="Translators: The branch, e.g. 
'stable' or '3.32'">Branch</property>
+                    <style>
+                      <class name="app-row-origin-text"/>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="branch_label">
+                    <property name="visible">True</property>
+                    <property name="halign">start</property>
+                    <property name="ellipsize">end</property>
+                    <style>
+                      <class name="app-row-origin-text"/>
+                    </style>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
         </child>
         <child>


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