diff --git a/subprojects/extensions-tool/src/command-disable.c b/subprojects/extensions-tool/src/command-disable.c index 93c316bf7..bae11b256 100644 --- a/subprojects/extensions-tool/src/command-disable.c +++ b/subprojects/extensions-tool/src/command-disable.c @@ -25,6 +25,18 @@ #include "common.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 disable_extension_dbus (GDBusProxy *proxy, const char *uuid) @@ -42,10 +54,7 @@ disable_extension_dbus (GDBusProxy *proxy, &error); if (response == NULL) - { - g_printerr (_("Failed to connect to GNOME Shell\n")); - return FALSE; - } + return disable_extension_gsettings (uuid); g_variant_get (response, "(b)", &success); @@ -55,18 +64,6 @@ disable_extension_dbus (GDBusProxy *proxy, 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 disable_extension (const char *uuid) { diff --git a/subprojects/extensions-tool/src/command-enable.c b/subprojects/extensions-tool/src/command-enable.c index 6ae3a8351..712de4a3d 100644 --- a/subprojects/extensions-tool/src/command-enable.c +++ b/subprojects/extensions-tool/src/command-enable.c @@ -25,6 +25,18 @@ #include "common.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 enable_extension_dbus (GDBusProxy *proxy, const char *uuid) @@ -42,10 +54,7 @@ enable_extension_dbus (GDBusProxy *proxy, &error); if (response == NULL) - { - g_printerr (_("Failed to connect to GNOME Shell\n")); - return FALSE; - } + return enable_extension_gsettings (uuid); g_variant_get (response, "(b)", &success); @@ -55,18 +64,6 @@ enable_extension_dbus (GDBusProxy *proxy, 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 enable_extension (const char *uuid) {