[gnome-software/wip/ubuntu-3-22] Display a warning for non-sandboxed snaps.



commit ebaa2a52a5ffc31e1d6b95c34994c6678d002306
Author: James Henstridge <james jamesh id au>
Date:   Fri Jun 23 11:22:36 2017 +0800

    Display a warning for non-sandboxed snaps.

 src/gs-shell-details.c  |   14 ++++++++++++++
 src/gs-shell-details.ui |   44 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 033b024..7a05b75 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -136,6 +136,7 @@ struct _GsShellDetails
        GtkWidget               *popover_license_free;
        GtkWidget               *popover_license_nonfree;
        GtkWidget               *popover_license_unknown;
+       GtkWidget               *box_not_sandboxed_warning;
 };
 
 G_DEFINE_TYPE (GsShellDetails, gs_shell_details, GS_TYPE_PAGE)
@@ -944,6 +945,18 @@ gs_shell_details_refresh_all (GsShellDetails *self)
                break;
        }
 
+       /* Display a warning about non-sandboxed apps that may come
+        * from third party sources.  Currently only checking snaps. */
+       ret = FALSE;
+       switch (gs_app_get_bundle_kind (self->app)) {
+       case AS_BUNDLE_KIND_SNAP:
+               ret |= (kudos & GS_APP_KUDO_SANDBOXED) == 0;
+               break;
+       default:
+               break;
+       }
+       gtk_widget_set_visible (self->box_not_sandboxed_warning, ret);
+
        /* are we trying to replace something in the baseos */
        gtk_widget_set_visible (self->infobar_details_package_baseos,
                                gs_app_has_quirk (self->app, AS_APP_QUIRK_COMPULSORY) &&
@@ -2089,6 +2102,7 @@ gs_shell_details_class_init (GsShellDetailsClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, popover_license_unknown);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_license_nonfree_details);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_licenses_intro);
+       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, box_not_sandboxed_warning);
 }
 
 static void
diff --git a/src/gs-shell-details.ui b/src/gs-shell-details.ui
index 3787d08..b4776a0 100644
--- a/src/gs-shell-details.ui
+++ b/src/gs-shell-details.ui
@@ -599,6 +599,46 @@
                           </packing>
                         </child>
                         <child>
+                          <object class="GtkBox" id="box_not_sandboxed_warning">
+                            <property name="visible">False</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">30</property>
+                            <child>
+                              <object class="GtkImage" id="image_not_sandboxed_image_icon">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="pixel_size">16</property>
+                                <property name="icon_name">dialog-warning</property>
+                                <property name="icon_size">6</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label_not_sandboxed_warning">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">This third party package is not 
sandboxed.  It will have access to your documents.</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0.5</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">12</property>
+                          </packing>
+                        </child>
+                        <child>
                           <object class="GtkBox" id="box_details_details">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
@@ -1094,7 +1134,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">12</property>
+                            <property name="position">13</property>
                           </packing>
                         </child>
                         <child>
@@ -1157,7 +1197,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">13</property>
+                            <property name="position">14</property>
                           </packing>
                         </child>
                         <child>


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