extension-tool: Fix falling back to GSettings
When we switched the tool to the public Extensions service, the fallback to GSettings broke in the case GNOME is installed but not running (because the service can be autostarted, albeit it'll fail later). Fix this by also falling back when we don't get a response from gnome-shell. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6127 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2552>
This commit is contained in:
parent
e86a0b32c2
commit
007778880b
@ -25,6 +25,18 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
disable_extension_gsettings (const char *uuid)
|
||||||
|
{
|
||||||
|
g_autoptr(GSettings) settings = get_shell_settings ();
|
||||||
|
|
||||||
|
if (settings == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return settings_list_remove (settings, "enabled-extensions", uuid) &&
|
||||||
|
settings_list_add (settings, "disabled-extensions", uuid);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
disable_extension_dbus (GDBusProxy *proxy,
|
disable_extension_dbus (GDBusProxy *proxy,
|
||||||
const char *uuid)
|
const char *uuid)
|
||||||
@ -42,10 +54,7 @@ disable_extension_dbus (GDBusProxy *proxy,
|
|||||||
&error);
|
&error);
|
||||||
|
|
||||||
if (response == NULL)
|
if (response == NULL)
|
||||||
{
|
return disable_extension_gsettings (uuid);
|
||||||
g_printerr (_("Failed to connect to GNOME Shell\n"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_variant_get (response, "(b)", &success);
|
g_variant_get (response, "(b)", &success);
|
||||||
|
|
||||||
@ -55,18 +64,6 @@ disable_extension_dbus (GDBusProxy *proxy,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
disable_extension_gsettings (const char *uuid)
|
|
||||||
{
|
|
||||||
g_autoptr(GSettings) settings = get_shell_settings ();
|
|
||||||
|
|
||||||
if (settings == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return settings_list_remove (settings, "enabled-extensions", uuid) &&
|
|
||||||
settings_list_add (settings, "disabled-extensions", uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
disable_extension (const char *uuid)
|
disable_extension (const char *uuid)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,18 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
enable_extension_gsettings (const char *uuid)
|
||||||
|
{
|
||||||
|
g_autoptr(GSettings) settings = get_shell_settings ();
|
||||||
|
|
||||||
|
if (settings == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return settings_list_add (settings, "enabled-extensions", uuid) &&
|
||||||
|
settings_list_remove (settings, "disabled-extensions", uuid);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
enable_extension_dbus (GDBusProxy *proxy,
|
enable_extension_dbus (GDBusProxy *proxy,
|
||||||
const char *uuid)
|
const char *uuid)
|
||||||
@ -42,10 +54,7 @@ enable_extension_dbus (GDBusProxy *proxy,
|
|||||||
&error);
|
&error);
|
||||||
|
|
||||||
if (response == NULL)
|
if (response == NULL)
|
||||||
{
|
return enable_extension_gsettings (uuid);
|
||||||
g_printerr (_("Failed to connect to GNOME Shell\n"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_variant_get (response, "(b)", &success);
|
g_variant_get (response, "(b)", &success);
|
||||||
|
|
||||||
@ -55,18 +64,6 @@ enable_extension_dbus (GDBusProxy *proxy,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
enable_extension_gsettings (const char *uuid)
|
|
||||||
{
|
|
||||||
g_autoptr(GSettings) settings = get_shell_settings ();
|
|
||||||
|
|
||||||
if (settings == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return settings_list_add (settings, "enabled-extensions", uuid) &&
|
|
||||||
settings_list_remove (settings, "disabled-extensions", uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
enable_extension (const char *uuid)
|
enable_extension (const char *uuid)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user