extensions-tool/uninstall: Error out for system extensions
UninstallExtensions() only returns whether the operation was successful, not why it failed. However we know that only user extensions can be uninstalled, so check that first to provide a more meaningful error. https://gitlab.gnome.org/GNOME/gnome-shell/issues/2391
This commit is contained in:
parent
636ab4b0e9
commit
62f3457a95
@ -29,14 +29,27 @@ static gboolean
|
|||||||
uninstall_extension (const char *uuid)
|
uninstall_extension (const char *uuid)
|
||||||
{
|
{
|
||||||
g_autoptr (GDBusProxy) proxy = NULL;
|
g_autoptr (GDBusProxy) proxy = NULL;
|
||||||
|
g_autoptr (GVariant) info = NULL;
|
||||||
g_autoptr (GVariant) response = NULL;
|
g_autoptr (GVariant) response = NULL;
|
||||||
g_autoptr (GError) error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
|
double type;
|
||||||
|
|
||||||
proxy = get_shell_proxy (&error);
|
proxy = get_shell_proxy (&error);
|
||||||
if (proxy == NULL)
|
if (proxy == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
info = get_extension_property (proxy, uuid, "type");
|
||||||
|
if (info == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
type = g_variant_get_double (info);
|
||||||
|
if (type == TYPE_SYSTEM)
|
||||||
|
{
|
||||||
|
g_printerr (_("Cannot uninstall system extensions\n"));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
response = g_dbus_proxy_call_sync (proxy,
|
response = g_dbus_proxy_call_sync (proxy,
|
||||||
"UninstallExtension",
|
"UninstallExtension",
|
||||||
g_variant_new ("(s)", uuid),
|
g_variant_new ("(s)", uuid),
|
||||||
@ -44,11 +57,6 @@ uninstall_extension (const char *uuid)
|
|||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (response == NULL)
|
|
||||||
{
|
|
||||||
g_printerr (_("Failed to connect to GNOME Shell"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_variant_get (response, "(b)", &success);
|
g_variant_get (response, "(b)", &success);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user