[gnome-software/wip/temp/ubuntu-xenial-rebased: 270/326] Disable the snappy plugin if the socket isn't there



commit 27637a55174f14c3f992329cca4150b8ed9228d7
Author: William Hua <william hua canonical com>
Date:   Mon Apr 18 11:07:13 2016 -0400

    Disable the snappy plugin if the socket isn't there

 src/plugins/gs-plugin-snappy.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-snappy.c b/src/plugins/gs-plugin-snappy.c
index a5a4ace..7dc6ca9 100644
--- a/src/plugins/gs-plugin-snappy.c
+++ b/src/plugins/gs-plugin-snappy.c
@@ -27,6 +27,8 @@
 
 // snapd API documentation is at https://github.com/ubuntu-core/snappy/blob/master/docs/rest.md
 
+#define SNAPD_SOCKET "/run/snapd.socket"
+
 struct GsPluginPrivate {
 };
 
@@ -43,6 +45,12 @@ gs_plugin_initialize (GsPlugin *plugin)
 {
        /* create private area */
        plugin->priv = GS_PLUGIN_GET_PRIVATE (GsPluginPrivate);
+
+       if (!g_file_test (SNAPD_SOCKET, G_FILE_TEST_EXISTS)) {
+               g_debug ("disabling '%s' as no %s available",
+                        plugin->name, SNAPD_SOCKET);
+               gs_plugin_set_enabled (plugin, FALSE);
+       }
 }
 
 static JsonParser *


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