[gnome-software/wip/hughsie/flatpak-profile] Don't refresh flatpak repos if there are no permissions
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/flatpak-profile] Don't refresh flatpak repos if there are no permissions
- Date: Tue, 1 Nov 2016 15:14:30 +0000 (UTC)
commit 1a69410f08ef7aba5cff2683a5bfac4eacdb0c13
Author: Richard Hughes <richard hughsie com>
Date: Tue Nov 1 15:12:50 2016 +0000
Don't refresh flatpak repos if there are no permissions
src/plugins/gs-plugin-flatpak-system.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-flatpak-system.c b/src/plugins/gs-plugin-flatpak-system.c
index e12086c..c2e3460 100644
--- a/src/plugins/gs-plugin-flatpak-system.c
+++ b/src/plugins/gs-plugin-flatpak-system.c
@@ -43,9 +43,25 @@ void
gs_plugin_initialize (GsPlugin *plugin)
{
GsPluginData *priv = gs_plugin_alloc_data (plugin, sizeof(GsPluginData));
+ const gchar *action_id = "org.freedesktop.Flatpak.appstream-update";
+ g_autoptr(GPermission) permission = NULL;
+
priv->flatpak = gs_flatpak_new (plugin, AS_APP_SCOPE_SYSTEM);
priv->settings = g_settings_new ("org.gnome.software");
+ /* if we can't update the AppStream database system-wide don't even
+ * pull the data as we can't do anything with it */
+ permission = gs_utils_get_permission (action_id);
+ if (permission != NULL) {
+ gboolean ret = g_permission_get_allowed (permission) ||
+ g_permission_get_can_acquire (permission);
+ if (!ret) {
+ g_debug ("no way to update using %s", action_id);
+ gs_plugin_set_enabled (plugin, FALSE);
+ return;
+ }
+ }
+
/* set plugin flags */
gs_plugin_add_flags (plugin, GS_PLUGIN_FLAGS_GLOBAL_CACHE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]