[gnome-software/wip/ubuntu-3-26: 24/27] Display a warning for non-sandboxed snaps.



commit 0d07faf53f4214ce84c0434e719fa97fc9c5df12
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-details-page.c  |   14 ++++++++++++++
 src/gs-details-page.ui |   44 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 6914319..730a350 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -143,6 +143,7 @@ struct _GsDetailsPage
        GtkWidget               *label_content_rating_none;
        GtkWidget               *button_details_rating_value;
        GtkWidget               *label_details_rating_title;
+       GtkWidget               *box_not_sandboxed_warning;
 };
 
 G_DEFINE_TYPE (GsDetailsPage, gs_details_page, GS_TYPE_PAGE)
@@ -1003,6 +1004,18 @@ gs_details_page_refresh_all (GsDetailsPage *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) &&
@@ -2372,6 +2385,7 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_content_rating_none);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, button_details_rating_value);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_details_rating_title);
+       gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_not_sandboxed_warning);
 }
 
 static void
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index 527087a..d1344e0 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -616,6 +616,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>
@@ -1150,7 +1190,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>
@@ -1213,7 +1253,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]