File: scale-to-fit

package info (click to toggle)
phoc 0.51.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,948 kB
  • sloc: ansic: 106,056; xml: 3,765; sh: 138; makefile: 33; javascript: 5
file content (39 lines) | stat: -rwxr-xr-x 749 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

set -e

export GSETTINGS_SCHEMA_DIR=_build/data/

function print_current()
{
  local app_id="$1"
  local munged_id="$2"

  echo -n "Scale-to-fit for $app_id: "
  G_MESSAGES_DEBUG='' gsettings get sm.puri.phoc.application:/sm/puri/phoc/application/"$munged_id"/ scale-to-fit
}

if [ -z "$1" ]; then
  echo "Usage: $0 APP-ID [VALUE]"
  exit 0
fi

APP_ID="$1"
MUNGED_ID=$(echo "$1" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]')

if [ -z "$2" ]; then
  print_current "$APP_ID" "$MUNGED_ID"
  exit 0
fi

case "$2" in
	""|on|1|ON|true)
	val=true
	;;
	*)
	val=false
	;;
esac
G_MESSAGES_DEBUG='' gsettings set sm.puri.phoc.application:/sm/puri/phoc/application/"$MUNGED_ID"/ scale-to-fit "$val"

print_current "$APP_ID" "$MUNGED_ID"