diff options
author | Stefano Karapetsas <[email protected]> | 2013-09-21 06:18:07 -0700 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-09-21 06:18:07 -0700 |
commit | 81c245baf79a4fcbd0ff6cf55ecb51616eab2311 (patch) | |
tree | c1a27d8dfb4b4d079d8f0e49660fef2f801cd398 | |
parent | 49000652ee447c377bf2c8cb7c4cd8db47b7698a (diff) | |
parent | 57bdf2d53a0811835957325b730c514929964e69 (diff) | |
download | mate-desktop-81c245baf79a4fcbd0ff6cf55ecb51616eab2311.tar.bz2 mate-desktop-81c245baf79a4fcbd0ff6cf55ecb51616eab2311.tar.xz |
Merge pull request #76 from infirit/1.6
Add mate-gsettings-toggle.sh
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | tools/Makefile.am (renamed from mate-conf/Makefile.am) | 5 | ||||
-rwxr-xr-x | tools/mate-conf-import (renamed from mate-conf/mate-conf-import) | 0 | ||||
-rw-r--r-- | tools/mate-conf-import.desktop.in.in (renamed from mate-conf/mate-conf-import.desktop.in.in) | 0 | ||||
-rwxr-xr-x | tools/mate-gsettings-toggle | 48 |
6 files changed, 57 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index 3283061..58ce43a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = libmate-desktop man docs po schemas +SUBDIRS = libmate-desktop man docs po schemas tools if MATE_ABOUT_ENABLED SUBDIRS += mate-about @@ -6,9 +6,6 @@ endif if DESKTOP_DOCS_ENABLED SUBDIRS += desktop-docs endif -if MATE_CONF_IMPORT_ENABLED -SUBDIRS += mate-conf -endif ACLOCAL_AMFLAGS = -I m4 @@ -26,7 +23,8 @@ EXTRA_DIST = \ HACKING \ MAINTAINERS \ mate-version.xml.in.in \ - mate-doc-utils.make + mate-doc-utils.make \ + tools/mate-gsettings-toggle CLEANFILES = \ $(version_DATA) diff --git a/configure.ac b/configure.ac index eea5093..c30102a 100644 --- a/configure.ac +++ b/configure.ac @@ -307,8 +307,8 @@ desktop-docs/gpl/Makefile desktop-docs/lgpl/Makefile schemas/Makefile man/Makefile -mate-conf/Makefile -mate-conf/mate-conf-import.desktop.in +tools/Makefile +tools/mate-conf-import.desktop.in ]) AC_OUTPUT diff --git a/mate-conf/Makefile.am b/tools/Makefile.am index 61b1a17..65faf6d 100644 --- a/mate-conf/Makefile.am +++ b/tools/Makefile.am @@ -1,10 +1,13 @@ -bin_SCRIPTS = mate-conf-import +bin_SCRIPTS = mate-gsettings-toggle +if MATE_CONF_IMPORT_ENABLED @INTLTOOL_DESKTOP_RULE@ desktopdir = $(datadir)/applications desktop_in_files = mate-conf-import.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) +bin_SCRIPTS += mate-conf-import +endif EXTRA_DIST = $(bin_SCRIPTS) diff --git a/mate-conf/mate-conf-import b/tools/mate-conf-import index beb7976..beb7976 100755 --- a/mate-conf/mate-conf-import +++ b/tools/mate-conf-import diff --git a/mate-conf/mate-conf-import.desktop.in.in b/tools/mate-conf-import.desktop.in.in index 97800f1..97800f1 100644 --- a/mate-conf/mate-conf-import.desktop.in.in +++ b/tools/mate-conf-import.desktop.in.in diff --git a/tools/mate-gsettings-toggle b/tools/mate-gsettings-toggle new file mode 100755 index 0000000..f650073 --- /dev/null +++ b/tools/mate-gsettings-toggle @@ -0,0 +1,48 @@ +#!/usr/bin/env sh + +SCHEMA="org.mate.applications-at" +KEYS="screen-keyboard-enabled screen-magnifier-enabled screen-reader-enabled" +GSETTINGS="$(which gsettings 2> /dev/null)" + +if [ "${?}" != "0" ]; then + printf "gsettings command not found....\n" + printf "please install gsettings which is part of glib\n" + exit 1 +fi + +found="0" +for key in ${KEYS}; do + if [ "${key}" = "${1}" ]; then + found="1" + fi +done + +if [ "${found}" = "0" ]; then + printf "Invalid key \"${1}\", should be one of:\n" + printf "${KEYS}\n" + exit 1 +fi + +curval=$(eval "${GSETTINGS} get ${SCHEMA} ${1}") + +case ${curval} in +"false") + $(eval "${GSETTINGS} set ${SCHEMA} ${1} 'true'") + if [ "${?}" = "0" ]; then + printf "Toggle true\n" + exit 0 + else + printf "Something went wrong: got exit status ${?}\n" + exit 1 + fi;; +"true") + $(eval "${GSETTINGS} set ${SCHEMA} ${1} 'false'") + if [ "${?}" = "0" ]; then + printf "Toggle false\n" + exit 0 + else + printf "Something went wrong: got exit status ${?}\n" + exit 1 + fi;; +esac + |