[gnome-software] Show flatpak installation type in the Source dropdown



commit 761375eea78a01efd6750c32663ba841fb1533f6
Author: Kalev Lember <klember redhat com>
Date:   Sun Feb 24 11:05:17 2019 +0100

    Show flatpak installation type in the Source dropdown
    
    String change notification:
    https://mail.gnome.org/archives/gnome-i18n/2019-February/msg00048.html

 src/gs-origin-popover-row.c  | 22 ++++++++++++++++++++++
 src/gs-origin-popover-row.ui | 29 +++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)
---
diff --git a/src/gs-origin-popover-row.c b/src/gs-origin-popover-row.c
index 7acca515..b3a5a4c4 100644
--- a/src/gs-origin-popover-row.c
+++ b/src/gs-origin-popover-row.c
@@ -21,6 +21,9 @@ typedef struct
        GtkWidget       *format_box;
        GtkWidget       *format_title;
        GtkWidget       *format_label;
+       GtkWidget       *installation_box;
+       GtkWidget       *installation_title;
+       GtkWidget       *installation_label;
        GtkWidget       *selected_image;
 } GsOriginPopoverRowPrivate;
 
@@ -65,6 +68,21 @@ refresh_ui (GsOriginPopoverRow *row)
        } else {
                gtk_widget_hide (priv->format_box);
        }
+
+       if (gs_app_get_bundle_kind (priv->app) == AS_BUNDLE_KIND_FLATPAK &&
+           gs_app_get_scope (priv->app) != AS_APP_SCOPE_UNKNOWN) {
+               AsAppScope scope = gs_app_get_scope (priv->app);
+               if (scope == AS_APP_SCOPE_SYSTEM) {
+                       /* TRANSLATORS: the installation location for flatpaks */
+                       gtk_label_set_text (GTK_LABEL (priv->installation_label), _("system"));
+               } else if (scope == AS_APP_SCOPE_USER) {
+                       /* TRANSLATORS: the installation location for flatpaks */
+                       gtk_label_set_text (GTK_LABEL (priv->installation_label), _("user"));
+               }
+               gtk_widget_show (priv->installation_box);
+       } else {
+               gtk_widget_hide (priv->installation_box);
+       }
 }
 
 static void
@@ -100,6 +118,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);
 }
 
 static void
@@ -135,6 +154,9 @@ gs_origin_popover_row_class_init (GsOriginPopoverRowClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, format_box);
        gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, format_title);
        gtk_widget_class_bind_template_child_private (widget_class, GsOriginPopoverRow, format_label);
+       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, selected_image);
 }
 
diff --git a/src/gs-origin-popover-row.ui b/src/gs-origin-popover-row.ui
index 761c328e..7cb4fe69 100644
--- a/src/gs-origin-popover-row.ui
+++ b/src/gs-origin-popover-row.ui
@@ -80,6 +80,35 @@
                 </child>
               </object>
             </child>
+            <child>
+              <object class="GtkBox" id="installation_box">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+                <property name="spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="installation_title">
+                    <property name="visible">True</property>
+                    <property name="halign">start</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes" comments="Translators: The installation 
location for flatpaks, e.g. 'user' or 'system'">Installation</property>
+                    <style>
+                      <class name="app-row-origin-text"/>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="installation_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]