diff options
author | Colomban Wendling <[email protected]> | 2020-08-07 22:13:06 +0200 |
---|---|---|
committer | Robert Antoni Buj Gelonch <[email protected]> | 2020-08-08 23:24:58 +0200 |
commit | c685b957089beda464724eaa13d28c4d90b88453 (patch) | |
tree | 7b45e83d3bcdade3f5e4b05f74cf0df85d531208 /plugins/a11y-keyboard/msd-a11y-keyboard-manager.c | |
parent | f04847a9904688db9ea50fe6bc8060258570b85d (diff) | |
download | mate-settings-daemon-c685b957089beda464724eaa13d28c4d90b88453.tar.bz2 mate-settings-daemon-c685b957089beda464724eaa13d28c4d90b88453.tar.xz |
a11y-keyboard: Don't create a dummy object if AT-SPI is not available
Instead guard the caller to only use it if available.
Diffstat (limited to 'plugins/a11y-keyboard/msd-a11y-keyboard-manager.c')
-rw-r--r-- | plugins/a11y-keyboard/msd-a11y-keyboard-manager.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c index 67a690b..40fbdca 100644 --- a/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c +++ b/plugins/a11y-keyboard/msd-a11y-keyboard-manager.c @@ -49,11 +49,15 @@ #include "mate-settings-profile.h" #include "msd-a11y-keyboard-manager.h" -#include "msd-a11y-keyboard-atspi.h" +#ifdef HAVE_LIBATSPI +# include "msd-a11y-keyboard-atspi.h" +#endif #include "msd-a11y-preferences-dialog.h" #define CONFIG_SCHEMA "org.mate.accessibility-keyboard" -#define KEY_CAPSLOCK_BEEP_ENABLED "capslock-beep-enable" +#ifdef HAVE_LIBATSPI +# define KEY_CAPSLOCK_BEEP_ENABLED "capslock-beep-enable" +#endif #define NOTIFICATION_TIMEOUT 30 struct MsdA11yKeyboardManagerPrivate @@ -66,7 +70,9 @@ struct MsdA11yKeyboardManagerPrivate GtkWidget *preferences_dialog; GtkStatusIcon *status_icon; XkbDescRec *original_xkb_desc; +#ifdef HAVE_LIBATSPI MsdA11yKeyboardAtspi *capslock_beep; +#endif GSettings *settings; @@ -987,6 +993,7 @@ keyboard_callback (GSettings *settings, maybe_show_status_icon (manager); } +#ifdef HAVE_LIBATSPI static void capslock_beep_callback (GSettings *settings, gchar *key G_GNUC_UNUSED, @@ -997,6 +1004,7 @@ capslock_beep_callback (GSettings *settings, else msd_a11y_keyboard_atspi_stop (manager->priv->capslock_beep); } +#endif static gboolean start_a11y_keyboard_idle_cb (MsdA11yKeyboardManager *manager) @@ -1008,11 +1016,13 @@ start_a11y_keyboard_idle_cb (MsdA11yKeyboardManager *manager) manager->priv->settings = g_settings_new (CONFIG_SCHEMA); +#ifdef HAVE_LIBATSPI manager->priv->capslock_beep = msd_a11y_keyboard_atspi_new (); if (g_settings_get_boolean (manager->priv->settings, KEY_CAPSLOCK_BEEP_ENABLED)) msd_a11y_keyboard_atspi_start (manager->priv->capslock_beep); g_signal_connect (manager->priv->settings, "changed::"KEY_CAPSLOCK_BEEP_ENABLED, G_CALLBACK (capslock_beep_callback), manager); +#endif if (!xkb_enabled (manager)) goto out; @@ -1126,7 +1136,9 @@ msd_a11y_keyboard_manager_stop (MsdA11yKeyboardManager *manager) p->slowkeys_shortcut_val = FALSE; p->stickykeys_shortcut_val = FALSE; +#ifdef HAVE_LIBATSPI g_clear_object (&p->capslock_beep); +#endif } static void |