[gnome-software] shell-extensions: Properly disable when not running Shell



commit 511b4ab35c71a0e13b86986b7fefcde96f57a651
Author: Iain Lane <iain orangesquash org uk>
Date:   Fri Aug 25 14:49:28 2017 +0100

    shell-extensions: Properly disable when not running Shell
    
    Don't try to activate org.gnome.Shell. If we're not running Shell, it's
    not going to be activatable, and we're showing an in-app error to tell
    the user about this.
    
    Instead we should not try to activate it, but just disable the
    extensions plugin.
    
    https://bugs.launchpad.net/ubuntu/+source/gnome-software/+bug/1713009

 .../shell-extensions/gs-plugin-shell-extensions.c  |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/plugins/shell-extensions/gs-plugin-shell-extensions.c 
b/plugins/shell-extensions/gs-plugin-shell-extensions.c
index a7baf27..a7cbf6b 100644
--- a/plugins/shell-extensions/gs-plugin-shell-extensions.c
+++ b/plugins/shell-extensions/gs-plugin-shell-extensions.c
@@ -268,7 +268,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        if (priv->proxy != NULL)
                return TRUE;
        priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
-                                                    G_DBUS_PROXY_FLAGS_NONE,
+                                                    G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION,
                                                     NULL,
                                                     "org.gnome.Shell",
                                                     "/org/gnome/Shell",
@@ -279,6 +279,13 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                gs_utils_error_convert_gio (error);
                return FALSE;
        }
+
+       /* not running under Shell */
+       if (g_dbus_proxy_get_name_owner (priv->proxy) == NULL) {
+               g_clear_object (&priv->proxy);
+               return FALSE;
+       }
+
        g_signal_connect (priv->proxy, "g-signal",
                          G_CALLBACK (gs_plugin_shell_extensions_changed_cb), plugin);
 


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