[gnome-software/wip/hughsie/sandbox-ui: 6/7] Show the sandbox and source infomation in search results
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/sandbox-ui: 6/7] Show the sandbox and source infomation in search results
- Date: Thu, 7 Jul 2016 19:43:20 +0000 (UTC)
commit b686fd20868509ddeecdf4e74b2d66104ab775c4
Author: Richard Hughes <richard hughsie com>
Date: Thu Jul 7 11:55:57 2016 +0100
Show the sandbox and source infomation in search results
src/gs-app-row.c | 34 ++++++++++++++++++++++++-
src/gs-app-row.ui | 63 ++++++++++++++++++++++++++++++++++++++++++++++
src/gs-shell-installed.c | 2 +
src/gs-shell-search.c | 1 +
src/gs-shell-updates.c | 1 +
src/gtk-style.css | 4 +++
6 files changed, 104 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index ff2507e..92a92eb 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2012-2013 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2012-2016 Richard Hughes <richard hughsie com>
* Copyright (C) 2013 Matthias Clasen <mclasen redhat com>
*
* Licensed under the GNU General Public License Version 2
@@ -51,6 +51,9 @@ typedef struct
GtkWidget *label_tag_webapp;
GtkWidget *label_tag_nonfree;
GtkWidget *label_tag_extension;
+ GtkWidget *label_origin;
+ GtkWidget *box_sandboxed;
+ GtkWidget *image_sandboxed;
gboolean colorful;
gboolean show_codec;
gboolean show_update;
@@ -152,6 +155,7 @@ gs_app_row_refresh (GsAppRow *app_row)
GsAppRowPrivate *priv = gs_app_row_get_instance_private (app_row);
GtkStyleContext *context;
GString *str = NULL;
+ const gchar *tmp;
gboolean missing_search_result;
gboolean show_nonfree = FALSE;
gboolean use_folders = FALSE;
@@ -231,6 +235,31 @@ gs_app_row_refresh (GsAppRow *app_row)
}
}
+ /* where did this app come from */
+ tmp = gs_app_get_origin_hostname (priv->app);
+ if (tmp != NULL) {
+ g_autofree gchar *origin_tmp = NULL;
+ /* TRANSLATORS: this refers to where the app came from */
+ origin_tmp = g_strdup_printf ("%s: %s", _("Source"), tmp);
+ gtk_label_set_label (GTK_LABEL (priv->label_origin), origin_tmp);
+ }
+ gtk_widget_set_visible (priv->label_origin, tmp != NULL);
+
+ /* sandboxed */
+ if (gs_app_get_kudos (priv->app) & GS_APP_KUDO_SANDBOXED_SECURE) {
+ gtk_widget_set_visible (priv->box_sandboxed, TRUE);
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->image_sandboxed),
+ "security-high-symbolic",
+ GTK_ICON_SIZE_SMALL_TOOLBAR);
+ } else if (gs_app_get_kudos (priv->app) & GS_APP_KUDO_SANDBOXED) {
+ gtk_widget_set_visible (priv->box_sandboxed, TRUE);
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->image_sandboxed),
+ "security-medium-symbolic",
+ GTK_ICON_SIZE_SMALL_TOOLBAR);
+ } else {
+ gtk_widget_set_visible (priv->box_sandboxed, FALSE);
+ }
+
/* Override the non-free label visibility from the settings if needed */
if (!g_settings_get_boolean (priv->settings, "show-nonfree-ui"))
show_nonfree = FALSE;
@@ -589,6 +618,9 @@ gs_app_row_class_init (GsAppRowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_tag_webapp);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_tag_nonfree);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_tag_extension);
+ gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_origin);
+ gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, box_sandboxed);
+ gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, image_sandboxed);
}
static void
diff --git a/src/gs-app-row.ui b/src/gs-app-row.ui
index 0146a6a..1177cee 100644
--- a/src/gs-app-row.ui
+++ b/src/gs-app-row.ui
@@ -95,6 +95,69 @@
<property name="fill">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label_origin">
+ <property name="visible">True</property>
+ <property name="xalign">0.0</property>
+ <property name="yalign">0.5</property>
+ <property name="halign">start</property>
+ <property name="ellipsize">end</property>
+ <style>
+ <class name="app-row-origin-text"/>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box_sandboxed">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">3</property>
+ <property name="halign">start</property>
+ <child>
+ <object class="GtkImage" id="image_sandboxed">
+ <property name="visible">True</property>
+ <property name="pixel_size">16</property>
+ <property name="valign">center</property>
+ <property name="halign">start</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_sandboxed">
+ <property name="label" translatable="yes" comments="security
sandbox">Sandboxed</property>
+ <property name="visible">True</property>
+ <property name="xalign">0.0</property>
+ <property name="yalign">0.5</property>
+ <property name="halign">start</property>
+ <property name="ellipsize">end</property>
+ <style>
+ <class name="app-row-origin-text"/>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 5a2543a..292824b 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -221,6 +221,8 @@ gs_shell_installed_load (GsShellInstalled *self)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION |
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS |
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index 1f7de0a..14fe066 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -188,6 +188,7 @@ gs_shell_search_load (GsShellSearch *self)
GS_PLUGIN_REFINE_FLAGS_REQUIRE_DESCRIPTION |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_LICENSE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS |
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING,
self->search_cancellable,
gs_shell_search_get_search_cb,
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index c8a1b7a..251a514 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -567,6 +567,7 @@ gs_shell_updates_load (GsShellUpdates *self)
gs_container_remove_all (GTK_CONTAINER (self->list_box_updates));
refine_flags = GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS |
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION;
gs_shell_updates_set_state (self,
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 62144db..20f7075 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -221,6 +221,10 @@
color: white;
}
+.app-row-origin-text {
+ font-size: 9px;
+}
+
.fake-header-bar {
all: unset;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]